sscanf question , how to do this ?
#1

pawn Код:
new giveplayer[20];
if (!sscanf(params, "i",giveplayer )||!sscanf(params, "s[20]",giveplayer))
{
    new para1;
    para1 = ReturnUser(giveplayer);
    //bla bla rest of the code
}
It works ok but only for the name of the player , if i give the playerid it doesn't work (invalid playerid) .
Reply
#2

Uhm, what do you want to do with this? Post te full command.
Reply
#3

pawn Код:
COMMAND:uninvite(playerid, params[])
{
    if(PlayerInfo[playerid][Leader] > 0)
    {
        new giveplayer[20];
        if (!sscanf(params, "i",giveplayer )||!sscanf(params, "s[20]",giveplayer))
        {
            new para1;
            para1 = ReturnUser(giveplayer);
            if(para1 != INVALID_PLAYER_ID)
            {
                if (PlayerInfo[para1][Loggedin] != 0)
                {
                    if (PlayerInfo[para1][Faction] == PlayerInfo[playerid][Leader])
                    {
                        new sendername[MAX_PLAYER_NAME];
                        new string[56];
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "%s Has uninvited you from his faction",sendername);
                        SendClientMessage(para1,culoare,string);
                        PlayerInfo[para1][Faction] = 0;
                        SetPlayerSkin(para1,25);
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, culoare, "ERROR : That player is not in your faction");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, culoare, "ERROR: Player Not logged in");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, culoare, "ERROR : Invalid player");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, culoare, "Use : /invite [playerid]");
            return 1;
        }
    }
    return 1;
}
Reply
#4

Try this:

pawn Код:
COMMAND:uninvite(playerid, params[])
{
    if(PlayerInfo[playerid][Leader] > 0)
    {
        new player;
        if (sscanf(params, "u",player))
        {
            new player;
            if(player != INVALID_PLAYER_ID)
            {
                if (PlayerInfo[player][Loggedin] != 0)
                {
                    if(PlayerInfo[player][Faction] == PlayerInfo[playerid][Leader])
                    {
                        new string[56];
                        new sendername[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "%s Has uninvited you from his faction",sendername);
                        SendClientMessage(player,culoare,string);
                        PlayerInfo[player][Faction] = 0;
                        SetPlayerSkin(player,25);
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, culoare, "ERROR : That player is not in your faction");
                    }
                }
                else
                {
                    SendClientMessage(playerid, culoare, "ERROR: Player Not logged in");
                }
            }
        }
        else
        {
            SendClientMessage(playerid, culoare, "Use : /invite [playerid]");
        }
    }
    return 1;
}
Reply
#5

Yep , that works , thanx .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)