• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Premium time checker

legolas23

New Member
Joined
Jan 8, 2009
Messages
537
Reaction score
3
Hello
This script checks players premium days on login and if the premium is finished tps player to free temple :P

Remember to edit temple position cords in scripts!!!

For 0.3.5pl1
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Pacc information" version="1.0" author="Legolas23" contact="otland.net" enabled="yes">
	<config name="PaccInformation"><![CDATA[
		config = {
			kickpos = { x=1234, y=123, z=4, stackpos=1 }
			paccStorage = 45322
			
		}
	]]></config>
	<event type="login" name="PaccInformation" event="script"><![CDATA[
		domodlib('PaccInformation')

	function onLogin(cid)
		if getPlayerPremiumDays(cid) == 0 then
			doTeleportThing(cid, config.kickpos)
			doPlayerSendTextMessage(cid, 25, "Your premium time has ran out!")
			setPlayerStorageValue(cid, config.paccStorage, (getPlayerStorageValue(cid, config.paccStorage)+1))
		else
			if getPlayerStorageValue(cid, config.paccStorage) <= 0 then
				return true
		end	
		return true
	end
	]]></event>

    <event type="login" name="PaccInformation" event="buffer"><![CDATA[
        registerCreatureEvent(cid, "PaccInformation")
        _result = true
    ]]></event>
</mod>

getPlayerPremiumDays(cid)

For 0.3+ save this code below in
creaturescripts as pacc.lua
Code:
function onLogin(cid)
		if getPlayerPremiumDays(cid) == 0 then
			doTeleportThing(cid, config.kickpos)
			doPlayerSendTextMessage(cid, 25, "Your premium time has ran out!")
			setPlayerStorageValue(cid, config.paccStorage, (getPlayerStorageValue(cid, config.paccStorage)+1))
		else
			if getPlayerStorageValue(cid, config.paccStorage) <= 0 then
				return true
		end	
		return true
	end

and in Creaturescripts.xml add

Code:
<event type="login" name="PaccInformation" event="script" value="pacc.lua"/>

and in login.lua before
Code:
return true
add
Code:
registerCreatureEvent(cid, "PaccInformation")

rep ++ :P
 
Last edited:
here it is not working xP
TFS 0.3.5pl1
Loading premium_checker.xml...[Error - ScriptingManager::loadFromXml] Cannot load mod mods/premium_checker.xml
Line: 32, Info: Extra content at the end of the document
 
Back
Top