• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Premium End Temple TP, all non prem affected..

Demnish

Tibian Hero
Joined
Sep 28, 2011
Messages
401
Solutions
2
Reaction score
63
Location
Sweden
I have added a creaturescript that should teleport a player to his/her temple when premium runs out.
Problem is that it teleports anyone without premium to their temple.

I know that I am missing a few lines, but I dont know which ones..

Here is my code, premend.lua
Code:
function onLogin(cid)

if getPlayerPremiumDays(cid) < 1 then
    doTeleportThing(cid,getPlayerMasterPos(cid))
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got teleported to the temple, as your premium has expired.")
    doSendMagicEffect(getThingPos(cid),CONST_ME_TELEPORT)
    end
    return true
end

login.lua (incase you want to see it)
Code:
function onLogin(cid)
    registerCreatureEvent(cid, "PlayerDeath")
    registerCreatureEvent(cid, "FirstItems")
        registerCreatureEvent(cid, "PremEnd")
    return TRUE
end

and creaturescripts.xml (incase you want it too)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
    <event type="login" name="PlayerLogin" script="login.lua"/>
    <event type="death" name="PlayerDeath" script="playerdeath.lua"/>

    <!--CUSTOM -->
    <event type="login" name="FirstItems" script="firstitems.lua"/>
    <event type="login" name="PremEnd" script="premend.lua"/>
</creaturescripts>


Thanks in advance.
/Zeeb


SOLVED

 
Last edited:
^ What this guy said.
actually that is not the easier way since you would need to alter your system to add checks where the premium ends and set a storage there while we can only set storages to characters and not to account you would need even more code and checks, so the easier way is to check map areas, just open RME, zoom out and copy positions :)

and don't forget to set the new player main city with something like doPlayerSetTown so it would not go back to premium area when dead
 
actually that is not the easier way since you would need to alter your system to add checks where the premium ends and set a storage there while we can only set storages to characters and not to account you would need even more code and checks, so the easier way is to check map areas, just open RME, zoom out and copy positions :)

and don't forget to set the new player main city with something like doPlayerSetTown so it would not go back to premium area when dead

IMO: I do think it's the easier way tho, even more if your premium area is not in a specific part of the map. He just need to put the storage when someone purchase premium days, and just need to set it to 0 in this same script he's doing. It'll be pretty much just one line of code added.

For example, if you can only get premium days using itens you'll add one line of code to 2 files.

Checking for an area you need to add a new function, as well as new variables and if you premium area is not everything in the same square, even more variables.
 
IMO: I do think it's the easier way tho, even more if your premium area is not in a specific part of the map. He just need to put the storage when someone purchase premium days, and just need to set it to 0 in this same script he's doing. It'll be pretty much just one line of code added.

For example, if you can only get premium days using itens you'll add one line of code to 2 files.

Checking for an area you need to add a new function, as well as new variables and if you premium area is not everything in the same square, even more variables.
see how simple the script can be: http://otland.net/threads/teleport-...ium-to-free-account-temple.10510/#post-114438
 
Back
Top