Pablosino Posted July 28, 2012 Posted July 28, 2012 (edited) Hi all i tree make new script for save score but don't work, Thx for all help This is my lua addEventHandler ( "onPlayerLogin", root, function( thePreviousAccount, theCurrentAccount, autoLogin ) setAccountData( account,"score",tonumber( getAccountData( account,"score" ) ) ) setElementData( Player, "score", tonumber( getAccountData( account,"score" ) ) ) source, "score") ) ) end else local accountSource = getPlayerAccount ( source ) setElementData( source, "score", tonumber( getAccountData( accountSource,"score" ) ) ) end ) addEventHandler( "onPlayerQuit",root, local account = getPlayerAccount ( source ) if not getAccountData( account,"score" ) and not getAccountData( account,"score" ) end setElementData( source,"score",tonumber( getAccountData( account,"score" ) ) ) source, "score") ) end ) addEventHandler( "onResourceStart",resourceRoot, function( ) outputDebugString( "add score to scoreboard Return: "..tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "score",root,2, 0.032 ) ) ) end ) Edited July 28, 2012 by Guest
Castillo Posted July 28, 2012 Posted July 28, 2012 That code has many errors. 1: "playeraccount" is not defined anywhere @ "onPlayerQuit". 2: At @ "setAccountData" you are using variable "kills", but your variable is "score". 3: What is this for: "setPlayerScoreboardForced"?
Pablosino Posted July 28, 2012 Author Posted July 28, 2012 oh sorry this is me old lua and don't work too now i add me actualy lua
Castillo Posted July 28, 2012 Posted July 28, 2012 Still doesn't really make much sense, I recommend to start from the basics.
Pablosino Posted July 31, 2012 Author Posted July 31, 2012 ok i tree make new script but still doesn't work i still write wiki but nothing i make one week score save scriptt but still dosen't work please help .. i have this error... !! savescore/server.lua:18: attempt to call global 'getPlayerScore' (a nil value) !! lua node = xmlLoadFile ("player.xml") function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount(source))) then local accountData = getAccountData (theCurrentAccount, "score") if (accountData) then local playerScore = getAccountData(theCurrentAccount, "score") setPlayerScore(source, playerScore) end end end addEventHandler("onPlayerLogin", getRootElement(), playerLogin) function onQuit() if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then setAccountData(account,"score", tostring(getPlayerScore(source))) end end end addEventHandler("onPlayerQuit", getRootElement(), onQuit)
Castillo Posted July 31, 2012 Posted July 31, 2012 That's because there's no such function: getPlayerScore setPlayerScore
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