Bug with SWAT Players entering vehicles
#1

Hey,

I've made a thing where if a SWAT player enters any of their cars in the SWAT base, a message will come up and a siren will be placed on the car. The problem is it occurs with every car a SWAT player enters.

Under OnPlayerStateChange

pawn Код:
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        Car[playerid] = GetPlayerVehicleID(playerid);
        new vehicleid = GetPlayerVehicleID(playerid);
        //////////////////////////////////////SWATS VEHICLES////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        if((vehicleid == SwatVehicle1 || SwatVehicle2 || SwatVehicle3 || SwatVehicle4 || SwatVehicle5 || SwatVehicle6 || SwatVehicle7 || SwatVehicle8 || SwatVehicle9 || SwatVehicle10 || SwatVehicle11 || SwatVehicle13 || SwatVehicle14 || SwatVehicle15 || SwatVehicle16 || SwatVehicle17) && (gTeam[playerid] == TEAM_SWAT))
        {
            new
                panels,
                doors,
                tires,
                lights;

            SendClientMessage(playerid, INFO, "[SWAT VEHICLE] You can use this vehicle to do your job!");

            obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.225000,0.750000,0.449999,0.000000,0.000000,0.000000);
            GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
            Flasher[vehicleid] = 1;
            return 1;
        }
    }
How can I fix this problem?

Thanks,

FunnyBear
Reply
#2

Any help?
Reply
#3

You need to keep using "vehicleid" ==. This is just checking if the vehicles are higher or equal to 1. Example:

pawn Код:
if((vehicleid == SwatVehicle1 || vehicleid == SwatVehicle2 || vehicleid == SwatVehicle ...
And not just
pawn Код:
if((vehicleid == SwatVehicle1 || SwatVehicle2...
Reply
#4

Quote:
Originally Posted by Abagail
Посмотреть сообщение
You need to keep using "vehicleid" ==. This is just checking if the vehicles are higher or equal to 1. Example:

pawn Код:
if((vehicleid == SwatVehicle1 || vehicleid == SwatVehicle2 || vehicleid == SwatVehicle ...
And not just
pawn Код:
if((vehicleid == SwatVehicle1 || SwatVehicle2...
Thank you, I will try it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)