CMD:whisper(playerid,params[]) {
new string[256];
new filestring[75];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
for(new i=0;i<MAX_PLAYERS;i++) {
if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 10) {
format(string, sizeof(string), "[WHISPER] %s[%d]: %s",pname,playerid,params);
SendClientMessage(i,red,string);
format(filestring, sizeof filestring, "[WHISPER] %s[%d]: %s", pname,playerid,params);}}
return 1;}
CMD:whisper(playerid,params[]) {
new string[256];
new filestring[75];
new pname[MAX_PLAYER_NAME];
new targetid;
GetPlayerName(playerid,pname,sizeof(pname));
for(new i=0;i<MAX_PLAYERS;i++) {
if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 10) {
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x,y,z);
if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))
format(string, sizeof(string), "[WHISPER] %s[%d]: %s",pname,playerid,params);
SendClientMessage(i,red,string);
format(filestring, sizeof filestring, "[WHISPER] %s[%d]: %s", pname,playerid,params);}}
return 1;}
Try that
PHP код:
|
CMD:w(playerid, params[]) return cmd_whisper(playerid, params);
CMD:whisper(playerid, params[])
{
new string[128], message[128], targetid;
if(sscanf(params, "us[128]", targetid, message)) return SendClientMessageEx(playerid, COLOR_GREY, "Usage: /w(hisper) [playerid] [message]");
else if(!IsPlayerConnectedEx(targetid)) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
else if(!IsPlayerInRangeOfPlayer(playerid, targetid) && PlayerInfo[playerid][pAdminLevel] < 2) return SendClientMessageEx(playerid, COLOR_GREY, "You must be near the specified player to use this command!");
else if(playerid == targetid) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot use this command on yourself!");
format(string, sizeof(string), "(ID %d) %s whispers to you: %s", playerid, GetPlayerNameEx(playerid), message);
SendClientMessageEx(targetid, COLOR_YELLOW, string);
format(string, sizeof(string), "You whispered to (ID %d) %s: %s", targetid, GetPlayerNameEx(targetid), message);
SendClientMessageEx(playerid, COLOR_YELLOW, string);
return 1;
CMD:setwdistance(playerid, params[])
{
if(sscanf(params, "f", distance)) return SendClientMessage(playerid, -1, "USAGE: /setwdistance [Float: distance]");
if(distance >= MAX_DISTANCE) return SendClientMessage(playerid, -1, "Distance too high!");
Distance[playerid] = distance;
new string[64];
format(string, sizeof(string), "Whisper distance set to %f.", distance);
SendClientMessage(playerid, -1, string);
return 1;
}
You'd have to save their setting using a variable. For example,
pawn Код:
|