Jump to content
  • 0

Eroare la motorul masinii


FDH_

Question

Salut. Am postat destul de mult, dar problemele nu se termina. Cu noroc, am avut multe probleme la GM pe care le-am fixat, dar pe asta nu stiu. Am facut un OnPlayerKeyStateChange ca atunci cand apas pe tasta 2, sa se porneasca/opreasca motorul.

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		if(newkeys == KEY_LOOK_BEHIND)
		{
			new vID = GetPlayerVehicleID(playerid),
				tmp_engine,
				tmp_lights,
				tmp_alarm,
				tmp_doors,
				tmp_bonnet,
				tmp_boot,
				tmp_objective;
			GetVehicleParamsEx(vID, tmp_engine, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
			if(tmp_engine == 0)
			{
				tmp_engine = 1;
				new Float:x, Float:y, Float:z;
				new text[128];
				GetPlayerPos(playerid, x, y, z);
				format(text, sizeof(text), "%s a pornit motorul.", GetName(playerid));
				if(IsPlayerInRangeOfPoint(playerid, 15, x, y, z)) SendClientMessage(playerid, 0x4E87F2FF, text);
			}
			else
			{
				tmp_engine = 0;
				new Float:a, Float:b, Float:c;
				new string[128];
				GetPlayerPos(playerid, a, b, c);
				format(string, sizeof(string), "%s a oprit motorul.", GetName(playerid));
				if(IsPlayerInRangeOfPoint(playerid, 15, a, b, c)) SendClientMessage(playerid, 0x4E87F2FF, string);
			}
			SetVehicleParamsEx(vID, tmp_engine, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
		}
	}
	return 1;
}

Sunt incepator, asa am reusit sa fac.

In joc, cand intru intr-o masina si apas pe 2, se opreste motorul si trebuie sa apas din nou pe 2 ca sa il pornesc.

Masina are motorul oprit din start, nu se aude zgomot de la motor si nu merge, de ce imi opreste motorul atunci?

eroare.PNG.545285b6df712012059bc5613ed1ffff.PNG

 

 

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{	
	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		if(newkeys & KEY_LOOK_BEHIND)
		{
			return cmd_engine(playerid, "a"); // sau cum ai comanda de pornit/oprit motorul
		}
	}

	return 1;
}

 

Edited by Umbra
Link to comment
Share on other sites

  • 0
12 hours ago, Umbra said:

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{	
	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		if(newkeys & KEY_LOOK_BEHIND)
		{
			return cmd_engine(playerid, "a"); // sau cum ai comanda de pornit/oprit motorul
		}
	}

	return 1;
}

 

Salut. Am incercat sa fac asta dar acum orice apas imi scrie "FDH_ a pornit motorul." si motorul nu se porneste.

Link to comment
Share on other sites

  • 0
13 hours ago, Kiran said:

pune ca mașina când dai f sau enter în ea sa se pornească automat, + alea sunt ca actiunile /me si /do, apesi 2 doar fac ce zici nu ca se si intampla 

Salut. Am incercat si sa pun ca atunci cand intra in masina sa se porneasca motorul, dar masina incepe sa zboare(intr-un fel) ca si cum ar avea noclip orice fac dupa aceea.

Link to comment
Share on other sites

  • 0

Imi place ca doresti sa porneasca motorul dar nu ii spui niciodata sa il porneasca

SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective)

Nu e de ajuns  sa ii iei conditia si sa zici ca tmp_engine = 1, trebuie sa ii si transmiti ca e 1

Edited by Banditul
Link to comment
Share on other sites

  • 0
CMD:engine(playerid, params[])
{
	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) 
		return SCM(playerid, -1, "Eroare: Nu conduci o masina!");
	new vID = GetPlayerVehicleID(playerid),
		engine,
		lights,
		alarm,
		doors,
		bonnet,
		boot,
		objective;
	GetVehicleParamsEx(vID, engine, lights, alarm, doors, bonnet, boot, objective);
	if(engine == 1)
	{
		engine = 0;
	}
	else
	{
		engine = 1;
	}
	SetVehicleParamsEx(vID, engine, lights, alarm, doors, bonnet, boot, objective);
	return 1;
}

Am facut comanda din nou, si merge perfect, dar daca adaug orice la partile unde schimba engine-ul in 0, respectiv 1, nu mai merge. Cum as putea sa adaug text atunci cand pornesc motorul sa le apara la cei din jur ca l-am pornit.

Link to comment
Share on other sites

  • 0
22 hours ago, Banditul said:

Mesajul il adaugi in if-u in care verifici engine, respectiv else-u lui

Prima data am facut absolut totul legat de mesaj in "if", si m-am enervat ca nu merge, dar am realizat ca daca fac string-ul in afara if-ului si dau doar SendClientMessage atunci merge. Acum merge si daca apas pe 2. Ms Banditule, mereu esti aici cand am nevoie de tine =]]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.