13.05.2012, 04:17
A CPU spike would definitely happen if you are looping through all the players and doing a lot of slow stuff inside those loops. I used to get carried away w/ foreach statements and getting vehicle id's etc. Now each player gets a variable that maintains their state (onfoot, dead, driving, etc) and that variable changes in onplayerstate only. That way, instead of using GetPlayerVehicleID inside loops, I check pstate[playerid] instead. Thing like that could streamline your player-checks a bit. I don't know if thats your problem per se, but if it is, this might help.