Klesh Posted December 6, 2010 Share Posted December 6, 2010 Hi comunity i have a script by me. but in scoreboard i set wins and this not works, here is the code addEvent("onPlayerDestructionDerbyWin",true) addEventHandler("onPlayerDestructionDerbyWin",getRootElement(), function (winner) outputChatBox(getPlayerName ( winner ) .. " is the last survivor and win 3 points getRootElement(),0,255,0) setElementData(winner,"Points",tonumber(getElementData(winner,"Points"))+2) setAccountData (account, "race-points", tonumber(2)) setElementData(winner,"Wins",tonumber(getElementData(winner,"Wins"))+1) setAccountData (account, "race-wins", tonumber(1)) else setAccountData (account, "race-points", tonumber(points + 2)) end) addEventHandler("onPlayerWasted",getRootElement(), function () setElementData(source,"Deaths",tonumber(getElementData(source,"Deaths"))+1) end) server - side //////////////////////////////////// exports.scoreboard:addScoreboardColumn('Money') exports.scoreboard:addScoreboardColumn('Points') exports.scoreboard:addScoreboardColumn('Wins') exports.scoreboard:addScoreboardColumn('Achievements') function setstats () local account = getPlayerAccount (source) local money = getPlayerMoney ( source ) setElementData ( source, "Money", "$" .. money ) local points = getAccountData (account, "race-points" ) if points == false then setElementData ( source, "Points", "0" ) else setElementData ( source, "Points", points ) end local wins = getAccountData (account, "race-wins" ) if wins == false then setElementData ( source, "Wins", "0" ) else setElementData ( source, "Wins", Wins ) end local achive = getAccountData (account, "race-achive" ) if achive == false then setElementData ( source, "Achievements", "0" ) else setElementData ( source, "Achievements", achive ) end end addEventHandler ( "onPlayerSpawn", getRootElement(), setstats ) addEventHandler ( "onPlayerLogin", getRootElement(), setstats ) Help. What is wrong, why the wins not works, appears but not works. Thanks for help Link to comment
Castillo Posted December 6, 2010 Share Posted December 6, 2010 first script is client side? if yes then its totally wrong because account data is only server side. Link to comment
Klesh Posted December 6, 2010 Author Share Posted December 6, 2010 the first code is server side the second is client side. Link to comment
DakiLLa Posted December 6, 2010 Share Posted December 6, 2010 Look at the first code: syntax highlighter is totally messed up because you forgot to put ", in 4th line after 'points' word. Link to comment
Castillo Posted December 7, 2010 Share Posted December 7, 2010 you said the second is client side, right? that means you are using server side functions / events on a client script, this won't work for sure, i recommend to learn from wiki and stop trying to create something without know anything. https://wiki.multitheftauto.com/wiki/Scripting_Introduction Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now