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

Teleport VIP - Storage Value

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,493
Solutions
17
Reaction score
187
Location
Brazil
Hi everybody,

I have a script to add a storage value to a player when he use a item:

LUA:
function onUse(cid, item, frompos, item2, topos)
    if item2.itemid == 2239 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabens, voce se tornou um membro VIP do ExtremeOT!")
        setPlayerStorageValue(cid, 30009, 1)
        doPlayerAddPremiumDays(cid, 7)
        doRemoveItem(item.uid, 1)
    end

    return true
end

I add storage value (30009) in Action ID teleport, but all players can jump in, how can i fix that?1595601868032.png
 
Solution
X
Remember to post your server version @potinho otherwise people will post tfs 1.0+ scripts by default.

XML:
<movevent type="StepIn" actionid="30009" event="script" value="vip_teleport.lua"/>
LUA:
function onStepIn(cid, item, position, fromPosition)
    if not isPlayer(cid) then
        return true
    end
   
    if getCreatureStorage(cid, 30009) ~= 1 then
        doTeleportThing(cid, fromPosition)
        doPlayerSendCancel(cid, "Sorry, you cannot access this place.")
        return true
    end
   
    doTeleportThing(cid, {x = 1000, y = 1000, z = 7})
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can access this place.")
    return true
end
Just create a movement script to check if player has storage 30009


LUA:
local config = {
pos = {x=4033, y=894, z=9}, -- Where it should teleport the player
pos2 = {x=4031, y=894, z=9} -- Send effect on x y z cordinates if hes not vip (storage 30009)
}
function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if player == nil or player:isInGhostMode() then
        return true
    end

    if(item.uid == 30009) then
    if player:getStorageValue(30009) == 1 then
       player:teleportTo(config.pos)
    else
     doSendMagicEffect(config.pos2, 10)
    end
end
return true
end

Code:
  <movevent event="StepIn" uniqueid="30009" script="script.lua"/>

Should work :D
 
Last edited:
Remember to post your server version @potinho otherwise people will post tfs 1.0+ scripts by default.

XML:
<movevent type="StepIn" actionid="30009" event="script" value="vip_teleport.lua"/>
LUA:
function onStepIn(cid, item, position, fromPosition)
    if not isPlayer(cid) then
        return true
    end
   
    if getCreatureStorage(cid, 30009) ~= 1 then
        doTeleportThing(cid, fromPosition)
        doPlayerSendCancel(cid, "Sorry, you cannot access this place.")
        return true
    end
   
    doTeleportThing(cid, {x = 1000, y = 1000, z = 7})
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can access this place.")
    return true
end
 
Solution
Remember to post your server version @potinho otherwise people will post tfs 1.0+ scripts by default.

XML:
<movevent type="StepIn" actionid="30009" event="script" value="vip_teleport.lua"/>
LUA:
function onStepIn(cid, item, position, fromPosition)
    if not isPlayer(cid) then
        return true
    end
  
    if getCreatureStorage(cid, 30009) ~= 1 then
        doTeleportThing(cid, fromPosition)
        doPlayerSendCancel(cid, "Sorry, you cannot access this place.")
        return true
    end
  
    doTeleportThing(cid, {x = 1000, y = 1000, z = 7})
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can access this place.")
    return true
end
Ok Xiki, i forgot...worked, thanks again bro
 
Back
Top