• 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 Error with script on creaturevent

Dalt0n

Hiho:)
Joined
Dec 14, 2011
Messages
535
Reaction score
31
Location
Italia
Hello otland users, eh created by a friend who helped me a lot ^ ^, but I get an error in console: S

Code:
local m = {
      back = {x=1050, y=987, z=z}, --- primera ciudad
      to = { x = 1045, y = 920, z = 7} -- segunda
    }
     
    function onAdvance(cid, skill, oldLevel, newLevel)
    if skill == SKILL__LEVEL then
       if newLevel > oldLevel and newLevel == 15 then
          doTeleportThing(cid, m.to)
          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Has sido enviado a una nueva ciudad!")
          doPlayerSetTown(cid, TOWNID) -- no se cual es el townID de la nueva ciudad
       elseif oldLevel > newLevel and newLevel < 15 then
              doTeleportThing(cid, m.back)
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Has sido enviado a tu vieja ciudad por que tu level es muy bajo")
              doPlayerSetTown(cid, TOWNIDvieja) -- townID de la primera ciudad
       end
    end
    return true
    end

my creaturescripts xml:
Code:
<event type="onadvance name="onAdvance" event="script" value="main.lua"/>

Error;
zt8zys.png
 
In the script check line 5 and see a error :P
or try this
code:
local m = {
back = {x=1050, y=987, z=z}, --- primera ciudad
to = { x = 1045, y = 920, z = 7} -- segunda
}
function onAdvance(cid, skill, oldLevel, newLevel)
if skill == SKILL__LEVEL then
if newLevel > oldLevel and newLevel == 15 then
doTeleportThing(cid, m.to)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Has sido enviado a una nueva ciudad!")
doPlayerSetTown(cid, TOWNID) -- no se cual es el townID de la nueva ciudad
elseif oldLevel > newLevel and newLevel < 15 then
doTeleportThing(cid, m.back)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Has sido enviado a tu vieja ciudad por que tu level es muy bajo")
doPlayerSetTown(cid, TOWNIDvieja) -- townID de la primera ciudad
end
end
return true
end
 
Last edited:
PHP:
local m = {
	town1 = {x = 1050, y = 987, z = 7}, --- primera ciudad
	town2 = { x = 1045, y = 920, z = 7}, -- segunda
	townid1 = 1, -- town if lvl == 15
	townid2 = 2 -- town if lvl < 15
}
     
function onAdvance(cid, skill, oldLevel, newLevel)
    if skill == SKILL__LEVEL then
		if newLevel == 15 then
			doTeleportThing(cid, m.town1)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Has sido enviado a una nueva ciudad!")
			doPlayerSetTown(cid, m.townid1) -- no se cual es el townID de la nueva ciudad
		elseif newLevel < 15 then
			doTeleportThing(cid, m.town2)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Has sido enviado a tu vieja ciudad por que tu level es muy bajo")
			doPlayerSetTown(cid, m.townid2) -- townID de la primera ciudad
		end
    end
	return true
end


should work now

@off
YOU SHOULD READ THE RULES BEFORE BUMP THREAD!!!
 
Back
Top