Nelsonnn

Untitled

Nov 5th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. addEventHandler ( "onPlayerWasted", root,
  2.     function( totalAmmo, killer, killerWeapon, bodypart, stealth )
  3.         if killer then
  4.             local account = getPlayerAccount ( killer )
  5.             if killer ~= source then
  6.                 setAccountData( account,"murders_total",tonumber( getAccountData( account,"murders_total" ) or 0 ) +1 )
  7.                 setElementData( killer, "T/K", tonumber( getAccountData( account,"murders_total" ) ) )
  8.                 setElementData( killer, "K/D/R", tonumber(getElementData( killer, "T/K" )/getElementData( source, "T/D") ) )
  9.             end
  10.         else
  11.             local accountSource = getPlayerAccount ( source )
  12.             setAccountData( accountSource,"deaths_total",tonumber( getAccountData(accountSource,"deaths_total") or 0 ) +1 )
  13.             setElementData( source, "T/D", tonumber( getAccountData( accountSource,"deaths_total" ) ) )
  14.             setElementData( source, "K/D/R", getElementData( killer, "T/K" )/getElementData( source, "T/D") )
  15.         end
  16.     end
  17. )      
  18.  
  19. addEventHandler( "onPlayerLogin",root,
  20.     function( thePreviousAccount, theCurrentAccount, autoLogin )
  21.         local account = getPlayerAccount ( source )
  22.         if not getAccountData( account,"murders_total" ) and not getAccountData( account,"deaths_total" ) then
  23.             setAccountData( account,"murders_total",0 )
  24.             setAccountData( account,"deaths_total",0 )
  25.         end
  26.         setElementData( source,"T/D",tonumber( getAccountData( account,"deaths_total" ) or 0 ) )
  27.         setElementData( source,"T/K",tonumber( getAccountData( account,"murders_total" ) or 0 ) )
  28.         setElementData( source, "K/D/R", getElementData( source, "T/K" )/getElementData( source, "T/D") )
  29.     end
  30.  )
  31.  
  32. addEventHandler( "onResourceStart",resourceRoot,
  33.     function( )
  34.         outputDebugString( "add Total Kills to scoreboard Return: "..tostring(
  35.             call( getResourceFromName("scoreboard"), "scoreboardColumns", "T/K",root,2, 0.032 )
  36.         ) )
  37.        
  38.         outputDebugString( "add K/D R to scoreboard Return: "..tostring(
  39.             call( getResourceFromName("scoreboard"), "scoreboardColumns", "K/D/R",root,4, 0.047 )
  40.         ) )
  41.        
  42.         outputDebugString( "add Total Deaths to scoreboard Return: "..tostring(
  43.             call( getResourceFromName("scoreboard"), "scoreboardColumns", "T/D",root,3, 0.032 )
  44.         ) )
  45.     end
  46. )
Advertisement
Add Comment
Please, Sign In to add comment