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

Lua Bug, With Script...

Obsdark

Member
Joined
Sep 25, 2011
Messages
213
Reaction score
9
LUA:
local t = {
[5001] = {nombre = "Unnamed Town", townID = 1},
[5002] = {nombre = "Thayrana", townID = 2}
}
function onStepIn(cid, item, fromPosition, position, toPosition)
temple = getPlayerMasterPos(cid)
Castle1Lever1 = getPlayerStorageValue(cid,3216)
local real = t(item.actionid)
for k, v in pairs(real) do
   if isPlayer(cid) then
      if getPlayerTown(cid) ~= k and Castle1Lever1 == -1 then
         doPlayerSetTown(cid,v.townID)
         doPlayerSendTextMessage(cid,22,"Ahora eres ciudadano de " .. v.nombre .. " City ")
         doTeleportThing(cid,temple)
      elseif getPlayerTown(cid) ~= k and Castle1Lever1 == 1 then
         doPlayerSendCancel(cid, "Eres rey, No puedes Nacionalizarte en una ciudad")
         doTeleportThing(cid,temple)
      elseif getPlayerTown(cid) == k then
         doPlayerSendCancel(cid, "Ya eras residente de " .. v.nombre .. " City ")
         doTeleportThing(cid,temple)
      else
         doPlayerSendCancel(cid, "Ya eras residente de " .. v.nombre .. " City ")
         doTeleportThing(cid,temple)
      end
   end
end
return true
end

This little code right here is for change your respawn area (temple) so i need it fix it or i don't gonna have nacionalization script, which is bad...

the problem occur when you enter the same teleport of nationalization twice, without enter to another of them first, the script then nationalizate you in the two citys, the first one and the second instantly after, changing your nationalization position permanently to the second one in that order, and keeps you trapped in that function so doesn't matter how much time i re-nacionalizate on the same one or in the other one, to fix it, i always be finaly nationalizated in the last city (second)

the message of this problems apparead thogheder, that means than, first is nacionalizates me in the first city, and then, instantly apparead the nationalization message of the second, leaving me like a resident in the second city, doesn't matter which one i took it.


The script shows me problems in particular lines too, this ones are the lines 5 and 8, acording to correspond they are:


LUA:
function onStepIn(cid, item, fromPosition, position, toPosition)

and


LUA:
local real = t(item.actionid)

i need to use it with more than one tp of nationalization i really be gratefull with any help


¡Bless to all and Cheers up!
(Y)(Y)

-Obsdark-
 
Last edited:
Back
Top