Jump to content

kills/deaths for destruction derby/race


Fury

Recommended Posts

hi, how can i work this with race mode?

function addTotalKill(totalAmmo, killer, killerWeapon, bodypart, stealth) 
local account = getPlayerAccount (killer) 
if (account) and (killer) then 
setAccountData(account,"kills",getAccountData(account,"kills")+1) 
setElementData(killer, "kills", getAccountData(account,"kills")) 
end 
end 
addEventHandler ("onPlayerWasted", getRootElement(), addTotalKill) 
function addTotalDeath(totalAmmo, killer, killerWeapon, bodypart, stealth) 
local account = getPlayerAccount (source) 
if (account) then 
setAccountData(account,"deaths",getAccountData(account,"deaths")+1) 
setElementData(source, "deaths", getAccountData(account,"deaths")) 
end 
end 
addEventHandler ("onPlayerWasted", getRootElement(), addTotalKill) 
function checkAccountKillsDeaths(thePreviousAccount, theCurrentAccount, autoLogin) 
if (getAccountData(theCurrentAccount,"kills") == nil) and (getAccountData(theCurrentAccount,"deaths") == nil) then 
setAccountData(theCurrentAccount,"kills",0) 
setAccountData(theCurrentAccount,"deaths",0) 
end 
end 
addEventHandler("onPlayerLogin",getRootElement(),checkAccountKillsDeaths) 
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), 
function() 
call(getResourceFromName("scoreboard"), "addScoreboardColumn", "kills",getRootElement(),1) 
call(getResourceFromName("scoreboard"), "addScoreboardColumn", "deaths",getRootElement(),2) 
end) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...