Postado Novembro 1, 2015 9 anos Eae Galera do TK , tudo bom? Bom , hoje eu gostaria de pedir um comando , bem igual o Plugin de Minecraft (NÃO JOGO VI EM UM VIDEO) Que no caso o "mod" usa um comando /admin que ao usar , ele volta pra Player , e se ele estiver em Player é usa /admin ele vira Mod denovo , e assim ninguém pode , hitar ele ou algo do tipo , queria um comando bem parecido , que quando algum GM , CM , GOD , ADM usassem /admin fosse para Player e ao Usar denovo voltasse para o cargo por ex : Um Gm , usa /admin ele vai pra Player , é quando usar /admin volta pra Jogador , caso não tenha como fazer para todos os cargos , queria pedir que fosse então para o GM ! Desde já agradeço
Postado Novembro 1, 2015 9 anos Em 31/10/2015 23:08:52, Sydion disse: queria um comando bem parecido , que quando algum GM , CM , GOD , ADM usassem /admin fosse para Player e ao Usar denovo voltasse para o cargo PS: Tô pelo cel admin.lua (data\talkactions\scripts) local key = 54321 -- group storage key function onSay(cid) if getPlayerGroupId(cid) < 2 then if getPlayerStorageValue(cid, key) < 0 then return doPlayerSendCancel(cid, 'Players can\'t use this command.') else doPlayerSetGroupId(cid, getPlayerStorageValue(cid, key)) setPlayerStorageValue(cid, key, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You returned to the '..getPlayerGroupName(cid)..'\'s rank.') end else setPlayerStorageValue(cid, key, getPlayerGroupId(cid)) doPlayerSetGroupId(cid, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You became a player again.') end return true end talkactions.xml (data\talkactions) <talkaction words="/admin" event="script" value="admin.lua"/> Editado Novembro 2, 2015 9 anos por Wise (veja o histórico de edições) The corrupt fear us. The honest support us. The heroic join us.
Postado Novembro 2, 2015 9 anos @Wise Só uma dúvida, vc setou na tag do talkactions.xml access="3" , isso não vai bugar o sistema? O adm la group 6 usa o comando e vira player, logo ele virou group 1 e não terá mais group 3 pra usar o comando novamente '-' Eu recomendaria fazer assim: data/talkaction/talkactions.xml Citar <talkaction log="yes" words="/admin" event="script" value="admin.lua"/> data/talkactions/scripts/admin.lua Citar function onSay(cid, words, param, channel) local key = 54321 -- group storage key local grupo = getPlayerGroupId(cid) local sto = getPlayerStorageValue(cid, key) if grupo > 1 and sto < 1 then setPlayerStorageValue(cid, key, grupo) doPlayerSetGroupId(cid, 1) doPlayerSendCancel(cid, "Virou Player.") elseif grupo <= 1 and sto > 1 then doPlayerSetGroupId(cid, sto) setPlayerStorageValue(cid, key, -1) doPlayerSendCancel(cid, "Virou Staff.") else doPlayerSendCancel(cid, "Você não pode usar este comando.") end return true end Te ajudei? Clique em Gostei ! ²²²d¬¬b²²² "She's got a smile that it seems to me...." ♪♪
Postado Novembro 2, 2015 9 anos Autor 10 horas atrás, Wise disse: PS: Tô pelo cel admin.lua (data\talkactions\scripts) local key = 54321 -- group storage key function onSay(cid) if getPlayerStorageValue(cid, key) < 1 then setPlayerStorageValue(cid, key, getPlayerAccess(cid)) doPlayerSetGroupId(cid, 1) else doPlayerSetGroupId(cid, getPlayerStorageValue(cid, key)) setPlayerStorageValue(cid, key, -1) end return true end talkactions.xml (data\talkactions) <talkaction log="yes" words="/admin" access="3" event="script" value="admin.lua"/> Como o @luangop disse , não dava mais para voltar para o cargo , obrigado por tentar ajudar , te de 1 rep + pelo esforço 7 horas atrás, luangop disse: @Wise Só uma dúvida, vc setou na tag do talkactions.xml access="3" , isso não vai bugar o sistema? O adm la group 6 usa o comando e vira player, logo ele virou group 1 e não terá mais group 3 pra usar o comando novamente '-' Eu recomendaria fazer assim: data/talkaction/talkactions.xml data/talkactions/scripts/admin.lua Muito obrigado vo reputar por 3 days , porque hoje já acabo kk
Postado Novembro 2, 2015 9 anos 12 horas atrás, luangop disse: vc setou na tag do talkactions.xml access="3" , isso não vai bugar o sistema? Sim, fiz esta tag no meio de um vôo, nem reparei no id. Obrigado por citar. Enfim.. 12 horas atrás, luangop disse: Eu recomendaria fazer assim: Não tem necessidade desse monte de variáveis e escopos que só atrasam a execução do código. Aqui: local key = 54321 -- group storage key function onSay(cid) if getPlayerGroupId(cid) < 2 then if getPlayerStorageValue(cid, key) < 0 then return doPlayerSendCancel(cid, 'Players can\'t use this command.') else doPlayerSetGroupId(cid, getPlayerStorageValue(cid, key)) setPlayerStorageValue(cid, key, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You returned to the '..getPlayerGroupName(cid)..'\'s rank.') end else setPlayerStorageValue(cid, key, getPlayerGroupId(cid)) doPlayerSetGroupId(cid, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You became a player again.') end return true end @Sydion Basta alterar na tag, para que o acesso da talkaction seja inaparente ou equivalente a 1. E relaxa, não ligo pra rep. O importante é ajudar, bro. Disponha ;] Editado Novembro 2, 2015 9 anos por Wise (veja o histórico de edições) The corrupt fear us. The honest support us. The heroic join us.
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.