Thats the talkaction script
Credits for the talkaction script goes to
Damadgerz
JDB
Ryxan
And for me adding that...
in Creaturescripts add
Ok let me explain... there was a bug in the script is that when someone logouts and logs in again he doesn't get the afk on command even if he didnt say !afk off, and he can move freely so by adding this creaturescripts it will be fixed
@edit
Thanks Damadger for that idea
make a new file call it afk.lua and paste this
Now go to login.lua and add
just after
now write in creaturescripts.xml
And that's all.
Rep++ me if i helped ya And thanks Damadger for that idea
LUA:
local time = 3 -- Seconds
local say_events = {}
local function SayText(cid)
if isPlayer(cid) == TRUE then
if say_events[getPlayerGUID(cid)] ~= nil then
if isPlayer(cid) == TRUE then
doSendAnimatedText(getPlayerPosition(cid),"AFK", math.random(01,255))
end
say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
end
end
return TRUE
end
local storage = 38417
function onSay(cid, words, param, channel)
local afkCheck = getPlayerStorageValue(cid, storage)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return TRUE
end
if (param == "on") then
if (afkCheck == -1) then
if (isPlayer(cid) == TRUE) then
doSendAnimatedText(getPlayerPosition(cid),"AFK", math.random(01,255))
end
say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You are now AFK.")
doCreatureSetNoMove(cid, true)
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are already AFK.")
end
elseif (param == "off") then
stopEvent(say_events[getPlayerGUID(cid)])
say_events[getPlayerGUID(cid)] = nil
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Welcome Back!")
doCreatureSetNoMove(cid, false)
setPlayerStorageValue(cid, storage, -1)
end
return TRUE
end
Damadgerz
JDB
Ryxan
And for me adding that...
in Creaturescripts add
LUA:
function onLogin(cid)
if getPlayerStorageValue(cid, 38417) > 0 then
doCreatureSetNoMove(cid, true)
doSendAnimatedText(getPlayerPosition(cid),"AFK", math.random(01,255))
end
return TRUE
end
@edit
Thanks Damadger for that idea
make a new file call it afk.lua and paste this
LUA:
function onLogout(cid)
if getPlayerStorageValue(cid, 38417) > 0 then
setPlayerStorageValue(cid, 38417, -1)
end
return TRUE
end
LUA:
registerCreatureEvent(cid, "Afk")
LUA:
registerCreatureEvent(cid, "ReportBug")
LUA:
<event type="logout" name="Afk" event="script" value="afk.lua"/>
Rep++ me if i helped ya And thanks Damadger for that idea
Last edited: