BorderLine Posted August 29, 2012 Share Posted August 29, 2012 hi everyone.. well i found this on comunity, but is bug the bug is, when im do /kill, my player dead, and the account give one more to scoreboard but when some player killme, dont giveme one to death score. I dont know if im explian. here is the code 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( getAccountData( account,"totalkillsdeaths.Kills" ) or 0 ) +1 ) setElementData( killer, "Kills", tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) ) ) end else local accountSource = getPlayerAccount ( source ) setAccountData( accountSource,"totalkillsdeaths.Deaths",tonumber( getAccountData(accountSource,"totalkillsdeaths.Deaths") or 0 ) +1 ) setElementData( source, "Deaths", tonumber( getAccountData( accountSource,"totalkillsdeaths.Deaths" ) ) ) end end ) if someone can found the error. Link to comment
Castillo Posted August 29, 2012 Share Posted August 29, 2012 That's because you are checking if there's a "killer", and that's why it works when you do /kill but not when someone kills you. 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 ( getAccountData ( account, "totalkillsdeaths.Kills" ) or 0 ) +1 ) setElementData ( killer, "Kills", tonumber ( getAccountData ( account, "totalkillsdeaths.Kills" ) ) ) end end local accountSource = getPlayerAccount ( source ) setAccountData ( accountSource, "totalkillsdeaths.Deaths", tonumber ( getAccountData ( accountSource, "totalkillsdeaths.Deaths" ) or 0 ) +1 ) setElementData ( source, "Deaths", tonumber ( getAccountData ( accountSource, "totalkillsdeaths.Deaths" ) ) ) end ) Link to comment
BorderLine Posted August 29, 2012 Author Share Posted August 29, 2012 really.. ididnt see that.. Its working.. thanks again solid 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