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

What's Wrong?

xTremoxx

domasturb(cid, genital)
Joined
Aug 11, 2007
Messages
418
Reaction score
6
Location
Brazil
Creaturescripts.xml:

PHP:
    <event type="advance" name="advance" script="promotion.lua"/>
    <event type="advance" name="advance1" script="promotion1.lua"/>

Login.php:

PHP:
	registerCreatureEvent(cid, "advance")
	registerCreatureEvent(cid, "advance1")

Script 1:

PHP:
local config = {
    promoLevel = 1,    -- promotion level : )
    needLevel = 19, -- level to get promotion 
    needPremium = "no" -- need premium (YES/NO)? :D
}

function onAdvance(cid, skill, oldlevel, newlevel)
    if (skill == 0) and (newlevel >= config.needLevel and getPlayerPromotionLevel(cid)<config.promoLevel) then
        if(string.lower(config.needPremium) == "yes" and isPremium(cid) == TRUE) or (string.lower(config.needPremium) == "no") then 
            doPlayerSendTextMessage(cid, 22, "Você alcançou o nível 19 ! Atenção recarregue seus POTIONS AGORA! , Pegue o level 20 e terá uma missão de imediato!")
        end
    end
    return TRUE
end

Script 2:

PHP:
local config = {
    promoLevel = 1,    -- promotion level : )
    needLevel = 20, -- level to get promotion 
    needPremium = "no" -- need premium (YES/NO)? :D
}

function onAdvance(cid, skill, oldlevel, newlevel)
    if (skill == 0) and (newlevel >= config.needLevel and getPlayerPromotionLevel(cid)<config.promoLevel) then
        if(string.lower(config.needPremium) == "yes" and isPremium(cid) == TRUE) or (string.lower(config.needPremium) == "no") then 
            doTeleportThing(cid,{x=1869, y=1344, z=6})
            doPlayerSendTextMessage(cid, 22, "Agora você irá fazer uma quest para pegar a 2° JOB de " .. getVocationInfo(getPlayerVocation(cid)).name .. ", Boa Sorte!")
        end
    end
    return TRUE
end

Script 1: When player reach level 19, say msg for he, prepare, in level 20 you go to one quest (teleported to one quest).

Script 2: Teleport player to position, and say one msg.

but script don't work, player take lvl 19 and script not send msg to he, he take lvl 20 and not be teleported. help plx.
 
I think the fault is from the registerEvent, sometimes it doesnt works correctly so what i recomment is to create new file with the function onLogin(cid) and there you add the registerEvent.

Other recomendation is to instead of using (name="advance") use for example (name="AdvanceScript").
 
Pitufo, can u help me ? i don't understand scripts, i take this and edit some lines, can u help me ? i rep++, tks so much.
 
Try changing
Lua:
    <event type="advance" name="advance" script="promotion.lua"/>
    <event type="advance" name="advance1" script="promotion1.lua"/>

To
Lua:
    <event type="advance" name="advance" event="script" value="promotion.lua"/>
    <event type="advance" name="advance1" event="script" value="promotion1.lua"/>
 
Try this...

Lua:
local config = {
    promoLevel = 1,    -- promotion level : )
    needLevel = 20, -- level to get promotion 
    needPremium = "no" -- need premium (YES/NO)? :D
}

function onAdvance(cid, skill, oldlevel, newlevel)
	if(skill == 0) and (newlevel >= config.needLevel and getPlayerPromotionLevel(cid) < config.promoLevel) then
		if(getBooleanFromString(config.needPremium) == TRUE) and isPremium(cid) == TRUE or (getBooleanFromString(config.needPremium) == FALSE) then 
			doTeleportThing(cid, {x=1869, y=1344, z=6})
			doPlayerSendTextMessage(cid, 22, "Agora você irá fazer uma quest para pegar a 2° JOB de " .. getVocationInfo(getPlayerVocation(cid)).name .. ", Boa Sorte!")
		end
    	end
	return TRUE
end
 
Back
Top