Idle-System 1.0
Hello guys, só deboua na lagoua é? Pensei em criar um sisteminha bem legal para OTServ, nele, os jogadores podem se distanciar [ficar AFK] quanto tempo quiserem, sem ser kikados pelo Idle do config.lua. Nenhum jogador gosta de ir comer e quando voltar estar deslogado rsrs.
Vá em (data/talkactions/scripts), crie um arquivo chamado idleSys.lua e adicione dentro:
--[[ Idle-System 1.0 Criado por Roksas Acesse já - XTibia.com. ]]-- function onSay(cid, words, param) if not param or param == "" then return doPlayerSendCancel(cid, "[Idle-System] Você deve informar o status desejado, [on/off].") and true end if getCreatureCondition(cid, CONDITION_INFIGHT) then return doPlayerSendCancel(cid, "[Idle-System] Você não pode utilizar este recurso caso esteja em batalha.") and true end if param == "on" then if getPlayerStorageValue(cid, 154490) >= 1 then return doPlayerSendCancel(cid, "[Idle-System] O seu idle já havia sido ativado, favor desativar.") and true end doCreatureSetNoMove(cid, true) setPlayerStorageValue(cid, 154490, 1) idleStart(cid) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Idle-System] Você ativou o seu idle.") elseif param == "off" then if getPlayerStorageValue(cid, 154490) < 1 then return doPlayerSendCancel(cid, "[Idle-System] O seu idle já havia sido desativado.") and true end doCreatureSetNoMove(cid, false) setPlayerStorageValue(cid, 154490, -1) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Idle-System] Você desativou o seu idle.") return true end return true end --//--// function idleStart(uid) local txts = {"Ausente", "AFK!", "Já volto!", "Aguarde..."} if not isPlayer(uid) then return true end if getPlayerStorageValue(uid, 154490) < 1 then return true end doCreatureSetLookDir(uid, math.random(1, 4)) doSendAnimatedText(getThingPos(uid), txts[math.random(#txts)], math.random(1, 255)) return addEvent(idleStart, 10 * 1000, uid) end
Logo em seguida, volte para a pasta (data/talkactions), abra com algum editor de texto o arquivo talkactions.xml e adicione esta seguinte tag:
<talkaction words="/afk;!afk;!ausente;/ausente" event="script" value="idleSys.lua"/>
É só isto meus anjos, façam bom proveito haha. Obrigado por acessar a comunidade