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

Lua Trying to add delay to my script

Xagul

deathzot.net
Joined
Jun 30, 2008
Messages
1,294
Solutions
3
Reaction score
1,037
Hello and thanks for taking a look at this thread despite the horrible description givin in the title (I couldn't think of a better way to briefly explain what I am trying to do)

So basically I have a spell script that checks all the players around the user and then heals the ones that are not greater than access 3. Right now it heals everyone at the exact same time and what I want it to do instead is heal one of them, wait 500ms and heal another one, wait 500ms and so on and so fourth. I cant figure out how to get it to delay between heals. Any ideas would be wonderful please! The script I am currently using is shown below:

Code:
if(#list > 0) then
	for i = 1, #list do
		if(isPlayer(list[i]) and getPlayerAccess(list[i]) < 3) then
			table.insert(players, list[i])
		end
	end
end

if(#players > 0) then
	for i = 1, #players do
		doCreatureAddHealth(players[i], 100)
	end
end
 
try
Lua:
if(#list > 0) then
	for i = 1, #list do
		if(isPlayer(list[i]) and getPlayerAccess(list[i]) < 3) then
			table.insert(players, list[i])
		end
	end
end

if(#players > 0) then
	for i = 1, #players do
		addEvent(doCreatureAddHealth,500,players[i], 100)
	end
end
 
proper version... although i would not recommend either of ours

Lua:
if(#list > 0) then
	for i = 1, #list do
		if(isPlayer(list[i]) and getPlayerAccess(list[i]) < 3) then
			table.insert(players, list[i])
		end
	end
end
 
if(#players > 0) then
	for i = 1, #players do
		if(isPlayer(players[i])) then
			addEvent(doCreatureAddHealth,500*i,players[i], 100)
		end
	end
end
 
Back
Top