NI

Pedido Stafftime

Por Nickbhz, 23 de abr. de 2016 em Scripts

10
1.8k
NickbhzN
23 de abril de 2016 às 12:39

Bom tarde galera, alguém poderia me ajudar neste pedido?

Se trata de um Staff Time, gostaria de ter um comando para saber quanto tempo os membros da staff estão ficando online, até pra ter uma premiação, talvez...
Enfim o que eu queria?

 

  • /stafftime, nome = Comando no qual iria mostrar as informações online ou não: nome, tempo online, e qual membro da staff ele é. (Obs: Esse comando só ler informação de membro da staff, group 2,3,4,5,6,7)
  • /stafftime all = Mostra o Staff Time de todos os membros da Staff online ou não, comando somente para o GOD.
  • /stafftime, clear, nome = Iria limpar o Staff Time do jogador citado, comando somente para o GOD.
  • /stafftime cleall = Iria limpar o Staff Time de todos os membro da Staff, comando somente para o GOD.

 

Seria possivel? Ou algo do tipo?

Fico grato!

 

Editado Abril 23 por brendoonh

miguel223M
24 de abril de 2016 às 00:37

Em creaturescripts.xml, adicione:

 

<event type="logout" name="time" event="script" value="time.lua"/>

 

Crie, em creaturescripts/scripts/, um arquivo de nome time.lua e adicione:

 

function onLogout(cid)

 

setPlayerStorageValue(cid, 19821, getPlayerStorageValue(cid, 19821) + os.time - getPlayerLastLogin(cid))

 

return true

end

 

Em talkactions/scripts/, crie um arquivo de nome time.lua e adicione:

function onSay(cid, words, param, channel)local t = param:explode(", ")if not(t[1]) thendoPlayerSendTextMessage(cid, 22, "This command need a param. Like: /time check, PLAYERNAME or /time clear, PLAYERNAME.")endif t[1] == "check" thenif not(t[2]) thendoPlayerSendTextMessage(cid, 22, "You need to put the players name in the command.")elseif getPlayerByName(t[2]) thenif getPlayerStorageValue(getPlayerByName(t[2]), 19821) < 0 thensetPlayerStorageValue(getPlayerByName(t[2]), 19821, 0)enddoPlayerSendTextMessage(cid, 22, "This player has "..(getPlayerStorageValue(getPlayerByName(t[2]), 19821)/60*60).." hours played until  his left login.")elsedoPlayerSendTextMessage(cid, 22, "This player isnt online now or he doesnt exist.")endendendif t[1] == "clear" thenif not(t[2]) thendoPlayerSendTextMessage(cid, 22, "You need to put the players name in the command.")elseif getPlayerByName(t[2]) and getPlayerGroupId(cid) == 6 thensetPlayerStorageValue(getPlayerByName(t[2]), 19821, 0)doPlayerSendTextMessage(cid, 22, "You cleaned this players hours played.")elsedoPlayerSendTextMessage(cid, 22, "This player isnt online now or he doesnt exist. Or, you arent a GOD to use this command.")endendendreturn trueend

 

Em talkactions.xml, adicione:

 

  <talkaction log="yes" words="/time;!time" access="2" event="script" value="time.lua" /> 

 

Editado Abril 24 por miguel223

NickbhzN
24 de abril de 2016 às 09:47

n1uhox.png

miguel223M
24 de abril de 2016 às 10:42

Tenta agora.

NickbhzN
24 de abril de 2016 às 12:05

cannot load script
 data/talk../script/time.lua:14: '>' expected near 'then'

miguel223M
24 de abril de 2016 às 13:00

Pronto.

NickbhzN
24 de abril de 2016 às 13:05

Mesma coisa .. :ohmy: 

miguel223M
24 de abril de 2016 às 13:46

Agora vai. kkk

NickbhzN
24 de abril de 2016 às 15:15
14 horas atrás, miguel223 disse:

Em creaturescripts.xml, adicione:

 

<event type="logout" name="time" event="script" value="time.lua"/>

 

Crie, em creaturescripts/scripts/, um arquivo de nome time.lua e adicione:

 

function onLogout(cid)

 

setPlayerStorageValue(cid, 19821, getPlayerStorageValue(cid, 19821) + os.time - getPlayerLastLogin(cid))

 

return true

end

 

Em talkactions/scripts/, crie um arquivo de nome time.lua e adicione:

function onSay(cid, words, param, channel)local t = param:explode(", ")if not(t[1]) thendoPlayerSendTextMessage(cid, 22, "This command need a param. Like: /time check, PLAYERNAME or /time clear, PLAYERNAME.")endif t[1] == "check" thenif not(t[2]) thendoPlayerSendTextMessage(cid, 22, "You need to put the players name in the command.")elseif getPlayerByName(t[2]) thenif getPlayerStorageValue(getPlayerByName(t[2]), 19821) < 0 thensetPlayerStorageValue(getPlayerByName(t[2]), 19821, 0)enddoPlayerSendTextMessage(cid, 22, "This player has "..(getPlayerStorageValue(getPlayerByName(t[2]), 19821)/60*60).." hours played until  his left login.")elsedoPlayerSendTextMessage(cid, 22, "This player isnt online now or he doesnt exist.")endendendif t[1] == "clear" thenif not(t[2]) thendoPlayerSendTextMessage(cid, 22, "You need to put the players name in the command.")elseif getPlayerByName(t[2]) and getPlayerGroupId(cid) == 6 thensetPlayerStorageValue(getPlayerByName(t[2]), 19821, 0)doPlayerSendTextMessage(cid, 22, "You cleaned this players hours played.")elsedoPlayerSendTextMessage(cid, 22, "This player isnt online now or he doesnt exist. Or, you arent a GOD to use this command.")endendendreturn trueend

 

Em talkactions.xml, adicione:

 

  <talkaction log="yes" words="/time;!time" access="2" event="script" value="time.lua" /> 

 

Não veio completo, como precisava, mas esse vai quebra o galho. Valeu!! s2

miguel223M
24 de abril de 2016 às 17:08

Sistema estava com defeito na hora de transmitir as horas jogadas e no logout. Reinstale conforme meu tópico em scripts > actions, talkactions e movements.