Jump to content

scoreboard add deaths


Klesh

Recommended Posts

Posted

Hi i have an error but i dont know where i do a server side and client side but no shows at scoreboard, here are the codes

ocalPlayer = getLocalPlayer() 
  
function addColumns() 
    exports.scoreboard:scoreboardAddColumn("Points")     
    exports.scoreboard:scoreboardAddColumn("Deaths")     
    setElementData(localPlayer,"Points",0) 
        setElementData(localPlayer,"Deaths",0)   
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), addColumns) 
  
    local playerMoney = getPlayerMoney(source) 
    local playerPoints = getElementData(getLocalPlayer(), "Points") 
    local playerWashted = getElementData(getLocalPlayer(), "Deaths") 
end 
  

client-side

addEvent("onPlayerDestructionDerbyWin",true) 
addEventHandler("onPlayerDestructionDerbyWin",getRootElement(), 
function (winner) 
        outputChatBox(getPlayerName ( winner ) .. " Win and give 3 Points",getRootElement(),0,255,0) 
        setElementData(winner,"Points",tonumber(getElementData(winner,"Points"))+3)              
end) 
  
addEventHandler("onPlayerWashted",getRootElement(), 
function () 
        setElementData(source,"Deaths",tonumber(getElementData(source,"Deaths"))+1) 
end) 

server-side

Posted

first errors i see: at first of client side script says "ocal player" not "local player" and in server side you're calling wrong the onPlayerWasted event, look

addEventHandler("onPlayerWashted",getRootElement(),

you're doing "onPlayerWashted" they aren't the same.

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

yes, also "ocal player" must be "local player", remplace onPlayerWashted with onPlayerWasted and ocalPlayer with localPlayer

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

you mean the column isn't being created?

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

you got errors, do you know how to use debugscript? if not then type /debugscript 3 in-game (loged in as admin)

client side:

  
localPlayer = getLocalPlayer() 
  
function addColumns() 
    exports.scoreboard:scoreboardAddColumn("Points")    
    exports.scoreboard:scoreboardAddColumn("Deaths")    
    setElementData(localPlayer,"Points",0) 
    setElementData(localPlayer,"Deaths",0)  
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), addColumns) 
  
function get() 
    local playerMoney = getPlayerMoney(source) 
    local playerPoints = getElementData(getLocalPlayer(), "Points") 
    local playerWasted = getElementData(getLocalPlayer(), "Deaths") 
end 

server side:

  
addEvent("onPlayerDestructionDerbyWin",true) 
addEventHandler("onPlayerDestructionDerbyWin",getRootElement(), 
function (winner) 
        outputChatBox(getPlayerName ( winner ) .. " Win and give 3 Points",getRootElement(),0,255,0) 
        setElementData(winner,"Points",tonumber(getElementData(winner,"Points"))+3)             
end) 
  
addEventHandler("onPlayerWasted",getRootElement(), 
function () 
        setElementData(source,"Deaths",tonumber(getElementData(source,"Deaths"))+1) 
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.

Posted

debug script is not a resource Lol, you type in-game /debugscript 3 when you are logged in as admin and there you are.

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

it tells the script errors.

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

ok, another thing how can i save the deaths???

localPlayer = getLocalPlayer() 
  
function addColumns() 
    exports.scoreboard:scoreboardAddColumn("Win Points")    
    exports.scoreboard:scoreboardAddColumn("Deaths")    
    setElementData(localPlayer,"Win Points",0) 
    setElementData(localPlayer,"Deaths",0)  
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), addColumns) 
  
function get() 
    local playerMoney = getPlayerMoney(source) 
    local playerPoints = getElementData(getLocalPlayer(), "Win Points") 
    local playerWasted = getElementData(getLocalPlayer(), "Deaths") 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), addColumns ) 
addEventHandler ( "onPlayerLogin", getRootElement(), addColumns ) 
  
  

cleint-side

Posted

you can use account data functions, but you must make it server side since account data is only server side, here are the links to them.

to save:

https://wiki.multitheftauto.com/wiki/SetAccountData

to load:

https://wiki.multitheftauto.com/wiki/GetAccountData

event handlers:

to save:

https://wiki.multitheftauto.com/wiki/OnPlayerQuit

to load:

https://wiki.multitheftauto.com/wiki/OnPlayerLogin

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

i tried script that posted solidsnake. with debug script 3 it shows - ERROR: call: failled to call 'scoreboard:scoreboardAddColumn' [string "?"]

Posted

you don't have the resource started or the resource "scoreboard" doesn't exist.

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
i tried script that posted solidsnake. with debug script 3 it shows - ERROR: call: failled to call 'scoreboard:scoreboardAddColumn' [string "?"]

all scoreboard exported functions are server-side (except "setScoreboardForced"), and in that script it is called from client, hence the error.

PS: klesh. you've got the ready script for car health to scoreboard (which is ALL server-side), its a matter of few lines editing to add deaths, and you again trying to do something in some strange way through the client. its like you dont even understand what you're doing. i mean at all.

?

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