GarQet
Own3d!
- Joined
- Feb 10, 2009
- Messages
- 1,381
- Solutions
- 14
- Reaction score
- 81
Hello OTlanders,
I have a small problem with my script, it is that I don't know how I can retrieve the number of players that are in the area. Depending on the outcome (number of players on area) script to continue executing commands.
I've tried to write this script, here it's:
actions/scripts/test.lua
lib/050-function.lua
Errors:
This should work, but it doesn't work.
Has anyone any idea how to do that work properly?
Regards, GarQet.
//Sorry for my English.
I have a small problem with my script, it is that I don't know how I can retrieve the number of players that are in the area. Depending on the outcome (number of players on area) script to continue executing commands.
I've tried to write this script, here it's:
actions/scripts/test.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local table = {}
if(table.empty(getSpectators({x=146,y=1322,z=7}, 37, 50)) and table.empty(getSpectators({x=146,y=1322,z=6}, 37, 50)) and table.empty(getSpectators({x=146,y=1322,z=5}, 37, 50))) then
doPlayerSendCancel(cid, "Sorry not possible, because someone is actually doing this mission.")
else
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doTeleportThing(cid, {x=128,y=1351,z=7})
return true
end
end
Code:
table.empty = function (t)
return next(t) == nil
end
Errors:
attempt to call field 'empty' (a nil value)
This should work, but it doesn't work.
Has anyone any idea how to do that work properly?
Regards, GarQet.
//Sorry for my English.