Locking other Factions out of vehicles
#1

Hello,

Could you possibly help me with my vehicles? In the script files all the vehicles are set to Faction 1, so unless you are Faction 1 it shouldn't be letting you drive, which is the case for some of the vehicles but not all of the vehicles, a couple of them can be driven by anyone dispite being set to Faction 1 only.

pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Vehiclefile[100], i;
    new engine, lights, alarm, doors, bonnet, boot, objective;
    format(Vehiclefile, sizeof(Vehiclefile), "vehicles/Vehicle_%d.ini", vehicleid);
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(fexist(Vehiclefile))
    {
        Vehicles[i][VFaction] = dini_Int(Vehiclefile, "Faction");
        if(PlayerInfo[playerid][FactionApartof] == Vehicles[i][VFaction] || Vehicles[i][VFaction] == 0 )
        {
            SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, 0);
        }
        else
        {
            SendClientMessage(i, COLOUR_CYAN, "You do not have the keys to this vehicle!" );
            SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, 0);
        }
    }
Thanks
Reply
#2

Maybe those who you can drive are not saved into the ini file.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)