Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2017
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <sourcemod>
  2.  
  3. #define GREEN 4
  4. #define LIGHTGREEN 3
  5. #define DARKGREEN 5
  6. #define DEFAULT 1
  7.  
  8. #define PREFIX "\x04[SurfTricks] \x01- \x03"
  9.  
  10. public OnPluginStart()
  11. {
  12.     RegConsoleCmd("specinfo", Command_SpecInfo);
  13. }
  14.  
  15. public Action:Command_SpecInfo(client, args)
  16. {
  17.     if (client == 0 || !IsClientInGame(client))
  18.     {
  19.         ReplyToCommand(client, "You must be in game to use this command");
  20.         return Plugin_Handled;
  21.     }
  22.    
  23.     if (!IsPlayerAlive(client))
  24.     {
  25.         PrintToChat(client, "%sDead people cannot have spectators !", PREFIX);
  26.         return Plugin_Handled;
  27.     }
  28.    
  29.     decl String:speclist[MAX_NAME_LENGTH*MAXPLAYERS+1];
  30.     speclist[0] = '\0';
  31.    
  32.     for (new i = 1; i <= MaxClients; i++)
  33.     {
  34.         if (i == client || !IsClientInGame(i) || IsPlayerAlive(i))
  35.             continue;
  36.        
  37.         Format(speclist, (sizeof(speclist)-strlen(speclist)), "%c%N%c, ", DARKGREEN, i, LIGHTGREEN);
  38.     }
  39.    
  40.     if (speclist[0] == '\0')
  41.     {
  42.         PrintToChat(client, "%sNobody is speccing you!", PREFIX);
  43.     }
  44.     else
  45.     {
  46.         new lastchar = strlen(speclist)-2;
  47.         if (speclist[lastchar] == ',')
  48.             speclist[lastchar] = '\0';
  49.        
  50.         PrintToChat(client, "%sYou are being specced by %s%c!", PREFIX, speclist, LIGHTGREEN);
  51.     }
  52.    
  53.     return Plugin_Handled;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement