• 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 Problem with Script; Local and Global Confused by the Server different than last time

Obsdark

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

I have a problem, i have this script:

LUA:
local tid = {
[5011] = {{x = 3021, y = 3085, z = 8}, {x = 3017, y = 3085, z = 8}, {x = 3029, y = 3076, z = 8}, {x = 3030, y = 3076, z = 8}, 25, 5}
}
local CastilloWare = {[2674] = {x = 3105, y = 3101, z = 8},
}
--- item.actionid :=: Posicion(from), Posicion(to), Posicion(Pago Peaje), posicion (Lector) id's_castillo, Cobros(Peaje), Comision(Castillo). ---

--- item.itemid (Castillo id's) :=: Coords de paga Castillo ---

function onUse(cid, item, fromPosition, itemEx, toPosition)
local Plyrps = tid[item.actionid]
local CastilloWare = CW[item.itemid]
Money = getPlayerMoney(cid)
Players = getPlayerPosition(cid)
vis = getTileItemById(Plyrps[4], CW)
	if item.itemid == 1945 and item.actionid == Plyrps and Players == Plyrps[1] and Money >= Plyrps[5] then
		doPlayerRemoveMoney(cid, Plyrps[5])
		doTeleportPlayer(cid, Plyrps[2])
		doCreateItem(2148,(Plyrps[5] - Plyrps[6]), Plyrps[3])
		doCreateItem(2148,Plyrps[6], CW[1])
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1945 and item.actionid == Plyrps and Players == Plyrps[1] and vis and Money >= Plyrps[5] then
		doPlayerRemoveMoney(cid, Plyrps[5])
		doTeleportThing(cid, Plyrps[2])
		doCreateItem(2148,Plyrps[5], Plyrps[3])
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1945 and item.actionid == Plyrps and Players == Plyrps[2] and Money >= Plyrps[5] then
		doPlayerRemoveMoney(cid, Plyrps[5])
		doTeleportPlayer(cid, Plyrps[1])
		doCreateItem(2148,(Plyrps[5] - Plyrps[6]), Plyrps[3])
		doCreateItem(2148,Plyrps[6], CW[1])
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1945 and item.actionid == Plyrps and Players == Plyrps[2] and CW == Plyrps[4] and Money >= Plyrps[5] then
		doPlayerRemoveMoney(cid, Plyrps[5])
		doTeleportThing(cid, Plyrps[1])
		doCreateItem(2148,Plyrps[5], Plyrps[3])
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 and item.uid == Plyrps then
		doPlayerSendTextMessage(cid,21,"¡La regresas a como estaba!")
		doTransformItem(item.uid, item.itemid - 1)
	else
		doPlayerSendCancel(cid,"No tienes suficiente dinero")
	end
	return 1
end

And when i try to pull the trigger to execute it the console send me this error message:



The codes Related to the problems are this ones:

LUA:
(...)
function onUse(cid, item, fromPosition, itemEx, toPosition)
local Plyrps = tid[item.actionid]
local CastilloWare = CW[item.itemid]
Money = getPlayerMoney(cid)
Players = getPlayerPosition(cid)
vis = getTileItemById(Plyrps[4], CW)
	if item.itemid == 1945 and item.actionid == Plyrps and Players == Plyrps[1] and Money >= Plyrps[5] then
		doPlayerRemoveMoney(cid, Plyrps[5]) --- 17
		doTeleportPlayer(cid, Plyrps[2])
		doCreateItem(2148,(Plyrps[5] - Plyrps[6]), Plyrps[3]) --- 19
		doCreateItem(2148,Plyrps[6], CW[1])
		doTransformItem(item.uid, item.itemid + 1)
(...)

I don't understand what is the problem, simply i can't detect it by myself...

Somebody can help me?, any help it would be very apreciated ;).

¡Tnx all of you since now!

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


-Obsdark-
 
Last edited:
xP, yeah, you are right, i didn't notice than i define 'Castlewares' but no 'CW'.

¡Tnx a lot & Have a great day!
(Y)(Y)

-Obsdark-
 
Back
Top