Ir para conteúdo
  • 0

[Pedido] Sistema De Reset Limitado !


Ponintatu

Pergunta

4 respostass a esta questão

Posts Recomendados

  • 0

Fiz um rapidinho aqui para você.

 

talkactions.xml:

 

<talkaction words="!reset" script="reset.lua"/>

 

reset.lua:

 

function onSay(cid, words)

local limite = 2 -- Limite de resets

local lvl = 10 -- Level que o player ficará após o reset

local stor = 1278

 

if getPlayerStorageValue(cid, stor) == limite then

doPlayerSendCancel(cid, "Sorry, but you can't reset more than "..limite.." times.") return true

elseif getPlayerStorageValue(cid, stor) == -1 and getPlayerLevel(cid) >= 500 then

db.executeQuery("UPDATE `players` SET `level` = "..lvl.." WHERE `id` = "..getPlayerGUID(cid))

setPlayerStorageValue(cid, stor, 1)

doRemoveCreature(cid) return true

elseif getPlayerStorageValue(cid, stor) == 1 and getPlayerLevel(cid) >= 1000 then

db.executeQuery("UPDATE `players` SET `level` = "..lvl.." WHERE `id` = "..getPlayerGUID(cid))

setPlayerStorageValue(cid, stor, 2)

doRemoveCreature(cid) return true

end

return true

end

 

 

Configure aqui:

local limite = 2 -- Limite de resets
local lvl = 10 -- Level que o player ficará após o reset

 

Para resetar, fale !reset.

Link para o comentário
Compartilhar em outros sites

  • 0

Refiz o do @luck algumas partes

 

function onSay(cid, words, param)
local limite = 2 -- Limite de resets
local lvl = 10 -- Level que o player ficará após o reset
local stor = 1278
if getPlayerStorageValue(cid, stor) == limite then
doPlayerSendCancel(cid, "Sorry, but you can't reset more than "..limite.." times.")
return true
elseif getPlayerStorageValue(cid, stor) == -1 then
elseif getPlayerLevel(cid) >= 500 then
db.executeQuery("UPDATE `players` SET `level` = "..lvl.." WHERE `id` = "..getPlayerGUID(cid))
setPlayerStorageValue(cid, stor, 1)
return true
elseif getPlayerStorageValue(cid, stor) == 1 then
elseif getPlayerLevel(cid) >= 1000 then
db.executeQuery("UPDATE `players` SET `level` = "..lvl.." WHERE `id` = "..getPlayerGUID(cid))
setPlayerStorageValue(cid, stor, 2)
doRemoveCreature(cid)
end
return true
end

Link para o comentário
Compartilhar em outros sites

  • 0

@SkyLigh

 

Cara, você só bagunçou o script. Declarou o "param" sendo que nem vai usar ele, adicionou linhas desnecessárias e o erro vai continuar da mesma forma.

 

@Noreply

 

Arrumei o script. Testado e funcionando.

 

talkactions.xml:

 

<talkaction words="!reset" script="reset.lua"/>

 

reset.lua:

 

function onSay(cid, words)

local limite = 2 -- Limite de resets

local lvl = 10 -- Level que o player ficará após o reset

local stor = 1278

local pg = getPlayerGUID(cid)

 

if getPlayerStorageValue(cid, stor) == limite then

doPlayerSendCancel(cid, "Sorry, but you can't reset more than "..limite.." times.") return true

elseif getPlayerStorageValue(cid, stor) == -1 and getPlayerLevel(cid) >= 500 then

setPlayerStorageValue(cid, stor, 1)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `level` = "..lvl.." WHERE `id` = "..pg)

elseif getPlayerStorageValue(cid, stor) == -1 and getPlayerLevel(cid) < 500 then

doPlayerSendCancel(cid, "You need level 500 to reset.")

elseif getPlayerStorageValue(cid, stor) == 1 and getPlayerLevel(cid) >= 1000 then

setPlayerStorageValue(cid, stor, 2)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `level` = "..lvl.." WHERE `id` = "..pg)

elseif getPlayerStorageValue(cid, stor) == 1 and getPlayerLevel(cid) < 1000 then

doPlayerSendCancel(cid, "You need level 1000 to reset.")

end

return true

end

 

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...