• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Add Exhaustion to [TalkAction]

Galaxy

New Member
Joined
Feb 24, 2011
Messages
108
Reaction score
1
Location
Ireland/Carlow
Hello,
For some of you this will seem very easy to do... I tried.. I even started to read the whole lua tutorial and I learned some things :P But I'm not able to add exhaustion for my talkaction script...

You see, I tested this today. I launched my elfbot and I made 20 hotkeys spamming a command "!bug map,haha".
Look what I got after - yea. It took me pretty long haha xD
xdddddddddddd.jpg

It means that there were over 1 milion command uses... ;P Like, I used the command 1 271 855 times - thats a lot ;p
I did it just to see what will happen haha ;D

So, here is my script...
Code:
local config = 
{
access = 1
}
function onSay(cid, words, param)
		if (param == '') then
			doPlayerSendTextMessage(cid, 26, 'You need to say !bug map/ques/script and add description of the bug.')
			return true
		end
	local position = getCreaturePosition(cid)
	local param = string.explode(param, ',')
	local params = {'map', 'quest', 'script'}
		if (not param[2]) then
			doPlayerSendTextMessage(cid, 26, 'Please add descripition to report.')
			return true
		end
		if (getPlayerAccess(cid) < config.access) then
			doPlayerSendTextMessage(cid, 26, 'Only support can raport bugs.')
			return true
		end
		if (isInArray(params, param[1]) == false) then
			doPlayerSendTextMessage(cid, 26, 'Wrong bug type, try again.')
			return true
		end
		local com = tostring(param[2])
		local type = tostring(param[1])
		addComment(com, type, position.x, position.y, position.z)
		doPlayerSendTextMessage(cid, 22, 'Bug addded to our bug list. Thanks!')
	return true
end
function addComment(comments, types, posxs, posys, poszs)
			db.executeQuery("INSERT INTO `bug tracker` ( `comment` , `type` , `posx` , `posy` , `posz`) VALUES ('"..comments.."', '"..types.."', "..posxs..", "..posys..", "..poszs..");")
	return true
end

Thank you for your help :)
 
LUA:
local config = 
{
access = 1
}
function onSay(cid, words, param)
       if exhaustion.get(cid, 501) then
		doPlayerSendCancel(cid, 'You can use this command only once per 10 seconds.')
		return true
	end
	exhaustion.set(cid, 501, 10)
	
		if (param == '') then
			doPlayerSendTextMessage(cid, 26, 'You need to say !bug map/ques/script and add description of the bug.')
			return true
		end
	local position = getCreaturePosition(cid)
	local param = string.explode(param, ',')
	local params = {'map', 'quest', 'script'}
		if (not param[2]) then
			doPlayerSendTextMessage(cid, 26, 'Please add descripition to report.')
			return true
		end
		if (getPlayerAccess(cid) < config.access) then
			doPlayerSendTextMessage(cid, 26, 'Only support can raport bugs.')
			return true
		end
		if (isInArray(params, param[1]) == false) then
			doPlayerSendTextMessage(cid, 26, 'Wrong bug type, try again.')
			return true
		end
		local com = tostring(param[2])
		local type = tostring(param[1])
		addComment(com, type, position.x, position.y, position.z)
		doPlayerSendTextMessage(cid, 22, 'Bug addded to our bug list. Thanks!')
	return true
end
function addComment(comments, types, posxs, posys, poszs)
			db.executeQuery("INSERT INTO `bug tracker` ( `comment` , `type` , `posx` , `posy` , `posz`) VALUES ('"..comments.."', '"..types.."', "..posxs..", "..posys..", "..poszs..");")
	return true
end
 
Back
Top