SA-MP Forums Archive
car bug - 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: car bug (/showthread.php?tid=349626)



Every car is buyable - jamax - 09.06.2012

Hello everybody


I have a bug whenever I enter a car it says its buyable if somebody knows how to solve it I will bag him to solve it PLeasseee

onplayerstatchange:


Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new string[256];
	new newcar = GetPlayerVehicleID(playerid);
	new skin = GetPlayerSkin(playerid);
		new vehicle = GetPlayerVehicleID(playerid);

	

	
	
		if(newstate == PLAYER_STATE_DRIVER) {
	    pvehicleid[playerid] = GetPlayerVehicleID(playerid);
	    pmodelid[playerid] = GetVehicleModel(pvehicleid[playerid]);
	}
	else {
	    pvehicleid[playerid] = 0;
	    pmodelid[playerid] = 0;
	}
	
	if(newstate == PLAYER_STATE_DRIVER)
	{
		if(IsAnOwnableCar(newcar))
		{
		    if(CarInfo[newcar][cOwned]==0)
		    {
		        TogglePlayerControllable(playerid, 0);
		        format(string,sizeof(string),"{FFFFFF}Vozilo: {00C0FF}%s{FFFFFF}, je na prodaji...",CarInfo[newcar][cDescription]);
		        SendClientMessage(playerid, COLOR_BLUE, string);
		        format(string,sizeof(string),"{FFFFFF}Cijena: {FFA1A1}%d{FFFFFF}, ako ga zelis kupit upisi{00C0FF} /v kupi",CarInfo[newcar][cValue]);
		        SendClientMessage(playerid, COLOR_BLUE, string);
		    }
		    if(CarInfo[newcar][cOwned]==1)
		    {
		        format(string,sizeof(string),"{FFFFFF}Vlasnik:{F81414} %s.",CarInfo[newcar][cOwner]);
				SendClientMessage(playerid, COLOR_BLUE, string);
				if(PlayerInfo[playerid][pPcarkey] == vehicle) { }
				else if(PlayerInfo[playerid][pPcarkey2] == vehicle) { }
				else if(PlayerInfo[playerid][pPcarkey3] == vehicle) { }
				else if(PlayerInfo[playerid][pPcarkey4] == vehicle) { }
				else if(PlayerInfo[playerid][pPcarkey5] == vehicle) { }
				else
				{
					if(IsPlayerAdmin(playerid))
					{
					    SendClientMessage(playerid, COLOR_GREY, "Mozes vozit ovo vozilo jer si admin");
					}
                    else
				    {
				    	RemovePlayerFromVehicle(playerid);
				    	SendClientMessage(playerid, COLOR_GREY, "Nemas kljuceve od ovog vozila");
					}
				}
		    }
		}
	}
	
	
	if(newstate == PLAYER_STATE_ONFOOT)
	{
	    if(PlayerKarting[playerid] > 0 && PlayerInKart[playerid] > 0)
		{
		    PlayerInKart[playerid] = 0;
		    KartingPlayers --;
		}
	    if(TransportDuty[playerid] > 0)
		{
		    if(TransportDuty[playerid] == 1)
			{
		        TaxiDrivers -= 1;
			}
			else if(TransportDuty[playerid] == 2)
			{
			    BusDrivers -= 1;
			}
			TransportDuty[playerid] = 0;
			format(string, sizeof(string), "* Vi ste sada van duznosti,zarada: $%d.", TransportMoney[playerid]);
			SendClientMessage(playerid, COLOR_WHITE, string);
			SafeJB_GivePlayerMoney(playerid, TransportMoney[playerid]);
		 	TransportValue[playerid] = 0; TransportMoney[playerid] = 0;
		}
		

		
		if(TransportCost[playerid] > 0 && TransportDriver[playerid] < 999)
		{
		    if(IsPlayerConnected(TransportDriver[playerid]))
			{
			    TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
			    TransportTime[TransportDriver[playerid]] = 0;
			    TransportCost[TransportDriver[playerid]] = 0;
			    format(string, sizeof(string), "~w~Voznja kosta~n~~r~$%d",TransportCost[playerid]);
			    GameTextForPlayer(playerid, string, 5000, 1);
			    format(string, sizeof(string), "~w~Putnik je napustio Taxi~n~~g~Zarada $%d",TransportCost[playerid]);
			    GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
				SafeJB_GivePlayerMoney(playerid, -TransportCost[playerid]);
				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
	{
	    new name[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, name, sizeof(name));
	    new vehicleid = GetPlayerVehicleID(playerid);
	    for(new i = 0; i < MAX_PLAYERS; i++)
	    {
	        if(IsPlayerConnected(i))
	        {
	            if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
	            {
	                if(GetPlayerMoney(playerid) < TransportValue[i])
	                {
	                    format(string, sizeof(string), "* Trebas $%d za ulaz.", TransportValue[i]);
						SendClientMessage(playerid, COLOR_WHITE, string);
						RemovePlayerFromVehicle(playerid);
	                }
	                else
	                {
	                    if(TransportDuty[i] == 1)
	                    {
	                        format(string, sizeof(string), "* Platio si $%d vozacu Taxi-ja.", TransportValue[i]);
							SendClientMessage(playerid, COLOR_WHITE, string);
							format(string, sizeof(string), "* Putnik %s je usao u vas Taxi.", name);
							SendClientMessage(i, COLOR_WHITE, 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), "* Platio si $%d vozacu Bus-a.", TransportValue[i]);
							SendClientMessage(playerid, COLOR_WHITE, string);
							format(string, sizeof(string), "* Putnik %s je usao u vas Bus.", name);
							SendClientMessage(i, COLOR_WHITE, string);
	                    }
						SafeJB_GivePlayerMoney(playerid, - TransportValue[i]);
						TransportMoney[i] += TransportValue[i];
	                }
	            }
	        }
	    }
	}
	if(newstate == PLAYER_STATE_WASTED)
	{
		if(WantedLevel[playerid] >= 1)
		{
		    new price = WantedLevel[playerid] * 4000;
			new count;
			for(new i = 0; i < MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
				    if(gTeam[i] == 2 && CrimInRange(30.0, playerid,i))
				    {
						count = 1;
						format(string, sizeof(string), "~w~Running Suspect~r~Killed~n~Bonus~g~$%d", price);
						GameTextForPlayer(i, string, 5000, 1);
						ConsumingMoney[i] = 1;
						SafeJB_GivePlayerMoney(i, price / 2);
						PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0);
					}
				}
			}
			if(count == 1)
			{
				SafeJB_GivePlayerMoney(playerid, - price);
				PlayerInfo[playerid][pWantedDeaths] += 1;
				PlayerInfo[playerid][pJailed] = 1;
			    PlayerInfo[playerid][pJailTime] = (WantedLevel[playerid])*(600);
			    format(string, sizeof(string), "* You are in Jail for %d Seconds and lose $%d because of running away and getting shot by the Officer.", PlayerInfo[playerid][pJailTime], price);
			    SendClientMessage(playerid, COLOR_LIGHTRED, string);
			    WantedPoints[playerid] = 0;
				WantedLevel[playerid] = 0;
			}
		}
	}
	if(newstate == PLAYER_STATE_DRIVER) //buggy dont finnish
	{// 38 / 49 / 56 = SS
		new oldcar = gLastCar[playerid];
		new housecar = PlayerInfo[playerid][pPhousekey]+1;
		TelePos[playerid][0] = 0.0;
		TelePos[playerid][1] = 0.0;
			if(IsAPlane(newcar))
		{
		    if(PlayerInfo[playerid][pFlyLic] < 1)
			{
			    if(TakingLesson[playerid] == 1) { }
			    else {
			    SendClientMessage(playerid, COLOR_GREY, "   Vi ne znate kako da letite,zato ste napustili avion !"); }
			}
		}
		else
		{
			if(PlayerInfo[playerid][pCarLic] < 0)
			{
			    if(PlayerDrunk[playerid] >= 5)
				{
				    WantedPoints[playerid] += 1;
					SetPlayerCriminal(playerid,255, "Vozite pijani");
				}

			}
			else if(PlayerDrunk[playerid] >= 5)
			{
			    WantedPoints[playerid] += 1;
				SetPlayerCriminal(playerid,255, "Vozite pijani");
			}

			if(PlayerInfo[playerid][pCarLic] < 1)
			{
			    {
					if(TakingLesson[playerid] == 1) { }
					else {
					SendClientMessage(playerid, COLOR_GRAD2, "   {FFAF00}Niste jos polozili vozacku, vozite pazljivo i pazite na policiju");
	              }
				}
			}
		}
		if(newcar == CopCar[0] || newcar == CopCar[1] || newcar == CopCar[2] || newcar == CopCar[3] || newcar == CopCar[4] || newcar == CopCar[5] || newcar == CopCar[6] || newcar == CopCar[7] || newcar == CopCar[8] || newcar == CopCar[9] || newcar == CopCar[10] || newcar == CopCar[11] || newcar == CopCar[12] || newcar == CopCar[13] || newcar == CopCar[14] || newcar == CopCar[15] || newcar == CopCar[16] || newcar == CopCar[17]|| newcar == CopCar[18]|| newcar == CopCar[19])
		{
			if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1){ }
			else
			{
			    format(string, sizeof(string), "~b~PD");
                GameTextForPlayer(playerid, string, 3000, 5);
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1);
			}
		}



		if(newcar == FbiCar[0] || newcar == FbiCar[1] || newcar == FbiCar[2] || newcar == FbiCar[3] || newcar == FbiCar[4] || newcar == FbiCar[5] || newcar == FbiCar[6] || newcar == FbiCar[7] || newcar == FbiCar[8] || newcar == FbiCar[9] || newcar == FbiCar[10] || newcar == FbiCar[11] || newcar == FbiCar[12])
		{
			if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2){ }
			else
			{
			    format(string, sizeof(string), "~b~FBI");
                GameTextForPlayer(playerid, string, 3000, 5);
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1);
			}
		}

		if(newcar == MdCar[0] || newcar == MdCar[1] || newcar == MdCar[2] || newcar == MdCar[3] || newcar == MdCar[4] || newcar == MdCar[5] || newcar == MdCar[6] || newcar == MdCar[7] || newcar == MdCar[8] || newcar == MdCar[9] || newcar == MdCar[10] || newcar == MdCar[11] || newcar == MdCar[12] || newcar == MdCar[13] || newcar == MdCar[14] || newcar == MdCar[15])
		{
			if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4){ }
			else
			{
			    format(string, sizeof(string), "~b~BOLNICA");
                GameTextForPlayer(playerid, string, 3000, 5);
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1);
			}
		}



		if(newcar == LcnCar[0] || newcar == LcnCar[1] || newcar == LcnCar[2] || newcar == LcnCar[3] || newcar == LcnCar[4] || newcar == LcnCar[5] || newcar == LcnCar[6] || newcar == LcnCar[7] || newcar == LcnCar[8] || newcar == LcnCar[9] || newcar == LcnCar[10] || newcar == LcnCar[11] || newcar == LcnCar[12] || newcar == LcnCar[13] || newcar == LcnCar[14] || newcar == LcnCar[15] || newcar == LcnCar[16] || newcar == LcnCar[17]|| newcar == LcnCar[18]|| newcar == LcnCar[19]|| newcar == LcnCar[20])
		{
			if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5){ }
			else
			{
			    format(string, sizeof(string), "~b~LCN");
                GameTextForPlayer(playerid, string, 3000, 5);
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1);
			}
		}
		
		
		if(newcar == YakCar[0] || newcar == YakCar[1] || newcar == YakCar[2] || newcar == YakCar[3] || newcar == YakCar[4] || newcar == YakCar[5] || newcar == YakCar[6] || newcar == YakCar[7] || newcar == YakCar[8] || newcar == YakCar[9] || newcar == YakCar[10] || newcar == YakCar[11] || newcar == YakCar[12] || newcar == YakCar[13] || newcar == YakCar[14] || newcar == YakCar[15] || newcar == YakCar[16] || newcar == YakCar[17]|| newcar == YakCar[18]|| newcar == YakCar[19])
		{
			if(PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6){ }
			else
			{
			    format(string, sizeof(string), "~b~YAKUZA");
                GameTextForPlayer(playerid, string, 3000, 5);
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1);
			}
		}

		if(newcar == HitCar[0] || newcar == HitCar[1] || newcar == HitCar[2] || newcar == HitCar[3] || newcar == HitCar[4] || newcar == HitCar[5] || newcar == HitCar[6] || newcar == HitCar[7] || newcar == HitCar[8] || newcar == HitCar[9] || newcar == HitCar[10] || newcar == HitCar[11] || newcar == HitCar[12] || newcar == HitCar[13] || newcar == HitCar[14] || newcar == HitCar[15] || newcar == HitCar[16])
		{
			if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8){ }
			else
			{
			    format(string, sizeof(string), "~b~HITMAN");
                GameTextForPlayer(playerid, string, 3000, 5);
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1);
			}
		}
		
		if(newcar == CnnCar[0] || newcar == CnnCar[1] || newcar == CnnCar[2] || newcar == CnnCar[3] || newcar == CnnCar[4] || newcar == CnnCar[5] || newcar == CnnCar[6] || newcar == CnnCar[7] || newcar == CnnCar[8] || newcar == CnnCar[9] || newcar == CnnCar[10])
		{
			if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9){ }
			else
			{
			    format(string, sizeof(string), "~b~CNN");
                GameTextForPlayer(playerid, string, 3000, 5);
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1);
			}
		}
		
				if(newcar == TaxiCar[0] || newcar == TaxiCar[1] || newcar == TaxiCar[2] || newcar == TaxiCar[3] || newcar == TaxiCar[4] || newcar == TaxiCar[5] || newcar == TaxiCar[6] || newcar == TaxiCar[7] || newcar == TaxiCar[8] || newcar == TaxiCar[9] || newcar == TaxiCar[10] || newcar == TaxiCar[11] || newcar == TaxiCar[12] || newcar == TaxiCar[13] || newcar == TaxiCar[14] || newcar == TaxiCar[15])
		{
			if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10){ }
			else
			{
			    format(string, sizeof(string), "~b~TAXI");
                GameTextForPlayer(playerid, string, 3000, 5);
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1);
			}
		}
		
		if(newcar == GpfCar[0] || newcar == GpfCar[1] || newcar == GpfCar[2] || newcar == GpfCar[3] || newcar == GpfCar[4] || newcar == GpfCar[5] || newcar == GpfCar[6] || newcar == GpfCar[7] || newcar == GpfCar[8] || newcar == GpfCar[9] || newcar == GpfCar[10] || newcar == GpfCar[11] || newcar == GpfCar[12])
		{
			if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11){ }
			else
			{
			    format(string, sizeof(string), "~b~GSF");
                GameTextForPlayer(playerid, string, 3000, 5);
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1);
			}
		}
		
		if(newcar == BalCar[0] || newcar == BalCar[1] || newcar == BalCar[2] || newcar == BalCar[3] || newcar == BalCar[4] || newcar == BalCar[5] || newcar == BalCar[6] || newcar == BalCar[7] || newcar == BalCar[8] || newcar == BalCar[9] || newcar == BalCar[10] || newcar == BalCar[11] || newcar == BalCar[12] || newcar == BalCar[13] || newcar == BalCar[14] || newcar == BalCar[15] || newcar == BalCar[16])
		{
			if(PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12){ }
			else
			{
			    format(string, sizeof(string), "~b~BALLAS");
                GameTextForPlayer(playerid, string, 3000, 5);
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1);
			}
		}
		
	
		if(newcar == NrCar[0] || newcar == NrCar[1] || newcar == NrCar[2] || newcar == NrCar[3] || newcar == NrCar[4] || newcar == NrCar[5] || newcar == NrCar[6] || newcar == NrCar[7] || newcar == NrCar[8] || newcar == NrCar[9] || newcar == NrCar[10] || newcar == NrCar[11] || newcar == NrCar[12] || newcar == NrCar[13] || newcar == NrCar[14] || newcar == NrCar[15] || newcar == NrCar[16])
		{
			if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13){ }
			else
			{
			    format(string, sizeof(string), "~b~NR");
                GameTextForPlayer(playerid, string, 3000, 5);
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1);
			}
		}
		if(newcar == BMauta[0] || newcar ==  BMauta[1] || newcar ==  BMauta[2] || newcar ==  BMauta[3] || newcar ==  BMauta[4] || newcar ==  BMauta[5] || newcar ==  BMauta[6] || newcar ==  BMauta[7])
		{
			if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14){ }
			else
			{
			    format(string, sizeof(string), "~b~Balkan Mafia");
                GameTextForPlayer(playerid, string, 3000, 5);
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1);
			}
		}

		

		if(oldcar != 301)
		{
			if((housecar != oldcar && oldcar != 0) && (HireCar[playerid] != oldcar && newcar != housecar))
			{
				if(gLastDriver[oldcar] == playerid && oldcar != newcar)
				{
					gLastDriver[oldcar] = 300;
					gCarLock[oldcar] = 0;
					UnLockCar(oldcar);
				}
			}
		}
		gLastCar[playerid] = newcar;
		gLastDriver[newcar] = playerid;
	}
	if(newstate == PLAYER_STATE_SPAWNED)
	{
		new Float: lwx, Float:lwy, Float:lwz;
		GetPlayerPos(playerid, lwx, lwy, lwz);
		if((lwz > 530.0 && PlayerInfo[playerid][pInt] == 0) || PlayerToPoint(1000.0, playerid, -1041.9,-1868.4,79.1)) //the highest land point in sa = 526.8
		{
			SetPlayerSpawn(playerid);
		}
		if(WantedPoints[playerid] > 0)
		{
		    new dstring[128];
			new wanted = WantedPoints[playerid];
			new diecash = 0;
		    while(WantedPoints[playerid] > 0)
		    {
		        diecash += 500;
		        WantedPoints[playerid] --;
		    }
		    format(dstring, sizeof(dstring), "You lost $%d for dieing with %d Wanted Points.", diecash, wanted);
		    SendClientMessage(playerid, COLOR_YELLOW, dstring);
		    SafeJB_GivePlayerMoney(playerid, - diecash);
		    PlayerInfo[playerid][pWantedDeaths] += 1;
		}

		WantedPoints[playerid] = 0;
		WantedLevel[playerid] = 0;
		if(PlayerInfo[playerid][pDonateRank] > 0) { SetPlayerHealth(playerid, 100.0); }
		else { SetPlayerHealth(playerid, 50.0+PlayerInfo[playerid][pSHealth]); }
		MedicBill[playerid] = 1;
		TelePos[playerid][0] = 0.0;
		TelePos[playerid][1] = 0.0;
		gPlayerSpawned[playerid] = 1;
		SafeTime[playerid] = 60;
	}

	
			if(IsAVozilovoz(newcar))
		{
			if(PlayerInfo[playerid][pJob] == 15)
			{
			    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Komande: /vlak");
			}
			else {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREY, "Nisi vlakovodja");}
		}
	
	
		if(IsAFarmer(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 1)
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Komande: /oranje /vrsenje /mlijeko");

			}
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, COLOR_GREY,"Niste farmer.");}
		}
	
			if(IsAKosac(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 4)
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Komande: /kosi");

			}
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, COLOR_GREY,"Niste kosac trave");}
		}
	
				if(IsAPilot(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 5)
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Komande: /leti");

			}
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, COLOR_GREY,"Niste pilot.");}
		}
		
		if(IsASweeper(newcar))
		{
	    if(PlayerInfo[playerid][pJob] == 6)
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Komande: /cisti");

			}
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, COLOR_GREY,"Nisi cistac ulica");}
		}
		if(IsATowcar(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 7)
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Komande: /refill /repair /tow");

			}
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, COLOR_GREY,"Nisi mehanicar");}
		}
		
				if(IsANafta(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 9)
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Komande: /nafta");

			}
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, COLOR_GREY,"Niste vozac nafte");}
		}
				if(IsABus(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 10)
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Komande: /linija /fare");

			}
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, COLOR_GREY,"Niste vozac busa.");}
		}
				if(IsAPizzabike(newcar))
		{
		if(PlayerInfo[playerid][pJob] == 11)
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Komande: /pizza");

			}
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, COLOR_GREY,"Niste pizza boy");}
		}
		
				if(IsASmetlar(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 12)
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Komande: /smece");

			}
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, COLOR_GREY,"Niste smetlar");}
		}
		if(IgracNosiKacigu[playerid] == 1)
		{
			RemovePlayerAttachedObject(playerid, SLOT);
		}

		if(IsABike(newcar))
	    {
		if(PlayerInfo[playerid][pImaKacigu] == 1)
		{
		SetPlayerAttachedObject(playerid, SLOT, 18645, 2, HelmetPos[skin][0], HelmetPos[skin][1], HelmetPos[skin][2], HelmetPos[skin][3], HelmetPos[skin][4], HelmetPos[skin][5]);IgracNosiKacigu[playerid]++;

		    }
			if(PlayerInfo[playerid][pImaKacigu] == 2)
		{

		IgracNosiKacigu[playerid]++;
		SetPlayerAttachedObject(playerid, SLOT, 18976, 2, HelmetPos[skin][0], HelmetPos[skin][1], HelmetPos[skin][2], HelmetPos[skin][3], HelmetPos[skin][4], HelmetPos[skin][5]);

		    }
				if(PlayerInfo[playerid][pImaKacigu] == 3)
		{

		IgracNosiKacigu[playerid]++;
		SetPlayerAttachedObject(playerid, SLOT, 18977, 2, HelmetPos[skin][0], HelmetPos[skin][1], HelmetPos[skin][2], HelmetPos[skin][3], HelmetPos[skin][4], HelmetPos[skin][5]);

		    }
			if(PlayerInfo[playerid][pImaKacigu] == 4)
		{

		 IgracNosiKacigu[playerid]++;
		SetPlayerAttachedObject(playerid, SLOT, 18978, 2, HelmetPos[skin][0], HelmetPos[skin][1], HelmetPos[skin][2], HelmetPos[skin][3], HelmetPos[skin][4], HelmetPos[skin][5], 1.2, 1.2, 1.2);

		    }
				if(PlayerInfo[playerid][pImaKacigu] == 5)
		{

		 IgracNosiKacigu[playerid]++;
		SetPlayerAttachedObject(playerid, SLOT, 18979, 2, HelmetPos[skin][0], HelmetPos[skin][1], HelmetPos[skin][2], HelmetPos[skin][3], HelmetPos[skin][4], HelmetPos[skin][5]);

		    }
		}
	


if(IsARentcar(newcar))
		{
		  if (HireCar[playerid] != newcar)
			{
			format(string, sizeof(string), "~w~Mozete da iznajmite ovo vozilo~n~Kosta:~g~$200~n~~w~Da iznajmite, ukucajte ~g~/rentcar~w~~n~da izadjete ~r~/exit");
				TogglePlayerControllable(playerid, 0);
				GameTextForPlayer(playerid, string, 5000, 3);
		}
		}
		
		
		
		if(IsAMotorcar(newcar))
		{
		  if (HireCar[playerid] != newcar)
			{
				format(string, sizeof(string), "~w~Mozete da iznajmite ovo vozilo~n~Kosta:~g~$150~n~~w~Da iznajmite, ukucajte ~g~/rentmotor~w~~n~da izadjete ~r~/exit");
				TogglePlayerControllable(playerid, 0);
				GameTextForPlayer(playerid, string, 5000, 3);
		}
		}
		
		
		
		
	return 1;
}
onplayerentervehicle:


Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{

	if(!ispassenger)
	{
		foreach(Player, i)
		{
		    if(GetPlayerVehicleID(i) == vehicleid && GetPlayerState(i) == PLAYER_STATE_DRIVER)
		    {
	     		new Float:Poz[3];
	       		GetPlayerPos(playerid, Poz[0], Poz[1], Poz[2]);
		        SetPlayerPos(playerid, Poz[0], Poz[1]+2, Poz[2]+0.5);
		        SendClientMessage(playerid, COLOR_RED, "CMD:{FFAF00} Ne mozete ukrasti vozilo dok je neko drugi u njemu!");
		        return 1;
		    }
		}
  }



	if(gTeam[playerid] >= 3)
	{
		if (IsACopCar(vehicleid) && !ispassenger)
		{
			if(PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pLeader]==3) {}
		    else { WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Pocino si kradju policiskog vozila, sada te policija trazi"); }
		}
		if (IsAnAmbulance(vehicleid) && !ispassenger)
		{
		    if(PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4) { }
		    else { WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Pocino si kradju bolnickog vozila, sada te policija trazi"); }
		}
	}
	
 if(IsAnOwnableCar(vehicleid) && CarInfo[vehicleid][cLock] == 1 && CarInfo[vehicleid][cOwned] == 1)
	{
		if(IsPlayerAdmin(playerid)) { }
		else
		{
			new Float:cx, Float:cy, Float:cz;
  			GetPlayerPos(playerid, cx, cy, cz);
    		SetPlayerPos(playerid, cx, cy, cz);
		}
	}
	
	
	return 1;
}



Re: I need HELP - JhnzRep - 09.06.2012

EDIT:OnPlayerStateChange or OnPlayerEnterVehicle code please.


Re: car bug - jamax - 09.06.2012

there