Guest User

Untitled

a guest
Jun 20th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.41 KB | None | 0 0
  1.     if(strcmp(cmd, "/whisper", true) == 0 || strcmp(cmd, "/w", true) == 0)
  2.     {
  3.         if(IsPlayerConnected(playerid))
  4.         {
  5.             if(gPlayerLogged[playerid] == 0)
  6.             {
  7.                 SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
  8.                 return 1;
  9.             }
  10.             tmp = strtok(cmdtext, idx);
  11.             if(!strlen(tmp))
  12.             {
  13.                 SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/w)isper [playerid/PartOfName] [whisper text]");
  14.                 return 1;
  15.             }
  16.             giveplayerid = ReturnUser(tmp);
  17.             if(IsPlayerConnected(giveplayerid))
  18.             {
  19.                 if(giveplayerid != INVALID_PLAYER_ID)
  20.                 {
  21.                     if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "   You can't whisper to yourself !"); return 1; }
  22.                     if(PlayerInfo[playerid][pAdmin] < 1)
  23.                     {
  24.                         if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 6 || GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING || PlayerInfo[playerid][pMask] == 1)
  25.                         {
  26.                             SendClientMessage(playerid, COLOR_GREY, "   That player is not in range !");
  27.                             return 1;
  28.                         }
  29.                     }
  30.                     if(HidePM[giveplayerid] > 0)
  31.                     {
  32.                         SendClientMessage(playerid, COLOR_GREY, "   That player is blocking whispers !");
  33.                         return 1;
  34.                     }
  35.                     GetPlayerName(playerid, sendername, sizeof(sendername));
  36.                     GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  37.                     new length = strlen(cmdtext);
  38.                     while ((idx < length) && (cmdtext[idx] <= ' '))
  39.                     {
  40.                         idx++;
  41.                     }
  42.                     new offset = idx;
  43.                     new result[96];
  44.                     while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  45.                     {
  46.                         result[idx - offset] = cmdtext[idx];
  47.                         idx++;
  48.                     }
  49.                     result[idx - offset] = EOS;
  50.                     if(!strlen(result))
  51.                     {
  52.                         SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/w)isper [playerid/PartOfName] [whisper text]");
  53.                         return 1;
  54.                     }
  55.                     format(string, sizeof(string), "Whisper to %s(ID: %d): %s", giveplayer, giveplayerid, (result));
  56.                     SendClientMessage(playerid,  COLOR_YELLOW, string);
  57.                     if(PlayerInfo[playerid][pAdmin] == 1)
  58.                     {
  59.                         if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 6) format(string, sizeof(string), "A Secret Admin whispers: %s", (result));
  60.                         else format(string, sizeof(string), "%s(ID: %d) whispers: %s", sendername, playerid, (result));
  61.                         SendClientMessage(giveplayerid, COLOR_YELLOW, string);
  62.                     }
  63.                     if(PlayerInfo[playerid][pStealthed] == 0)
  64.                     {
  65.                         format(string, sizeof(string), "%s(ID: %d) whispers: %s", sendername, playerid, (result));
  66.                         SendClientMessage(giveplayerid, COLOR_YELLOW, string);
  67.                     }
  68.                     else if(PlayerInfo[playerid][pStealthed] == 1)
  69.                     {
  70.                         format(string, sizeof(string), "A silent admin whispers: %s", (result));
  71.                         SendClientMessage(giveplayerid, COLOR_YELLOW, string);
  72.                     }
  73.                     if(IsGod[giveplayerid] || (PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin]))
  74.                     {
  75.                         if(PlayerInfo[playerid][pStealthed] == 1)
  76.                         {
  77.                             format(string, sizeof(string), "%s(ID: %d) whispers: %s", sendername, playerid, (result));
  78.                             SendClientMessage(giveplayerid, COLOR_YELLOW, string);
  79.                         }
  80.                     }
  81.                     return 1;
  82.                 }
  83.             }
  84.             else
  85.             {
  86.                     format(string, sizeof(string), "   %d is not an active player !", giveplayerid);
  87.                     SendClientMessage(playerid, COLOR_GREY, string);
  88.             }
  89.         }
  90.         return 1;
  91.     }
Add Comment
Please, Sign In to add comment