SA-MP Forums Archive
Car system - 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 system (/showthread.php?tid=648139)



Car system - BanhVo - 16.01.2018

I do a script, I want the car when the proprietor can launch it. Other players can not start when they are not the owner.
Код:
 	
if(newkeys == KEY_NO)
	{
	    if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	    {
		    new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
			vehicleid = GetPlayerVehicleID(playerid);
			if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510 || vehicleid == CrateIslandVehicles[0] || vehicleid == CrateIslandVehicles[1]) return SendClientMessageEx(playerid,COLOR_WHITE,"Lenh nay khong duoc su dung tren chiec xe nay.");
			GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
			if(engine == VEHICLE_PARAMS_ON)
			{
				SetVehicleEngine(vehicleid, playerid);
			}
			else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "Xe dang duoc khoi dong, vui lтng cho doi...");
				SetTimerEx("SetVehicleEngine", 1000, 0, "dd",  vehicleid, playerid);
			}
		}
		return 1;
	}



Re: Car system - andrejc999 - 16.01.2018

Do you have a variable for cars owner?

Because as I understood, if I'm not wrong, you want to check if player is an owner of that specific car?