Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(strcmp(cmd, "/whisper", true) == 0 || strcmp(cmd, "/w", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- if(gPlayerLogged[playerid] == 0)
- {
- SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !");
- return 1;
- }
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/w)isper [playerid/PartOfName] [whisper text]");
- return 1;
- }
- giveplayerid = ReturnUser(tmp);
- if(IsPlayerConnected(giveplayerid))
- {
- if(giveplayerid != INVALID_PLAYER_ID)
- {
- if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, " You can't whisper to yourself !"); return 1; }
- if(PlayerInfo[playerid][pAdmin] < 1)
- {
- if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 6 || GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING || PlayerInfo[playerid][pMask] == 1)
- {
- SendClientMessage(playerid, COLOR_GREY, " That player is not in range !");
- return 1;
- }
- }
- if(HidePM[giveplayerid] > 0)
- {
- SendClientMessage(playerid, COLOR_GREY, " That player is blocking whispers !");
- return 1;
- }
- GetPlayerName(playerid, sendername, sizeof(sendername));
- GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
- new length = strlen(cmdtext);
- while ((idx < length) && (cmdtext[idx] <= ' '))
- {
- idx++;
- }
- new offset = idx;
- new result[96];
- while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
- {
- result[idx - offset] = cmdtext[idx];
- idx++;
- }
- result[idx - offset] = EOS;
- if(!strlen(result))
- {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/w)isper [playerid/PartOfName] [whisper text]");
- return 1;
- }
- format(string, sizeof(string), "Whisper to %s(ID: %d): %s", giveplayer, giveplayerid, (result));
- SendClientMessage(playerid, COLOR_YELLOW, string);
- if(PlayerInfo[playerid][pAdmin] == 1)
- {
- if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 6) format(string, sizeof(string), "A Secret Admin whispers: %s", (result));
- else format(string, sizeof(string), "%s(ID: %d) whispers: %s", sendername, playerid, (result));
- SendClientMessage(giveplayerid, COLOR_YELLOW, string);
- }
- if(PlayerInfo[playerid][pStealthed] == 0)
- {
- format(string, sizeof(string), "%s(ID: %d) whispers: %s", sendername, playerid, (result));
- SendClientMessage(giveplayerid, COLOR_YELLOW, string);
- }
- else if(PlayerInfo[playerid][pStealthed] == 1)
- {
- format(string, sizeof(string), "A silent admin whispers: %s", (result));
- SendClientMessage(giveplayerid, COLOR_YELLOW, string);
- }
- if(IsGod[giveplayerid] || (PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin]))
- {
- if(PlayerInfo[playerid][pStealthed] == 1)
- {
- format(string, sizeof(string), "%s(ID: %d) whispers: %s", sendername, playerid, (result));
- SendClientMessage(giveplayerid, COLOR_YELLOW, string);
- }
- }
- return 1;
- }
- }
- else
- {
- format(string, sizeof(string), " %d is not an active player !", giveplayerid);
- SendClientMessage(playerid, COLOR_GREY, string);
- }
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment