SA-MP Forums Archive
Bug with SWAT Players entering vehicles - 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: Bug with SWAT Players entering vehicles (/showthread.php?tid=552224)



Bug with SWAT Players entering vehicles - FunnyBear - 23.12.2014

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


Re: Bug with SWAT Players entering vehicles - FunnyBear - 23.12.2014

Any help?


Re: Bug with SWAT Players entering vehicles - Abagail - 23.12.2014

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



Re: Bug with SWAT Players entering vehicles - FunnyBear - 23.12.2014

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.