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

[PROBLEM] i don't know where put the "Return" command in this script

Obsdark

Member
Joined
Sep 25, 2011
Messages
213
Reaction score
9
¡Hi to all!

The problem is very simple, i check, check and check a lot of levers script untile i learn how to make one perfectly, however i can't find examples for more than one lever, i'm asking for this because i don't know where to put the "return" stuff when u have more than one lever in the script.

i leave

LUA:
function onUse (cid, item, frompos, itemEx, topos)
	valueGM = 0
	Castle1Tower1 = 0
	Castle1Tower2 = 0
	Castle1Tower3 = 0
	Castle1Tower4 = 0
	if item.itemid == 1945 and item.uid == 9898 and valueGM == 0 then
		valueGM = 1
		doPlayerSendTextMessage(cid,21,"el sistema de asedio ha sido activado !")
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 and item.uid == 9898 and valueGM == 1 then
		valueGM = 0
		doTransformItem(item.uid, item.itemid - 1)
		doPlayerSendTextMessage(cid,21,"La Vuelves a su Posición Original !")
	else
		doPlayerSendCancel(cid,"tu hermana !")
	end
	if item.itemid == 1945 and item.uid == 3211 and valueGM == 1 and Castle1Tower1 == 0 then
		Castle1Tower1 = 1
		doPlayerSendTextMessage(cid,21,"Con Exito y Funcionando, la primera torre ha sido activada !")
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 and item.uid == 3211 and Castle1Tower1 == 1 then
		Castle1Tower1 = 0
		doPlayerSendTextMessage(cid,21,"La Vuelves a su Posición Original !")
		doTransformItem(item.uid, item.itemid - 1)
	else
		doPlayerSendCancel(cid,"Error1 !")
	end 
	if item.itemid == 1945 and item.uid == 3212 and valueGM == 1 and Castle1Tower2 == 0 then
		Castle1Tower2 = 1
		doPlayerSendTextMessage(cid,21,"Con Exito y Funcionando, la Segunda torre ha sido activada !")
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 and item.uid == 3212 and Castle1Tower2 == 1 then
		Castle1Tower2 = 0
		doPlayerSendTextMessage(cid,21,"La Vuelves a su Posición Original !")
		doTransformItem(item.uid, item.itemid - 1)
	else
		doPlayerSendCancel(cid,"Error 2!")
	end 
	if item.itemid == 1945 and item.uid == 3213 and valueGM == 1 and Castle1Tower3 == 0 then
		Castle1Tower3 = 1
		doPlayerSendTextMessage(cid,21,"Con Exito y Funcionando, la Tercera torre ha sido activada!")
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 and item.uid == 3213 and Castle1Tower3 == 1 then
		Castle1Tower3 = 0
		doPlayerSendTextMessage(cid,21,"La Vuelves a su Posición Original !")
		doTransformItem(item.uid, item.itemid - 1)
	else
		doPlayerSendCancel(cid,"Error 3!")
	end 
	if item.itemid == 1945 and item.uid == 3214 and valueGM == 1 and Castle1Tower4 == 0 then
		Castle1Tower4 = 1
		doPlayerSendTextMessage(cid,21,"Con Exito y Funcionando, la Cuarta torre ha sido activada !")
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 and item.uid == 3214 and Castle1Tower4 == 1 then
		Castle1Tower4 = 0
		doPlayerSendTextMessage(cid,21,"La Vuelves a su Posición Original !")
		doTransformItem(item.uid, item.itemid - 1)
	else
		doPlayerSendCancel(cid,"Error4 !")
	end
	if valueGM == 1 and Castle1Tower1 == 1 and Castle1Tower2 == 1 and Castle1Tower3 == 1 and Castle1Tower4 == 1 then
		castletake1 = 1
		CastleMain1Tower1 = getPlayerStorageValue(cid, 3215)
	end
	if item.itemid == 1945 and item.uid == 3215 and castletake1 == 1 and CastleMain1tower1 ~= 1 then
		CastleMain1Tower1 = 1
		setPlayerStorageValue(cid, 3218, 1)
		doPlayerSendTextMessage(cid,21,"Felicitaciones, ahora ya te puedes convertir en rey !")
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 and item.uid == 3215 and CastleMain1Tower1 == 1 then
		doPlayerSendTextMessage(cid,21,"Ya eres rey, no puedes volver a ser coronado sin antes perder la corona...")
		doTransformItem(item.uid, item.itemid - 1)
	elseif item.itemid == 1946 and item.uid == 3215 and castletake1 == 0 then
		doPlayerSendTextMessage(cid,21,"No puedes realizar esta acción, pues no estamos en tiempo de ASEDIO !")
		doTransformItem(item.uid, item.itemid - 1)
	else
		doPlayerSendCancel(cid,"Error, tú hermana!")
	end
end

And the other one..., my try with Tables, but i don't know how to make variables work in a table

LUA:
local var = {
	[9898] = {valueGM},
	[3211] = {Castle1Tower1},
	[3212] = {Castle1Tower2},
	[3213] = {Castle1Tower3},
	[3214] = {Castle1Tower4},
	[3215] = {CastleMain1Tower1}
	}
function onUse(cid, item, frompos, itemEx, topos)
	local vars = var[item.uid]
	valueGM = 0
	Castle1Tower1 = 0
	Castle1Tower2 = 0
	Castle1Tower3 = 0
	Castle1Tower4 = 0
	CastleMain1Tower1 = 0
	Castle1Data1 = getPlayerStorageValue(cid, 3218)
	if item.itemid == 1945 and vars and Castle1Data1 == 0 then
		vars = 1
		setPlayerStorageValue(cid, 3218, 1)
		doPlayerSendTextMessage(cid,21,"Una de las palancas, ha sido activada !")
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 and vars then
		doPlayerSendTextMessage(cid,21,"La Vuelves a su Posición Original !")
		doTransformItem(item.uid, item.itemid - 1)
	end
	return true
end

Both suposly do the same, however none of them works properly, if someone can fix any of both i'll give him a rep, i don't think take too much time, specialy with the first one, is fix that and nothing else (i guess) anyway

Since now, honestly

Thanks You all
¡Bless!

-Obsdark-
 
Back
Top