Memory Posted October 20, 2012 Share Posted October 20, 2012 Hi, Can you are help, make this function for all players, who finished, get points? function raceWin( rank ) local acc = getPlayerAccount( source ) local ptzData = getAccountData( acc, "Points" ) if rank < 4 then if ptzData then setAccountData( acc, "Points", ptzData + pointswin ) else setAccountData( acc, "Points", pointswin ) end outputChatBox("[Points]#FFFFFF " .. getPlayerName(source).. " #00FF00 receive 1 point", getRootElement(), 255, 255, 255, true ) end end addEventHandler("onPlayerFinish", getRootElement(), raceWin) How can make points for 2 and 3 places? function check() local alive = getAlivePlayers() local player = alive[1] local acc = getPlayerAccount( player ) local ptzData = getAccountData( acc, "Points" ) if (#alive == 1) then if ptzData then setAccountData( acc, "Points", ptzData + pointsToWin ) else setAccountData( acc, "Points", pointsToWin ) end outputChatBox("[Points]#FFFFFF " .. getPlayerName(player).. " #00FF00 receive 10 points", getRootElement(), 255, 255, 255, true ) end end addEventHandler("onPlayerWasted",getRootElement(),check) Link to comment
Araa Posted October 20, 2012 Share Posted October 20, 2012 Can you are help, make this function for all players, who finished, get points? function raceWin( rank ) local acc = getPlayerAccount( source ) local ptzData = getAccountData( acc, "Points" ) if ptzData then setAccountData( acc, "Points", ptzData + pointswin ) else setAccountData( acc, "Points", pointswin ) end outputChatBox("[Points]#FFFFFF " .. getPlayerName(source).. " #00FF00 receive 1 point", getRootElement(), 255, 255, 255, true ) end addEventHandler("onPlayerFinish", getRootElement(), raceWin) How can make points for 2 and 3 places? function check() local alive = getAlivePlayers() local player = alive[1] local acc = getPlayerAccount( player ) local ptzData = getAccountData( acc, "Points" ) if (#alive <= 3) then if ptzData then setAccountData( acc, "Points", ptzData + pointsToWin ) else setAccountData( acc, "Points", pointsToWin ) end outputChatBox("[Points]#FFFFFF " .. getPlayerName(player).. " #00FF00 receive 10 points", getRootElement(), 255, 255, 255, true ) end end addEventHandler("onPlayerWasted",getRootElement(),check) 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