restricted faction cars help
#2

Try this :

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!ispassenger)
    {
        if(IsDMVCar(vehicleid))
        {
            if(!LicenseTest[playerid])
            {
                SendClientMessage(playerid, COLOR_ORANGE, "You are not taking a drivers license test.");
                RemovePlayerFromVehicle(playerid);
                ClearAnimations(playerid,true);
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "* GPS: Finish the test by driving through all of the checkpoints on your GPS.");
                SetPlayerCheckpoint(playerid,980.1932,-1407.9902,13.0956,5);
                SendClientMessage(playerid, COLOR_RED, "If you exit the car your test will be failed and it will have to be re-done.");
            }
        }
        if(IsDLCar(vehicleid))
        {
            RemovePlayerFromVehicle(playerid);
            ClearAnimations(playerid,true);
        }
        else if(IsFamVehicle(vehicleid) && Fam[vehicleid] != PlayerInfo[playerid][pFam] && !IsACop(playerid))
        {
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to a family.");
            RemovePlayerFromVehicle(playerid);
            ClearAnimations(playerid,true);
            print("Family cars loaded successfully.");
        }
        else if(IsLeoVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 1)
        {
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the LSPD.");
            RemovePlayerFromVehicle(playerid);
            ClearAnimations(playerid,true);
            print("Police Cars loaded successfully.");
        }
        else if(IsLSFMDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 5)
        {
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the LSFMD.");
            RemovePlayerFromVehicle(playerid);
            ClearAnimations(playerid,true);
            print("LSFMD cars loaded successfully.");
        }
        else if(IsNewsVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 4)
        {
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the News Agency.");
            RemovePlayerFromVehicle(playerid);
            ClearAnimations(playerid,true);
            print("News cars loaded successfully.");
        }
        else if(IsFBIVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 6)
        {
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the FBI.");
            RemovePlayerFromVehicle(playerid);
            ClearAnimations(playerid,true);
            print("FBI cars loaded successfully.");
        }
        else if(IsNGVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 7)
        {
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the NG.");
            RemovePlayerFromVehicle(playerid);
            ClearAnimations(playerid,true);
            print("NG cars loaded successfully.");
        }
        else if(IsTruckerVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TRUCKER)
        {
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the Truckers.");
            RemovePlayerFromVehicle(playerid);
            ClearAnimations(playerid,true);
            print("Trucks cars loaded successfully.");
        }
        else if(IsGovVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 2)
        {
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the GOV.");
            RemovePlayerFromVehicle(playerid);
            ClearAnimations(playerid,true);
            print("Gov cars loaded successfully.");
        }

    }
    return 1;
}


public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(LicenseTest[playerid])
    {
        DisablePlayerCheckpoint(playerid);
        LicenseTest[playerid] = 0;
        CP[playerid] = 0;
        SetVehicleToRespawn(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Driving Center: You have left your car, therefore your test has been failed.");
    }
    if(PlayerInfo[playerid][pFac] == 1 && PlayerInfo[playerid][pFac] == 7 && PlayerInfo[playerid][pFac] == 6)
    {
        LastCar[playerid] = vehicleid;
    }
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_PASSENGER)
    {
        SetPlayerArmedWeapon(playerid,0);
    }
    if(newstate == PLAYER_STATE_PASSENGER)
    {
        if(newstate == PLAYER_STATE_PASSENGER)
        {
            new gun,tmp;
            GetPlayerWeaponData(playerid,4,gun,tmp);
            #pragma unused tmp
            if(gun)SetPlayerArmedWeapon(playerid,gun);
            else SetPlayerArmedWeapon(playerid,0);
        }
    }
    if(newstate == PLAYER_STATE_DRIVER && oldstate != PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        if(!engine) SendClientMessage(playerid, COLOR_WHITE, "You can start or stop the vehicle's engine using {FF6347}/engine{FFFFFF}.");
        //if(!engine) GameTextForPlayer(playerid, "~w~/engine to turn on/off the vehicle engine.", 3500, 3);
        if(!PlayerInfo[playerid][pCarLic]) SendClientMessage(playerid, COLOR_LIGHTRED, " You don't have a drivers license, beware of cops.");
        //if(IsATowTruck(vehicleid)) SendClientMessage(playerid, COLOR_WHITE, "You can tow a vehicle using {FF6347}/tow{FFFFFF}.");
    }
    return 1;
}
You have to use RemovePlayerFromVehicle when a player goes into a Faction cart
Reply


Messages In This Thread
restricted faction cars help - by lulo356 - 12.05.2014, 02:24
Re : restricted faction cars help - by Ramoboss - 12.05.2014, 03:10
Re: restricted faction cars help - by CJay9209 - 12.05.2014, 04:22
Re: restricted faction cars help - by lulo356 - 12.05.2014, 17:30
Re: restricted faction cars help - by lulo356 - 12.05.2014, 17:41
Re: restricted faction cars help - by lulo356 - 12.05.2014, 17:45
Re: restricted faction cars help - by lulo356 - 13.05.2014, 08:05
Re: restricted faction cars help - by IceBilizard - 13.05.2014, 08:17
Re: restricted faction cars help - by Madd92 - 13.05.2014, 08:23
Re: restricted faction cars help - by Madd92 - 13.05.2014, 14:04

Forum Jump:


Users browsing this thread: 1 Guest(s)