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

Starter items

tedlu1711

New Member
Joined
Jan 19, 2017
Messages
9
Reaction score
0
Been trying to change starter EQ, when u log on my server. Doesnt work. Running a 8.6 client.
(im new on scripting and shit, havent been running a server since it only was XML files, also new to SQL)

here is the script i did make
xml
Code:
    <event type="login" name="FirstItems" event="script" value="firstitems.lua"/>
xml
Lua:
[code]
    function onLogin(cid)
    if getPlayerGroupId(cid) == 1 and getPlayerStorageValue(cid, 50000) == -1 then
    if isSorcerer(cid) then
    local bag = doPlayerAddItem(cid, 9774, 1)

    doAddContainerItem(bag, 2120, 1)
    doAddContainerItem(bag, 2554, 1)
    doAddContainerItem(bag, 2152, 20)

    doPlayerAddItem(cid, 2525, 1)
    doPlayerAddItem(cid, 2190, 1)
    doPlayerAddItem(cid, 2463, 1)
    doPlayerAddItem(cid, 2457, 1)
    doPlayerAddItem(cid, 2647, 1)
    doPlayerAddItem(cid, 2643, 1)

    setPlayerStorageValue(cid, 50000, 1)

    elseif isDruid(cid) then
    local bag = doPlayerAddItem(cid, 9774, 1)
    doAddContainerItem(bag, 2120, 1)
    doAddContainerItem(bag, 2554, 1)
    doAddContainerItem(bag, 2152, 20)

    doPlayerAddItem(cid, 2525, 1)
    doPlayerAddItem(cid, 2182, 1)
    doPlayerAddItem(cid, 2463, 1)
    doPlayerAddItem(cid, 2457, 1)
    doPlayerAddItem(cid, 2647, 1)
    doPlayerAddItem(cid, 2643, 1)

    setPlayerStorageValue(cid, 50000, 1)

    elseif isPaladin(cid) then
    local bag = doPlayerAddItem(cid, 9774, 1)
    doAddContainerItem(bag, 2120, 1)
    doAddContainerItem(bag, 2554, 1)
    doAddContainerItem(bag, 2152, 20)

    doPlayerAddItem(cid, 2389, 3)
    doPlayerAddItem(cid, 2525, 1)
    doPlayerAddItem(cid, 2457, 1)
    doPlayerAddItem(cid, 2643, 1)
    doPlayerAddItem(cid, 2647, 1)
    doPlayerAddItem(cid, 2463, 1)
    setPlayerStorageValue(cid, 50000, 1)

    elseif isKnight(cid) then
    local bag = doPlayerAddItem(cid, 9774, 1)
    doAddContainerItem(bag, 2120, 1)
    doAddContainerItem(bag, 2554, 1)
    doAddContainerItem(bag, 2152, 20)
    doAddContainerItem(bag, 8601, 1)

    doPlayerAddItem(cid, 2525, 1)
    doPlayerAddItem(cid, 2463, 1)
    doPlayerAddItem(cid, 2457, 1)
    doPlayerAddItem(cid, 2647, 1)
    doPlayerAddItem(cid, 2643, 1)

    setPlayerStorageValue(cid, 50000, 1)
    end
    end
    return TRUE
end
[/code]
 
Last edited:
How to post in code tags
[.code] Text Here [./code] -- without dots

data/creaturescripts/login.lua [somewhere near the bottom with the other registered events]
Code:
registerCreatureEvent(cid, "FirstItems")
 
thanks :)

And i did add

Code:
registerCreatureEvent(cid, "FirstItems")


but still not working
 
Last edited by a moderator:
Added some prints.
Remember to reload script, or restart server.
Check for any error codes in console and report back here.

If no errors are found..
Login with a character, then check your console and tell us what shows up when testing script. (Or troubleshoot it yourself, using the helpful prints I added. :D)
Code:
function onLogin(cid)
    print("Players group id is " .. getPlayerGroupId(cid) .. ". Storage value 50000 has a " .. getPlayerStorageValue(cid, 50000) .. " value.")
    if getPlayerGroupId(cid) == 1 and getPlayerStorageValue(cid, 50000) == -1 then
        print("Player has not received items previously.")
        print("Checking vocation...")
        if isSorcerer(cid) then
            print("Vocation Sorcerer.. Giving items to player.")
            local bag = doPlayerAddItem(cid, 9774, 1)

            doAddContainerItem(bag, 2120, 1)
            doAddContainerItem(bag, 2554, 1)
            doAddContainerItem(bag, 2152, 20)

            doPlayerAddItem(cid, 2525, 1)
            doPlayerAddItem(cid, 2190, 1)
            doPlayerAddItem(cid, 2463, 1)
            doPlayerAddItem(cid, 2457, 1)
            doPlayerAddItem(cid, 2647, 1)
            doPlayerAddItem(cid, 2643, 1)

            setPlayerStorageValue(cid, 50000, 1)

        elseif isDruid(cid) then
            print("Vocation Druid.. Giving items to player.")
            local bag = doPlayerAddItem(cid, 9774, 1)
            doAddContainerItem(bag, 2120, 1)
            doAddContainerItem(bag, 2554, 1)
            doAddContainerItem(bag, 2152, 20)

            doPlayerAddItem(cid, 2525, 1)
            doPlayerAddItem(cid, 2182, 1)
            doPlayerAddItem(cid, 2463, 1)
            doPlayerAddItem(cid, 2457, 1)
            doPlayerAddItem(cid, 2647, 1)
            doPlayerAddItem(cid, 2643, 1)

            setPlayerStorageValue(cid, 50000, 1)

        elseif isPaladin(cid) then
            print("Vocation Paladin.. Giving items to player.")
            local bag = doPlayerAddItem(cid, 9774, 1)
            doAddContainerItem(bag, 2120, 1)
            doAddContainerItem(bag, 2554, 1)
            doAddContainerItem(bag, 2152, 20)

            doPlayerAddItem(cid, 2389, 3)
            doPlayerAddItem(cid, 2525, 1)
            doPlayerAddItem(cid, 2457, 1)
            doPlayerAddItem(cid, 2643, 1)
            doPlayerAddItem(cid, 2647, 1)
            doPlayerAddItem(cid, 2463, 1)
            setPlayerStorageValue(cid, 50000, 1)

        elseif isKnight(cid) then
            print("Vocation Knight.. Giving items to player.")
            local bag = doPlayerAddItem(cid, 9774, 1)
            doAddContainerItem(bag, 2120, 1)
            doAddContainerItem(bag, 2554, 1)
            doAddContainerItem(bag, 2152, 20)
            doAddContainerItem(bag, 8601, 1)

            doPlayerAddItem(cid, 2525, 1)
            doPlayerAddItem(cid, 2463, 1)
            doPlayerAddItem(cid, 2457, 1)
            doPlayerAddItem(cid, 2647, 1)
            doPlayerAddItem(cid, 2643, 1)

            setPlayerStorageValue(cid, 50000, 1)
        else
            print("Vocation Unknown! Ending Script.")
            return true
        end
        print("Items given successfully.")
    end
    return true
end
 
[22/01/2017 12:30:29] [Error - LuaScriptInterface::loadFile] cannot open data/creaturescripts/scripts/firstitems.lua: No such file or directory
[22/01/2017 12:30:29] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/firstitems.lua)
[22/01/2017 12:30:29] cannot open data/creaturescripts/scripts/firstitems.lua: No such file or directory
[22/01/2017 12:30:29] Reloaded creature events.
 
Did you save it as a ". lua" file?
Check the file name and type of file.

If you don't know how to save it as ". lua" then copy one of the existing lua documents, rename it, and replace inside with the code above.
 
Back
Top