• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Problem with script 1.0

Maldero

/root/
Joined
Oct 2, 2010
Messages
62
Reaction score
1
Location
Szczecin, Poland
Hello i have problem with script on tfs 1.0
This is script:
Code:
function onAdvance(cid, oldLevel, newLevel)
    if getPlayerLevel(cid) >= 20 and getPlayerStorageValue(cid, 90005) == -1 then
        if getPlayerVocation(cid) == 1 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have received 2 cc and wand.")
            doPlayerAddItem(cid, 2160, 2)
            doPlayerAddItem(cid, 2188, 1)
        elseif getPlayerVocation(cid) == 2 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have received 2 cc and rod.")
            doPlayerAddItem(cid, 2160, 2)
            doPlayerAddItem(cid, 2185, 1)
        elseif getPlayerVocation(cid) == 3 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have received 2 cc and spears.")
            doPlayerAddItem(cid, 2160, 2)
            doPlayerAddItem(cid, 2389, 5)
        elseif getPlayerVocation(cid) == 4 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have received 2 cc and weapons.")
            doPlayerAddItem(cid, 2160, 2)
            doPlayerAddItem(cid, 2423, 1)
            doPlayerAddItem(cid, 7385, 1)
            doPlayerAddItem(cid, 2435, 1)
        end
        setPlayerStorageValue(cid, 90005, 1)
    end
    if getPlayerLevel(cid) >= 45 and getPlayerStorageValue(cid, 90010) == -1 then
        if getPlayerVocation(cid) == 1 or 5 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have received 3 cc and wand.")
            doPlayerAddItem(cid, 2160, 3)
            doPlayerAddItem(cid, 8922, 1)
        elseif getPlayerVocation(cid) == 2 or 6 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have received 3 cc and rod.")
            doPlayerAddItem(cid, 2160, 3)
            doPlayerAddItem(cid, 8910, 1)
        elseif getPlayerVocation(cid) == 3 or 7 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have received 3 cc and enchanted spears.")
            doPlayerAddItem(cid, 2160, 3)
            doPlayerAddItem(cid, 7367, 5)
        elseif getPlayerVocation(cid) == 4 or 8 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have received 3 cc and weapons.")
            doPlayerAddItem(cid, 2160, 3)
            doPlayerAddItem(cid, 7419, 1)
            doPlayerAddItem(cid, 3961, 1)
            doPlayerAddItem(cid, 7404, 1)
        end
        setPlayerStorageValue(cid, 90010, 1)
    end
    if getPlayerLevel(cid) >= 75 and getPlayerStorageValue(cid, 90015) == -1 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have received 5 cc.")
        doPlayerAddItem(cid, 2160, 5)
        setPlayerStorageValue(cid, 90015, 1)
    end
    if getPlayerLevel(cid) >= 100 and getPlayerStorageValue(cid, 90020) == -1 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have received 8 cc.")
        doPlayerAddItem(cid, 2160, 8)
        setPlayerStorageValue(cid, 90020, 1)
    end
    if getPlayerLevel(cid) >= 150 and getPlayerStorageValue(cid, 90025) == -1 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have received 10 cc.")
        doPlayerAddItem(cid, 2160, 10)
        setPlayerStorageValue(cid, 90025, 1)
    end
    if getPlayerLevel(cid) >= 275 and getPlayerStorageValue(cid, 90045) == -1 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have received 25 cc and mount doll.")
        doPlayerAddItem(cid, 2160, 25)
        doPlayerAddItem(cid, 13565, 1)
        setPlayerStorageValue(cid, 90045, 1)
    end
end

And problem is: When knight advance to lv 45 he get voodo doll :P But should get weapons.. ;/
 
Code:
function onAdvance(cid, oldLevel, newLevel)
    local p = Player(cid)
    if p:getLevel() >= 20 and p:getStorageValue(90005) == -1 then
        if p:getVocation():getId() == 1 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 2 cc and wand.")
            p:addItem(2160, 2)
            p:addItem(2188, 1)
        elseif p:getVocation():getId() == 2 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 2 cc and rod.")
            p:addItem(2160, 2)
            p:addItem(2185, 1)
        elseif p:getVocation():getId() == 3 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 2 cc and spears.")
            p:addItem(2160, 2)
            p:addItem(2389, 5)
        elseif p:getVocation():getId() == 4 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 2 cc and weapons.")
            p:addItem(2160, 2)
            p:addItem(2423, 1)
            p:addItem(7385, 1)
            p:addItem(2435, 1)
        end
        p:setStorageValue(90005, 1)
    end
   
    if p:getLevel() >= 45 and p:getStorageValue(90010) == -1 then
        if p:getVocation():getId() == 1 or 5 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 3 cc and wand.")
            p:addItem(2160, 3)
            p:addItem(8922, 1)
        elseif p:getVocation():getId() == 2 or 6 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 3 cc and rod.")
            p:addItem(2160, 3)
            p:addItem(8910, 1)
        elseif p:getVocation():getId() == 3 or 7 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 3 cc and enchanted spears.")
            p:addItem(2160, 3)
            p:addItem(7367, 5)
        elseif p:getVocation():getId() == 4 or 8 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 3 cc and weapons.")
            p:addItem(2160, 3)
            p:addItem(7419, 1) -- dreaded cleaver
            p:addItem(3961, 1) -- lich staff
            p:addItem(7404, 1) -- assassin dagger
        end
        p:setStorageValue(90010, 1)
    end
   
    if p:getLevel() >= 75 and p:getStorageValue(90015) == -1 then
        p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 5 cc.")
        p:addItem(2160, 5)
        p:setStorageValue(90015, 1)
    end
   
    if p:getLevel() >= 100 and p:getStorageValue(90020) == -1 then
        p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 8 cc.")
        p:addItem(2160, 8)
        p:setStorageValue(90020, 1)
    end
   
    if p:getLevel() >= 150 and p:getStorageValue(90025) == -1 then
        p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 10 cc.")
        p:addItem(2160, 10)
        p:setStorageValue(90025, 1)
    end
   
    if p:getLevel() >= 275 and p:getStorageValue(90045) == -1 then
        p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 25 cc and mount doll.")
        p:addItem(2160, 25)
        p:addItem(13565, 1)
        p:setStorageValue(90045, 1)
    end
end

I checked the code and converted it to meta.
I could not find any items in lvl 45 what is the itemid of the item he gets? Do you have any other scripts with onAdvance?
 
Players when advance to lv 45 always get wand for sorcerers:
8922 but dont know how is now. Must wait.
Only this script is on advance type.

So its not knights as you said? Ill take a look tomorow when I can look in my items.xml

What item are they supposed to get?
 
Code:
function onAdvance(cid, oldLevel, newLevel)
    local p = Player(cid)
    if p:getLevel() >= 20 and p:getStorageValue(90005) == -1 then
        if p:getVocation():getId() == 1 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 2 cc and wand.")
            p:addItem(2160, 2) -- crystal coin
            p:addItem(2188, 1) -- wand of decay
        elseif p:getVocation():getId() == 2 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 2 cc and rod.")
            p:addItem(2160, 2) -- crystal coin
            p:addItem(2185, 1) -- necrotic rod
        elseif p:getVocation():getId() == 3 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 2 cc and spears.")
            p:addItem(2160, 2) -- crystal coin
            p:addItem(2389, 5) -- spear
        elseif p:getVocation():getId() == 4 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 2 cc and weapons.")
            p:addItem(2160, 2) -- crystal coin
            p:addItem(2423, 1) -- clerical mace
            p:addItem(7385, 1) -- crimson sword
            p:addItem(2435, 1) -- dwarven axe
        end
       
        p:setStorageValue(90005, 1)
    end
   
    if p:getLevel() >= 45 and p:getStorageValue(90010) == -1 then
        if p:getVocation():getId() == 1 or 5 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 3 cc and wand.")
            p:addItem(2160, 3) -- crystal coin
            p:addItem(8922, 1) -- wand of voodoo
        elseif p:getVocation():getId() == 2 or 6 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 3 cc and rod.")
            p:addItem(2160, 3) -- crystal coin
            p:addItem(8910, 1) -- underworld rod
        elseif p:getVocation():getId() == 3 or 7 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 3 cc and enchanted spears.")
            p:addItem(2160, 3) -- crystal coin
            p:addItem(7367, 5) -- enchanted spear
        elseif p:getVocation():getId() == 4 or 8 then
            p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 3 cc and weapons.")
            p:addItem(2160, 3) -- crystal coin
            p:addItem(7419, 1) -- dreaded cleaver
            p:addItem(3961, 1) -- lich staff
            p:addItem(7404, 1) -- assassin dagger
        end
       
        p:setStorageValue(90010, 1)
    end
   
    if p:getLevel() >= 75 and p:getStorageValue(90015) == -1 then
        p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 5 cc.")
        p:addItem(2160, 5) -- crystal coin
        p:setStorageValue(90015, 1)
    end
   
    if p:getLevel() >= 100 and p:getStorageValue(90020) == -1 then
        p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 8 cc.")
        p:addItem(2160, 8) -- crystal coin
        p:setStorageValue(90020, 1)
    end
   
    if p:getLevel() >= 150 and p:getStorageValue(90025) == -1 then
        p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 10 cc.")
        p:addItem(2160, 10) -- crystal coin
        p:setStorageValue(90025, 1)
    end
   
    if p:getLevel() >= 275 and p:getStorageValue(90045) == -1 then
        p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have received 25 cc and mount doll.")
        p:addItem(2160, 25) -- crystal coin
        p:addItem(13565, 1) -- Meandi
        p:setStorageValue(90045, 1)
    end
end

There are no items that is a doll except the "mount doll" aka meandi.
Do you have any other onAdvance scripts, corrupted items.xml?
 
Im getting confused, is it that knights get the wrong items or sorcerers? Or is that none of the vocations gets items?
And all players gets a rod and a wand but only sorcerers?

You should tho use Rey's code since that also workes for promoted characters or if you want a cleaner code you can use the isVocation functions, isKnight(cid), isSorcerer(cid) etc since that does the exact same thing, but if you later wanna add another vocation its easier to make that function work insted of changing alot of scripts to add another id to the table.
 
Back
Top