Issue with sscanf and strcmp
#1

Can somebody explain to me, how the /frespawn all works, but frespawn <id> no longer works? It worked before I changed if(str to if(!str

pawn Code:
YCMD:frespawn(playerid, params[]) {
    new vehicleid, text[12];

    if(PlayerInfo[playerid][pFaction] != 0 && FactionInfo[PlayerInfo[playerid][pFaction]][fLeaderrank] >= PlayerInfo[playerid][pRank] - 1)
    {      
        if(sscanf(params, "s[12]", text)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /frespawn [vehicleid/all]");
        if(!strcmp("all", text))
        {
            for(new v = GetVehiclePoolSize(); v > 0; v--)
            {
                if(VehicleInfo[v][vFaction] != 0 && PlayerInfo[playerid][pFaction])
                {
                    SetVehicleToRespawn(v);
                }
            }
        return 1;
        }
        else
        {
            new vehicleidint = strval(text);

            if(VehicleInfo[vehicleidint][vFaction] == PlayerInfo[vehicleidint][pFaction])
            {
                SetVehicleToRespawn(vehicleidint);
               
            }
        }
    }
    else return SendClientMessage(playerid, -1, "nope...");
    return 1;
}
Reply
#2

Because VehicleInfo != PlayerInfo
Reply
#3

Quote:
Originally Posted by Jefff
View Post
Because VehicleInfo != PlayerInfo
Some times........ xD
Cheers mate!
Reply
#4

Quote:
Originally Posted by Jefff
View Post
Because VehicleInfo != PlayerInfo
Wait actually, what exactly do you mean by that?
Reply
#5

Figured out I put PlayerInfo[vehicleidint][pFaction] and not the player's id, my bad. Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)