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

Teleports when you have X storages or --> VIP <--

bury

Active Member
Joined
Jul 27, 2008
Messages
421
Solutions
7
Reaction score
25
Hello

Maybe someone can help me with this I think is veeery simple but I can not complete it without errors.

I use a script which if u have two storages a teleport tp you to X place. I want if you dont have your teleports but in return you got VIP it teleports you too, but to another part of the place I want be teleported (a boat near the city)

This is the script:

LUA:
local teleport = {x= 316 , y= 1965 , z= 7 } ---    where you go when enter teleport 
local storages = {2020, 2021} ------ storages 
local Message  = "Complete the quests or buy VIP to enter this teleport " --  here Message if not teleport 
 
 
function onStepIn(cid, item, position, fromPosition)
for i = 1,#storages do
    if getPlayerStorageValue(cid, storages[i]) >= 1 then
			doTeleportThing(cid, teleport)
			doSendMagicEffect(teleport,10)
    else
			doTeleportThing(cid, fromPosition, false)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Message)
			doSendMagicEffect(fromPosition,10)
    end
end
return true
end



As you can see with the local storages, the action id will teleport you to the local teleport, I want to include now another 'if'. If you have vip (no matter you dont have that storages/quests) you'll travel to Y position (different that X). My vip door works with this 'formule':
LUA:
if getPlayerVipDays(cid) >= 1 then


Pd: (with another .lua it finds a duplicate action id so I think it should be all in the same script)

Thanks!
 
i have vip teleport but one storage if u want u can take
Code:
function onStepIn(cid, item, frompos, item2, topos)
 
    local vip = getPlayerStorageValue(cid,11551) >= 1 --Vip Storage.
    local back = {x=32345, y=32223, z=7} --Place where non vip is teleported.
        local allowed = {x=31965, y=32388, z=7} --Place where VIPs are teleported.
 
 
    if(vip) then
        doCreatureSay(cid, "Welcome in vip!", TALKTYPE_ORANGE_1) 
                doSendMagicEffect(getPlayerPosition(cid),2) 
                doTeleportThing(cid, allowed) 
                doSendMagicEffect(allowed,10)
    else
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You can't pass because you don't have Vip! You can get it in our SMS Shop.")
                doTeleportThing(cid, back)
    end
end
 
LUA:
local config = {
	action = action id here,
	tps = {{x = 316, y = 1965, z = 7}, {x = vip x pos, y = vip y pos, z = vip z pos}}, ---    where you go when enter teleport 
	storages = {2020, 2021}, ------ storages 
	msgcancel  = "Complete the quests or buy VIP to enter this teleport " --  here Message if not teleport 
} 

function onStepIn(cid, item, position, fromPosition)
	if item.aid == config.action and item.itemid == 1387 then
		if getPlayerVipDays(cid) >= 1 return doTeleportThing(cid, config.tps[2]) and doSendMagicEffect(config.tps[2], 10) and true end
		for i = 1, #config.storages do
			if getPlayerStorageValue(cid, config.storages[i]) >= 1 then
				doTeleportThing(cid, config.tps[1])
				doSendMagicEffect(config.tps[1], 10)
				break
			else
				doTeleportThing(cid, fromPosition, false)
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.msgcancel)
				doSendMagicEffect(fromPosition, 10)
			end
		end
	end
	return true
end

also i put an actionid for the config. gl&hf
 
Thanks again @streamside.

I filled the action id, the position where you will teleport, the storages and the message if you dont have the requirements and I receive this error:

[Error - LuaInterface::loadFile] data/movements/scripts/teleport strages.lua:10: 'then' expected near 'return'
[Warning - Event::loadScript] Cannot load script (data/movements/scripts/teleport strages.lua)
data/movements/scripts/teleport strages.lua:10: 'then' expected near 'return'
 
lol, my error
LUA:
local config = {
	action = action id here,
	tps = {{x = 316, y = 1965, z = 7}, {x = vip x pos, y = vip y pos, z = vip z pos}}, ---    where you go when enter teleport 
	storages = {2020, 2021}, ------ storages 
	msgcancel  = "Complete the quests or buy VIP to enter this teleport " --  here Message if not teleport 
} 
 
function onStepIn(cid, item, position, fromPosition)
	if item.aid == config.action and item.itemid == 1387 then
		if getPlayerVipDays(cid) >= 1 then return doTeleportThing(cid, config.tps[2]) and doSendMagicEffect(config.tps[2], 10) and true end
		for i = 1, #config.storages do
			if getPlayerStorageValue(cid, config.storages[i]) >= 1 then
				doTeleportThing(cid, config.tps[1])
				doSendMagicEffect(config.tps[1], 10)
				break
			else
				doTeleportThing(cid, fromPosition, false)
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.msgcancel)
				doSendMagicEffect(fromPosition, 10)
			end
		end
	end
	return true
end
 
Back
Top