Abra o creaturescripts.xml e coloque essas tags:
<event type="login" name="ExpPorHoraLogin" event="script" value="expporhora.lua"/> <event type="logout" name="ExpPorHoraLogout" event="script" value="expporhora.lua"/>
agora crie um arquivo chamado expporhora.lua em data/creaturescripts/scripts e cole isso dentro:
expTable = {} -- não modifique
interval = 60 * 60 * 1000
expGain = 10000
function execLogin(cid, lastLogin)
registerCreatureEvent(cid, "ExpPorHoraLogout")
if not expTable[getPlayerGUID(cid)] then
expTable[getPlayerGUID(cid)] = {timeOnline = 0}
end
expTable[getPlayerGUID(cid)].lastLogin = os.clock()
expTable[getPlayerGUID(cid)].event = addEvent(addExp, interval - 1000 * expTable[getPlayerGUID(cid)].timeOnline, cid)
end
function addExp(cid)
if not isCreature(cid) then return end
expTable[getPlayerGUID(cid)].timeOnline = 0
doPlayerAddExperience(cid, expGain)
doSendAnimatedText(getThingPos(cid), expGain, 215)
doPlayerSendTextMessage(cid, 27, "Você recebeu "..expGain.." xp por ficar 1 hora online!")
execLogin(cid, os.clock())
end
function onLogout(cid)
if not expTable[getPlayerGUID(cid)] then return true end
expTable[getPlayerGUID(cid)].timeOnline = expTable[getPlayerGUID(cid)].timeOnline +
os.clock() - expTable[getPlayerGUID(cid)].lastLogin
stopEvent(expTable[getPlayerGUID(cid)].event)
return true
end
function onLogin(cid)
if getCreatureName(cid) == "Account Manager" then return true end
execLogin(cid)
return true
end
o tempo salva, significa que se o player fica 30 min online e fizer logout, quando ele entrar de novo só vai precisar esperar mais 30 min pra ganhar o xp. o tempo só é resetado se o servidor fechar






info
Grupo: Campones
Registrado: 08/03/13
Posts: 42
Reputação: +1
Um script que dê 10000 de xp a cada hora online do char...
(y)