SA-MP Forums Archive
weird command? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: weird command? (/showthread.php?tid=271950)



weird command? - Dr - 26.07.2011

Hello, the command is:
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;
}
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?


Re: weird command? - antonio112 - 26.07.2011

pawn Код:
CMD:whisper(playerid, params[])
{
    new Player, Text[128];
    if (sscanf(params, "us[128]", 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;
}



Re: weird command? - Dr - 26.07.2011

Ahh... Thank you