Blackheart OT
Defense in depth
Hello Otland community,
I've spent a couple hours trying to find a thread that could explain this at the level of a beginner in lua with previous programming knowledge in Java and Matlab, and I have failed, so I resort to asking the community.
I'm trying to prevent abuse of the talkaction system on my server. I would like to set up a delay before which a player cannot submit the same talkaction twice.
Ill show you what I have so far; its pretty bad; I'm sorry.
What I was trying to do with above code was create a toggle that would go false once ticks had occurred, and reset when you called getCreatureCondition. Honestly, I'm sort of making that up because I cant find any documentation for these functions anywhere on the internet. I only found a list of the functions in the script tutorial section of this website.
Perhaps the above strategy is incorrect and I have to reset the timer each time? (I.e. create an else for the if loop where I reset counter.)
I am running TFS 1.1, and the error message is that createCreatureCondition can only be used while first loading the script. Please let me know if I left out any crucial information.
I sincerely appreciate your help,
Mike
I've spent a couple hours trying to find a thread that could explain this at the level of a beginner in lua with previous programming knowledge in Java and Matlab, and I have failed, so I resort to asking the community.
I'm trying to prevent abuse of the talkaction system on my server. I would like to set up a delay before which a player cannot submit the same talkaction twice.
Ill show you what I have so far; its pretty bad; I'm sorry.
Code:
function onSay(cid, words, param, channel)
local storage = 6707
local delaytime = 2 * 60 * 1000 -- 2 minutes
local condition = createCreatureCondition(cid, CONDITION_EXHAUST)
condition:setConditionParam(CONDITION_PARAM_TICKS, delaytime)
if not getCreatureCondition(cid, CONDITION_EXHAUST) then
-- Do talkaction
end
return true
end
What I was trying to do with above code was create a toggle that would go false once ticks had occurred, and reset when you called getCreatureCondition. Honestly, I'm sort of making that up because I cant find any documentation for these functions anywhere on the internet. I only found a list of the functions in the script tutorial section of this website.
Perhaps the above strategy is incorrect and I have to reset the timer each time? (I.e. create an else for the if loop where I reset counter.)
I am running TFS 1.1, and the error message is that createCreatureCondition can only be used while first loading the script. Please let me know if I left out any crucial information.
I sincerely appreciate your help,
Mike
Last edited: