Jump to content

Question

Posted

Am un cod pentru pornirea motorului dar cand pornesc motorul se aprind si luminile iar eu le vreau separat, cand apas pe tasta 2 sa porneasca/opreasca motorul iar pe CTRL sa pornesc/opresc luminile

if(newkeys & KEY_SUBMISSION) //Number 2 or + in your keyboard.
	{
	    if(IsPlayerInAnyVehicle(playerid)) // If the player is in any vehicle (I should have done this to state driver but anyways).
	    {
     		new engine, lights, alarm, doors, bonnet, boot, objective; // Variables to store the status.
    		new vid = GetPlayerVehicleID(playerid); // We need to get players vehicle to get the params.
    		GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective); // We need to get vehicle params in order to change them.
			if(engine == 0) // If engine is OFF the code below turns on the engine.
			{
			    SetVehicleParamsEx(vid,1,1,alarm,doors,bonnet,boot,objective);
			    SendClientMessage(playerid,-1,"You turned ON your vehicle engine and lights.");
				return 1;
			}
			else if(engine == 1) // If the engine is ON so we turn it off.
			{
   				SetVehicleParamsEx(vid,0,0,alarm,doors,bonnet,boot,objective);
			    SendClientMessage(playerid,-1,"You turned OFF your vehicle engine and lights.");
				return 1;
			}
			else if(engine == -1) // If the params are unset let's take a example when you spawn a car as admin.
			{
			    SetVehicleParamsEx(vid,1,1,alarm,doors,bonnet,boot,objective);
			}
		}
	}

Multumesc de ajutor .

5 answers to this question

Recommended Posts

  • 0
Posted

Stiu ce acel site, m-am uitat acolo problema este ca nu imi dau seama cum sa separ "motorul" de lumini, adica cand pornesc motorul se aprind si luminile iar eu nu vreau asa, vreau motorul pe cifra 2 iar luminile pe CTRL . :) Multumesc celor ce isi rapesc putin timp sa-mi explice/ajute .

  • 0
Posted
On 17.01.2017 at 4:02 AM, Tudo said:

if(engine == 0) // If engine is OFF the code below turns on the engine. { SetVehicleParamsEx(vid,1,1,alarm,doors,bonnet,boot,objective);

aici este greseala ta.

SetVehicleParamsEx(vid,1,0,alarm,doors,bonnet,boot,objective);

 

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.