Advertisement
JuSTaR

[CS:GO] ShopAPI Usage Example

Jun 6th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.62 KB | None | 0 0
  1. #include <ShopAPI>
  2.  
  3. public OnPluginStart()
  4. {
  5.     RegConsoleCmd("RandomPoints", GivePointToRandomGuy);
  6. }
  7.  
  8. public Action GivePointToRandomGuy(int client, int args)
  9. {
  10.     int RandomGuy = GetRandomPlayer();
  11.     int Amount = 99999;
  12.  
  13.     Native_GivePoints(RandomGuy, Amount);
  14.  
  15.     PrintToChatAll("%N has just got %d Points Randomly!", RandomGuy, Amount);
  16.  
  17.     return Plugin_Handled;
  18. }
  19.  
  20. public int GetRandomPlayer()
  21. {
  22.     new clients[MaxClients+1], clientCount;
  23.     for (new i = 1; i <= MaxClients; i++)
  24.         if (IsClientInGame(i))
  25.             clients[clientCount++] = i;
  26.     return (clientCount == 0) ? -1 : clients[GetRandomInt(0, clientCount-1)];
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement