Cocodrilo Posted March 15, 2012 Posted March 15, 2012 I am trying add a command to restartscores which are in the account but that seems not to work local function resetScores (element) setAccountData(element, "kills", 0) setAccountData(element, "deaths", 0) setAccountData(element, "self", 0) setAccountData(element, "ratio", "-") local status = "" if isPedDead(element) then status = "Dead" end setAccountData(element, "status", status) end addCommandHandler("restartscore", resetScores) addEventHandler ( "onPlayerWasted", root, function( totalAmmo, killer, killerWeapon, bodypart, stealth ) if killer then local account = getPlayerAccount ( killer ) if killer ~= source then setAccountData( account,"totalkillsdeaths.Kills",tonumber">tonumber">tonumber">tonumber">tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) or 0 ) +1 ) setElementData( killer, "kills", tonumber">tonumber">tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) ) ) setElementData( killer, "ratio", tonumber">tonumber">tonumber(getElementData( killer, "kills" )/getElementData( source, "deaths") ) ) end else local accountSource = getPlayerAccount ( source ) setAccountData( accountSource,"totalkillsdeaths.Deaths",tonumber">tonumber( getAccountData(accountSource,"totalkillsdeaths.Deaths") or 0 ) +1 ) setElementData( source, "deaths", tonumber">tonumber">tonumber">tonumber">tonumber( getAccountData( accountSource,"totalkillsdeaths.Deaths" ) ) ) setElementData( source, "ratio", getElementData( killer, "kills" )/getElementData( source, "deaths") ) end end ) addEventHandler( "onPlayerLogin",root, function( thePreviousAccount, theCurrentAccount, autoLogin ) local account = getPlayerAccount ( source ) if not getAccountData( account,"totalkillsdeaths.Kills" ) and not getAccountData( account,"totalkillsdeaths.Deaths" ) then setAccountData( account,"totalkillsdeaths.Kills",0 ) setAccountData( account,"totalkillsdeaths.Deaths",0 ) end setElementData( source,"deaths",tonumber">tonumber">tonumber( getAccountData( account,"totalkillsdeaths.Deaths" ) or 0 ) ) setElementData( source,"kills",tonumber">tonumber">tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) or 0 ) ) setElementData( source, "ratio", getElementData( source, "kills" )/getElementData( source, "deaths") ) end ) addEventHandler( "onResourceStart",resourceRoot, function( ) outputDebugString( "add Total Kills to scoreboard Return: "..tostring">tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "kills",root,2, 0.100 ) ) ) outputDebugString( "add K/D R to scoreboard Return: "..tostring">tostring">tostring">tostring">tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "ratio",root,4, 0.100 ) ) ) outputDebugString( "add Total Deaths to scoreboard Return: "..tostring">tostring">tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "deaths",root,3, 0.100 ) ) ) end )
Castillo Posted March 15, 2012 Posted March 15, 2012 Your problem is that you're using setAccountData on a player element, not an account element. You must use getPlayerAccount to get the player account. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted March 15, 2012 Posted March 15, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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