Mera Mero
Guess Who?
- Joined
- Dec 27, 2014
- Messages
- 417
- Reaction score
- 86
I've got problem with afk command which makes you to be afk in game if you switch it on , Now i'm trying to setconditionobject but i found some errors
and this is the erros appeared to me when i spelled !afk on
Code:
local condition1 = createConditionObject(CONDITION_INFIGHT)
local condition2 = createConditionObject(CONDITION_EXHAUST)
local condition3 = createConditionObject(CONDITION_MUTED)
setConditionParam(condition1, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition2, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition3, CONDITION_PARAM_TICKS, -1)
local time = 3 -- 1 = 1 sec, 2 = 2 sec, ...
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", TEXTCOLOR_ORANGE)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
end
say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
end
end
return TRUE
end
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return true
end
if param == "on" then
if isPlayer(cid) == TRUE then
doSendAnimatedText(getPlayerPosition(cid),"AFK", TEXTCOLOR_ORANGE)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
createConditionObject(CONDITION_MUTED)
createConditionObject(CONDITION_EXHAUST)
createConditionObject(CONDITION_INFIGHT)
end
say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Afk mode is [ON].")
elseif param == "off" then
stopEvent(say_events[getPlayerGUID(cid)])
say_events[getPlayerGUID(cid)] = nil
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Afk mode is [OFF].")
doRemoveCondition(cid, CONDITION_INFIGHT)
doRemoveCondition(cid, CONDITION_EXHAUST)
doRemoveCondition(cid, CONDITION_MUTED)
end
return TRUE
end
Code:
[08/03/2015 14:58:14] [Error - TalkAction Interface]
[08/03/2015 14:58:14] data/talkactions/scripts/custom/all/afk.lua:onSay
[08/03/2015 14:58:14] Description:
[08/03/2015 14:58:14] (luaCreateConditionObject) This function can only be used while loading the script.
[08/03/2015 14:58:15] [Error - TalkAction Interface]
[08/03/2015 14:58:15] data/talkactions/scripts/custom/all/afk.lua:onSay
[08/03/2015 14:58:15] Description:
[08/03/2015 14:58:15] (luaCreateConditionObject) This function can only be used while loading the script.
[08/03/2015 14:58:15] [Error - TalkAction Interface]
[08/03/2015 14:58:15] data/talkactions/scripts/custom/all/afk.lua:onSay
[08/03/2015 14:58:15] Description:
[08/03/2015 14:58:15] (luaCreateConditionObject) This function can only be used while loading the script.