Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //----------------------------------[Whisper]-----------------------------------------------
- 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_GRAD2, "USAGE: (/w)hisper [playerid/PartOfName] [whisper text]");
- return 1;
- }
- giveplayerid = ReturnUser(tmp);
- if (IsPlayerConnected(giveplayerid))
- {
- if(giveplayerid != INVALID_PLAYER_ID)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(giveplayerid,x,y,z);
- if(PlayerToPoint(5, playerid, x, y, z))
- {
- GetPlayerName(playerid, sendername, sizeof(sendername));
- GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
- if(giveplayerid == playerid)
- {
- format(string, sizeof(string), "* %s mutters something to himself.", sendername);
- ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else
- {
- format(string, sizeof(string), "* %s whispers something to %s", sendername, giveplayer);
- ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- new length = strlen(cmdtext);
- while ((idx < length) && (cmdtext[idx] <= ' '))
- {
- idx++;
- }
- new offset = idx;
- new result[64];
- while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
- {
- result[idx - offset] = cmdtext[idx];
- idx++;
- }
- result[idx - offset] = EOS;
- if(!strlen(result))
- {
- SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/w)isper [playerid/PartOfName] [whisper text]");
- return 1;
- }
- format(string, sizeof(string), "%s whispers: %s", sendername, (result));
- SendClientMessage(giveplayerid, COLOR_YELLOW, string);
- format(string, sizeof(string), "%s whispers: %s", sendername, (result));
- SendClientMessage(playerid, COLOR_YELLOW, string);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, " Player is not near you !");
- return 1;
- }
- }
- }
- else
- {
- format(string, sizeof(string), " %d is not an active player.", giveplayerid);
- SendClientMessage(playerid, COLOR_GRAD1, string);
- }
- }
- return 1;
- }
- //----------------------------------[Car Whisper]-----------------------------------------------
- if(strcmp(cmd, "/cw", true) == 0 || strcmp(cmd, "/carwhisper", true) == 0 || strcmp(cmd, "/cwhisper", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- if(gPlayerLogged[playerid] == 0)
- {
- SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet!");
- return 1;
- }
- if(!IsPlayerInAnyVehicle(playerid))
- {
- SendClientMessage(playerid, COLOR_GREY, " You are not in a car!");
- return 1;
- }
- GetPlayerName(playerid, sendername, sizeof(sendername));
- new length = strlen(cmdtext);
- while ((idx < length) && (cmdtext[idx] <= ' '))
- {
- idx++;
- }
- new offset = idx;
- new result[64];
- while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
- {
- result[idx - offset] = cmdtext[idx];
- idx++;
- }
- result[idx - offset] = EOS;
- if(!strlen(result))
- {
- SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/cw)hisper [text]");
- return 1;
- }
- new vehicle = GetPlayerVehicleID(playerid);
- for( new i = 0; i != MAX_PLAYERS; i++ )
- {
- if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
- {
- if(GetPlayerVehicleID(i) == vehicle)
- {
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
- {
- format(string, sizeof(string), "Driver %s Says: %s", sendername, result);
- SendClientMessage(i, 0xD7DFF3AA, string);
- }
- else
- {
- format(string, sizeof(string), "Passenger %s Says: %s", sendername, result);
- SendClientMessage(i, 0xD7DFF3AA, string);
- }
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement