Advertisement
Faisal_khan

Karan

Jun 25th, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.86 KB | None | 0 0
  1.  
  2. new ReadPM[MAX_PLAYERS];
  3. new ReadCMD[MAX_PLAYERS];
  4.  
  5. CMD:pm(playerid, params[])
  6. {
  7.     new string1[128], string2[128], string3[128], ID, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
  8.     if(sscanf(params, "us[128]", ID, string2))
  9.     {
  10.         SendClientMessage(playerid, 0xFF0000FF, "Usage: /pm <id> <message>");
  11.         return 1;
  12.     }
  13.     if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player not connected");
  14.     if(playerid == ID) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot pm yourself!");
  15.     {
  16.         GetPlayerName(playerid, Name1, sizeof(Name1));
  17.         GetPlayerName(ID, Name2, sizeof(Name2));
  18.         format(string1, sizeof(string1), "PM To %s(ID %d): %s", Name2, ID, string2);
  19.         SendClientMessage(playerid, 0xFF0000FF, string1);
  20.         format(string1, sizeof(string1), "PM From %s(ID %d): %s", Name1, playerid, string2);
  21.         SendClientMessage(ID, 0xFF0000FF, string1);
  22.         if(ReadPM[playerid] == 1)
  23.         {
  24.             format(string3, sizeof(string3), "[INFO]:PM FROM %s(%d) to %s(%d): %s", Name1, playerid, Name2, ID, string2);
  25.             SendMessageToAdmins(string3);
  26.         }
  27.     }
  28.     return 1;
  29. }
  30.  
  31. /*CMD:readpm(playerid, params[])
  32. {
  33.     if(IsPlayerAdmin(playerid))
  34.     {
  35.         new string;
  36.         if(sscanf(params, "i", string)) return SendClientMessage(playerid, -1, "Usage: /readpm <1/0>");
  37.         switch(string)
  38.         {
  39.             case 0:
  40.             {
  41.                 ReadPM[playerid] = 0;
  42.                 SendClientMessage(playerid, -1, "Read PM Command is OFF");
  43.             }
  44.             case 1:
  45.             {
  46.                 ReadPM[playerid] = 1;
  47.                 SendClientMessage(playerid, -1, "Read PM Command is ON");
  48.             }
  49.         }
  50.     }
  51.     return 1;
  52. }*/
  53.  
  54. CMD:readcmd(playerid, params[])
  55. {
  56.     if(IsPlayerAdmin(playerid))
  57.     {
  58.         new string;
  59.         if(sscanf(params, "i", string)) return SendClientMessage(playerid, -1, "Usage: /readcmd <1/0>");
  60.         switch(string)
  61.         {
  62.             case 0:
  63.             {
  64.                 ReadCMD[playerid] = 0;
  65.                 SendClientMessage(playerid, -1, "Read Command is OFF");
  66.             }
  67.             case 1:
  68.             {
  69.                 ReadCMD[playerid] = 1;
  70.                 SendClientMessage(playerid, -1, "Read Command is ON");
  71.             }
  72.         }
  73.     }
  74.     return 1;
  75. }
  76.  
  77. public OnPlayerCommandPerformed(playerid, cmdtext[], success)
  78. {
  79.     if(!success) SendClientMessage(playerid, -1, "Incorrect command, type /cmds to find out available commands");
  80.     if(success)
  81.     {
  82.         if(ReadCMD[playerid] == 1)
  83.         {
  84.             new string[128], name[MAX_PLAYER_NAME];
  85.             GetPlayerName(playerid, name, sizeof(name));
  86.             format(string, sizeof(string), "[INFO]:%s[%d] HAS USED [CMD]:%s", name, playerid, cmdtext);
  87.             SendMessageToAdmins(string);
  88.         }
  89.     }
  90.     return 1;
  91. }
  92.  
  93. stock SendMessageToAdmins(text[])
  94. {
  95.     for(new i = 0; i < MAX_PLAYERS; i++)
  96.     {
  97.         if(IsPlayerAdmin(i))
  98.         {
  99.             SendClientMessage(i, 0x00FFFFFF, text);
  100.         }
  101.     }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement