Possibly an sscanf issue?
#1

Hi.

I've been struggling with this bug for like an hour, it wasted time. I have no clue what to do in it..
When I do /setplace 0, it sets it to place 0, cool, it works.
But if I did /setplace 1, nothing happens, not even a message appears.

Variables:
pawn Код:
new DefautlPlace = 0;
new ServerPlace;
pawn Код:
CMD:setplace(playerid, params[])
{
    new placeid, string[128];
    if(IsPlayerAdmin(playerid)|| PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(sscanf(params, "u", placeid)) return SendClientMessage(playerid, GREY, "Usage: /setplace [id] | 0: Area 51 | 1: San Fierro | more soon ");
        //if(placeid == ServerPlace) return SendClientMessage(playerid, RED, "This is the current place!");

        if(placeid != ServerPlace)
        {
            switch(placeid)
            {
                case 0:
                {
                    TextDrawHideForAll(Textdraw1);
                    format(string,sizeof(string),"Admin "COL_PINK"%s (%d)"COL_WHITE" has set playing place to "COL_PINK"0 (Area 51)", GetName(playerid), playerid);
                    SendClientMessageToAll(WHITE, string);
                    TextDrawSetString(Textdraw1, "PLACE: ~r~Area 51");
                    TextDrawShowForAll(Textdraw1);
                    ServerPlace = 0;
                    DefaultPlace = -1;
                    for(new i = 0; i < MAX_PLAYERS; i++)
                    {
                        SpawnPlayer(i);
                    }
                }
                case 1:
                {
                    TextDrawHideForAll(Textdraw1);
                    format(string,sizeof(string),"Admin "COL_PINK"%s (%d)"COL_WHITE" has set playing place to "COL_PINK"1 (San Fierro)", GetName(playerid), playerid);
                    SendClientMessageToAll(WHITE, string);
                    TextDrawSetString(Textdraw1, "PLACE: ~r~San Fierro");
                    TextDrawShowForAll(Textdraw1);
                    ServerPlace = 1;
                    DefaultPlace = -1;
                    for(new i = 0; i < MAX_PLAYERS; i++)
                    {
                        SpawnPlayer(i);
                    }
                }
            }
        }
    }
    else
    {
        SendClientMessage(playerid, RED, "You're not an admin");
    }
    return 1;
}
Note; I've used if statements for placeid 0 and 1, same result.
Reply


Messages In This Thread
Possibly an sscanf issue? - by MythicalMarauder - 10.12.2014, 08:26
Re: Possibly an sscanf issue? - by PinkFloydLover - 10.12.2014, 08:29
Re: Possibly an sscanf issue? - by Divergent - 10.12.2014, 08:31
Re: Possibly an sscanf issue? - by MythicalMarauder - 10.12.2014, 08:41

Forum Jump:


Users browsing this thread: 1 Guest(s)