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

Lua At the End Premium Account, Back to Townid = 2

MUTANO

New Member
Joined
Jan 10, 2009
Messages
39
Reaction score
2
Location
Brazil - Santa Catarina
Hi, all good? I hope so ...

It happens like this:
The player in a town ta premium account in the last hours of his remaining premium, so it just must not use the boat and then went out of town, it has just become free account.

The script would do so:
I have the premium days of the face, so he login again, he logs into the temple of the city that will be townid = 2 (major city, free) and will also be their new church.

You get the idea right?

I thank you very much, any help is welcome!
Thanks ...

P.S.: Sorry an error in English ^_^
 
I found the script:
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

but I still have a doubt about it ... my server has rookgaard, so if a player is in the area premmy rook, which I add the script to the rooker only born in the temple of rook, in the case is on the area free account.
 
Last edited:
Maybe you can try to change the temple position to the one you want and delete "freetownid":

Code:
function onLogin(cid)
local templePos = [B][COLOR="Red"]{x = XXX, y = XXX, z = X}[/COLOR][/B]

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

Tell me if it didn't work, I'll change it
 
Last edited:
this freetownid was wrong, actually my script is like this:

function onLogin(cid)
local templePos = {x = 737, y = 733, z = 7}

if isPremium(cid) == FALSE and getPlayerStorageValue(cid, 1000) == TRUE then
setPlayerStorageValue(cid, 1000, -1)
doTeleportThing(cid, templePos)
doPlayerSetTown(cid, 2)
doPlayerSendTextMessage(cid, 22, "Your Premium has been expired")
elseif isPremium(cid) == TRUE and getPlayerStorageValue(cid, 1000) == FALSE then
setPlayerStorageValue(cid, 1000, TRUE)
end
return TRUE
end

only that if the guy has a character in rookgaard and end your premium, this character will login to the main temple.
So I need to add to this script if the player is in rookgaard (townID: 4) in the premium area, place it in the temple of the free side of Rookgaard.
Just as does the tibia global ...
 
I found the script:


but I still have a doubt about it ... my server has rookgaard, so if a player is in the area premmy rook, which I add the script to the rooker only born in the temple of rook, in the case is on the area free account.

Lua:
function onLogin(cid)
local freeTownId = 2
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, You are now in youre new town!")
elseif isPremium(cid) == TRUE and getPlayerStorageValue(cid, 1234) == FALSE then
setPlayerStorageValue(cid, 1234, TRUE)
end
return TRUE
end

freeTownId must be an local if you wanna it to work.
 
Yes, actually my script is like this:
function onLogin(cid)
local templePos = {x = 737, y = 733, z = 7}

if isPremium(cid) == FALSE and getPlayerStorageValue(cid, 1000) == TRUE then
setPlayerStorageValue(cid, 1000, -1)
doTeleportThing(cid, templePos)
doPlayerSetTown(cid, 2)
doPlayerSendTextMessage(cid, 22, "Your Premium has been expired")
elseif isPremium(cid) == TRUE and getPlayerStorageValue(cid, 1000) == FALSE then
setPlayerStorageValue(cid, 1000, TRUE)
end
return TRUE
end

And what I want, I do not think I explained right.
Actually the script would have to work that way;
If the player was in the area of premium MAIN citizen he would turn the city ID and 2 would be teleported to end up there when your premium account (as it is in my current script).
Now, if the player was a citizen of rook, and was in the area of premium rookgaard when your premium time was over, he would be teleported to the temple of rook, which is on the free account (rookgaard of my map is equal to the tibia global ).

The perfect script for me that would be, would have to do?
 
Lua:
function onLogin(cid)
local templePos = {x = 100, y = 200, z = 7}
        if isPremium(cid) == false and getPlayerStorageValue(cid, 1234) == 1 then
	doTeleportThing(cid, templePos)
	doPlayerSetTown(cid, 2)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your premium expired")
            setPlayerStorageValue(cid, 1234, -1) 
        end
return true
end
 
Dude, he needs players that are in rook not to be teleported.


Use this one, just made it I hope it works (fingers crossed).

Lua:
function onLogin(cid)
	local pacc_storageid = 1234
	local town_id_rook = 1
	local templepos_rook = {x = 123, y = 123, z = 7}
	local town_id_facc = 2
	local templepos_facc = {x = 123, y = 123, z = 7}

	if isPremium(cid) == FALSE and getPlayerStorageValue(cid, pacc_storageid) == TRUE then
		setPlayerStorageValue(cid, pacc_storageid, -1)
		if getPlayerTown(cid) == town_id_rook then
			doTeleportThing(cid, templepos_rook)
			doPlayerSetTown(cid, town_id_rook)
			doPlayerSendTextMessage(cid, 22, "Your Premium has been expired")
		else
			doTeleportThing(cid, templepos_facc)
			doPlayerSetTown(cid, town_id_facc)
			doPlayerSendTextMessage(cid, 22, "Your Premium has been expired")
		end
	elseif isPremium(cid) == TRUE and getPlayerStorageValue(cid, pacc_storageid) == FALSE then
	setPlayerStorageValue(cid, pacc_storageid, TRUE)
	end
	return TRUE
end
 
not work :(

Brother Coiler, now I pulled rookgaard, could you create a script deset same type, just working like this:
Terminate your premium account, and around free account again, he is transported to the TownID 2 (x = 737, y = 733, z = 7), which will also be their new temple.
When this happens it when logged in or not.

For this script here:
function onLogin(cid)
local templePos = {x = 737, y = 733, z = 7}

if isPremium(cid) == FALSE and getPlayerStorageValue(cid, 1000) == TRUE then
setPlayerStorageValue(cid, 1000, -1)
doTeleportThing(cid, templePos)
doPlayerSetTown(cid, 2)
doPlayerSendTextMessage(cid, 22, "Your Premium has been expired")
elseif isPremium(cid) == TRUE and getPlayerStorageValue(cid, 1000) == FALSE then
setPlayerStorageValue(cid, 1000, TRUE)
end
return TRUE
end
is not working anymore ...
Thank you for everything you have tried to help me even more grateful if this could be done.
Thank you very much. :D
 
Back
Top