faction vehicles help
#1

Hi

I am trying to make this function so when a player enters a cop car, and they are not part of the police faction it will remove them from the car and tell them they are not part of that faction. But only if they are in the driver seat.

Here is my code:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new vehicleid = GetPlayerVehicleID(playerid);
	if(newstate == 2)
	{
		SetPlayerArmedWeapon(playerid, 0);
		if(IsLAPDVeh(vehicleid) && pInfo[playerid][pFaction] != 1)
		{
			RemovePlayerFromVehicle(playerid);
			SendClientMessage(playerid, COLOR_GREY, "You are not in the LAPD");
		}
		else if(IsLAFMDVeh(vehicleid) && pInfo[playerid][pFaction] != 2)
		{
			RemovePlayerFromVehicle(playerid);
			SendClientMessage(playerid, COLOR_GREY, "You are not in the LAFMD");
		}
        }
        return 1;
}

stock IsLAPDVeh(vehicleid)
{
	for(new i = 0; i < sizeof(LAPDVeh); ++i)
	{
		if(vehicleid == LAPDVeh[i]) return 1;
	}
	return 0;
}
This is under ongamemodeinit:
Код:
LAPDVeh[0] = AddStaticVehicleEx(596, 1602.8655, -1684.0818, 5.5351, 89.8200, -1, -1, 3000);
Reply


Messages In This Thread
faction vehicles help - by Blademaster680 - 01.12.2014, 11:22
Re: faction vehicles help - by Airblog - 01.12.2014, 11:34
Re: faction vehicles help - by Blademaster680 - 01.12.2014, 11:54
Re: faction vehicles help - by Blademaster680 - 01.12.2014, 13:01

Forum Jump:


Users browsing this thread: 1 Guest(s)