PHP:
-- Function isInaArea by Colandus!
function isInArea(pos, area)
if pos.x >= area.fromx and pos.x <= area.tox then
if pos.y >= area.fromy and pos.y <= area.toy then
if pos.z >= area.fromz and pos.z <= area.toz then
return true
end
end
end
return false
end
PHP:
local templePos = {x=32360, y=31784, z=8} -- This is the Free account temple position
local townPositions = {
{ -- Ankrahmun
topLeft = {x=33061, y=32531, z=7},
bottomRight = {x=33269, y=32892, z=7}
},
{ -- Edron
topLeft = {x=33054, y=31588, z=7},
bottomRight = {x=33392, y=32075, z=7}
},
{ -- darashia
topLeft = {x=33180, y=332229, z=7},
bottomRight = {x=33345, y=32502, z=7}
},
{ -- port hope
topLeft = {x=32771, y=32448, z=7},
bottomRight = {x=32992, y=32900, z=7}
},
{ -- liberty bay
topLeft = {x=32181, y=32690, z=7},
bottomRight = {x=32431, y=32955, z=7}
},
{ -- svargrond
topLeft = {x=32146, y=31068, z=7},
bottomRight = {x=32573, y=31528, z=7}
},
}
function onLogin(cid)
if getPlayerPremiumDays(cid) < 1 then
for _, positions in pairs(townPositions) do
if isInArea(getPlayerPosition(cid), positions.topLeft, positions.bottomRight) then
doTeleportThing(cid, templePos)
doPlayerSendTextMessage(cid, 24, "You no longer have a premium account. Please renew your premium to gain access to the premium areas.")
break
end
end
end
registerCreatureEvent(cid, "PlayerDeath")
return TRUE
end
PHP:
[13/12/2008 18:15:19] Lua Script Error: [CreatureScript Interface]
[13/12/2008 18:15:19] data/creaturescripts/scripts/login.lua:onLogin
[13/12/2008 18:15:19] data/global.lua:651: attempt to compare nil with number
[13/12/2008 18:15:19] stack traceback:
[13/12/2008 18:15:19] data/global.lua:651: in function 'isInArea'
[13/12/2008 18:15:19] data/creaturescripts/scripts/login.lua:169: in function <data/creaturescripts/scripts/login.lua:166>
[13/12/2008 18:15:46] Storm Screamer has logged out.
[13/12/2008 18:15:48] Storm Screamer has logged in.
[13/12/2008 18:15:48] Lua Script Error: [CreatureScript Interface]
[13/12/2008 18:15:48] data/creaturescripts/scripts/login.lua:onLogin
[13/12/2008 18:15:48] data/global.lua:651: attempt to compare nil with number
[13/12/2008 18:15:48] stack traceback:
[13/12/2008 18:15:48] data/global.lua:651: in function 'isInArea'
[13/12/2008 18:15:48] data/creaturescripts/scripts/login.lua:169: in function <data/creaturescripts/scripts/login.lua:166>
[13/12/2008 18:16:25] Odisea has logged in.
[13/12/2008 18:16:25] Lua Script Error: [CreatureScript Interface]
[13/12/2008 18:16:25] data/creaturescripts/scripts/login.lua:onLogin
[13/12/2008 18:16:25] data/global.lua:651: attempt to compare nil with number
[13/12/2008 18:16:25] stack traceback:
[13/12/2008 18:16:25] data/global.lua:651: in function 'isInArea'
[13/12/2008 18:16:25] data/creaturescripts/scripts/login.lua:169: in function <data/creaturescripts/scripts/login.lua:166>
i have problem?
my server is tfs 0.2
thz