• 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 Need Help "End Premium, player sent to town id X" Dont work

Vikarious

New Member
Joined
Dec 16, 2008
Messages
93
Reaction score
2
Ok, I found this script:

LUA:
function onLogin(cid)
local templePos = {x = 834, y = 185, z = 6}
local freetownid = 5

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

and I installed this way:

\data\creaturescripts\scripts=>teleportfree.lua

and into

craturescripts.xml

I added:

LUA:
<event type="login" name="TeleportFACC" event="script" value="teleportfree.lua"/>

but when i log, dont happen nothing.

both with premium player that i set premdays to 0 and with free players.

What I'm missing?


Hope someone be able to help me!!


=)
 
Last edited:
data/creaturescripts/scripts/login.lua
PHP:
registerCreatureEvent(cid, "TeleportFACC")

data/creaturescripts/creaturescripts.xml
PHP:
<event type="login" name="TeleportFACC" event="script" value="script_name.lua"/>

data/creaturescripts/scripts/script_name.lua
Code:
function onLogin(cid)
	local freetown, storage = 5, 12345
	if isPremium(cid) == false and getPlayerStorageValue(cid, storage) == 1 then
		setPlayerStorageValue(cid, storage, -1)
		doTeleportThing(cid, getTownTemplePosition(freetown))
		doPlayerSetTown(cid, freetown)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your Premium has expired.")
	else
		setPlayerStorageValue(cid, storage, 1)
	end
	return true
end
 
Back
Top