Advertisement
supertimor

Untitled

Jan 30th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. stock int GetAllAlivePlayersServerCount()
  2. {
  3. int iCount, i; iCount = 0;
  4.  
  5. for( i = 1; i <= MaxClients; i++ )
  6. if( IsClientInGame(i) && IsPlayerAlive(i))
  7. iCount++;
  8.  
  9. return iCount;
  10. }
  11. stock bool IsValidClientAdi(int client)
  12. {
  13. if (client > 0 && client <= MAXPLAYERS && IsClientConnected(client))
  14. return true;
  15. return false;
  16. }
  17. stock int GetAllPlayersServerCount()
  18. {
  19. int iCount, i; iCount = 0;
  20.  
  21. for( i = 1; i <= MaxClients; i++ )
  22. if( IsClientInGame(i))
  23. iCount++;
  24.  
  25. return iCount;
  26. }
  27.  
  28. stock ClearTimer(&Handle:timer)
  29. {
  30. if (timer != INVALID_HANDLE)
  31. {
  32. KillTimer(timer);
  33. timer = INVALID_HANDLE;
  34. }
  35. }
  36.  
  37. stock int GetRandomPlayer(int team) {
  38.  
  39. int clients[MAXPLAYERS+1];
  40. int clientCount;
  41. for (int i = 1; i <= MaxClients; i++)
  42. if (IsClientInGame(i) && (GetClientTeam(i) == team))
  43. clients[clientCount++] = i;
  44. return (clientCount == 0) ? -1 : clients[GetRandomInt(0, clientCount-1)];
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement