Nas Posted July 27, 2013 Share Posted July 27, 2013 hi can anyone help me i have script save [ kills, deaths, Ratio] my problim kills is work and good deaths no work if kill with weapons if kill me with admin panel or [F1 Freeroam] he let me +1 deaths sorry for my english code addEventHandler ( "onPlayerWasted", root, function( totalAmmo, killer, killerWeapon, bodypart, stealth ) if killer then local account = getPlayerAccount ( killer ) if killer ~= source then setAccountData( account,"kills",tonumber( getAccountData( account,"kills" ) or 0 ) +1 ) setElementData( killer, "kills", tonumber( getAccountData( account,"kills" ) ) ) setElementData( killer, "Ratio", tonumber(getElementData( killer, "kills" )/getElementData( source, "Deaths") ) ) end else local accountSource = getPlayerAccount ( source ) setAccountData( accountSource,"Deaths",tonumber( getAccountData(accountSource,"Deaths") or 0 ) +1 ) setElementData( source, "Deaths", tonumber( getAccountData( accountSource,"Deaths" ) ) ) setElementData( source, "Ratio", tonumber(getElementData( killer, "kills" )/getElementData( source, "Deaths") ) ) end end ) Link to comment
Castillo Posted July 27, 2013 Share Posted July 27, 2013 addEventHandler ( "onPlayerWasted", root, function ( totalAmmo, killer, killerWeapon, bodypart, stealth ) if ( killer ) then local account = getPlayerAccount ( killer ) if ( killer ~= source ) then setAccountData ( account,"kills",tonumber ( getAccountData ( account,"kills" ) or 0 ) +1 ) setElementData ( killer, "kills", tonumber ( getAccountData ( account,"kills" ) ) ) setElementData ( killer, "Ratio", tonumber ( getElementData ( killer, "kills" ) / getElementData ( source, "Deaths" ) ) ) end end local accountSource = getPlayerAccount ( source ) setAccountData ( accountSource, "Deaths",tonumber ( getAccountData ( accountSource, "Deaths" ) or 0 ) +1 ) setElementData ( source, "Deaths", tonumber ( getAccountData ( accountSource, "Deaths" ) ) ) setElementData ( source, "Ratio", tonumber ( getElementData ( killer, "kills" ) / getElementData ( source, "Deaths" ) ) ) end ) Try that. Link to comment
Nas Posted July 28, 2013 Author Share Posted July 28, 2013 Thanks Solidsnake14 he work now can you say to me where a problem ? Link to comment
Castillo Posted July 28, 2013 Share Posted July 28, 2013 Well, you were checking if there was a killer, if there was, don't increment deaths. That's why it worked with the admin panel and freeroam, because there was no killer. 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