26.07.2011, 16:40
Hello, the command is:
It works fine, but problem is that it doesn't let the player type anything more then one letter, example if he/she does /whisper 0 test it wouldn't work but if they type /whisper 0 t it would work... What is happening?
pawn Код:
CMD:whisper(playerid, params[])
{
new Player, Text;
if (sscanf(params, "us[256]", Player, Text))
{
SendClientMessage(playerid, COLOR_GREY, "[Command Usage]: /w(hisper) [playerid or name] [text]");
}
else if (Player == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_GREY, "Invalid player name or id entered!");
}
else
{
if(IsPlayerConnected(playerid) && IsPlayerConnected(Player))
{
if(gPlayerLogged[playerid] == 1 && gPlayerLogged[Player] == 1)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(Player, X,Y,Z);
if(IsPlayerInRangeOfPoint(Player, 5.0, X,Y,Z))
{
new string[256], string2[256], playername[MAX_PLAYER_NAME], playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerName(Player, playername2, sizeof(playername2));
format(string, sizeof(string), " %s whispers something to %s", playername, playername2);
ProxDetector(15.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
format(string2, sizeof(string2), " [Whisper] %s says: %s", playername, Text);
SendClientMessage(playerid, COLOR_YELLOW, string2);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Player is too far away from you!");
}
}
}
}
return 1;
}