Postado Julho 12, 2015 10 anos porque voce nao apenas muda no sql ou mysql o nome do player quando voce o colocar na staff? mais pratico não?
Postado Julho 12, 2015 10 anos Aproveitei e fiz para que a tag seja removida caso a criatura que a possui volte a ser player. autotag.lua (data\creaturescripts\scripts): function onLogin(cid) local tag = '[6S]' if getPlayerGroupId(cid) < 2 and getCreatureName(cid):find(tag) then db.query("UPDATE `players` SET `name` = '"..getCreatureName(cid):sub(5).."' WHERE `id` = "..getPlayerGUID(cid)..";") elseif getPlayerGroupId(cid) > 1 and not getCreatureName(cid):find(tag) then db.query("UPDATE `players` SET `name` = '"..tag..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";") end return doRemoveCreature(cid, true) end creaturescripts.xml (data\creaturescripts): <event type="login" name="AutoTag" event="script" value="autotag.lua"/> Não registra creature event. Nesse código, você ta removendo o player sempre. O certo seria colocar pra remover só se passar pelo if ou elseif. Talvez isso: function onLogin(cid) local tag = '[6S]' if getPlayerGroupId(cid) < 2 and getCreatureName(cid):find(tag) then db.query("UPDATE `players` SET `name` = '"..getCreatureName(cid):sub(5).."' WHERE `id` = "..getPlayerGUID(cid)..";") return false elseif getPlayerGroupId(cid) > 1 and not getCreatureName(cid):find(tag) then db.query("UPDATE `players` SET `name` = '"..tag..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";") return false end return true end To sem nada pra testar aqui, sorry. Editado Julho 12, 2015 10 anos por Demonbholder (veja o histórico de edições)
Postado Julho 12, 2015 10 anos Solução Nesse código, você ta removendo o player sempre. O certo seria colocar pra remover só se passar pelo if ou elseif. Fiz tão rápido que nem me dei conta dessa cagada, mas enfim.. Já que retornar removendo o player ou fazer com que retorne false ao callback nos escopos, faz com que ele não consiga executar login, acho mais simples apenas alterar o callback para que o processo ocorra quando o player estiver com/ou sem acesso e executar logout. autotag.lua (data\creaturescripts\scripts): function onLogout(cid) local tag = '[6S]' if getPlayerGroupId(cid) < 2 and getCreatureName(cid):find(tag) then db.query("UPDATE `players` SET `name` = '"..getCreatureName(cid):sub(tag:len() + 1).."' WHERE `id` = "..getPlayerGUID(cid)..";") elseif getPlayerGroupId(cid) > 1 and not getCreatureName(cid):find(tag) then db.query("UPDATE `players` SET `name` = '"..tag..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";") end return true end creaturescripts.xml (data\creaturescripts): <event type="logout" name="AutoTag" event="script" value="autotag.lua"/> The corrupt fear us. The honest support us. The heroic join us.
Postado Julho 18, 2015 10 anos Autor Fiz tão rápido que nem me dei conta dessa cagada, mas enfim.. Já que retornar removendo o player ou fazer com que retorne false ao callback nos escopos, faz com que ele não consiga executar login, acho mais simples apenas alterar o callback para que o processo ocorra quando o player estiver com/ou sem acesso e executar logout. autotag.lua (data\creaturescripts\scripts): function onLogout(cid) local tag = '[6S]' if getPlayerGroupId(cid) < 2 and getCreatureName(cid):find(tag) then db.query("UPDATE `players` SET `name` = '"..getCreatureName(cid):sub(tag:len() + 1).."' WHERE `id` = "..getPlayerGUID(cid)..";") elseif getPlayerGroupId(cid) > 1 and not getCreatureName(cid):find(tag) then db.query("UPDATE `players` SET `name` = '"..tag..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";") end return true end creaturescripts.xml (data\creaturescripts): <event type="logout" name="AutoTag" event="script" value="autotag.lua"/> Obrigado!
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.