Code:
Script: Auto-Logout Script
Type: Talkaction
Tested on: TFS Version 3 - Beta 3
Credits: Beon(All)
Fix: Bug of seconds: I had placed in seconds for test, because it does not get tested and wait 1 minute, then posting in just seconds without wanting to = P.
ADDED: You can only leave if not in battle.
I had nothing to do and decided to make this Talkaction. It means (very) unhelpful, but for those who want to use ...
But what it does?
The player has a commitment to 15 minutes away, and all clocks are mangled him so he simply says:! Exit 15 to 15 minutes in the game it will kicked
1 - First of all, open the data> talkactions> talkactions.XML and put this:
Code:
[CODE]<talkaction words="!sair" script="exit.lua"/>
2 - Then, open the data> talkactions> scripts and create a new LUA file called "exit.LUA" and within this copy:
Code:
local limite = 120
function onSay(cid, words, param)
if param == "" then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Command needs parameter. <Minutos>")
elseif tonumber(param) == nil then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "parameter must be a number.")
elseif tonumber(param) > 0 and tonumber(param) >= limite then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The limit is (is) "limit .. .." Minute (s).")
elseif tonumber(param) < 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The number must be positive.")
elseif tonumber(param) > 0 and tonumber(param) < limite then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will leave the game ".. stop .." Minute (s).")
addEvent(Exit, 60000*param, cid, param)
end
return TRUE
end
function Exit(cid, param)
if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
doRemoveCreature(cid)
else
doPlayerSendDefaultCancel(cid, 32)
end
end
Ready! If there is no problem of compatibility with other versions, you can use the command! Leave me # # m and number of minutes!
Example of Use:
Code:
!exit 2
You will leave the game in 2 minute (s).
Or
Code:
!exit "2
You will leave the game in 2 minute (s).
Note that it does not work, use the quotes.
I hope you enjoy, if like commenting on the topic.