Faction restricted vehicles help
#3

This should work for you, basically your 'strcmp' function was using the cell length parameter, which does not equal 20 in this case... I won't explain it now, but research it a little and you'll understand.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    //get vehicle id
    new vid;
    new factionrequired[5] = "None";
    vid = GetVehicleModel(vehicleid);
    //check for factions
    for(new i = 0; i < sizeof(LSPDvehicles); i++)
    {
        if(vid == LSPDvehicles[i])
        {
            factionrequired = "LSPD";
            break;
        }
        else if(vid == LSFDvehicles[i])
        {
            factionrequired = "LSFD";
            break;
        }
        else if(vid == taxivehicles[i])
        {
            factionrequired = "taxi";
            break;
        }
    }

    new test[128];
    format(test, sizeof(test), "FactionRequired: %s - Faction: %s", factionrequired, pInfo[playerid][Faction]);
    SendClientMessage(playerid, -1, test);

    if(strcmp(pInfo[playerid][Faction], factionrequired, true) == 0)
    {
        SendClientMessage(playerid, -1, "allowed");
    }
    else
    {
        SendClientMessage(playerid, -1, "not allowed");
        ClearAnimations(playerid);
    }
    return 1;
}
Reply


Messages In This Thread
Faction restricted vehicles help - by Nathan_Taylor - 13.03.2013, 15:55
Re: Faction restricted vehicles help - by Nathan_Taylor - 13.03.2013, 20:26
Re: Faction restricted vehicles help - by Threshold - 13.03.2013, 20:38

Forum Jump:


Users browsing this thread: 1 Guest(s)