Hi,
First of all the script its not tested im lazy to run mysql xD it should work for TFS 0.3.4
Well first explain how it works:
-A player type !invoke player_name.
-The player_name player gets a message telling him to type !accept or !reject in 2 minutes.
-If the player_name player types !accept he goes to the gm position when gm typed !invoke.
-If time expires player_name player can't get teleported there.
Well first add this code to talkactions.xml
Then create the file invoke.lua in your talkactions directory:
And finally create invok.lua in the same directory:
Well if you found any errors post it here ^^
First of all the script its not tested im lazy to run mysql xD it should work for TFS 0.3.4
Well first explain how it works:
-A player type !invoke player_name.
-The player_name player gets a message telling him to type !accept or !reject in 2 minutes.
-If the player_name player types !accept he goes to the gm position when gm typed !invoke.
-If time expires player_name player can't get teleported there.
Well first add this code to talkactions.xml
PHP:
<talkaction log="yes" words="!invoke" access="0" event="script" value="invoke.lua"/>
<talkaction words="!accept" access="0" event="script" value="invok.lua"/>
<talkaction words="!reject" access="0" event="script" value="invok.lua"/>
Then create the file invoke.lua in your talkactions directory:
PHP:
function onSay(cid, words, param, channel)
if(param ~= "")then
local player = getPlayerByName(param)
local pos = getCreaturePosition(cid)
local expire = 60 * 60 * 2 -- time to expire invocation
if(isPlayer(player))then
setPlayerStorageValue(player, 30000, os.time()+expire)
setPlayerStorageValue(player, 30001, pos.x)
setPlayerStorageValue(player, 30002, pos.y)
setPlayerStorageValue(player, 30003, pos.z)
doPlayerSendTextMessage(cid, 19, "You have tried to invoke "..getPlayerName(player).." please wait him to write !accept or !reject.")
doPlayerSendTextMessage(player, 19, ""..getPlayerName(cid).." is trying to invoke you to his position please type !accept or !reject you have only 2 minutes.")
else
doPlayerSendCancel(cid, "Wrong player.")
end
else
doPlayerSendCancel(cid, "Please write the player name.")
end
return TRUE
end
And finally create invok.lua in the same directory:
PHP:
function onSay(cid, words, param, channel)
local pos = {x=getPlayerStorageValue(cid, 30001), y=getPlayerStorageValue(cid, 30002), z=getPlayerStorageValue(cid, 30003), stackpos=1}
local expire = getPlayerStorageValue(cid, 30000)
if(words=="!accept" and expire > os.time())then
doTeleportThing(cid, pos)
else
setPlayerStorageValue(player, 30000, 0)
end
return TRUE
end
Well if you found any errors post it here ^^
Last edited: