Weapons problem!
#1

Ok, I got a LSPD code to work. When I have a weapon, and exit the LSPD, the weapon is in my hand. But, when I enter a car and then exit a car, is the weapon gone! Is it any kind of saving code I need to put so the weapons not going when I enter a car?
Thanks.
Reply
#2

PLEASE paste your code here so we can understand problem in it !
Reply
#3

Can you show your onplayerentervehicle and onplayerstatechange callbacks?
Reply
#4

Onplayerenter:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	Seatbelt[playerid] = 0;
	IsPlayerSteppingInVehicle[playerid] = vehicleid;
	if(PlayerCuffed[playerid] != 0) SetPVarInt( playerid, "ToBeEjected", 1 );
	if(GetPVarInt(playerid, "Injured") == 1) SetPVarInt(playerid, "ToBeEjected", 1);
	SetPVarInt(playerid, "LastWeapon", GetPlayerWeapon(playerid));

	new engine,lights,alarm,doors,bonnet,boot,objective;
	GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
	if(engine == VEHICLE_PARAMS_UNSET) switch(GetVehicleModel(vehicleid)) {
		case 509, 481, 510: VehicleFuel[vehicleid] = 100, arr_Engine{vehicleid} = 1, SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
		default: SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective), arr_Engine{vehicleid} = 0;
	}

    if(GetVehicleModel(vehicleid) == 519 && ispassenger == 1)
    {
    	PutPlayerInVehicle(playerid, vehicleid, 1);
    	TogglePlayerControllable(playerid, 1);
    	InsideShamal[playerid] = vehicleid;
    }
    if(GetPVarInt(playerid, "Pizza") != 0 && !(IsAPizzaCar(vehicleid)))
	{
	    new Float:slx, Float:sly, Float:slz;
		GetPlayerPos(playerid, slx, sly, slz);
		SetPlayerPos(playerid, slx, sly, slz+1.3);
		PlayerPlaySound(playerid, 1130, slx, sly, slz+1.3);
		RemovePlayerFromVehicle(playerid);
		NOPCheck(playerid);
		SendClientMessageEx(playerid, COLOR_GRAD2, "You need to be in a PizzaBoy when delivering pizzas!");
		return 1;
	}
	if(!ispassenger)
	{
	    SetPlayerArmedWeapon(playerid, 0);
		if(IsVIPcar(vehicleid))
		{
		    if(PlayerInfo[playerid][pDonateRank] == 0)
			{
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz+1.3);
				PlayerPlaySound(playerid, 1130, slx, sly, slz+1.3);
			    RemovePlayerFromVehicle(playerid);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a VIP, this is a vehicle from the VIP Garage!");
			}
		}
		else if(IsAPizzaCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pJob] != 21 && PlayerInfo[playerid][pJob2] != 21)
		    {
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz+1.3);
				PlayerPlaySound(playerid, 1130, slx, sly, slz+1.3);
			    RemovePlayerFromVehicle(playerid);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a Pizza Boy!");
			}
		}
		else if(IsAnAmbulance(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4)
			{
			    if(FDSAVehicles[13] == vehicleid && PlayerInfo[playerid][pRank] < 5)
			    {
			        RemovePlayerFromVehicle(playerid);
			        new Float:slx, Float:sly, Float:slz;
					GetPlayerPos(playerid, slx, sly, slz);
					SetPlayerPos(playerid, slx, sly, slz);
					NOPCheck(playerid);
					SendClientMessageEx(playerid, COLOR_GRAD2, "Only ranks 5+ can drive this vehicle.");
			    }
			}
		    else
			{
			    SendClientMessageEx(playerid,COLOR_GREY,"   You are not in the FDSA!");
				RemovePlayerFromVehicle(playerid);
				new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
				NOPCheck(playerid);
			}
		}
		else if(IsAnSASDCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
		    {
		    }
		    else
		    {
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		        NOPCheck(playerid);
		        SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SASD!");
		    }
		}
		else if(IsATruckerCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pJob] == 20 || PlayerInfo[playerid][pJob2] == 20)
			{
				new string[128];

				new truckcontents = TruckContents[vehicleid];
				new truckcontentname[50];
				if(truckcontents == 0)
				{ format(truckcontentname, sizeof(truckcontentname), "None"); }
				else if(truckcontents >= 1 && truckcontents <= 3)
				{ format(truckcontentname, sizeof(truckcontentname), "{00F70C}Food & beverages");}
				else if(truckcontents >= 4 && truckcontents <= 6)
				{ format(truckcontentname, sizeof(truckcontentname), "{00F70C}Clothing"); }
				else if(truckcontents == 7)
				{ format(truckcontentname, sizeof(truckcontentname), "{00F70C}Legal materials"); }
				else if(truckcontents >= 8 && truckcontents <= 10)
				{ format(truckcontentname, sizeof(truckcontentname), "{00F70C}24/7 items"); }
				else if(truckcontents >= 11 && truckcontents <= 15)
				{ format(truckcontentname, sizeof(truckcontentname), "{FF0606}Illegal weapons"); }
				else if(truckcontents >= 16 && truckcontents <= 20)
				{ format(truckcontentname, sizeof(truckcontentname), "{FF0606}Illegal drugs"); }
				else if(truckcontents >= 21 && truckcontents <= 25)
				{ format(truckcontentname, sizeof(truckcontentname), "{FF0606}Illegal materials"); }

				format(string, sizeof(string), "TRUCKER JOB: (Truck registration: %s %d) - (Content: %s{FFFF00})", GetVehicleName(vehicleid), vehicleid, truckcontentname);
				SendClientMessageEx(playerid, COLOR_YELLOW, string);

				if(IsACop(playerid) && truckcontents >= 11)
				{
					SendClientMessageEx(playerid, COLOR_YELLOW, "TRUCKER JOB: To remove the illegal goods type /cleartruck near the Truck.");
				}
				if(truckcontents > 0 && TruckUsed[playerid] == INVALID_VEHICLE_ID)
				{
					SendClientMessageEx(playerid, COLOR_YELLOW, "TRUCKER JOB: To deliver the goods type /hijacktruck as the driver.");
				}
				else if(TruckUsed[playerid] == INVALID_VEHICLE_ID)
				{
    				SendClientMessageEx(playerid, COLOR_YELLOW, "TRUCKER JOB: To get goods type /loadtruck as the driver.");
				}
				else if(TruckUsed[playerid] == vehicleid && gPlayerCheckpointStatus[playerid] == CHECKPOINT_RETURNTRUCK)
				{
					SendClientMessageEx(playerid, COLOR_YELLOW, "TRUCKER JOB: This is your Truck, you have not returned it to the docks yet for your pay.");
				}
				else if(TruckUsed[playerid] == vehicleid)
   				{
      				SendClientMessageEx(playerid, COLOR_YELLOW, "TRUCKER JOB: This is your Truck, you have not delivered your goods yet.");
     			}
				else if(TruckUsed[playerid] != INVALID_VEHICLE_ID)
   				{
      				SendClientMessageEx(playerid, COLOR_YELLOW, "TRUCKER JOB: You are already on another delivery, type /cancel truck to cancel that delivery.");
     			}
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a Trucker!");
			}
		}
		else if(IsAnSFPDCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SFPD!");
			}
		}
		else if(IsAnEPCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pRank] >= 5)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SFPD Executive Protection Division!");
			}
		}
		else if(IsAnWPCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == 7)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
    			SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SASD!");
			}
		}
		else if(IsANooseCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 13)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not part of the NOOSE!");
			}
		}
		else if(IsATierraCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pRank] >= 2)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not Tierra Robada rank 2+!");
			}
		}
		else if(IsATierraARCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Tierra Robada Armed Forces Division!");
			}
		}
		else if(IsATierraESCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 3)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Tierra Robada Emergency Services Division!");
			}
		}
		else if(IsAGovCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 6)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Government faction!");
			}
		}
		else if(IsACopCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the LSPD!");
			}
		}
		else if(IsAFBICar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the FBI!");
			}
		}
		else if(vehicleid == 378 || vehicleid == 379)
		{
		    if((PlayerInfo[playerid][pMember] == 9||PlayerInfo[playerid][pLeader] == 9) && (PlayerInfo[playerid][pRank] >= 3))
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not R3+ SANews.");
			}
		}
		else if(IsAnNGAIRCar(vehicleid))
		{
		    if((PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11) && (PlayerInfo[playerid][pDivision] == 1 || PlayerInfo[playerid][pDivision] == 4))
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the NG AIR Division!");
			}
		}
/*		else if(IsAnNGARMCar(vehicleid))
		{
		    if((PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11) && (PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pDivision] == 3 || PlayerInfo[playerid][pDivision] == 5 || PlayerInfo[playerid][pDivision] == 6))
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the NG ARM Division!");
			}
		} */
		else if(IsAnNGCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the National Guard!");
			}
		}
		else if(IsAnDOCCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
			{
			}
		    else
			{
	   			NOPCheck(playerid);
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the National Guard!");
			}
		}
		else if(IsAnMPSCar(vehicleid))
		{
		    if(IsACop(playerid))
		    {
		    }
		    else
		    {
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		        NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You aren't in a LEO Faction.");
		    }
		}
		else if(IsACoastguardCar(vehicleid))
		{
		    if( ( PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 ) || ( PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pDivision] == 3 ))
			{
			}
			else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Coastguard division!");
			}
		}
	 	else if(IsANewsCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 9 ||PlayerInfo[playerid][pLeader] == 9)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SANews!");
			}
		}
	   	else if(IsAPlane(vehicleid))
		{
	  		if(PlayerInfo[playerid][pFlyLic] != 1)
	  		{
		  		RemovePlayerFromVehicle(playerid);
		  		new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		  		NOPCheck(playerid);
			 	SendClientMessageEx(playerid,COLOR_GREY,"You don't have a pilot license!");
	  		}
		}
		else if(IsAHelicopter(vehicleid))
		{
		    PlayerInfo[playerid][pAGuns][GetWeaponSlot(46)] = 46;
			GivePlayerValidWeapon(playerid, 46, 60000);
		}
		else if(IsAnTaxi(vehicleid) || IsAnBus(vehicleid))
		{
	        if(PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17 || PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pTaxiLicense] == 1)
			{
			}
		    else
			{
		        SendClientMessageEx(playerid,COLOR_GREY,"   You are not a Taxi/Bus Driver!");
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		    }
		}
	}
	else if(!IsPlayerInRangeOfVehicle(playerid, vehicleid, 7.5) || LockStatus[vehicleid] >= 1) { 
		ClearAnimations(playerid);
	}
	return 1;
Onplayerstate.

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate != 2) NOPTrigger[playerid] = 0;
    if(IsPlayerNPC(playerid))
	{
	    if(newstate == PLAYER_STATE_SPECTATING)
	    {
        	TogglePlayerSpectating(playerid, false);
		}
		return 1;
	}
	if(GettingSpectated[playerid] != 999)
	{
	    new spectator = GettingSpectated[playerid];
	    if(!IsPlayerConnected(spectator))
	    {
	        GettingSpectated[playerid] = 999;
	        Spectate[spectator] = 999;
		}

	    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[spectator][pAdmin] >= 2 || newstate == PLAYER_STATE_PASSENGER && PlayerInfo[spectator][pAdmin] >= 2)
	    {
	        TogglePlayerSpectating(spectator, true);
			new carid = GetPlayerVehicleID( playerid );
			PlayerSpectateVehicle( spectator, carid );
			SetPVarInt(spectator, "SpecState", newstate);
	    }
	    else if(newstate == PLAYER_STATE_ONFOOT && PlayerInfo[spectator][pAdmin] >= 2)
	    {
	        TogglePlayerSpectating(spectator, true);
		   	PlayerSpectatePlayer( spectator, playerid );
		   	SetPlayerInterior( spectator, GetPlayerInterior( playerid ) );
			SetPVarInt(spectator, "SpecState", newstate);
	    }
	}
	if(newstate == PLAYER_STATE_ONFOOT)
	{
 		if(Audio_IsClientConnected(playerid))
		{
			Audio_Stop(playerid, stationidp[playerid]);
 			stationidp[playerid] = 0;
		}
		
		if(GettingSpectated[playerid] < MAX_PLAYERS && PlayerInfo[GettingSpectated[playerid]][pAdmin] >= 2) {
			new spectator = GettingSpectated[playerid];
	        // Preventing possible buffer overflows with the arrays
	 		TogglePlayerSpectating(spectator, true);
			PlayerSpectatePlayer( spectator, playerid );
			SetPlayerInterior( spectator, GetPlayerInterior( playerid ) );
			SetPVarInt(spectator, "SpecState", newstate);
			SetPlayerInterior( spectator, GetPlayerInterior( playerid ) );
			SetPlayerVirtualWorld( spectator, GetPlayerVirtualWorld( playerid ) );
		}

	    if(oldstate == PLAYER_STATE_DRIVER)
		{
			SetPlayerWeaponsEx(playerid);
		}
		else if(oldstate == PLAYER_STATE_PASSENGER) SetPlayerWeaponsEx(playerid);

		if(ConnectedToPC[playerid] == 1337)//mdc
	    {
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You are now logged off the MDC.");
	        ConnectedToPC[playerid] = 0;
		}
        if(TransportDuty[playerid] > 0)
		{
		    if(TransportDuty[playerid] == 1)
			{
		        TaxiDrivers -= 1;
			}
			else if(TransportDuty[playerid] == 2)
			{
			    BusDrivers -= 1;
			}
			TransportDuty[playerid] = 0;
			new string[42];
			format(string, sizeof(string), "* You are now off duty and earned $%d.", TransportMoney[playerid]);
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
			GivePlayerCash(playerid, TransportMoney[playerid]);
			ConsumingMoney[playerid] = 1; TransportValue[playerid] = 0; TransportMoney[playerid] = 0;
			SetPlayerColor(playerid, TEAM_HIT_COLOR);
			TransportTime[playerid] = 0;
   			TransportCost[playerid] = 0;
		}
		if(TransportDriver[playerid] < MAX_PLAYERS)
		{
			new string[128];
			TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
			format(string, sizeof(string), "~w~The ride cost~n~~r~$%d",TransportCost[playerid]);
			GameTextForPlayer(playerid, string, 5000, 3);
			format(string, sizeof(string), "~w~Passenger left the taxi.~n~~g~Earned $%d",TransportCost[playerid]);
			GameTextForPlayer(TransportDriver[playerid], string, 5000, 3);
			GivePlayerCash(playerid, -TransportCost[playerid]);

			new ip[32], ipex[32];
			GetPlayerIp(playerid, ip, sizeof(ip));
			GetPlayerIp(TransportDriver[playerid], ipex, sizeof(ipex));
			TaxiWarn[playerid][TransportDriver[playerid]] += TransportCost[playerid];
			if(TaxiWarn[playerid][TransportDriver[playerid]] >= 10000)
			{
				format(string, sizeof(string), "%s (IP:%s) has taxied %s (IP:%s) $%d in this session.", GetPlayerNameEx(playerid), ip, GetPlayerNameEx(TransportDriver[playerid]), ipex, TaxiWarn[playerid][TransportDriver[playerid]]);
				Log("logs/pay.log", string);
				ABroadCast(COLOR_YELLOW, string, 2);
			}
			TransportTime[TransportDriver[playerid]] = 0;
			TransportCost[TransportDriver[playerid]] = 0;
			TransportCost[playerid] = 0;
			TransportTime[playerid] = 0;
			TransportDriver[playerid] = 999;
		}
		TelePos[playerid][0] = 0.0;
		TelePos[playerid][1] = 0.0;
	}
    if(newstate == PLAYER_STATE_PASSENGER) // TAXI & BUSSES
	{
 		if(stationidv[GetPlayerVehicleID(playerid)] != 0)
		{
		    new station[64];
			switch(stationidv[GetPlayerVehicleID(playerid)])
			{
				case 1: format(station, sizeof(station), "http://216.246.109.162:8000");
				case 2: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1415249");
				case 3: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1415249");
				case 4: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1628721");
				case 5: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283687");
				case 6: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1628932");
				case 7: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1756658");
				case 8: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377200");
				case 9: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2057197");
				case 10: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=18695");
				case 11: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=412093");
				case 12: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=181367");
				case 13: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1275071");
				case 14: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=412093");
				case 15: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356");
				case 16: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1279013");
				case 17: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1281016");
				case 18: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280855");
				case 19: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1116397");
				case 20: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2057543");
				case 21: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=616366");
				case 22: format(station, sizeof(station), "http://38.107.220.164:8014");
				case 23: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=847066");
			}
			if(Audio_IsClientConnected(playerid))
		 	{
		 	    Audio_Stop(playerid, stationidp[playerid]);
				stationidp[playerid] = Audio_PlayStreamed(playerid, station, false, true, false);
			}
		}
        new vehicleid = GetPlayerVehicleID(playerid);
	    if(vehicleid == NGVehicles[12] ||
		vehicleid == NGVehicles[13] ||
		vehicleid == NGVehicles[14] ||
		vehicleid == NGVehicles[15] ||
		vehicleid == NGVehicles[16] ||
		vehicleid == NGVehicles[17])
		{
		    TogglePlayerSpectating(playerid, 1);
			PlayerSpectateVehicle(playerid, vehicleid);
			SetPVarInt(playerid, "NGPassenger", 1);
			SetPVarInt(playerid, "NGPassengerVeh", vehicleid);
			SetPVarInt(playerid, "NGPassengerSkin", GetPlayerSkin(playerid));
			new Float:health, Float:armour;
			GetPlayerHealth(playerid, health);
			GetPlayerArmour(playerid, armour);
			SetPVarFloat(playerid, "NGPassengerHP", health);
			SetPVarFloat(playerid, "NGPassengerArmor", armour);
		}

	    /*new gun,tmp;
        GetPlayerWeaponData(playerid,4,gun,tmp);
        #pragma unused tmp
        if(gun)SetPlayerArmedWeapon(playerid,gun);
        else SetPlayerArmedWeapon(playerid,0);*/
        if(PlayerInfo[playerid][pGuns][4] > 0)	SetPlayerArmedWeapon(playerid,PlayerInfo[playerid][pGuns][4]);
		else SetPlayerArmedWeapon(playerid,0);

	    if( GetPVarInt( playerid, "ToBeEjected" ) >= 1 )
    	{
	       	SetPVarInt( playerid, "ToBeEjected", 0 );
	       	RemovePlayerFromVehicle( playerid );
	       	new Float:X, Float:Y, Float:Z;
			GetPlayerPos(playerid, X, Y, Z);
			SetPlayerPos(playerid, X, Y, Z+2);

			if(GetPVarInt(playerid, "Injured") == 1)
  			{
  			    Streamer_UpdateEx(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
		   		SetPlayerPos(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
				SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"MedicVW"));
				SetPlayerInterior(playerid, GetPVarInt(playerid,"MedicInt"));
   				ClearAnimations(playerid);
				ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.0, 0, 1, 1, 1, 0, 1);
   			}
   		}
	    //SetPVarInt(playerid, "LastWeapon", GetPlayerWeapon(playerid));
	    gLastCar[playerid] = vehicleid;
	    foreach(Player, i)
	    {
     		if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
       		{
				if(GetPlayerCash(playerid) < TransportValue[i])
				{
					new string[28];
					format(string, sizeof(string), "* You need $%d to enter.", TransportValue[i]);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					RemovePlayerFromVehicle(playerid);
					new Float:X, Float:Y, Float:Z;
					GetPlayerPos(playerid, X, Y, Z);
					SetPlayerPos(playerid, X, Y, Z+2);
					TogglePlayerControllable(playerid, 1);
				}
				else
				{
					new string[38];
					if(TransportDuty[i] == 1)
					{
						format(string, sizeof(string), "* You paid $%d to the taxi driver.", TransportValue[i]);
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Passenger %s has entered your taxi.", GetPlayerNameEx(playerid));
						SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
						TransportTime[i] = 1;
						TransportTime[playerid] = 1;
						TransportCost[playerid] = TransportValue[i];
						TransportCost[i] = TransportValue[i];
						TransportDriver[playerid] = i;
					}
					else if(TransportDuty[i] == 2)
					{
						format(string, sizeof(string), "* You paid $%d to the Taxi Driver.", TransportValue[i]);
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Passenger %s has entered your Taxi.", GetPlayerNameEx(playerid));
						SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
					}
					GivePlayerCash(playerid, - TransportValue[i]);
					TransportMoney[i] += TransportValue[i];
				}
      		}
	    }
	}
	if(newstate == PLAYER_STATE_WASTED)
	{
	    if(GetPVarInt(playerid, "EventToken") == 0)
	    {
			SetPVarInt(playerid, "MedicBill", 1);
		}
		if(ConnectedToPC[playerid] == 1337)//mdc
	    {
	        ConnectedToPC[playerid] = 0;
		}
		Seatbelt[playerid] = 0;
	}
	if(newstate == PLAYER_STATE_DRIVER)
	{
	    if(stationidv[GetPlayerVehicleID(playerid)] != 0)
		{
		    new station[64];
			switch(stationidv[GetPlayerVehicleID(playerid)])
			{
				case 1: format(station, sizeof(station), "*");
				case 2: format(station, sizeof(station), "*");
				case 3: format(station, sizeof(station), "*");
				case 4: format(station, sizeof(station), "*");
				case 5: format(station, sizeof(station), "*");
				case 6: format(station, sizeof(station), "*");
				case 7: format(station, sizeof(station), "*");
				case 8: format(station, sizeof(station), "*");
				case 9: format(station, sizeof(station), "*");
				case 10: format(station, sizeof(station), "*");
				case 11: format(station, sizeof(station), "*");
				case 12: format(station, sizeof(station), "*);
				case 13: format(station, sizeof(station), "*");
				case 14: format(station, sizeof(station), "*");
				case 15: format(station, sizeof(station), "*);
				case 16: format(station, sizeof(station), "*");
				case 17: format(station, sizeof(station), "*");
				case 18: format(station, sizeof(station), "*");
				case 19: format(station, sizeof(station), "*");
				case 20: format(station, sizeof(station), "*");
				case 21: format(station, sizeof(station), "*");
				case 22: format(station, sizeof(station), "*");
				case 23: format(station, sizeof(station), *");
			}
			if(Audio_IsClientConnected(playerid))
		 	{
		 	    Audio_Stop(playerid, stationidp[playerid]);
				stationidp[playerid] = Audio_PlayStreamed(playerid, station, false, true, false);
			}
		}
		
		SetPlayerArmedWeapon(playerid, 0);

		new
			newcar = GetPlayerVehicleID(playerid),
			engine, lights, alarm, doors, bonnet, boot, objective, v;

		gLastCar[playerid] = newcar;

	 	foreach(Player, i) {
	   		v = GetPlayerVehicle(i, newcar);
		    if(v != -1) {
				if(i == playerid) {

					new
						string[96];

					format(string, sizeof(string),"You are the owner of this %s.", GetVehicleName(newcar));
					SendClientMessageEx(playerid, COLOR_GREY, string);
					if(PlayerVehicleInfo[i][v][pvTicket] != 0)
					{
						format(string, sizeof(string),"A $%d parking ticket was left on your vehicle. You must pay the ticket at the DMV in Dilimore.", PlayerVehicleInfo[i][v][pvTicket]);
						SendClientMessageEx(playerid, COLOR_GREY, string);
						SendClientMessageEx(playerid, COLOR_GREY, "Failure to pay this ticket as soon as possible will result in a fine, or even an arrest.");
					}
				}
				else if(i == PlayerInfo[playerid][pVehicleKeysFrom]) {

					new
						string[64 + MAX_PLAYER_NAME];

					format(string, sizeof(string),"You have the keys for this %s from owner %s.", GetVehicleName(newcar), GetPlayerNameEx(i));
					SendClientMessageEx(playerid, COLOR_GREY, string);
				}
				else if(PlayerVehicleInfo[i][v][pvLocked] == 1 && PlayerVehicleInfo[i][v][pvLock] == 1) {
				    GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(newcar,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
					SetTimerEx("DisableVehicleAlarm", 20000, 0, "d",  newcar);
				}
				else if(PlayerVehicleInfo[i][v][pvLocked] == 1 && PlayerVehicleInfo[i][v][pvLock] == 2) {

					new
						string[49 + MAX_PLAYER_NAME];

	          		if(PlayerInfo[playerid][pAdmin] < 2)
					{
						format(string, sizeof(string), "* %s has been stunned by the electric anti-theft.",GetPlayerNameEx(playerid));
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						new Float:X, Float:Y, Float:Z, Float:HP;
	     				GetPlayerPos(playerid, X, Y, Z);
	     				SendAudioToRange(10300, 100, 0, X, Y, Z, 20.0);
	     				SetPlayerPos(playerid, X + 1, Y, Z);
	         			RemovePlayerFromVehicle(playerid);
	         			SetPVarInt(playerid, "IsFrozen", 1);
	            		TogglePlayerControllable(playerid,0);
		            	SetTimerEx("ReleasePlayer", 10000, 0, "d", playerid);
			            GameTextForPlayer(playerid,"~r~STUNNED!",11000,3);
			            GetPlayerHealth(playerid,HP);
			            SetPlayerHealth(playerid,HP-15);
					}
					else
					{
	    				format(string, sizeof(string), "Warning: This %s is owned by %s.", GetVehicleName(newcar), GetPlayerNameEx(i));
	      				SendClientMessageEx(playerid, COLOR_GREY, string);
					}
				}
				return 1;
			}
		}

		for(new f = 0; f < MAX_FAMILY; f++) {
			v = GetGangVehicle(f, newcar);
			if(v != -1) {
				new string[49 + MAX_PLAYER_NAME];
				if(PlayerInfo[playerid][pFMember] == f)
				{
					format(string, sizeof(string), "You are in the family that owns this %s.", GetVehicleName(newcar));
	    			SendClientMessageEx(playerid, COLOR_GREY, string);
				}
				else if(FamilyVehicleInfo[f][v][fvLocked] == 1 && FamilyVehicleInfo[f][v][fvLock] == 1)
				{
					GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(newcar,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
					SetTimerEx("DisableVehicleAlarm", 20000, 0, "d",  newcar);
				}
				else if(FamilyVehicleInfo[f][v][fvLocked] == 1 && FamilyVehicleInfo[f][v][fvLock] == 2)
				{
		            format(string, sizeof(string), "* %s has been stunned by the electric anti-theft.",GetPlayerNameEx(playerid));
		            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		            new Float:X, Float:Y, Float:Z, Float:HP;
		            GetPlayerPos(playerid, X, Y, Z);
		            SendAudioToRange(10300, 100, 0, X, Y, Z, 20.0);
		            SetPlayerPos(playerid, X + 1, Y, Z);
		            RemovePlayerFromVehicle(playerid);
		            new Float:slx, Float:sly, Float:slz;
					GetPlayerPos(playerid, slx, sly, slz);
					SetPlayerPos(playerid, slx, sly, slz);
					SetPVarInt(playerid, "IsFrozen", 1);
		            TogglePlayerControllable(playerid,0);
		            SetTimerEx("ReleasePlayer", 10000, 0, "d", playerid);
		            GameTextForPlayer(playerid,"~r~STUNNED!",11000,3);
		            GetPlayerHealth(playerid,HP);
		            SetPlayerHealth(playerid,HP-15);
				}
				return 1;
			}
		}
		new vehicleid = newcar;
		if(IsVIPcar(vehicleid))
		{
		    if(PlayerInfo[playerid][pDonateRank] > 0)
			{
				SendClientMessageEx(playerid, COLOR_YELLOW, "VIP: This is a VIP vehicle from the VIP garage, therefore it has unlimited fuel.");
			}
		    else
			{
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz+1.3);
				PlayerPlaySound(playerid, 1130, slx, sly, slz+1.3);
			    RemovePlayerFromVehicle(playerid);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a VIP, this is a vehicle from the VIP Garage!");
			}
		}
		else if(IsAnAmbulance(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4)
			{
			    if(FDSAVehicles[13] == vehicleid && PlayerInfo[playerid][pRank] < 5)
			    {
			        RemovePlayerFromVehicle(playerid);
			        new Float:slx, Float:sly, Float:slz;
					GetPlayerPos(playerid, slx, sly, slz);
					SetPlayerPos(playerid, slx, sly, slz);
			        NOPCheck(playerid);
					SendClientMessageEx(playerid, COLOR_GRAD2, "Only ranks 5+ can drive this vehicle.");
			    }
			}
		    else
			{
			    SendClientMessageEx(playerid,COLOR_GREY,"   You are not in the FDSA!");
				RemovePlayerFromVehicle(playerid);
				new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
				NOPCheck(playerid);
			}
		}
		else if(IsAnSASDCar(vehicleid))
		{
			if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
		    {
		    }
		    else
		    {
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		        NOPCheck(playerid);
		        SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SASD!");
		    }
		}
		else if(IsAnSFPDCar(vehicleid))
		{
            if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SFPD!");
			}
		}
		else if(IsAnEPCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pRank] >= 5)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SFPD Executive Protection Division!");
			}
		}
		else if(IsAnWPCar(vehicleid))
		{
		   	if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == 7){
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SASD!");
			}
		}
		else if(IsACopCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the LSPD!");
			}
		}
	 	else if(IsAHouse275Car(vehicleid))
		{
		    TogglePlayerControllable(playerid, false);
	  		ShowPlayerDialog(playerid, House275CAR, DIALOG_STYLE_INPUT, "KeyPad", "Password:", "ENTER", "ENTER");
		}
		else if(IsAFBICar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the FBI!");
			}
		}
	/*	else if(IsAnNGARMCar(vehicleid))
		{
		    if((PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11) && (PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pDivision] == 3 || PlayerInfo[playerid][pDivision] == 6 || PlayerInfo[playerid][pDivision] == 7))
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the NG ARM Division!");
			}
		} */
		else if(vehicleid == FDSAVehicles[12] || vehicleid == FDSAVehicles[33] || vehicleid == FDSAVehicles[34] || vehicleid == FDSAVehicles[35])
		{
		    if(PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 1)
		    {
		    }
			else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Fire Department Division!");
			}
		}
		else if(vehicleid == FDSAVehicles[37] || vehicleid == FDSAVehicles[36])
		{
		    if(PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2)
		    {
		    }
			else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Life Flight Division!");
			}
		}
		else if(IsAnNGAIRCar(vehicleid))
		{
		    if((PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11) && (PlayerInfo[playerid][pDivision] == 1 || PlayerInfo[playerid][pDivision] == 4))
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the NG AIR Division!");
			}
		}
		else if(IsAnNGCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the National Guard!");
			}
		}
		else if(IsAnDOCCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
			{
			}
		    else
			{
	   			NOPCheck(playerid);
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the National Guard!");
			}
		}
		else if(IsAnMPSCar(vehicleid))
		{
		    if(IsACop(playerid))
		    {
		    }
		    else
		    {
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		        NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You aren't in a LEO Faction.");
		    }
		}
		else if(IsACoastguardCar(vehicleid))
		{
		    if( ( PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 ) || ( PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pDivision] == 3 ))
			{
			}
			else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Coastguard division!");
			}
		}
	 	else if(IsANewsCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 9 ||PlayerInfo[playerid][pLeader] == 9)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SANews!");
			}
		}
	   	else if(IsAPlane(vehicleid))
		{
	  		if(PlayerInfo[playerid][pFlyLic] != 1)
	  		{
		  		RemovePlayerFromVehicle(playerid);
		  		new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		  		NOPCheck(playerid);
			 	SendClientMessageEx(playerid,COLOR_GREY,"You don't have a pilot license!");
	  		}
		}
		else if(IsAHelicopter(vehicleid))
		{
		    PlayerInfo[playerid][pAGuns][GetWeaponSlot(46)] = 46;
			GivePlayerValidWeapon(playerid, 46, 60000);
		}
		else if(IsAnTaxi(vehicleid) || IsAnBus(vehicleid))
		{
	        if(PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17 || PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pTaxiLicense] == 1)
			{
			}
		    else
			{
		        SendClientMessageEx(playerid,COLOR_GREY,"   You are not a Taxi/Bus Driver!");
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		    }
		}
	    if( GetPVarInt( playerid, "ToBeEjected" ) >= 1 )
    	{
	       	SetPVarInt( playerid, "ToBeEjected", 0 );
	       	RemovePlayerFromVehicle( playerid );
	       	new Float:X, Float:Y, Float:Z;
			GetPlayerPos(playerid, X, Y, Z);
			SetPlayerPos(playerid, X, Y, Z+2);

			if(GetPVarInt(playerid, "Injured") == 1)
  			{
  			    Streamer_UpdateEx(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
		   		SetPlayerPos(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
				SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"MedicVW"));
				SetPlayerInterior(playerid, GetPVarInt(playerid,"MedicInt"));
   				ClearAnimations(playerid);
				ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.0, 0, 1, 1, 1, 0, 1);
   			}
   		}
		//if(lights == VEHICLE_PARAMS_UNSET) SetVehicleParamsEx(newcar,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
		TelePos[playerid][0] = 0.0;
		TelePos[playerid][1] = 0.0;
		//SetPVarInt(playerid, "LastWeapon", GetPlayerWeapon(playerid));
		if(IsARental(newcar) && gBike[playerid] == 0 && gBikeRenting[playerid] == 0)
		{
			TogglePlayerControllable(playerid,0);
			ShowPlayerDialog(playerid, RENTMENU, DIALOG_STYLE_LIST, "Bike Shed BMX Rentals","15 Minutes - 1000$\n30 Minutes - 2000$\n1 Hour - 4000$", "Rent", "Cancel");
		}
	    if(GetCarDealershipVehicleId(newcar) != -1 && GetCarDealershipVehicleId(newcar) == GetPVarInt(playerid, "editingcdveh")) return 1;
        if(GetCarDealershipVehicleId(newcar) != -1)
        {
			new string[57 + 20 + 4];
			format(string, sizeof(string),"Would you like to buy this %s?\n\nThis vehicle costs $%d.", GetVehicleName(newcar), CarDealershipInfo[GetCarDealershipId(newcar)][cdVehicleCost][GetCarDealershipVehicleId(newcar)]);
		    ShowPlayerDialog(playerid,DIALOG_CDBUY,DIALOG_STYLE_MSGBOX,"Warning:",string,"Buy","Cancel");
		    TogglePlayerControllable(playerid, false);
		    return 1;
        }
		GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
		if((engine == VEHICLE_PARAMS_UNSET || engine == VEHICLE_PARAMS_OFF) && GetVehicleModel(newcar) != 509 && GetVehicleModel(newcar) != 481 && GetVehicleModel(newcar) != 510) {
			SendClientMessageEx(playerid, COLOR_WHITE, "This vehicle's engine is not running - if you wish to start it, type /car engine.");
		}
		else
		{
			if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 481 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 509 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 510)
			{
				SetPVarInt(playerid, "fuelonoff", 1);
	 			FuelBar[playerid] = CreateProgressBar(548.00, 26.00, 57.50, 3.20, 866792447, 100.0);
	 			textdrawscount++;
	  			SetProgressBarValue(FuelBar[playerid], VehicleFuel[GetPlayerVehicleID(playerid)]);
				ShowProgressBarForPlayer(playerid, FuelBar[playerid]);
			}
		}
	}
	if((newstate == 2 || newstate == 3 || newstate == 7 || newstate == 9) && pTazer[playerid] == 1)
	{
		GivePlayerValidWeapon(playerid, pTazerReplace[playerid], 60000);
		pTazer[playerid] = 0;
	}
	if(newstate == PLAYER_STATE_SPAWNED)
	{
		if(ConnectedToPC[playerid] == 1337)//mdc
	    {
	        ConnectedToPC[playerid] = 0;
		}
		TelePos[playerid][0] = 0.0;
		TelePos[playerid][1] = 0.0;
		gPlayerSpawned[playerid] = 1;
		SafeTime[playerid] = 60;
	}
	if(newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
	    if(VehicleStatus{vehicleid} == 1) return SendClientMessageEx(playerid, COLOR_WHITE, "You are not allowed to enter this Shamal as it's been damaged!");
	    new string[47 + MAX_PLAYER_NAME];
   		format(string, sizeof(string), "* %s enters the Shamal airplane as a passenger.", GetPlayerNameEx(playerid));
		ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
     	SetPlayerPos(playerid, 2.509036, 23.118730, 1199.593750);
     	SetPlayerFacingAngle(playerid, 82.14);
        SetCameraBehindPlayer(playerid);
		PlayerInfo[playerid][pVW] = vehicleid;
		SetPlayerVirtualWorld(playerid, vehicleid);
		PlayerInfo[playerid][pInt] = 1;
        SetPlayerInterior(playerid, 1);
		InsideShamal[playerid] = vehicleid;
		SendClientMessageEx(playerid, COLOR_WHITE, "Type /exit near the door to exit the vehicle, or /window to look outside.");
	}
	IsPlayerSteppingInVehicle[playerid] = -1;
	return 1;
}
Reply
#5

Duh, my bad, i mean OnPlayerExitVehicle - sorry.
Reply
#6

Onplayerenter:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	Seatbelt[playerid] = 0;
	IsPlayerSteppingInVehicle[playerid] = vehicleid;
	if(PlayerCuffed[playerid] != 0) SetPVarInt( playerid, "ToBeEjected", 1 );
	if(GetPVarInt(playerid, "Injured") == 1) SetPVarInt(playerid, "ToBeEjected", 1);
	SetPVarInt(playerid, "LastWeapon", GetPlayerWeapon(playerid));

	new engine,lights,alarm,doors,bonnet,boot,objective;
	GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
	if(engine == VEHICLE_PARAMS_UNSET) switch(GetVehicleModel(vehicleid)) {
		case 509, 481, 510: VehicleFuel[vehicleid] = 100, arr_Engine{vehicleid} = 1, SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
		default: SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective), arr_Engine{vehicleid} = 0;
	}

    if(GetVehicleModel(vehicleid) == 519 && ispassenger == 1)
    {
    	PutPlayerInVehicle(playerid, vehicleid, 1);
    	TogglePlayerControllable(playerid, 1);
    	InsideShamal[playerid] = vehicleid;
    }
    if(GetPVarInt(playerid, "Pizza") != 0 && !(IsAPizzaCar(vehicleid)))
	{
	    new Float:slx, Float:sly, Float:slz;
		GetPlayerPos(playerid, slx, sly, slz);
		SetPlayerPos(playerid, slx, sly, slz+1.3);
		PlayerPlaySound(playerid, 1130, slx, sly, slz+1.3);
		RemovePlayerFromVehicle(playerid);
		NOPCheck(playerid);
		SendClientMessageEx(playerid, COLOR_GRAD2, "You need to be in a PizzaBoy when delivering pizzas!");
		return 1;
	}
	if(!ispassenger)
	{
	    SetPlayerArmedWeapon(playerid, 0);
		if(IsVIPcar(vehicleid))
		{
		    if(PlayerInfo[playerid][pDonateRank] == 0)
			{
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz+1.3);
				PlayerPlaySound(playerid, 1130, slx, sly, slz+1.3);
			    RemovePlayerFromVehicle(playerid);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a VIP, this is a vehicle from the VIP Garage!");
			}
		}
		else if(IsAPizzaCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pJob] != 21 && PlayerInfo[playerid][pJob2] != 21)
		    {
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz+1.3);
				PlayerPlaySound(playerid, 1130, slx, sly, slz+1.3);
			    RemovePlayerFromVehicle(playerid);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a Pizza Boy!");
			}
		}
		else if(IsAnAmbulance(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4)
			{
			    if(FDSAVehicles[13] == vehicleid && PlayerInfo[playerid][pRank] < 5)
			    {
			        RemovePlayerFromVehicle(playerid);
			        new Float:slx, Float:sly, Float:slz;
					GetPlayerPos(playerid, slx, sly, slz);
					SetPlayerPos(playerid, slx, sly, slz);
					NOPCheck(playerid);
					SendClientMessageEx(playerid, COLOR_GRAD2, "Only ranks 5+ can drive this vehicle.");
			    }
			}
		    else
			{
			    SendClientMessageEx(playerid,COLOR_GREY,"   You are not in the FDSA!");
				RemovePlayerFromVehicle(playerid);
				new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
				NOPCheck(playerid);
			}
		}
		else if(IsAnSASDCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
		    {
		    }
		    else
		    {
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		        NOPCheck(playerid);
		        SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SASD!");
		    }
		}
		else if(IsATruckerCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pJob] == 20 || PlayerInfo[playerid][pJob2] == 20)
			{
				new string[128];

				new truckcontents = TruckContents[vehicleid];
				new truckcontentname[50];
				if(truckcontents == 0)
				{ format(truckcontentname, sizeof(truckcontentname), "None"); }
				else if(truckcontents >= 1 && truckcontents <= 3)
				{ format(truckcontentname, sizeof(truckcontentname), "{00F70C}Food & beverages");}
				else if(truckcontents >= 4 && truckcontents <= 6)
				{ format(truckcontentname, sizeof(truckcontentname), "{00F70C}Clothing"); }
				else if(truckcontents == 7)
				{ format(truckcontentname, sizeof(truckcontentname), "{00F70C}Legal materials"); }
				else if(truckcontents >= 8 && truckcontents <= 10)
				{ format(truckcontentname, sizeof(truckcontentname), "{00F70C}24/7 items"); }
				else if(truckcontents >= 11 && truckcontents <= 15)
				{ format(truckcontentname, sizeof(truckcontentname), "{FF0606}Illegal weapons"); }
				else if(truckcontents >= 16 && truckcontents <= 20)
				{ format(truckcontentname, sizeof(truckcontentname), "{FF0606}Illegal drugs"); }
				else if(truckcontents >= 21 && truckcontents <= 25)
				{ format(truckcontentname, sizeof(truckcontentname), "{FF0606}Illegal materials"); }

				format(string, sizeof(string), "TRUCKER JOB: (Truck registration: %s %d) - (Content: %s{FFFF00})", GetVehicleName(vehicleid), vehicleid, truckcontentname);
				SendClientMessageEx(playerid, COLOR_YELLOW, string);

				if(IsACop(playerid) && truckcontents >= 11)
				{
					SendClientMessageEx(playerid, COLOR_YELLOW, "TRUCKER JOB: To remove the illegal goods type /cleartruck near the Truck.");
				}
				if(truckcontents > 0 && TruckUsed[playerid] == INVALID_VEHICLE_ID)
				{
					SendClientMessageEx(playerid, COLOR_YELLOW, "TRUCKER JOB: To deliver the goods type /hijacktruck as the driver.");
				}
				else if(TruckUsed[playerid] == INVALID_VEHICLE_ID)
				{
    				SendClientMessageEx(playerid, COLOR_YELLOW, "TRUCKER JOB: To get goods type /loadtruck as the driver.");
				}
				else if(TruckUsed[playerid] == vehicleid && gPlayerCheckpointStatus[playerid] == CHECKPOINT_RETURNTRUCK)
				{
					SendClientMessageEx(playerid, COLOR_YELLOW, "TRUCKER JOB: This is your Truck, you have not returned it to the docks yet for your pay.");
				}
				else if(TruckUsed[playerid] == vehicleid)
   				{
      				SendClientMessageEx(playerid, COLOR_YELLOW, "TRUCKER JOB: This is your Truck, you have not delivered your goods yet.");
     			}
				else if(TruckUsed[playerid] != INVALID_VEHICLE_ID)
   				{
      				SendClientMessageEx(playerid, COLOR_YELLOW, "TRUCKER JOB: You are already on another delivery, type /cancel truck to cancel that delivery.");
     			}
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a Trucker!");
			}
		}
		else if(IsAnSFPDCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SFPD!");
			}
		}
		else if(IsAnEPCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pRank] >= 5)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SFPD Executive Protection Division!");
			}
		}
		else if(IsAnWPCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == 7)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
    			SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SASD!");
			}
		}
		else if(IsANooseCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 13)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not part of the NOOSE!");
			}
		}
		else if(IsATierraCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pRank] >= 2)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not Tierra Robada rank 2+!");
			}
		}
		else if(IsATierraARCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Tierra Robada Armed Forces Division!");
			}
		}
		else if(IsATierraESCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 3)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Tierra Robada Emergency Services Division!");
			}
		}
		else if(IsAGovCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 6)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Government faction!");
			}
		}
		else if(IsACopCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the LSPD!");
			}
		}
		else if(IsAFBICar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the FBI!");
			}
		}
		else if(vehicleid == 378 || vehicleid == 379)
		{
		    if((PlayerInfo[playerid][pMember] == 9||PlayerInfo[playerid][pLeader] == 9) && (PlayerInfo[playerid][pRank] >= 3))
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not R3+ SANews.");
			}
		}
		else if(IsAnNGAIRCar(vehicleid))
		{
		    if((PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11) && (PlayerInfo[playerid][pDivision] == 1 || PlayerInfo[playerid][pDivision] == 4))
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the NG AIR Division!");
			}
		}
/*		else if(IsAnNGARMCar(vehicleid))
		{
		    if((PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11) && (PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pDivision] == 3 || PlayerInfo[playerid][pDivision] == 5 || PlayerInfo[playerid][pDivision] == 6))
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the NG ARM Division!");
			}
		} */
		else if(IsAnNGCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the National Guard!");
			}
		}
		else if(IsAnDOCCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
			{
			}
		    else
			{
	   			NOPCheck(playerid);
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the National Guard!");
			}
		}
		else if(IsAnMPSCar(vehicleid))
		{
		    if(IsACop(playerid))
		    {
		    }
		    else
		    {
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		        NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You aren't in a LEO Faction.");
		    }
		}
		else if(IsACoastguardCar(vehicleid))
		{
		    if( ( PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 ) || ( PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pDivision] == 3 ))
			{
			}
			else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Coastguard division!");
			}
		}
	 	else if(IsANewsCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 9 ||PlayerInfo[playerid][pLeader] == 9)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SANews!");
			}
		}
	   	else if(IsAPlane(vehicleid))
		{
	  		if(PlayerInfo[playerid][pFlyLic] != 1)
	  		{
		  		RemovePlayerFromVehicle(playerid);
		  		new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		  		NOPCheck(playerid);
			 	SendClientMessageEx(playerid,COLOR_GREY,"You don't have a pilot license!");
	  		}
		}
		else if(IsAHelicopter(vehicleid))
		{
		    PlayerInfo[playerid][pAGuns][GetWeaponSlot(46)] = 46;
			GivePlayerValidWeapon(playerid, 46, 60000);
		}
		else if(IsAnTaxi(vehicleid) || IsAnBus(vehicleid))
		{
	        if(PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17 || PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pTaxiLicense] == 1)
			{
			}
		    else
			{
		        SendClientMessageEx(playerid,COLOR_GREY,"   You are not a Taxi/Bus Driver!");
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		    }
		}
	}
	else if(!IsPlayerInRangeOfVehicle(playerid, vehicleid, 7.5) || LockStatus[vehicleid] >= 1) { 
		ClearAnimations(playerid);
	}
	return 1;
OnplayerExit

Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{

	if (GetPlayerState(playerid) == 1)
	{
		return 1;
	}

	
	switch(Seatbelt[playerid])
	{
	    case 1:
	    {
			new string[128];
	        if(IsABike(vehicleid))
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "You have taken off your helmet.");
				format(string, sizeof(string), "* %s reaches for their helmet, and takes it off.", GetPlayerNameEx(playerid));
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "You have taken off your seatbelt.");
				format(string, sizeof(string), "* %s reaches for their seatbelt, and unbuckles it.", GetPlayerNameEx(playerid));
			}
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  			Seatbelt[playerid] = 0;
	    }
	}

	if(GetPVarInt(playerid, "rccam") == 1)
	{
		DestroyVehicle(GetPVarInt(playerid, "rcveh"));
	    SetPlayerPos(playerid, GetPVarFloat(playerid, "rcX"), GetPVarFloat(playerid, "rcY"), GetPVarFloat(playerid, "rcZ"));
		DeletePVar(playerid, "rccam");
	    KillTimer(GetPVarInt(playerid, "rccamtimer"));
	}
	return 1;
}
Reply
#7

Is it a save code I need to have in the OnPlayerExit
Reply
#8

Nothing wrong with your code. It can be a bug?
Reply
#9

Are you sure that you don't have another FS that contains something to ResetPlayerWeapons at exit vehicle?
Reply
#10

I looked over the filterscripts, No ResetPlayerWeapons there...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)