SA-MP Forums Archive
possibly fixed - 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: possibly fixed (/showthread.php?tid=308215)



Cars for police and SRT not working - SomebodyAndMe - 02.01.2012

As title said, it doesn't let police people in the police cars.

pawn Код:
// Check if the player is not a cop
            if (APlayerData[playerid][PlayerClass] != ClassPolice)
            {
                // First check if the vehicle is a static vehicle (player can still use a bought cop-car that he bought in his house,
                // as a bought vehicle isn't static)
                if (AVehicleData[vid][StaticVehicle] == true)
                {
                    // Check if the entered vehicle is a cop vehicle
                    switch (GetVehicleModel(vid))
                    {
                        case VehiclePoliceLSPD, VehiclePoliceSFPD, VehiclePoliceLVPD, VehicleHPV1000, VehiclePoliceRanger:
                        {
                            // Force the player out of the vehicle
                            RemovePlayerFromVehicle(playerid);
                            // Turn off the lights and engine
                            GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
                            SetVehicleParamsEx(vid, 0, 0, alarm, doors, bonnet, boot, objective);
                            // Let the player know he cannot use a cop car
                            SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use a police vehicle");
                        }
                    }
                }
            }
            // Check if the player is not a cop
            if (APlayerData[playerid][PlayerClass] != ClassSRT)
            {
                // First check if the vehicle is a static vehicle (player can still use a bought cop-car that he bought in his house,
                // as a bought vehicle isn't static)
                if (AVehicleData[vid][StaticVehicle] == true)
                {
                    // Check if the entered vehicle is a cop vehicle
                    switch (GetVehicleModel(vid))
                    {
                        case VehiclePoliceLSPD, VehiclePoliceSFPD, VehiclePoliceLVPD, VehicleHPV1000, VehiclePoliceRanger:
                        {
                            // Force the player out of the vehicle
                            RemovePlayerFromVehicle(playerid);
                            // Turn off the lights and engine
                            GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
                            SetVehicleParamsEx(vid, 0, 0, alarm, doors, bonnet, boot, objective);
                            // Let the player know he cannot use a cop car
                            SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use a police vehicle");
                        }
                    }
                }
            }
REP+ if you helped me


Thanks