Jump to content

Get points


Memory

Recommended Posts

Hi,

have problem with points system, point in DM, DD maps got second player, not winner.

Code

function check() 
local alive = getAlivePlayers() 
local acc = getPlayerAccount( source ) 
local ptzData = getAccountData( acc, "Points" ) 
   if (#alive == 1) then 
    local player = alive[1] 
    local playerCount = getPlayerCount() 
    local pointsToWin = playerCount *10 
        if ptzData then 
        setAccountData( acc, "Points", ptzData + pointsToWin ) 
        else 
        setAccountData( acc, "Points", pointsToWin ) 
        end 
    outputChatBox("#FF9900[Points]#FFFFFF " .. getPlayerName(player).. " #00FF00 receive "..pointsToWin, getRootElement(), 255, 255, 255, true ) 
   end 
end 
addEventHandler("onPlayerWasted",getRootElement(),check) 

For money work, money got winner

function check() 
   local alive = getAlivePlayers() 
   if (#alive == 1) then 
      local player = alive[1] 
       givePlayerMoney(player,300) 
       outputChatBox("#FFFFFF"..getPlayerName(player).." #00FF00has earned $300 for being the last player alive",getRootElement(),255,255,255, true) 
   end 
end 
addEventHandler("onPlayerWasted",getRootElement(),check) 
  

Link to comment

Thanks, work

function check() 
local alive = getAlivePlayers() 
local player = alive[1] 
local acc = getPlayerAccount( player ) 
local ptzData = getAccountData( acc, "Points" ) 
   if (#alive == 1) then 
    local playerCount = getPlayerCount() 
    local pointsToWin = playerCount *10 
        if ptzData then 
        setAccountData( acc, "Points", ptzData + pointsToWin ) 
        else 
        setAccountData( acc, "Points", pointsToWin ) 
        end 
    outputChatBox("#FF9900[Points]#FFFFFF " .. getPlayerName(player).. " #00FF00 receive "..pointsToWin, getRootElement(), 255, 255, 255, true ) 
   end 
end 
addEventHandler("onPlayerWasted",getRootElement(),check) 

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...