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

[CreatureEvents] Help Onadvance get´s teleported

Solorn Moveryx

New Member
Joined
Mar 18, 2009
Messages
10
Reaction score
1
So i was searching for a script about a player getting teleported to a place when reach lvl 10 and found out

Lua:
local config = 
{
    pos = {x = 974, y = 831, z = 7},
    message = "You have raised your 10 Level. Teleport!",
    levelToTeleport = 10,
    skill = 8 -- 8 = level	
}
 
function onAdvance(cid, skill, oldlevel, newlevel)
    if skill == config.skill and newlevel >= config.levelToTeleport then
        doPlayerSendTextMessage(cid,TALKTYPE_BROADCAST, config.message)
        doTeleportThing(cid, config.pos)
    end		
    return TRUE
end

but when the player gets lvl 11,12 etc it is still teleported and not only lvl 10 so i tried to add a storage value but now it doesnt works.

Lua:
local config = 
{
    pos = {x = 974, y = 831, z = 7},
    message = "You have raised your 10 Level. Teleport!",
    levelToTeleport = 10,
    skill = 8 -- 8 = level	
}
 
function onAdvance(cid, skill, oldlevel, newlevel)
    if skill == config.skill and newlevel >= config.levelToTeleport and if getPlayerStorageValue(cid, 14722) == 0 then
        doPlayerSendTextMessage(cid,TALKTYPE_BROADCAST, config.message)
        doTeleportThing(cid, config.pos)
        setPlayerStorageValue(cid, 14722, 1)
    end		
    return TRUE
end
end

I need someone to help me to find out what is wrong.
thanks.
 
Lua:
local t, storage = {x = 974, y = 831, z = 7}, 14722
function onAdvance(cid, skill, oldLevel, newLevel)
	if( (skill == SKILL__LEVEL and newLevel == 10) and (getPlayerStorageValue(cid, storage) < 0) ) then
		doTeleportThing(cid, t, false)
		setPlayerStorageValue(cid, storage, 1)
		doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
		doCreatureSay(cid, "Congratulations! You have reached level 10.", TALKTYPE_ORANGE_1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Now that you are level 10, you have been teleported to a new place. Take care, Adventurer.")
	end
	return true
end
 

Similar threads

Back
Top