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

When you Premmy function.

MUTANO

New Member
Joined
Jan 10, 2009
Messages
39
Reaction score
2
Location
Brazil - Santa Catarina
^_^ Hello.
I have a problem with my Server.
I have a script that causes the player to finish your premium account back to the temple at the same time free.
But there is a problem, because when the players free account logout, born in the temple.

Script:

<event type="login" name="PremiumCity" script="premiumcity.lua"/>

function onLogin(cid)

freetownid = 1
freetowntemplepos = {x=287,y=217,z=7}

if getPlayerPremiumDays(cid) == 0 then
doPlayerSetTown(cid, freetownid)
doTeleportThing(cid, freetowntemplepos)
end
return TRUE
end

I much help.
Thank you all.
Bye, and excuse me any error of English.:p
 
Last edited:
PHP:
function onLogin(cid)
local templePos = {x = 123, y = 123, z = 7}

 if isPremium(cid) == FALSE and getPlayerStorageValue(cid, 1234) == TRUE then
	setPlayerStorageValue(cid, 1234, -1)
	doTeleportThing(cid, templePos)
	doPlayerSendTextMessage(cid, 22, "Your Premium has been expired")
elseif isPremium(cid) == TRUE and getPlayerStorageValue(cid, 1234) == FALSE then
	setPlayerStorageValue(cid, 1234, TRUE)
		end
	return TRUE
end
You have to use sotrage values.
creaturescript.xml
PHP:
		<event type="login" name="Premium" event="script" value="SCRIPT_NAME.lua"/>

and in login.lua
below
PHP:
registerCreatureEvent(cid, "PlayerDeath")

write
PHP:
registerCreatureEvent(cid, "Premium")
 
@Zonet make sure the script sets his town id too or else he will be tped back to premmy lands when he dies.

It's a very simple fix but here it is:
PHP:
function onLogin(cid)
local templePos = {x = 123, y = 123, z = 7}

 if isPremium(cid) == FALSE and getPlayerStorageValue(cid, 1234) == TRUE then
    setPlayerStorageValue(cid, 1234, -1)
    doTeleportThing(cid, templePos)
    doPlayerSetTown(cid, freetownid)
    doPlayerSendTextMessage(cid, 22, "Your Premium has been expired")
elseif isPremium(cid) == TRUE and getPlayerStorageValue(cid, 1234) == FALSE then
    setPlayerStorageValue(cid, 1234, TRUE)
        end
    return TRUE
end
Just make sure you set the correct town id.


Also, you don't need to register the creaturevent in login.lua if the script is a login script. :p
 
Last edited:
Back
Top