GrubaS Posted February 1, 2017 Share Posted February 1, 2017 Hello, i have problem with getAlivePlayers because if someone come join the server it's not adding the point. it's code. function autopts() local pTeam = getPlayerTeam(source) aPs = #getAlivePlayersInTeam(pTeam) or 0 if not (#getAlivePlayers() == 0) then if not ( getTeamName(getPlayerTeam(source)) == "Spectators" ) then if aPs == 0 then if pTeam == homeTeam then visitPoints = visitPoints + 1 outputChatBox(hexColorVisit .. visitName .."#FFFFFF won the round! "..hexColorVisit..visitPoints.."#ffffff : "..hexColorHome..homePoints, root, 255,255,255, true) elseif pTeam == visitTeam then homePoints = homePoints + 1 outputChatBox(hexColorHome .. homeName .."#FFFFFF won the round! "..hexColorHome..homePoints.."#ffffff : "..hexColorVisit..visitPoints, root,255,255,255, true) end triggerClientEvent("sync:points", root, homePoints, visitPoints) setTimer(playSoundFrontEnd, 1000, 1,root, 16 ) if not matchEnded then setTimer(nextMap, 2000, 1, playedRounds or nil) outputDebugString("redo_Map(CWS)", 3) else outputDebugString("didn't_redo_Map(CWS)", 1) end end end end end addEvent("onPlayerRaceWasted",true) addEventHandler("onPlayerRaceWasted",root,autopts) function getAlivePlayersInTeam(theTeam) local theTable = { } local players = getPlayersInTeam(theTeam) for i,v in pairs(players) do if not isPedDead(v) then theTable[#theTable+1]=v end end return theTable end Link to comment
GrubaS Posted February 1, 2017 Author Share Posted February 1, 2017 Already i fixed it, it was cuz of state "Waiting" 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