Jump to content

EXP script


OrbTanT

Recommended Posts

Posted

Good, this is the first time that I am messing with experience, and I would like to know how can I use the function of resource exp_system Castillo, I have to download the exp_system for using or only export the functions?

Posted

You must use the resource and you can use the exported functions too...

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

How can I leave on the scoreboard, the value of "Level".

exports [ "scoreboard" ]:addScoreboardColumn ( "Level", 4 ) 
  
function level ( player, Level ) 
    for index, player in ipairs ( getElementsByType "player" ) do 
        local account = getAccountData ( player ) 
        local Level = 1 
        local myExp = setAccountData ( account, player) 
    end 
end 

MUST have some errors, first time with getAccountData and setAccountData.

Posted

You must use setElementData.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Is not working, create a column "level" more does not show the level of the player, right way to use setElementData?

exports [ "scoreboard" ]:addScoreboardColumn ( "Level", 4 ) 
  
addCommandHandler ( "mylevel", 
    function ( player, theLevel ) 
        for index, player in ipairs ( getElementsByType "player" ) do 
            local account = getAccountData ( player ) 
            local theLevel = 1 
            local myExp = setAccountData ( account, player) 
            setElementData ( player, "Level", theLevel ) 
  
        end 
    end 
) 

Posted

If you are using my resource, then you must create the scoreboard column with data name "level" lowercase.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

How can I save the XPs and LVLs when the player exits the game and load, xp and lvl when you enter.

exports.scoreboard:scoreboardAddColumn("EXP") 
exports.scoreboard:scoreboardAddColumn("Level") 
  
function level () 
    for index, player in ipairs ( getElementsByType "player" ) do 
        setElementData( player, "Level", "lvl 1") 
        setElementData( player, "EXP", 0) 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), level) 
  
function levelup (ammo, killer, weapon, bodypart) 
    local XP = getElementData(killer, "EXP") 
    local LVL = getElementData(killer, "Level") 
        if killer and killer ~=source then 
            setElementData(killer, "EXP", tonumber(XP)+10) 
            if tonumber(XP) == 100 then 
                setElementData(killer, "Level", "lvl 2") 
            elseif tonumber(XP) == 200 then 
                setElementData(killer, "Level", "lvl 3") 
            elseif tonumber(XP) == 300 then 
                setElementData(killer, "Level", "lvl 4") 
            elseif tonumber(XP) == 400 then 
                setElementData(killer, "Level", "lvl 5") 
            elseif tonumber(XP) == 500 then 
                setElementData(killer, "Level", "lvl 6") 
            elseif tonumber(XP) == 600 then 
                setElementData(killer, "Level", "lvl 7") 
            elseif tonumber(XP) == 700 then 
                setElementData(killer, "Level", "lvl 8") 
            elseif tonumber(XP) == 800 then 
                setElementData(killer, "Level", "lvl 9") 
            elseif tonumber(XP) == 900 then 
                setElementData(killer, "Level", "lvl 10") 
            end 
        end 
end 
addEventHandler("onPlayerWasted", getRootElement(), levelup) 

Posted
How can I save the XPs and LVLs when the player exits the game and load, xp and lvl when you enter.
exports.scoreboard:scoreboardAddColumn("EXP") 
exports.scoreboard:scoreboardAddColumn("Level") 
  
function level () 
    for index, player in ipairs ( getElementsByType "player" ) do 
        setElementData( player, "Level", "lvl 1") 
        setElementData( player, "EXP", 0) 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), level) 
  
function levelup (ammo, killer, weapon, bodypart) 
    local XP = getElementData(killer, "EXP") 
    local LVL = getElementData(killer, "Level") 
        if killer and killer ~=source then 
            setElementData(killer, "EXP", tonumber(XP)+10) 
            if tonumber(XP) == 100 then 
                setElementData(killer, "Level", "lvl 2") 
            elseif tonumber(XP) == 200 then 
                setElementData(killer, "Level", "lvl 3") 
            elseif tonumber(XP) == 300 then 
                setElementData(killer, "Level", "lvl 4") 
            elseif tonumber(XP) == 400 then 
                setElementData(killer, "Level", "lvl 5") 
            elseif tonumber(XP) == 500 then 
                setElementData(killer, "Level", "lvl 6") 
            elseif tonumber(XP) == 600 then 
                setElementData(killer, "Level", "lvl 7") 
            elseif tonumber(XP) == 700 then 
                setElementData(killer, "Level", "lvl 8") 
            elseif tonumber(XP) == 800 then 
                setElementData(killer, "Level", "lvl 9") 
            elseif tonumber(XP) == 900 then 
                setElementData(killer, "Level", "lvl 10") 
            end 
        end 
end 
addEventHandler("onPlayerWasted", getRootElement(), levelup) 

I , Just hate when someone's steal My Codes , Why Don't you meak your Own ?

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted
How can I save the XPs and LVLs when the player exits the game and load, xp and lvl when you enter.
exports.scoreboard:scoreboardAddColumn("EXP") 
exports.scoreboard:scoreboardAddColumn("Level") 
  
function level () 
    for index, player in ipairs ( getElementsByType "player" ) do 
        setElementData( player, "Level", "lvl 1") 
        setElementData( player, "EXP", 0) 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), level) 
  
function levelup (ammo, killer, weapon, bodypart) 
    local XP = getElementData(killer, "EXP") 
    local LVL = getElementData(killer, "Level") 
        if killer and killer ~=source then 
            setElementData(killer, "EXP", tonumber(XP)+10) 
            if tonumber(XP) == 100 then 
                setElementData(killer, "Level", "lvl 2") 
            elseif tonumber(XP) == 200 then 
                setElementData(killer, "Level", "lvl 3") 
            elseif tonumber(XP) == 300 then 
                setElementData(killer, "Level", "lvl 4") 
            elseif tonumber(XP) == 400 then 
                setElementData(killer, "Level", "lvl 5") 
            elseif tonumber(XP) == 500 then 
                setElementData(killer, "Level", "lvl 6") 
            elseif tonumber(XP) == 600 then 
                setElementData(killer, "Level", "lvl 7") 
            elseif tonumber(XP) == 700 then 
                setElementData(killer, "Level", "lvl 8") 
            elseif tonumber(XP) == 800 then 
                setElementData(killer, "Level", "lvl 9") 
            elseif tonumber(XP) == 900 then 
                setElementData(killer, "Level", "lvl 10") 
            end 
        end 
end 
addEventHandler("onPlayerWasted", getRootElement(), levelup) 

I , Just hate when someone's steal My Codes , Why Don't you meak your Own ?

Cuz it's easier to steal

A unique GangWar gamemode waiting for you!
Click here for more information.

560x95_FFFFFF_FF9900_000000_000000.png

Posted
exports.scoreboard:scoreboardAddColumn("EXP") 
exports.scoreboard:scoreboardAddColumn("Level") 
  
function levelup (ammo, killer, weapon, bodypart) 
    if (killer and getElementType(killer) == "player" and killer ~= source) then 
        local XP = getElementData(killer, "EXP") or 0 
        local LVL = getElementData(killer, "Level") or 1 
        setElementData(killer, "EXP", tonumber(XP)+10) 
        if tonumber(XP) == 100 then 
            setElementData(killer, "Level", 2) 
        elseif tonumber(XP) == 200 then 
            setElementData(killer, "Level", 3) 
        elseif tonumber(XP) == 300 then 
            setElementData(killer, "Level", 4) 
        elseif tonumber(XP) == 400 then 
            setElementData(killer, "Level", 5) 
        elseif tonumber(XP) == 500 then 
            setElementData(killer, "Level", 6) 
        elseif tonumber(XP) == 600 then 
            setElementData(killer, "Level", 7) 
        elseif tonumber(XP) == 700 then 
            setElementData(killer, "Level", 7) 
        elseif tonumber(XP) == 800 then 
            setElementData(killer, "Level", 7) 
        elseif tonumber(XP) == 900 then 
            setElementData(killer, "Level", 10) 
        end 
    end 
end 
addEventHandler("onPlayerWasted", getRootElement(), levelup) 
  
function onLogin (_,account) 
    setElementData(source, "Level", getAccountData(account, "Level") or 1) 
    setElementData(source, "EXP", getAccountData(account, "EXP") or 0) 
end 
addEventHandler ("onPlayerLogin", root, onLogin) 
  
function onLogout (_,account) 
    setElementData(source, "Level", 0) 
    setElementData(source, "EXP", 0) 
end 
addEventHandler ("onPlayerLogout", root, onLogout) 
  
function saveData(thePlayer, theAccount) 
local theAccount = getPlayerAccount(source) 
    if (theAccount and not isGuestAccount(theAccount)) then 
        setAccountData (theAccount, "Level", getElementData(thePlayer, "Level")) 
        setAccountData (theAccount, "EXP", getElementData(thePlayer, "EXP")) 
    end 
end 
  
addEventHandler ("onPlayerQuit", root, 
function () 
    saveData(source, getPlayerAccount(source)) 
end) 
  
addEventHandler ("onPlayerLogout", root, 
function ()  
    saveData(source, getPlayerAccount(source))  
end) 

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted
thanks, Nightfury =)

You're welcome

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...