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

Need some help here again!

Grinch

www.loronia.se
Joined
Oct 19, 2007
Messages
217
Reaction score
0
Location
Sweden/Värnamo
Need some help with a script here. The script is teleporting free account players from preium are, to free account area when their premium time is over.
It works, but then my website shop stop work, and i want them both to work.
And i've tried to change the name to login3.lua and added it to creaturescripts to get this work.


In creatures.lua
PHP:
<event type="login" name="PlayerLogin" script="login3.lua"/>

login3.lua
PHP:
PremDay = getPlayerPremiumDays(cid) -- Checks premium player days
ftemple = {x=438, y=503, z=8} -- This is the Free account temple position
Prem1 = {x=370, y=592, z=7} -- This is the top left Co-ord for checking the Premium area.
Prem2 = {x=403, y=645, z=7} -- This is the bottom right co-ord for checking the Premium area.

-- Top left, and bottom right co-ords exist because isInArea function checks a SQAURE area. from top left to bottom right

function onLogin(cid)
    if isInArea(getPlayerPosition(cid), Prem1, Prem2) then
        if PremDay < 1 then
            doTeleportThing(cid, ftemple)
            doPlayerSendTextMessage(cid,24,"You no longer have a premium account, Please renew your premium to gain access to the premium areas.")
        end
    end
    registerCreatureEvent(cid, "PlayerDeath")
return TRUE
end

global.lua
PHP:
-- Function isInaArea by Colandus!
function isInArea(pos, fromPos, toPos)
    if pos.x >= fromPos.x and pos.x <= toPos.x then
        if pos.y >= fromPos.y and pos.y <= toPos.y then
            if pos.z >= fromPos.z and pos.z <= toPos.z then
                return true
            end
        end
    end
    return false
end


Thanks for the help!
 
premDay is nil up there, put it below function onLogin(), also, use local variables -> local premDay etc...

btw... why not use isPremium(cid)?
 
Code:
function onLogin(cid)
	local ftemple = {x=438, y=503, z=8} -- This is the Free account temple position
	local Prem1 = {x=370, y=592, z=7} -- This is the top left Co-ord for checking the Premium area.
	local Prem2 = {x=403, y=645, z=7} -- This is the bottom right co-ord for checking the Premium area.
    if isInArea(getPlayerPosition(cid), Prem1, Prem2) then
        if isPremium(cid) == FALSE then
            doTeleportThing(cid, ftemple)
            doPlayerSendTextMessage(cid,24,"You no longer have a premium account, Please renew your premium to gain access to the premium areas.")
        end
    end
    registerCreatureEvent(cid, "PlayerDeath")
return TRUE
end
 
Code:
function onLogin(cid)
	local ftemple = {x=438, y=503, z=8} -- This is the Free account temple position
	local Prem1 = {x=370, y=592, z=7} -- This is the top left Co-ord for checking the Premium area.
	local Prem2 = {x=403, y=645, z=7} -- This is the bottom right co-ord for checking the Premium area.
    if isInArea(getPlayerPosition(cid), Prem1, Prem2) then
        if isPremium(cid) == FALSE then
            doTeleportThing(cid, ftemple)
            doPlayerSendTextMessage(cid,24,"You no longer have a premium account, Please renew your premium to gain access to the premium areas.")
        end
    end
    registerCreatureEvent(cid, "PlayerDeath")
return TRUE
end

bump
Need this for 2 citys, can someone help me please?
 
This works if i use login.lua. But when i changed to login3.lua it stoped to work! Can someone help me? I changed because i am using login.lua for gesiors shop system!
As you can see i added it to creature scripts too, so i don't know what is wrong.


In creatures.lua
PHP:
<event type="login" name="PlayerLogin" script="login3.lua"/>

login3.lua
PHP:
PremDay = getPlayerPremiumDays(cid) -- Checks premium player days
ftemple = {x=438, y=503, z=8} -- This is the Free account temple position
Prem1 = {x=370, y=592, z=7} -- This is the top left Co-ord for checking the Premium area.
Prem2 = {x=403, y=645, z=7} -- This is the bottom right co-ord for checking the Premium area.

-- Top left, and bottom right co-ords exist because isInArea function checks a SQAURE area. from top left to bottom right

function onLogin(cid)
    if isInArea(getPlayerPosition(cid), Prem1, Prem2) then
        if PremDay < 1 then
            doTeleportThing(cid, ftemple)
            doPlayerSendTextMessage(cid,24,"You no longer have a premium account, Please renew your premium to gain access to the premium areas.")
        end
    end
    registerCreatureEvent(cid, "PlayerDeath")
return TRUE
end

global.lua
PHP:
-- Function isInaArea by Colandus!
function isInArea(pos, fromPos, toPos)
    if pos.x >= fromPos.x and pos.x <= toPos.x then
        if pos.y >= fromPos.y and pos.y <= toPos.y then
            if pos.z >= fromPos.z and pos.z <= toPos.z then
                return true
            end
        end
    end
    return false
end
 
Back
Top