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" />




info
Grupo: Visconde
Registrado: 04/01/14
Posts: 320
Reputação: +15
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?
Seria possivel? Ou algo do tipo?
Fico grato!
Editado Abril 23 por brendoonh