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

Enter on Teleport only with x Capacity

myalitth

New Member
Joined
Jan 13, 2013
Messages
69
Reaction score
3
Is it possible to create a script in which only players with a capacity 400 or less can enter a teleport?

Moveevent or actions...

Thanks!

TFS 0.3.6 / TFS 0.4
 
Solution
Try this, deve funcionar:

Code:
local vocation = {0} -- vocações que vai poder usar o teleport
local pos = {x = 32005, y = 32363, z = 5} -- local para onde sera teleportado
function onStepIn(cid, player, position, FromPosition)
    if getPlayerFreeCap(cid) <= 400 then
        if isInArray(vocation, getPlayerVocation(cid)) then
            doTeleportThing(cid, pos)
        else
            doTeleportThing(cid,FromPosition)
            doPlayerSendCancel(cid,"Only no Vocations!")
        end
    else
        doTeleportThing(cid,FromPosition)
        doPlayerSendCancel(cid,"Your cap must be lower than 400!")
    end       
return true
I found the check for max capacity here. I have no idea if it'll work.

Lua:
function getPlayerMaxCap(cid)           -- Function by darkhaos
   local query = db.getResult("SELECT `cap` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";")
   if query:getID() ~= -1 then
       return query:getDataInt("cap")
   end
   query:free()
   return LUA_ERROR
end

function onStepIn(cid, item, position, fromPosition)
   if getPlayerMaxCap(cid) < 400 then
       return true
   end
   return false
end
 
i need a simple script, where player enter on teleport if his cap is under 400...
I have an teleport with action 2611

I've an script working like this...

local vocation = {0} -- vocações que vai poder usar o teleport
local pos = {x = 32005, y = 32363, z = 5} -- local para onde sera teleportado
function onStepIn(cid, player, position, FromPosition)
if isInArray(vocation, getPlayerVocation(cid)) then
doTeleportThing(cid, pos)
else
doTeleportThing(cid,FromPosition)
doPlayerSendCancel(cid,"Only no Vocations!")
end
return true
end
 
Last edited:
Try this, deve funcionar:

Code:
local vocation = {0} -- vocações que vai poder usar o teleport
local pos = {x = 32005, y = 32363, z = 5} -- local para onde sera teleportado
function onStepIn(cid, player, position, FromPosition)
    if getPlayerFreeCap(cid) <= 400 then
        if isInArray(vocation, getPlayerVocation(cid)) then
            doTeleportThing(cid, pos)
        else
            doTeleportThing(cid,FromPosition)
            doPlayerSendCancel(cid,"Only no Vocations!")
        end
    else
        doTeleportThing(cid,FromPosition)
        doPlayerSendCancel(cid,"Your cap must be lower than 400!")
    end       
return true
 
Solution
Solved Specially Thanks to Siegh!


local vocation = {0} -- vocações que vai poder usar o teleport
local pos = {x = 32005, y = 32363, z = 5} -- local para onde sera teleportado
function onStepIn(cid, player, position, FromPosition)
if getPlayerFreeCap(cid) <= 400 then
if isInArray(vocation, getPlayerVocation(cid)) then
doTeleportThing(cid, pos)
else
doTeleportThing(cid,FromPosition)
doPlayerSendCancel(cid,"Only no Vocations!")
end
else
doTeleportThing(cid,FromPosition)
doPlayerSendCancel(cid,"Your cap must be lower than 400!")
end
return true
end
 
That's not what you asked for.
>.>

Only thing that script accomplishes is forcing players to pick up trash loot until they have no cap left, then drop it the moment they get through the portal

bah
 
That's not what you asked for.
>.>

Only thing that script accomplishes is forcing players to pick up trash loot until they have no cap left, then drop it the moment they get through the portal

I agree, though he may have his reasons. Or he simply meant the opposite by mistake.
 
Back
Top