SA-MP Forums Archive
Faction Cars help - 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: Faction Cars help (/showthread.php?tid=511403)



Faction Cars help - lulo356 - 05.05.2014

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



Re: Faction Cars help - DiGiTaL_AnGeL - 05.05.2014

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


Re: Faction Cars help - lulo356 - 05.05.2014

Yes im sure abut it


Re: Faction Cars help - lulo356 - 06.05.2014

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


Re: Faction Cars help - mrtms - 06.05.2014

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]);


Re: Faction Cars help - lulo356 - 06.05.2014

Can someone please help me!


Re: Faction Cars help - ChuckyBabe - 07.05.2014

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


Re: Faction Cars help - lulo356 - 07.05.2014

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...