SA-MP Forums Archive
lock vehicle - 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: lock vehicle (/showthread.php?tid=654343)



lock vehicle - enzulikeS - 26.05.2018

Код:
else if(CheckPlayerDistanceToVehicle(5.0, playerid, masinaInchiriata[playerid] == 0))
			{
				new carid = masinaInchiriata[playerid];
				if(gCarLock[carid] == 0)
				{
					new vehicles = GetVehicleModel(carid) - 400;
					format(string, sizeof(string), "~h~%s~n~~r~Locked", aVehicleNames[vehicles]);
					GameTextForPlayer(playerid, string, 5000, 3);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					gCarLock[carid] = 1;
					GetVehicleParamsEx(carid, engine, lights, alarm, doors, bonnet, boot, objective);
					SetVehicleParamsEx(carid, engine, lights, alarm, 1, bonnet, boot, objective);
					return 1;
				}
				else if(masinaInchiriata[playerid] == 1)
				{
					new vehicles = GetVehicleModel(carid) - 400;
					format(string, sizeof(string), "~h~%s~n~~g~Unlocked", aVehicleNames[vehicles]);
				    GameTextForPlayer(playerid, string, 5000, 3);
					PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					gCarLock[carid] = 0;
	    			GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
	      	    	SetVehicleParamsEx(carid,engine,lights,alarm,0,bonnet,boot,objective);
		            return 1;
				}
			}
this is for KEY_NO, why the car is not locking / unlocking?