Jump to content

Level&Exp Script Error !


Recommended Posts

Posted

It's impossible to script without english knowledge bud .. :/

350x20.png

Impossible is a word to be found only in the dictionary of fools.

Napoleon Bonaparte

Posted

try this:

exports [ "scoreboard" ]:addScoreboardColumn ( "EXP") 
exports [ "scoreboard" ]:addScoreboardColumn ( "LEVEL") 
      
    function updatePlayersExp ( )  
        for index, player in ipairs ( getElementsByType "player" ) do  
            setElementData ( player, "EXP", getElementData(player,"exp") )  
        end 
    end  
    setTimer ( updatePlayersExp, 2500, 0 ) 
  
    function updatePlayersLevel ( )  
        for index, player in ipairs ( getElementsByType "player" ) do  
            setElementData ( player, "LEVEL", getElementData(player,"level") )  
        end 
    end  
    setTimer ( updatePlayersLevel, 2500, 0 ) 

Omerta Roleplay

Posted

Updating is not requring, level and experience are saved as element data, so you can just use the data name of them which is: "exp" and "level".

exports [ "scoreboard" ]:addScoreboardColumn ( "exp" ) 
exports [ "scoreboard" ]:addScoreboardColumn ( "level" ) 

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

try this:

exports [ "scoreboard" ]:addScoreboardColumn ( "exp") 
exports [ "scoreboard" ]:addScoreboardColumn ( "level") 
      
    function updatePlayersExp ( )  
        for index, player in ipairs ( getElementsByType "player" ) do  
            setElementData ( player, "exp", getElementData(player,"exp") )  
        end 
    end  
    setTimer ( updatePlayersExp, 2500, 0 ) 
  
    function updatePlayersLevel ( )  
        for index, player in ipairs ( getElementsByType "player" ) do  
            setElementData ( player, "level", getElementData(player,"level") )  
        end 
    end  
    setTimer ( updatePlayersLevel, 2500, 0 ) 

Omerta Roleplay

Posted (edited)

Meta.XML

<meta> 
    <info author="Castillo" type="script" name="exp/level system" description="exp/level system" version="3.2"/> 
     
    <script src="client.lua" type="client"/>     
    <script src="server.lua" type="server"/> 
    <file src="level_up.mp3" type="client" /> 
     
    <export function="getPlayerLevel" type="server" /> <!-- arguments: thePlayer --> 
    <export function="setPlayerLevel" type="server" /> <!-- arguments: thePlayer, theLevel  --> 
    <export function="getPlayerEXP" type="server" /> <!-- arguments: thePlayer --> 
    <export function="setPlayerEXP" type="server" /> <!-- arguments: thePlayer, theExperience  -->   
    <export function="addPlayerEXP" type="server" /> <!-- arguments: thePlayer, theExperience  -->   
     
    <export function="getAccountLevel" type="server" /> <!-- arguments: theAccount --> 
    <export function="setAccountLevel" type="server" /> <!-- arguments: theAccount, theLevel  --> 
    <export function="getAccountEXP" type="server" /> <!-- arguments: theAccount --> 
    <export function="setAccountEXP" type="server" /> <!-- arguments: theAccount, theExperience  -->     
    <export function="addAccountEXP" type="server" /> <!-- arguments: theAccount, theExperience  --> 
    <export function="getLevelData" type="server" /> <!-- arguments: theLevel  --> 
     
    <export function="loadLevelsFromXML" type="server" /> <!-- arguments: None  --> 
</meta> 
  

server.lua

exports [ "scoreboard" ]:addScoreboardColumn ( "EXP") 
exports [ "scoreboard" ]:addScoreboardColumn ( "LEVEL") 
      
    function updatePlayersExp ( ) 
        for index, player in ipairs ( getElementsByType "player" ) do 
            setElementData ( player, "EXP", getElementData(player,"exp") ) 
        end 
    end 
    setTimer ( updatePlayersExp, 2500, 0 ) 
  
    function updatePlayersLevel ( ) 
        for index, player in ipairs ( getElementsByType "player" ) do 
            setElementData ( player, "LEVEL", getElementData(player,"level") ) 
        end 
    end 
    setTimer ( updatePlayersLevel, 2500, 0 ) 
  

LEVELS.XML

<levels> 
    <level name = "Test 1" experienceRequired = "20" /> 
    <level name = "Test 2" experienceRequired = "100" /> 
    <level name = "Test 3" experienceRequired = "150" /> 
    <level name = "Test 4" experienceRequired = "200" /> 
    <level name = "Test 5" experienceRequired = "2000" /> 
</levels> 

Edited by Guest
n-560x95.png
Posted

You haven't read my post or what?

Updating is not requring, level and experience are saved as element data, so you can just use the data name of them which is: "exp" and "level".
exports [ "scoreboard" ]:addScoreboardColumn ( "exp" ) 
exports [ "scoreboard" ]:addScoreboardColumn ( "level" ) 

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

That's a compiled script, you can't edit it.

Make a new script file on the same resource, then add it to the meta.xml.

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 that hard to create a new text document and copy what I gave you on it, save, then add to meta.xml like the other scripts?

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

Send me the teamviewer details over PM, you obviously don't understand anything.

Edit: You don't have any script to give exp at all, try with this one:

addEvent ( "onPlayerDestructionDerbyWin", true ) 
addEventHandler ( "onPlayerDestructionDerbyWin", root, 
    function ( winner ) 
        local randomExp = math.random ( 10, 30 ) 
        exports [ "Level" ]:addPlayerEXP ( winner, randomExp ) 
        outputChatBox ( getPlayerName ( winner ) .." has won ".. randomExp .." experience for winning the map!", root, 0, 255, 0 ) 
    end 
) 

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.

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...