Unknown Soldier
Mapping a map
- Joined
- Oct 30, 2010
- Messages
- 291
- Solutions
- 11
- Reaction score
- 660
Hello,
got a little problem with a movement script. It nicely checks creatures in room, and remove them if player is allowed to enter, however I got a problem making it also check if there is a player in the room. If there is someone then just doesn't allow new player to enter until current player leave (either exit the room or die).
Thanks in advance!
got a little problem with a movement script. It nicely checks creatures in room, and remove them if player is allowed to enter, however I got a problem making it also check if there is a player in the room. If there is someone then just doesn't allow new player to enter until current player leave (either exit the room or die).
Thanks in advance!
Lua:
local config = {
centre_of_arena = {x = 1500, y = 1617, z = 10},
x_range = 10,
y_range = 10,
player_teleport_position = {x = 1500, y = 1616, z = 10},
--player_cancel_position = {x = 1500, y = 1618, z = 11}
}
function onStepIn(cid, item, position, fromPosition)
if not isPlayer(cid) then
return true
end
local queststatus = getPlayerStorageValue(cid,60003)
if queststatus == 2 then
local count, creatures = 0, getSpectators(config.centre_of_arena, config.x_range, config.y_range, false)
if creatures ~= nil then
for _, pid in ipairs(creatures) do
if isPlayer(pid) then
count = count + 1
end
end
end
if count == 0 then
if creatures ~= nil then
for _, pid in ipairs(creatures) do
doRemoveCreature(pid)
end
end
Game.createMonster("Rotworm Queen", {x = 1500 + math.random(-2,2), y = 1612 + math.random(-2,2), z = 10}, false, true)
end
doTeleportThing(cid, config.player_teleport_position)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Kill Rotworm Queen!')
else
doTeleportThing(cid, fromPosition, true)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You are not allowed to go there.")
end
return true
end