Faction Cars help
#1

http://pastebin.com/SjAFjcre

in that link you see my code of the faction cars, but the issue is, you can still enter every single faction car,

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!ispassenger)
    {
        if(IsDMVCar(vehicleid))
        {
            if(DrivingTest[playerid] == 0)
            {
                new Float:pos[3];
                GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SendClientMessage(playerid, COLOR_ORANGE, "You are not taking a drivers license test.");
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "* GPS: Finish the test by driving through all of the checkpoints on your GPS.");
                SetPlayerCheckpoint(playerid,958.4611,-1411.9598,13.1681,5);
                SendClientMessage(playerid, COLOR_RED, "If you exit the car your test will be failed and it will have to be re-done.");
            }
        }
            else if(IsDLCar(vehicleid))
        {
                new Float:pos[3];
                GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
        }
        else if(IsFamVehicle(vehicleid) && Fam[vehicleid] != PlayerInfo[playerid][pFam] && !IsACop(playerid))
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to a family.");
        }
        else if(IsLeoVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 1)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the LSPD.");
        }
        else if(IsLSFMDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 5)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the LSFMD.");
        }
        else if(IsNewsVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 4)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the News Agency.");
        }
        else if(IsFBIVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 6)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the FBI.");
        }
        else if(IsNGVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 7)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the NG.");
        }
        else if(IsSASTVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 8)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the SAST.");
        }
        else if(IsTruckerVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TRUCKER)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the Truckers.");
        }
        else if(IsGovVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 2)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the GOV.");
        }
        else if(GetVehicleModel(vehicleid) == 448 || GetVehicleModel(vehicleid) == 461 || GetVehicleModel(vehicleid) == 462 || GetVehicleModel(vehicleid) == 463 || GetVehicleModel(vehicleid) == 468 || GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510 || GetVehicleModel(vehicleid) == 521 || GetVehicleModel(vehicleid) == 522 || GetVehicleModel(vehicleid) == 581 || GetVehicleModel(vehicleid) == 586 && !IsDMVCar(vehicleid))
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_ORANGE, " You can't drive the motor bike as you dont have an motor license.");
        }
    }
    return 1;
}
Reply
#2

pawn Код:
Fam[vehicleid] != PlayerInfo[playerid][pFam]
Are you sure that "Fam[vehicleid]" is used correctly?
Reply
#3

Yes im sure abut it
Reply
#4

Can someone please help me because its a big issue and it need to be fixed
Reply
#5

Try printing out the variables in the CMD so you can see if the variables are actually being set.

printf("Veh ID: %d, Fam: %d", Fam[vehicleid], PlayerInfo[playerid][pFam]);
Reply
#6

Can someone please help me!
Reply
#7

Because your are putting this code to the wrong section...

Put it on the OnPlayerStateChange

then apply ClearAnimations every after SendClientMessage at your code !!

+rep if i help
Reply
#8

Quote:
Originally Posted by ChuckyBabe
Посмотреть сообщение
Because your are putting this code to the wrong section...

Put it on the OnPlayerStateChange

then apply ClearAnimations every after SendClientMessage at your code !!

+rep if i help
Still not working...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)