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

Lua Toll Sistem (With Charge in GP)

Obsdark

Member
Joined
Sep 25, 2011
Messages
213
Reaction score
9
¡Hey oh!

I have this Toll script, who works like a teleport bridge, or must work i must say, because acualy is not teleporting nobody to the coords it must. i don't know why is not working, can someone check it and tell me what's wrong?

LUA:
local table = {
[{x = 3021, y = 3084, z = 8}] = {pos={x = 3017, y = 3085, z = 8}, price = 20, cCount = 5, cPos = {x= 3026, y= 3072, z= 8}, dPos ={x= 3023, y= 3072, z= 8}},

[{x = 3017, y = 3084, z = 8}] = {pos={x = 3021, y = 3085, z = 8}, price = 20, cCount = 5, cPos = {x= 3026, y= 3072, z= 8}, dPos ={x= 3023, y= 3072, z= 8}},
}
function onUse(cid, item, fromPos, itemEx, toPos)
   if item.itemid == 1946 then
          doTransformItem(item.uid, 1945)
   return true
end
local Money = getPlayerMoney(cid)
   for k, v in pairs(table) do
          if getThingPos(item.uid) == k and Money >= (v.price + v.cCount) then
                 if doPlayerRemoveMoney(cid, (v.price + v.cCount)) then
                        doTeleportThing(cid, v[1])
                        doCreateItem(2148, v.price, v.cPos)
                        doCreateItem(2148, v.cCount, v.dPos)
                 else
                        doPlayerSendCancel(cid, "You dont have the required gold.")
                 end
          end
   end
return true
end

Thanks to all of you Since now, Honestly

¡¡Bless you and Cheers up!!
(Y)(Y)


-Obsdark-
 
Last edited:
¡¡¡Hey oh!!!


Common, Somebody must have one idea of how to make a teleport bridge who consume Gp
Tnx from now for the one(s) who help me ;)

¡Bump & Rep++!

¡Bless you and Cheers up!
(Y)(Y)

-Obsdark
 
Hmm, try this script out.

LUA:
local t = {
	[1001] = {
		cost = 50,
		pos = {
			{x = 100, y = 100, z = 7}, -- where the player goes.
			{x = 100, y = 100, z = 7}, -- where the gold is created (spot 1).
			{x = 100, y = 100, z = 7} -- where the gold is created (spot 2).
		}
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v, k = t[item.actionid], item.itemid == 1945
	if(v and k) then
		if(not doPlayerRemoveMoney(cid, v.cost)) then
			return doPlayerSendCancel(cid, "You do not have enough money."), doSendMagicEffect(getThingPosition(cid, CONST_ME_POFF)
		else
			local b, c = getTileItemById(v.pos[2], 2148), getTileItemById(v.pos[3], 2148)
			if(b.type > 0 or c.type > 0) then
				doRemoveItem(b.uid)
				doRemoveItem(c.uid)
			end
			
			doTeleportThing(cid, v.pos[1], false)
			doCreateItem(2148, math.random(10, v.cost), v.pos[2])
			doCreateItem(2148, math.random(10, v.cost), v.pos[3])
			doSendMagicEffect(v.pos[1], CONST_ME_TELEPORT)
			doSendMagicEffect(v.pos[2], CONST_ME_ENERGYAREA)
			doSendMagicEffect(v.pos[3], CONST_ME_ENERGYAREA)
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Last edited:
well, this problem apparead, i try to add it a "end" at the end of the script to fix it, but even when this end was missing, the script doesn't fix himself, the implicated lines are the 15 and the 16:

i don't know how to fix it, because i don't know how to end (or close) a return :S

LUA:
(...)
if(not doPlayerRemoveMoney(cid, v.cost)) then -- line 15
			return doPlayerSendCancel(cid, "You do not have enough money."), doSendMagicEffect(getThingPosition(cid, CONST_ME_POFF) -- line 16
		else
			local b, c = getTileItemById(v.pos[2], 2148), getTileItemById(v.pos[3], 2148)
			if(b.type > 0 or c.type > 0) then
				doRemoveItem(b.uid)
				doRemoveItem(c.uid)
			end
 
			doTeleportThing(cid, v.pos[1], false)
			doCreateItem(2148, math.random(1, v.cost), v.pos[2])
			doCreateItem(2148, math.random(1, v.cost), v.pos[3])
			doSendMagicEffect(v.pos[1], CONST_ME_TELEPORT)
			doSendMagicEffect(v.pos[2], CONST_ME_ENERGYAREA)
			doSendMagicEffect(v.pos[3], CONST_ME_ENERGYAREA)
		end
	end -- end line 15
(...)

and this is the error, like it seems in the console.



¿Can you think you can help me with this? :S

¡Bless you, Tnx a lot & Cheers up!
(Y)(Y)


-Obsdark-
 
Probably because you keep messing with the script. Stop trying to edit it, if you don't know how to code. You want the script to work from both sides of the bridge, correct? The script above only works on one side.

Do you have MSN or Skype? Send it to me via Private Message, please.
 
Last edited:
Yeah it's true, i'm not one expert scripter, and yeah i notice than only works in one side, i just need to add the another side like another "actionid" on the table right?, well, the problem isn't that because it doesn't load the script at all. :S

But i send you my msn, i preffer works with e-mail, but i think msn is better for this case. ;)

¡Bless you, Tnx a lot and Cheers up!
(Y)(Y)

-Obsdark-
 
¡Bump!

None of the three codes exposed here works properly, ¿can somebody else check it?

¡Bless you and Cheers up!
(Y)(Y)

-Obsdark-
 
Back
Top