Buahs super rápido!!! Gracias me pongo a ello
Un placer.
Aquí tienes una versión modificada del código:
```lua
local MSGQC = "#qc" -- Command
local rankCommand = 3 -- GM Rank
local takeMoney = 0.025 -- Set the amount of gold you want to take from the player (0.025 = 2.5%)
function CompleteQuest(player, questTitle)
local found = false
local query = WorldDBQuery("SELECT ID, LogTitle FROM quest_template WHERE LogTitle LIKE '" .. questTitle .. "'")
if query then
repeat
local entry = query:GetRow()
local questId = tonumber(entry["ID"])
local logTitle = entry["LogTitle"]
if player:HasQuest(questId) then
player:CompleteQuest(questId)
player:SendBroadcastMessage("|cFFffffff|cFF00ff00Quest: |r|cFFffffff" .. logTitle .. "|cFFffffff|cFF00ff00 ID:|r |cFFffffff" .. questId .. "|cFFffffff|cFFffffff completed for you")
player:ModifyMoney(-math.floor(player:GetMoney() * takeMoney))
player:SendBroadcastMessage("|cFFffffff|cFF00ff00The World |r|cFFffffff has taken |cFFffffff|cFF00ff00" .. (takeMoney * 100) .. "%|r|cFFffffff of your gold")
found = true
break
end
until not query:NextRow()
end
if not found then
player:SendBroadcastMessage("|cFFffffff|cFF00ff00Quest: |r|cFFffffff" .. questTitle .. "|cFFffffff|cFF00ff00 not found or you haven't accepted it")
end
end
function QuestCompleteCommandHandler(_, player, msg, _, _)
if msg:find(MSGQC) then
local gmRank = player:GetGMRank()
if gmRank < rankCommand then
player:SendBroadcastMessage("|cFFffffff|cFF00ff00The World |r|cFFffffff doesn't have access.")
return false
end
local startIndex, endIndex = string.find(msg, "#qc")
local questTitle = string.sub(msg, endIndex + 2) -- Skip the command and space
if questTitle == "" then
player:SendBroadcastMessage("|cFFffffff|cFF00ff00Please specify a quest to complete.")
return false
end
CompleteQuest(player, questTitle)
return false
end
end
RegisterPlayerEvent(18, QuestCompleteCommandHandler)
```
Con esta modificación, los jugadores pueden utilizar el comando "#qc" seguido del nombre de la misión para completarla. Por ejemplo, "#qc Misión de ejemplo". El script buscará la misión con el título especificado y, si el jugador tiene la misión, la completará y tomará un porcentaje del oro del jugador.
Espero que esto te sea útil. ¡Si tienes alguna otra pregunta, no dudes en preguntar! Recuerda citar mi último mensaje para que te pueda ayudar.