SA-MP Forums Archive
Issue with sscanf and strcmp - 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)
+--- Thread: Issue with sscanf and strcmp (/showthread.php?tid=663118)



Issue with sscanf and strcmp - EmilLykke - 22.01.2019

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;
}



Re: Issue with sscanf and strcmp - Jefff - 22.01.2019

Because VehicleInfo != PlayerInfo


Re: Issue with sscanf and strcmp - EmilLykke - 22.01.2019

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


Re: Issue with sscanf and strcmp - EmilLykke - 22.01.2019

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


Re: Issue with sscanf and strcmp - EmilLykke - 22.01.2019

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