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

onStepin check

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
I have this script
LUA:
local area = {frompos = {x=347,y=550,z=0}, topos = {x=466,y=653,z=8}}
local reward , count = 2665, 3
local players = 0

function onThink(cid, interval)
	if(not isCreature(cid)) then
		return
	end

	if isPlayer(cid) and isPlayer(target) then
		for _,pid in ipairs(getPlayersOnline()) do 
			if (pid ~= cid) and isInRange(getThingPos(pid), area.frompos, area.topos) then
				players = players+1
			end
		end
		if players < 1 then 
			doPlayerAddItem(cid,reward,count)
		end
	end
	return true
end
I have this script but it's not better way.

How to do that:
When player stepin script will if he is alone in area (The check will be each 30 seconds without stop, the first check will be 1 minute after stepin)
- if alone then reward
- if he isn't alone do nothing
If stepout cancel check
 
How to do that:
When player stepin script will if he is alone in area (The check will be each 30 seconds without stop, the first check will be 1 minute after stepin)
- if alone then reward
- if he isn't alone do nothing
If stepout cancel check
 
If player is the first to get in area event and stepin throne he will receibe reward XD

I really need this:
When player stepin script will if he is alone in area (The check will be each 30 seconds without stop, the first check will be 1 minute after stepin)
- if alone then reward
- if he isn't alone do nothing
If stepout cancel check


EDIT:
Will it work?
Code:
local area = {frompos = {x=347,y=550,z=0}, topos = {x=466,y=653,z=8}}
local reward , count = 2160, 5

local function check1(p)
	if isPlayer(cid) then
		for _,pid in ipairs(getPlayersOnline()) do 
			if (pid ~= cid) and isInRange(getThingPos(pid), area.frompos, area.topos) then
				players = players+1
				[COLOR="#008000"]addEvent(check2, 120000)[/COLOR]
			end
		end
		if players < 1 then 
			doPlayerAddItem(cid,reward,count)
		end
	end
	return TRUE
end

local function check2(p)
	if isPlayer(cid) then
		for _,pid in ipairs(getPlayersOnline()) do 
			if (pid ~= cid) and isInRange(getThingPos(pid), area.frompos, area.topos) then
				players = players+1
			end
		end
		if players < 1 then 
			doPlayerAddItem(cid,reward,count)
		end
	end
	return TRUE
end

function onStepIn(cid, item, position, fromPosition)

	if isPlayer(cid) then
		[COLOR="#008000"]addEvent(check1, 300000)[/COLOR]
	end
return true
end
 
Last edited:
Back
Top