• 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!

Problem with exhaustion functions...

harry127

Member
Joined
Jul 19, 2009
Messages
435
Reaction score
5
Location
Poland
Hello.
I have problem with exhaustion functions...

This is my testScript.lua:
Code:
function check(cid)
	doPlayerSendTextMessage(cid, 22, exhaustion.check(cid, 12345) and "Not exhausted." or "Exhausted!")
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	exhaustion.set(cid, 12345, 3500)
	for i = 1, 4 do
		addEvent(check, i*1000, cid)
	end
end

And when I use the item, I see:
22:27 Not exhausted!
22:27 Not exhausted!
22:27 Not exhausted!
22:27 Not exhausted!

Please, tell me what is bad in my script!
 
Last edited:
Exhaustion functions isn't my best side but.... test to remove the "4" at line 7.
If that doesn't work, change the "4" at line "7" to a "1".
 
The script in my first post can be:
Code:
function check(cid)
	if exhaustion.check(cid, 12345) then
		doPlayerSendTextMessage(cid, 22, "Not exhausted.")
	else
		doPlayerSendTextMessage(cid, 22, "Exhausted!")
	end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	exhaustion.set(cid, 12345, 3500)
	addEvent(check, 1000, cid)
	addEvent(check, 2000, cid)
	addEvent(check, 3000, cid)
	addEvent(check, 4000, cid)
end

It's longer version, but do the same.
 
As I see the item u use will add exhaustion time.
Like this:
You use the item: Exhaustion time add 1 sec + add 2 sec + add 3 sec + add 4 sec. Therefor 10 seconds Exhaustion time.
And you will also recive 4 Exhastion messages.

Still Exhaustion timer isn't my best side this is just what I think it does.
 
No, no, no. Look:
Code:
 - add 3,5 seconds exhaustion to player
 - [1 second after use] tell player if exhausted //should be "Exhausted."
 - [2 seconds after use] tell player if exhausted //should be "Exhausted."
 - [3 seconds after use] tell player if exhausted //should be "Exhausted."
 - [4 seconds after use] tell player if exhausted //should be "Not exhausted."
 
Back
Top