Guest User

iGetty's Support Script.

a guest
Aug 4th, 2012
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.56 KB | None | 0 0
  1. /*
  2.  
  3.     This script was created as somebody in the SA-MP community asked for it.
  4.     You can use this freely, but I'd be greatful if you would give me some
  5.     credit for it. The commands are as follows:
  6.     /ask [playerid/name] - This lets a person ask a question.
  7.     /answer [playerid/name] - This lets an Administrator answer a question. (Must be RCON).
  8.     /pm [playerid/name] [message] - This is so then two people can communicate with each
  9.     other, answering questions.
  10.    
  11.     Thank you for using this script,
  12.    
  13.     iGetty.
  14.    
  15. */
  16.  
  17.  
  18. #include <a_samp>
  19. #include <zcmd>
  20. #include <sscanf2>
  21.  
  22. forward SendAdminMessage(color, string[]);
  23. new Asked[MAX_PLAYERS];
  24.  
  25.  
  26. public OnPlayerConnect(playerid)
  27. {
  28.     Asked[playerid] = 0;
  29. }
  30.  
  31. public OnPlayerDisconnect(playerid, reason)
  32. {
  33.     Asked[playerid] = 0;
  34. }
  35.  
  36. command(pm, playerid, params[])
  37. {
  38.     new id, message[128], string[256];
  39.     if(sscanf(params, "us[128]", id, message)) return SendClientMessage(playerid, -1, "Server: /pm [playerid/name] [message]");
  40.     {
  41.         format(string, sizeof(string), "[PM From: %s] %s", pName(playerid), message);
  42.         SendClientMessage(id, -1, string);
  43.         format(string, sizeof(string), "[PM To: %s] %s", pName(id), message);
  44.         SendClientMessage(playerid, -1, string);
  45.     }
  46.     return 1;
  47. }
  48.  
  49. command(ask, playerid, params[])
  50. {
  51.     new message[128], string[256];
  52.     if(sscanf(params, "s[128]", message)) return SendClientMessage(playerid, -1, "Server: /ask [question]");
  53.     {
  54.         format(string, sizeof(string), "Ask: %s has asked a question. (%s)", pName(playerid), message);
  55.         SendAdminMessage(-1, string);
  56.         Asked[playerid] = 1;
  57.     }
  58.     return 1;
  59. }
  60.  
  61. command(answer, playerid, params[])
  62. {
  63.     if(IsPlayerAdmin(playerid))
  64.     {
  65.         new id, string[128];
  66.         if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "Server: /answer [playerid/name]");
  67.         {
  68.             if(Asked[id] == 1)
  69.             {
  70.                 format(string, sizeof(string), "Admin %s is now assisting you. Use \"/pm %d\" to talk to him.", pName(playerid), playerid);
  71.                 SendClientMessage(id, -1, string);
  72.                 Asked[id] = 0;
  73.             }
  74.             else return SendClientMessage(playerid, -1, "That player hasn't asked a question.");
  75.         }
  76.     }
  77.     else return SendClientMessage(playerid, -1, "You must be an Administrator to use this.");
  78.     return 1;
  79. }
  80.  
  81. public SendAdminMessage(color, string[])
  82. {
  83.     for(new i = 0; i < MAX_PLAYERS; i++)
  84.     {
  85.         if(IsPlayerAdmin(i))
  86.         {
  87.             SendClientMessage(i, -1, string);
  88.         }
  89.     }
  90.     return 1;
  91. }
  92.  
  93. stock pName(playerid)
  94. {
  95.     new Name[24];
  96.     GetPlayerName(playerid, Name, sizeof(Name));
  97.     return Name;
  98. }
Advertisement
Add Comment
Please, Sign In to add comment