Oko vozila

Započeo RoninTheGreat, Maj 03, 2020, 21:41:45 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Problem(error/warning): Kada udjem u vozilo bilo koje a da nije rent igrac se automatski zaledi i onda ja kad ukucam /unfreeze onda mogu da vozim , takodje kad izadjem iz vozila ono nestane samo tj vrati se na na spawn point
Dio skripte: [ pawn ][ /pawn ]
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [ code ][ /code ]
Slika/video ingame problema(obavezno ako je ingame problem): //

Daj OnPlayerEnterVehicle ili OnPlayerStateChange

Citat: V01D poslato Maj 03, 2020, 22:20:28 POSLE PODNE
Daj OnPlayerEnterVehicle ili OnPlayerStateChange
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
   new modelvozila = GetPlayerVehicleModel(playerid);
   if(!ispassenger)
   {
      foreach(Player, i)
      {
          if(GetPlayerVehicleID(i) == vehicleid && GetPlayerState(i) == PLAYER_STATE_DRIVER)
          {
               ClearAnimations(playerid);
                new Float:cx, Float:cy, Float:cz;
               GetPlayerPos(playerid, cx, cy, cz);
               SetPlayerPos(playerid, cx, cy, cz);
               ClearAnimations(playerid);ClearAnimations(playerid);ClearAnimations(playerid);
                 SendClientMessage(playerid, COLOR_RED, "{FFFF11}| OldCity | {FF0000}Ne mozes krasti drugim igracima vozilo!");
                  return 1;
          }
      }
     }

Citat: V01D poslato Maj 03, 2020, 22:20:28 POSLE PODNE
Daj OnPlayerEnterVehicle ili OnPlayerStateChange
public OnPlayerStateChange(playerid, newstate, oldstate)
{
   new string[256];
   new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
   new vehicle = GetPlayerVehicleID(playerid);
   if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_PASSENGER)

Nista neuobicajeno, posalji ceo OnPlayerStateChange, i takodje posalji OnPlayerExitVehicle, ali ceo. Takodje koristi

Neki Kod;


[ pawn ]Bez razmaka![ /pawn ]

Kada nam vec forum pruza tu mogucnost :D


Citat: V01D poslato Maj 04, 2020, 15:11:26 POSLE PODNE
Nista neuobicajeno, posalji ceo OnPlayerStateChange, i takodje posalji OnPlayerExitVehicle, ali ceo. Takodje koristi

Neki Kod;


[ pawn ]Bez razmaka![ /pawn ]

Kada nam vec forum pruza tu mogucnost :D

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new string[256];
	new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
	new vehicle = GetPlayerVehicleID(playerid);
	if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_PASSENGER)

Dobro, ucimo polako xDDD

Kao sto rekoh, posalji ceo :D

Citat: V01D poslato Maj 04, 2020, 15:11:26 POSLE PODNE
Nista neuobicajeno, posalji ceo OnPlayerStateChange, i takodje posalji OnPlayerExitVehicle, ali ceo. Takodje koristi

Neki Kod;


[ pawn ]Bez razmaka![ /pawn ]

Kada nam vec forum pruza tu mogucnost :D

public OnPlayerExitVehicle(playerid, vehicleid)
{
	TextDrawHideForPlayer(playerid, imevozila[playerid]);
	TextDrawHideForPlayer(playerid, cijenavozila[playerid]);
	TextDrawHideForPlayer(playerid, registracijavozila[playerid]);



  	
	if(GetPlayerState(playerid) == 1)
	{
		return 1;
	}
	if(gGas[playerid] == 1)
	{
	    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Je napustio auto", 500, 3);
	}
	return 1;
}

Citat: V01D poslato Maj 04, 2020, 15:19:12 POSLE PODNE
Dobro, ucimo polako xDDD

Kao sto rekoh, posalji ceo :D

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new string[256];
	new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
	new vehicle = GetPlayerVehicleID(playerid);
	if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_PASSENGER)
	{
		if(RadioOffOn[playerid] != 0)
		{
			StopAudioStreamForPlayer(playerid);
			return 1;
		}
	}
	if(newstate == PLAYER_STATE_PASSENGER)
	{
	    if (vehicle == OCTeam[0] || vehicle == OCTeam[1] || vehicle == OCTeam[12])
	    {
            SetPlayerPos(playerid, 2022.0273, 2235.2402, 2103.9536);
            SetPlayerTime(playerid, 00,00);
			SetPlayerFacingAngle(playerid, 0);
            SetCameraBehindPlayer(playerid);
            SetPlayerInterior(playerid, 1);
			TogglePlayerControllable(playerid,0);
			SetTimerEx("Ucitavanje",1000,false,"i",playerid);
            Timer1[playerid] = SetTimerEx("HornA", 60000, 1, "i", playerid);
            Timer2[playerid] = SetTimerEx("HornB", 60500, 1, "i", playerid);
            Timer3[playerid] = SetTimerEx("STime", 60000, 1, "i", playerid);
	        IsInBus[playerid] = vehicle;
	    }
	}
	if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
	{
		if(HireCar[playerid] != 299 || Rentano[playerid] != 299 || RentanoBiciklo[playerid] != 299 ) return unrenttimer = SetTimerEx("RespawnujRent",595000,false, "i", playerid);
	}
	if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
	{
		if(vehicle == HireCar[playerid] || vehicle == Rentano[playerid] || vehicle == RentanoBiciklo[playerid]) return KillTimer(unrenttimer);
	}

	if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_PASSENGER)
	{
		if(RadioOffOn[playerid] != 0)
		{
			StopAudioStreamForPlayer(playerid);
			return 1;
		}
	}
	if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid) && !IsAPlane(vehicle) && !IsAKosacAuto(vehicle) && !IsASweeper(vehicle))
	{
		SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
		SetTimerEx("engine2", 2500, false, "ii", playerid);
	}
	else if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid) && !IsAPlane(vehicle) && !IsAKosacAuto(vehicle) && !IsASweeper(vehicle))
	{
		SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
		SetTimerEx("engine2", 2500, false, "ii", playerid);
	}

	if(newstate == PLAYER_STATE_ONFOOT)
	{
	    if(TransportDuty[playerid] > 0)
		{
		    if(TransportDuty[playerid] == 1)
			{
		        TaxiDrivers -= 1;
			}
			else if(TransportDuty[playerid] == 2)
			{
			    BusDrivers -= 1;
			}
			TransportDuty[playerid] = 0;
			format(string, sizeof(string), "* Vise niste na duznosti i zaradili ste $%d.", TransportMoney[playerid]);
			SendClientMessage(playerid, COLOR_WHITE, string);
			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~Zaradili ste $%d",TransportCost[playerid]);
			    GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
				GivePlayerMoney(playerid, -TransportCost[playerid]);
				TransportCost[playerid] = 0;
				TransportTime[playerid] = 0;
				TransportDriver[playerid] = 999;
			}
		}
		TelePos[playerid][0] = 0.0;
		TelePos[playerid][1] = 0.0;
	}


ja mislim da je to to

if (vehicle == OCTeam[0] || vehicle == OCTeam[1] || vehicle == OCTeam[12])
	    {
            SetPlayerPos(playerid, 2022.0273, 2235.2402, 2103.9536);
            SetPlayerTime(playerid, 00,00);
			SetPlayerFacingAngle(playerid, 0);
            SetCameraBehindPlayer(playerid);
            SetPlayerInterior(playerid, 1);
			TogglePlayerControllable(playerid,0);
			SetTimerEx("Ucitavanje",1000,false,"i",playerid);
            Timer1[playerid] = SetTimerEx("HornA", 60000, 1, "i", playerid);
            Timer2[playerid] = SetTimerEx("HornB", 60500, 1, "i", playerid);
            Timer3[playerid] = SetTimerEx("STime", 60000, 1, "i", playerid);
	        IsInBus[playerid] = vehicle;
	    }


Jedino sto freeza igraca je ovo, ali nema smisla..

Mora imati jos nesto..

Citat: V01D poslato Maj 04, 2020, 15:27:33 POSLE PODNE
if (vehicle == OCTeam[0] || vehicle == OCTeam[1] || vehicle == OCTeam[12])
	    {
            SetPlayerPos(playerid, 2022.0273, 2235.2402, 2103.9536);
            SetPlayerTime(playerid, 00,00);
			SetPlayerFacingAngle(playerid, 0);
            SetCameraBehindPlayer(playerid);
            SetPlayerInterior(playerid, 1);
			TogglePlayerControllable(playerid,0);
			SetTimerEx("Ucitavanje",1000,false,"i",playerid);
            Timer1[playerid] = SetTimerEx("HornA", 60000, 1, "i", playerid);
            Timer2[playerid] = SetTimerEx("HornB", 60500, 1, "i", playerid);
            Timer3[playerid] = SetTimerEx("STime", 60000, 1, "i", playerid);
	        IsInBus[playerid] = vehicle;
	    }


Jedino sto freeza igraca je ovo, ali nema smisla..

Mora imati jos nesto..

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new string[256];
	new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
	new vehicle = GetPlayerVehicleID(playerid);
	if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_PASSENGER)
	{
		if(RadioOffOn[playerid] != 0)
		{
			StopAudioStreamForPlayer(playerid);
			return 1;
		}
	}
	if(newstate == PLAYER_STATE_PASSENGER)
	{
	    if (vehicle == OCTeam[0] || vehicle == OCTeam[1] || vehicle == OCTeam[12])
	    {
            SetPlayerPos(playerid, 2022.0273, 2235.2402, 2103.9536);
            SetPlayerTime(playerid, 00,00);
			SetPlayerFacingAngle(playerid, 0);
            SetCameraBehindPlayer(playerid);
            SetPlayerInterior(playerid, 1);
			TogglePlayerControllable(playerid,0);
			SetTimerEx("Ucitavanje",1000,false,"i",playerid);
            Timer1[playerid] = SetTimerEx("HornA", 60000, 1, "i", playerid);
            Timer2[playerid] = SetTimerEx("HornB", 60500, 1, "i", playerid);
            Timer3[playerid] = SetTimerEx("STime", 60000, 1, "i", playerid);
	        IsInBus[playerid] = vehicle;
	    }
	}
	if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
	{
		if(HireCar[playerid] != 299 || Rentano[playerid] != 299 || RentanoBiciklo[playerid] != 299 ) return unrenttimer = SetTimerEx("RespawnujRent",595000,false, "i", playerid);
	}
	if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
	{
		if(vehicle == HireCar[playerid] || vehicle == Rentano[playerid] || vehicle == RentanoBiciklo[playerid]) return KillTimer(unrenttimer);
	}

	if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_PASSENGER)
	{
		if(RadioOffOn[playerid] != 0)
		{
			StopAudioStreamForPlayer(playerid);
			return 1;
		}
	}
	if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid) && !IsAPlane(vehicle) && !IsAKosacAuto(vehicle) && !IsASweeper(vehicle))
	{
		SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
		SetTimerEx("engine2", 2500, false, "ii", playerid);
	}
	else if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid) && !IsAPlane(vehicle) && !IsAKosacAuto(vehicle) && !IsASweeper(vehicle))
	{
		SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
		SetTimerEx("engine2", 2500, false, "ii", playerid);
	}

	if(newstate == PLAYER_STATE_ONFOOT)
	{
	    if(TransportDuty[playerid] > 0)
		{
		    if(TransportDuty[playerid] == 1)
			{
		        TaxiDrivers -= 1;
			}
			else if(TransportDuty[playerid] == 2)
			{
			    BusDrivers -= 1;
			}
			TransportDuty[playerid] = 0;
			format(string, sizeof(string), "* Vise niste na duznosti i zaradili ste $%d.", TransportMoney[playerid]);
			SendClientMessage(playerid, COLOR_WHITE, string);
			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~Zaradili ste $%d",TransportCost[playerid]);
			    GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
				GivePlayerMoney(playerid, -TransportCost[playerid]);
				TransportCost[playerid] = 0;
				TransportTime[playerid] = 0;
				TransportDriver[playerid] = 999;
			}
		}
		TelePos[playerid][0] = 0.0;
		TelePos[playerid][1] = 0.0;
	}
	//svjetla
	if (newstate == PLAYER_STATE_DRIVER)
	{
	    if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == false)
	    {
			GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
	        UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, encode_lights(1, 1, 1, 1), tires);
   			VehicleLightsOn[GetPlayerVehicleID(playerid)] = false;
	    }
	    else
	    {
			GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
	        UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, encode_lights(0, 0, 0, 0), tires);
         	VehicleLightsOn[GetPlayerVehicleID(playerid)] = true;
		}
	}
	if(newstate == PLAYER_STATE_PASSENGER) // TAXI & BUSSES
	{
	    new name[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, name, sizeof(name));
	    new vehicleid = GetPlayerVehicleID(playerid);
		foreach (Player, i)
		{
            if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
            {
                if(GetPlayerMoney(playerid) < TransportValue[i])
                {
                    format(string, sizeof(string), "* Treba vam $%d da biste usli.", TransportValue[i]);
					SendClientMessage(playerid, COLOR_WHITE, string);
					RemovePlayerFromVehicle(playerid);
                }
                else
                {
                    if(TransportDuty[i] == 1)
                    {
						if(PlayerInfo[playerid][pLevel] > 2)
						{
							format(string, sizeof(string), "* Platili ste $%d taxisti.", 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
						{
							SCM(playerid,-1,"Level ste 1 ne nozete da se vozite taxiem!");
							SCM(i,-1,"Igrac je level 1 i nemoze da se vozi taxiem!");
							RemovePlayerFromVehicle(playerid);
						}
                    }
                    else if(TransportDuty[i] == 2)
                    {
                        format(string, sizeof(string), "* Platili ste $%d vozacu busa.", TransportValue[i]);
						SendClientMessage(playerid, COLOR_WHITE, string);
						format(string, sizeof(string), "* Putnik %s je usao u vas Bus.", name);
						SendClientMessage(i, COLOR_WHITE, string);
                    }
					GivePlayerMoney(playerid, - TransportValue[i]);
					TransportMoney[i] += TransportValue[i];
                }
            }
	    }
	}

/*	if(newstate == PLAYER_STATE_WASTED)
	{
		if(WantedLevel[playerid] >= 1)
		{
		    new price = WantedLevel[playerid] * 500;
			GivePlayerMoney(playerid, - price);
			PlayerInfo[playerid][pWantedDeaths] += 1;
			PlayerInfo[playerid][pJailed] = 1;
		    PlayerInfo[playerid][pJailTime] = (WantedLevel[playerid])*(600);
		    format(string, sizeof(string), "* U zatvoru ste na %d sekundi i izgubili ste $%d jer ste bezali i oboreni ste od strane policajca.", PlayerInfo[playerid][pJailTime], price);
		    SendClientMessage(playerid, COLOR_LIGHTRED, string);
		    WantedPoints[playerid] = 0;
			WantedPoints[playerid] = 0;
		}
 }*/

	if(newstate == PLAYER_STATE_DRIVER)
	{// 38 / 49 / 56 = SS
		new newcar = GetPlayerVehicleID(playerid);
		new oldcar = gLastCar[playerid];
		new housecar = PlayerInfo[playerid][pPhousekey]+1;
		TelePos[playerid][0] = 0.0;
		TelePos[playerid][1] = 0.0;
		new name[256];
		GetPlayerName(playerid, name, sizeof(name));
		new carid = GetPlayerVehicleID(playerid);
  		new modelvozila = GetPlayerVehicleModel(playerid);
		if(IsABoat(modelvozila))
		{
			if(!IsAEvent(carid))
			{
				if(PlayerInfo[playerid][pBoatLic] < 1)
				{
				    SendClientMessage(playerid, COLOR_GREY, "   Ne znate da plovite pa ste napustili brod !");
				    RemovePlayerFromVehicle(playerid);
				    TogglePlayerControllable(playerid, 1);
				}
			}
		}
		else if(IsAPlane(modelvozila))
		{
		    if(PlayerInfo[playerid][pFlyLic] < 1)
			{
			if(PolaganjeAvion[playerid] == 1)
			{
			return 1;
			}
			    if(TakingLesson[playerid] == 1) { }
			    else {
			    SendClientMessage(playerid, COLOR_GREY, "Ne znate da letite pa ste napustili avion/helis!");
			    RemovePlayerFromVehicle(playerid);
				TogglePlayerControllable(playerid, 1); }
			}
		}
		else
		{
			if(PlayerInfo[playerid][pCarLic] < 0)
			{
			    if(PlayerDrunk[playerid] >= 5)
				{
				    WantedPoints[playerid] += 1;
					SetPlayerCriminal(playerid,255, "Voznja u pijanom stanju");
				}

			}
			else if(PlayerDrunk[playerid] >= 5)
			{
			    WantedPoints[playerid] += 1;
				SetPlayerCriminal(playerid,255, "Voznja u pijanom stanju");
			}

			if(PlayerInfo[playerid][pCarLic] < 1)
			{
			    if(IsABike(newcar) || IsAOBike(newcar)) { }
			    else
			    {
					if(TakingLesson[playerid] == 1) { }
					else {
					SendClientMessage(playerid, COLOR_GRAD1, "Nemate vozacku dozvolu i zato pazite kako vozite zbog policije.");
	              }
				}
			}
		} //Done with car check
		if(IsACopCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pMember] == 1) { }
		    else
			{
				RemovePlayerFromVehicle(playerid);
				SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Policije.");
			}
		}
		if(IsAnBiaCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 2) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan BIA-e.");}
		}
		if(IsAnRmCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 17||PlayerInfo[playerid][pMember] == 17) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Ruske Mafije.");}
		}
		if(IsAnBajkeriCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 14||PlayerInfo[playerid][pMember] == 14) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Bajkera.");}
		}
		if(IsNgCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 3||PlayerInfo[playerid][pMember] == 3) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Vojske.");}
		}
		if(IsAGovernmentCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 7 || PlayerInfo[playerid][pMember] == 7)
			{
			}
		    else
			{
		        RemovePlayerFromVehicle(playerid);
		        SendClientMessage(playerid, SIVA, "(Izbacen!) Nemate kljuceve od ovog vozila.");
			}
		}
		else if(IsAnAmbulance(newcar))
		{
		    if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4) { }
		    else { RemovePlayerFromVehicle(playerid); }
		}
		if(IsAHitmanCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 8||PlayerInfo[playerid][pMember] == 8) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Hitmana.");}
		}
		if(IsALcnCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 6||PlayerInfo[playerid][pMember] == 6) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan L.C.N-a.");}
		}
		if(IsAGsfcar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 15 ||PlayerInfo[playerid][pMember] == 15) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan G.S.F-a.");}
		}
		if(IsADilercar(newcar))
		{
            if(PlayerInfo[playerid][pJob] == 4) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Nisi diler droge ovo vozilo mogu voziti samo dileri droge.");}
		}
		if(IsALsurCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 13 ||PlayerInfo[playerid][pMember] == 13) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Los Surenosa.");}
		}
		if(IsAPrivatnaOrg1Car(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 19 ||PlayerInfo[playerid][pMember] == 19) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Privatne Org 1.");}
		}
		if(IsAPrivatnaOrg2Car(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 20 ||PlayerInfo[playerid][pMember] == 20) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Privatne Org 2.");}
		}
		if(IsACRacercar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 14 ||PlayerInfo[playerid][pMember] == 14) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Carbon Racer-a.");}
		}
		if(IsAParkingSCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 18 ||PlayerInfo[playerid][pMember] == 18) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Parking Servisa.");}
		}
		if(IsAMScar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 16||PlayerInfo[playerid][pMember] == 16) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan MS-a");}
		}
		if(IsAGGcar(newcar))
		{
		    if(PlayerInfo[playerid][pAdmin] >= 2) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste Admin");}
		}
		if(IsAYakuzaCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 5||PlayerInfo[playerid][pMember] == 5) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Yakuza.");}
		}
		if(IsABallasCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 12||PlayerInfo[playerid][pMember] == 12) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Ballasa.");}
		}
		if(IsACnnCar(newcar))
		{
			if(PlayerInfo[playerid][pLeader] == 9 || PlayerInfo[playerid][pMember] == 9 ){ }
			else{
            RemovePlayerFromVehicle(playerid);
			SendClientMessage(playerid, SIVA, "(Izbacen!) Nemate kljuceve ovog vozila.");}
		}
		if(IsAnTaxiCar(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 10||PlayerInfo[playerid][pMember] == 10) { }
		    else{
			RemovePlayerFromVehicle(playerid);
		    SendClientMessage(playerid, SIVA, "(Izbacen!) Niste clan Taxi-ja.");}
		        
		}
		if(IsADonatorCar(newcar)) //donatorska auta
		{
		    if(PlayerInfo[playerid][pVip] > 2) { }
		    else{
            RemovePlayerFromVehicle(playerid);
		    SendClientMessage(playerid, SIVA, "(Izbacen!) Morate biti donator da bi mogli vozit ovo auto!");}
		}
		//gigi test rad za smugler car
		if(IsASmuggleCar(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 20) { }
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Nemate kljuceve od ovog vozila.");}
		}
		if(IsAPizzabike(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 17)
			{
			    SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Komanda posla: "svpl"/pduty /sellpizza");
			}
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Nemate kljuceve od ovog motora.");}
		}
		if(IsAPostarvozilo(newcar))
		{
			if(PlayerInfo[playerid][pJob] == 25)
			{
			    SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Komanda posla: "svpl"/posta /ponisti");
			}
			else {
			RemovePlayerFromVehicle(playerid);
			SendClientMessage(playerid, SIVA, "(Izbacen!) Niste zaposlen kao postar!");}
		}
		if(IsAVozilovoz(newcar))
		{
			if(PlayerInfo[playerid][pJob] == 26)
			{
			    SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Komanda posla: "svpl"/Voz");
			}
			else {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, SIVA, "(Izbacen!) Niste zaposlen kao masinovodja!");}
		}
		if(IsABus(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 14)
			{
				SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Komanda posla: "svpl"/fare /bus");
			}
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Nemate kljuceve od ovog busa.");}
		}
		if(IsATowcar(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 7)
			{
			    SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Komanda posla: "svpl"/repair /refill /pduty");
			}
		    else {
	        RemovePlayerFromVehicle(playerid);
	        SendClientMessage(playerid, SIVA, "(Izbacen!) Nemate kljuceve od ovog vozila.");}
		}
		if(IsATruck(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 16)
			{
				format(string, sizeof(string), "Produkti: %d/%d", PlayerHaul[newcar][pLoad],PlayerHaul[newcar][pCapasity]);
				SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
				SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!)Produkte dostavljate po firmama.");
				SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Komanda posla: "svpl"/load /buyprods /sellprods");
			}
			else
			{
	        	RemovePlayerFromVehicle(playerid);
	        	SendClientMessage(playerid, SIVA, "(Izbacen!) Nemate kljuceve od ovog vozila.");
			}
		}
		if(IsASweeper(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 21)
		    {
		        if(PlayerIsSweeping[playerid] == 0)
		        {
		        	TogglePlayerControllable(playerid, 0);
		        	SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Komanda posla: "svpl"/cisti");
				}
				else
				{
				    SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Da zavrsis pisi: "svpl"/ponisti.");
				}
		    }
		    else
		    {
		        RemovePlayerFromVehicle(playerid);
	        	SendClientMessage(playerid, SIVA, "(Izbacen!) Nemate kljuceve od ovog vozila.");
		    }
		}
		if(IsADjubretar(newcar))
		{
		    if(PlayerInfo[playerid][pJob] == 21)
		    {
		        if(PlayerIsCisti[playerid] == 0)
		        {
		        	TogglePlayerControllable(playerid, 0);
		        	SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Komanda posla: "svpl"/kupismece");
				}
				else
				{
				    SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Da zavrsis pisi: "svpl"/ponisti.");
				}
		    }
		    else
		    {
		        RemovePlayerFromVehicle(playerid);
	        	SendClientMessage(playerid, COLOR_GREY,"Nemate kljuceve od ovog vozila.");
		    }
		}
		//---------------
		if(IsARentBiciklo(newcar))
		{
			if (RentanoBiciklo[playerid] == 299)
			{
				format(string,sizeof(string),"{FFFFFF}Ovo se biciklo iznajmljuje.\nDa iznajmite kliknite na {00C0FF}~Rentanje~.\n{FFFFFF}Da napustite vozilo kliknite {00C0FF}~Napusti~.\n{FFFFFF}Cena iznajmljivanja: {00C0FF}%d$.",BiciklRent);
				ShowPlayerDialog(playerid, 43, DIALOG_STYLE_MSGBOX,"{F81414}Auto Rent",string,"Rentanje","Napusti");
				TogglePlayerControllable(playerid, 0);

			}
			else if(RentanoBiciklo[playerid] != newcar)
   			{
                TogglePlayerControllable(playerid, 1);
				RemovePlayerFromVehicle(playerid);
			}
		}
  		if(IsARentCar(newcar))
		{
			if (HireCar[playerid] == 299)
			{
				format(string,sizeof(string),"{FFFFFF}Ovo se vozilo iznajmljuje.\nDa iznajmite kliknite na {00C0FF}~Rentanje~.\n{FFFFFF}Da napustite vozilo kliknite {00C0FF}~Napusti~.\n{FFFFFF}Cena iznajmljivanja: {00C0FF}%d$.",AutoRent);
				ShowPlayerDialog(playerid, 44, DIALOG_STYLE_MSGBOX,"{F81414}Auto Rent",string,"Rentanje","Napusti");
				TogglePlayerControllable(playerid, 0);

			}
			else if(HireCar[playerid] != newcar)
   			{
                TogglePlayerControllable(playerid, 1);
				RemovePlayerFromVehicle(playerid);
			}
			
		}
	 	if(IsARentBike(newcar))
		{
		 	if (Rentano[playerid] == 299)
			{
				format(string,sizeof(string),"{FFFFFF}Ovaj se motor iznajmljuje.\nDa iznajmite kliknite na {00C0FF}~Rentanje~.\n{FFFFFF}Da napustite vozilo kliknite {00C0FF}~Napusti~.\n{FFFFFF}Cena iznajmljivanja: {00C0FF}%d$.",MotorRent);
				ShowPlayerDialog(playerid, 42, DIALOG_STYLE_MSGBOX,"{F81414}Moto Rent",string,"Rentaj","Napusti");
				TogglePlayerControllable(playerid, 0);// Freeza igraca, da ne moze da pobegne
				PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
			}
			else if(Rentano[playerid] != newcar)
   			{
                TogglePlayerControllable(playerid, 1);
				RemovePlayerFromVehicle(playerid);
			}
	  	}
		if(IsAKosacAuto(newcar))
		{
			if(PlayerInfo[playerid][pJob] == 18)
			{
			    if(KosiTravu[playerid] == 0)
			    {
			        SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Komanda posla: "svpl"/kosenje");
			    	TogglePlayerControllable(playerid, 0);
				}
				else
				{
                    SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Da ponistite kosenje: "svpl"/ponisti");
				}
			}
			else
			{
			    SendClientMessage(playerid, SIVA, "(Izbacen!) Nemate kljuceve od ovog vozila!");
			    RemovePlayerFromVehicle(playerid);
			}
		}
		if(IsAFarmerTraktor(newcar))
		{
			if(PlayerInfo[playerid][pJob] == 10)
			{
			    if(RadiKaoFarmer[playerid] == 0)
			    {
			        SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) "svpl"Da zakacite kopacicu morate biti u blizini nje i pritisnuti tipku CTRL");
				}
				else
				{
				}
			}
			else
			{
			    SendClientMessage(playerid, SIVA, "(Izbacen!) Nemate kljuceve od ovog vozila!");
			    RemovePlayerFromVehicle(playerid);
			}
		}
		if(IsAFarmerTraktor(newcar) || IsAFarmerKonbajn(newcar))
		{
			if(PlayerInfo[playerid][pJob] == 10)
			{
			    if(RadiKaoFarmer[playerid] == 0)
			    {
			        SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Komanda posla: "svpl"/oranje /vrsenje /prekiniposao");
			    	TogglePlayerControllable(playerid, 0);
				}
				else
				{
                    SendClientMessage(playerid, WHITE, "("svpl"Pomoc{FFFFFF}!) Da ponistite posao na farmi: "svpl"/ponisti");
				}
			}
			else
			{
			    SendClientMessage(playerid, SIVA, "(Izbacen!) Nemate kljuceve od ovog vozila!");
			    RemovePlayerFromVehicle(playerid);
			}
		}
		if(oldcar != 330)
		{
			if((housecar != oldcar && oldcar != 0) && (HireCar[playerid] != oldcar && newcar != housecar))
			{
				if(gLastDriver[oldcar] == playerid && oldcar != newcar)
				{
					gLastDriver[oldcar] = 329;
					gCarLock[oldcar] = 0;
					UnLockCar(oldcar);
				}
			}
		}
	}
	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(WantedLevel[playerid] > 0)
		{
		    new dstring[128];
			new wanted = WantedLevel[playerid];
			new diecash = 0;
		    while(WantedLevel[playerid] > 0)
		    {
		        diecash += 500;
		        WantedLevel[playerid] --;
		    }
		    format(dstring, sizeof(dstring), "Izgubili ste $%d zbog umiranja sa %d Wanted Poena/om.", diecash, wanted);
		    SendClientMessage(playerid, COLOR_YELLOW, dstring);
		    GivePlayerMoney(playerid, - diecash);
		    PlayerInfo[playerid][pWantedDeaths] += 1;
		}
		if(PlayerOnMission[playerid] > 0)
		{
			GameTextForPlayer(playerid, "~r~Misija je izgubljena", 5000, 3);
			PlayerOnMission[playerid] = 0;
		    PlayerInfo[playerid][pMissionNr] = 0;
		}
		WantedPoints[playerid] = 0;
		WantedPoints[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;
	}
	return 1;
}


evo izvuko sam sve sto je bilo vezano za OnPlayerStateChange ispod toga nema vise nista

Imaš dvije opcije:
1) Napraviš globalnu 'per-player' varijablu u koju češ stavljati vozilo ID svakoga puta kada igrač uđe u neko vozilo, te onda ispod OnPlayerStateChange napraviti provjeru ako mu je old state driver, a novo onfoot i ako je vozilo ID od te varijable bilokoje rent vozilo ID -> Unfreeze.

2) Ispod OnPlayerExitVehicle napraviti provjeru ako je vehicleid bilokoje rent vozilo ID -> Unfreeze.
Citat: CheezItFollow your heart and own style.
Citat: PottusThat is perfectly fine, I'm just pointing out where you made mistakes what does hearing "good job" get you? Absolutely nothing. You need to hear the problems otherwise you'll keep making the same mistakes :)

Citat: ShadowMortar poslato Maj 04, 2020, 15:48:10 POSLE PODNE
Imaš dvije opcije:
1) Napraviš globalnu 'per-player' varijablu u koju češ stavljati vozilo ID svakoga puta kada igrač uđe u neko vozilo, te onda ispod OnPlayerStateChange napraviti provjeru ako mu je old state driver, a novo onfoot i ako je vozilo ID od te varijable bilokoje rent vozilo ID -> Unfreeze.

2) Ispod OnPlayerExitVehicle napraviti provjeru ako je vehicleid bilokoje rent vozilo ID -> Unfreeze.

Nista ja ne kapiram mora mi ti to bolje objasnis

new ZadnjiAutoID[ MAX_PLAYERS ] = { INVALID_VEHICLE_ID, ... };
/*
	Deklariramo varijablu u koju ćemo stavljati ID od vozila svakoga puta kada igrač uđe u jedno
*/
hook OnPlayerEnterVehicle( playerid, vehicleid, ispassenger ) {
	ZadnjiAutoID[ playerid ] = vehicleid;
	return ( true );
}

bool:AkoJeZadnjeVoziloRentano( playerid ) {
	/*
		Možeš i sa loopom napraviti ako koristiš arrays
	*/
	if( ZadnjiAutoID[ playerid ] == TvojaVarijablaZaRentanaVozila ) return ( true );
	/*
		for( new i, j = sizeof( RentanaVozila ); i < j; i++ ) {
			if( ZadnjiAutoID[ playerid ] = TvojArrayZaRentanaVozila[ i ] ) return ( true );
		}
	*/
	return ( false );
}

hook OnPlayerStateChange( playerid, newstate, oldstate ) {
	/*
		Radimo provjeru ako je igrač prije nego li je kako bih mogao reči, stao na noge,
		ali prije toga je vozio auto i ako je zadnji ID od vozila rentano vozilo ~ unfreeze
	*/
	if( newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER && AkoJeZadnjeVoziloRentano( playerid ) )
		TogglePlayerSpectating( playerid, true );
	return ( true );
}


// ILI

hook OnPlayerExitVehicle( playerid, vehicleid ) {
	if( AkoJeZadnjeVoziloRentano( playerid ) )
		TogglePlayerSpectating( playerid, true );
	return ( true );
}

Sada ti testiraj koje će ti raditi, inače, prije ako se dobro sječam sam imao problem sa "OnPlayerExitVehicle" pa ti sada vidi.
Citat: CheezItFollow your heart and own style.
Citat: PottusThat is perfectly fine, I'm just pointing out where you made mistakes what does hearing "good job" get you? Absolutely nothing. You need to hear the problems otherwise you'll keep making the same mistakes :)