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

CreatureEvent Advanced Pacc check and teleport if Facc

Mikuch

/home/mikuch
Joined
Jul 1, 2008
Messages
440
Reaction score
1
Location
Poland/Kielce
REP++ me please if You like it


It checks if player have Premium then if not:
It check if player had last time pacc if not then:
-Teleport player to facc area (You can change coordinates in script)
-Set player Home town ID (configurable in script)



In
Code:
data/creaturescripts/creaturescripts.xml
after
PHP:
<event type="login" name="FirstItems" event="script" value="firstitems.lua"/>

add
PHP:
<event type="login" name="Pacccheck" event="script" value="pacccheck.lua"/>


In


Code:
data/creaturescripts/scripts/login.lua

after

PHP:
registerCreatureEvent(cid, "PlayerDeath")

add

PHP:
registerCreatureEvent(cid, "Pacccheck")



In


Code:
data/creaturescripts/scripts

add file named

Code:
pacccheck.lua

copy into it


Code:
function onLogin(cid)
        if isPremium(cid) == TRUE then
                if getPlayerStorageValue(cid, [COLOR="Red"]30002[/COLOR]) == -1 then
                   setPlayerStorageValue(cid, [COLOR="Red"]30002[/COLOR], 1)
                end
        elseif isPremium(cid) == FALSE then
                if getPlayerStorageValue(cid, [COLOR="Red"]30002[/COLOR]) == 1 then
                   setPlayerStorageValue(cid, [COLOR="Red"]30002[/COLOR], -1)
                   doPlayerSetTown(cid, [COLOR="Magenta"]1[/COLOR])
                   doTeleportThing(cid, {[COLOR="Lime"]x = 381, y = 602, z = 7[/COLOR], stackpos = 1}, TRUE)
                end
        end
        return TRUE
end

30002 - set storage as U want to be storage in database
1 - Player Home Town ID
x = 100, y = 100, z = 7 - Coordinates where player should be teleported after become facc
 
Last edited:
Great one ;)

This is with a message.

PHP:
function onLogin(cid)
        if isPremium(cid) == TRUE then
                if getPlayerStorageValue(cid, 30002) == -1 then
                   setPlayerStorageValue(cid, 30002, 1)
                end
        elseif isPremium(cid) == FALSE then
                if getPlayerStorageValue(cid, 30002) == 1 then
                   setPlayerStorageValue(cid, 30002, -1)
                   doPlayerSetTown(cid, 1)
                   doTeleportThing(cid, {x = 381, y = 602, z = 7, stackpos = 1}, TRUE)
doPlayerSendTextMessage(cid, 22, "You have been teleported to Thais. Your premium has been expired")
                end
        end
        return TRUE
end

I think this will work with globalevent, much better.
 
Last edited:
Sorry. Storage that function Exhaustiveness?
Simply what for there is storage ?
 
This way you wouldn't have to add any coordinates, simply add the town id (e.g. Thais town id).
PHP:
local FIRST_TOWN_ID = 1
doTeleportThing(cid, getTownTemplePosition(FIRST_TOWN_ID))
 
//
PHP:
local config = {
townId = 1,
storage = 30002
}
function onLogin(cid)
        if isPremium(cid) == TRUE then
                if getPlayerStorageValue(cid, config.storage) == LUA_ERROR then
                   setPlayerStorageValue(cid, config.storage, TRUE)
                end
        else
                if getPlayerStorageValue(cid, config.storage) == TRUE then
                   setPlayerStorageValue(cid, config.storage, LUA_ERROR)
                   doPlayerSetTown(cid, config.townId)
                   doTeleportThing(cid, getTownTemplePosition(config.townId), TRUE)
                end
        end
        return TRUE
end
 
@up
When you login as premium account it adds a sotrage to your account. When you are free account and have this storage it teleports you out from premium islands etc.

And this will work much better on Globalevent, also on login it adds storage, in globlaevent it checks.
 
Very Nice !! good job
Request mum
Anybody < somebody > will add for it changed it on in order to x x x x?


function onLogin(cid)
if isPremium(cid) == TRUE then
if getPlayerStorageValue(cid, 30002) == -1 then
setPlayerStorageValue(cid, 30002, 1)
end
elseif isPremium(cid) == FALSE then
if getPlayerStorageValue(cid, 30002) == 1 then
setPlayerStorageValue(cid, 30002, -1)
doPlayerSetTown(cid, 2)
doTeleportThing(cid, {x = 996, y = 2577, z = 7, stackpos = 1}, TRUE)
end
end
return TRUE
end
 
how do i make it so if a player has a certain storage number they wont be tele but once they lose that storage their tele'd to town?
 
That works perfectly, thanks!

Lua:
local config = {
townId = 2,
storage = 7125
}
function onLogin(cid)
        if isPremium(cid) == TRUE then
                if getPlayerStorageValue(cid, config.storage) == -1 then
                   setPlayerStorageValue(cid, config.storage, 1)
                end
        else
                if getPlayerStorageValue(cid, config.storage) == 1 then
                   setPlayerStorageValue(cid, config.storage, -1)
                   doPlayerSetTown(cid, config.townId)
                   doTeleportThing(cid, getTownTemplePosition(config.townId), TRUE)
		     doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
		     doPlayerSendTextMessage(cid, 25, "You have been teleported to Carlin. Your premium has been expired.")
                end
        end
        return TRUE
end
 
to dont teleport to temple always when player is facc

Why not just use it this way:
Code:
local pTowns = { 4, 5, 6 }
local nTown = 1

if isInArray(pTowns, getPlayerTown(cid)) == TRUE and isPremium(cid) == FALSE then
    doPlayerSetTown(cid, nTown)
    doTeleportThing(cid, getTownTemplePosition(nTown))
end
 
Would this work with VIP?
Code:
function onLogin(cid)
        if getPlayerStorageValue(cid,11551) == TRUE then
                if getPlayerStorageValue(cid, 30002) == -1 then
                   setPlayerStorageValue(cid, 30002, 1)
                end
        elseif getPlayerStorageValue(cid,11551) == FALSE then
                if getPlayerStorageValue(cid, 30002) == 1 then
                   setPlayerStorageValue(cid, 30002, -1)
                   doPlayerSetTown(cid, 5)
                   doTeleportThing(cid, {x = 32369, y = 32241, z = 7, stackpos = 1}, TRUE)
                end
        end
        return TRUE
end
 
Does this work with 0.2 TFS?!
If not, could somebody please make it work with 0.2? That'd be god!

Red
 
Back
Top