SA-MP Forums Archive
Vehicle Dialog Help - 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: Vehicle Dialog Help (/showthread.php?tid=316167)



Vehicle Dialog Help - IvancheBG - 05.02.2012

Xi guys.I maked a vehicle dialog with categories like airplanes,bikes and others.It works perfectly but i have a problem.When the vehicle dies it respawns.Here is my code:

Code:
if(dialogid == 10)
	{
	    if(response)
	    {
	        if(listitem==0) // Airplanes
	        {
	            ShowPlayerDialog(playerid, 11, DIALOG_STYLE_LIST,"Airplanes","Andromada\nAT-400\nBeagle\nCropduster\nDodo\nHydra\nNevada\nRustler\nSkimmer\nStuntplane\nShamal","Choose","Cancel");
			}
		}
		if(response)
		{
		}
	}
	if(dialogid==11) // Airplanes
	{
		if(response)
		{
			if(listitem==0) // Andromada
			{
                if(currentvehicle[playerid]!=0)
				{
					DestroyVehicle(currentvehicle[playerid]);
				}
				new Float:x, Float:y, Float:z, Float:a;
				GetPlayerPos(playerid, x,y,z);
				GetPlayerFacingAngle(playerid, a);
				currentvehicle[playerid] = CreateVehicle(592, x+4,y+4,z, a, -1, -1, -1);
				PutPlayerInVehicle(playerid, currentvehicle[playerid], 0);
			}
			else if(listitem == 1) // AT-400
			{
			    if(currentvehicle[playerid]!=0)
				{
					DestroyVehicle(currentvehicle[playerid]);
				}
				new Float:x, Float:y, Float:z, Float:a;
				GetPlayerPos(playerid, x,y,z);
				GetPlayerFacingAngle(playerid, a);
				currentvehicle[playerid] = CreateVehicle(577, x+4,y+4,z, a, -1, -1, -1);
				PutPlayerInVehicle(playerid, currentvehicle[playerid], 0);
			}
			else if(listitem == 2) // Beagle
			{
			    if(currentvehicle[playerid]!=0)
				{
					DestroyVehicle(currentvehicle[playerid]);
				}
				new Float:x, Float:y, Float:z, Float:a;
				GetPlayerPos(playerid, x,y,z);
				GetPlayerFacingAngle(playerid, a);
				currentvehicle[playerid] = CreateVehicle(511, x+4,y+4,z, a, -1, -1, -1);
				PutPlayerInVehicle(playerid, currentvehicle[playerid], 0);
			}
			else if(listitem == 3) // Cropduster
			{
			    if(currentvehicle[playerid]!=0)
				{
					DestroyVehicle(currentvehicle[playerid]);
				}
				new Float:x, Float:y, Float:z, Float:a;
				GetPlayerPos(playerid, x,y,z);
				GetPlayerFacingAngle(playerid, a);
				currentvehicle[playerid] = CreateVehicle(512, x+4,y+4,z, a, -1, -1, -1);
				PutPlayerInVehicle(playerid, currentvehicle[playerid], 0);
			}
			else if(listitem == 4) // Dodo
			{
			    if(currentvehicle[playerid]!=0)
				{
					DestroyVehicle(currentvehicle[playerid]);
				}
				new Float:x, Float:y, Float:z, Float:a;
				GetPlayerPos(playerid, x,y,z);
				GetPlayerFacingAngle(playerid, a);
				currentvehicle[playerid] = CreateVehicle(593, x+4,y+4,z, a, -1, -1, -1);
				PutPlayerInVehicle(playerid, currentvehicle[playerid], 0);
			}
			else if(listitem == 5) // Hydra
			{
			    if(currentvehicle[playerid]!=0)
				{
					DestroyVehicle(currentvehicle[playerid]);
				}
				new Float:x, Float:y, Float:z, Float:a;
				GetPlayerPos(playerid, x,y,z);
				GetPlayerFacingAngle(playerid, a);
				currentvehicle[playerid] = CreateVehicle(520, x+4,y+4,z, a, -1, -1, -1);
				PutPlayerInVehicle(playerid, currentvehicle[playerid], 0);
			}
			else if(listitem == 6) // Nevada
			{
			    if(currentvehicle[playerid]!=0)
				{
					DestroyVehicle(currentvehicle[playerid]);
				}
				new Float:x, Float:y, Float:z, Float:a;
				GetPlayerPos(playerid, x,y,z);
				GetPlayerFacingAngle(playerid, a);
				currentvehicle[playerid] = CreateVehicle(553, x+4,y+4,z, a, -1, -1, -1);
				PutPlayerInVehicle(playerid, currentvehicle[playerid], 0);
			}
			else if(listitem == 7) // Rustler
			{
		        if(currentvehicle[playerid]!=0)
				{
					DestroyVehicle(currentvehicle[playerid]);
				}
				new Float:x, Float:y, Float:z, Float:a;
				GetPlayerPos(playerid, x,y,z);
				GetPlayerFacingAngle(playerid, a);
				currentvehicle[playerid] = CreateVehicle(476, x+4,y+4,z, a, -1, -1, -1);
				PutPlayerInVehicle(playerid, currentvehicle[playerid], 0);
			}
			else if(listitem == 8) // Skimmer
			{
			    if(currentvehicle[playerid]!=0)
				{
					DestroyVehicle(currentvehicle[playerid]);
				}
				new Float:x, Float:y, Float:z, Float:a;
				GetPlayerPos(playerid, x,y,z);
				GetPlayerFacingAngle(playerid, a);
				currentvehicle[playerid] = CreateVehicle(560, x+4,y+4,z, a, -1, -1, -1);
				PutPlayerInVehicle(playerid, currentvehicle[playerid], 0);
			}
			else if(listitem == 9)
			{
		        if(currentvehicle[playerid]!=0) // Stuntplane
				{
					DestroyVehicle(currentvehicle[playerid]);
				}
				new Float:x, Float:y, Float:z, Float:a;
				GetPlayerPos(playerid, x,y,z);
				GetPlayerFacingAngle(playerid, a);
				currentvehicle[playerid] = CreateVehicle(513, x+4,y+4,z, a, -1, -1, -1);
				PutPlayerInVehicle(playerid, currentvehicle[playerid], 0);
			}
			else if(listitem == 10) // Shamal
			{
			    if(currentvehicle[playerid]!=0)
				{
					DestroyVehicle(currentvehicle[playerid]);
				}
				new Float:x, Float:y, Float:z, Float:a;
				GetPlayerPos(playerid, x,y,z);
				GetPlayerFacingAngle(playerid, a);
				currentvehicle[playerid] = CreateVehicle(519, x+4,y+4,z, a, -1, -1, -1);
				PutPlayerInVehicle(playerid, currentvehicle[playerid], 0);
			}
		}
	}
And The variable:
Code:
new currentvehicle[MAX_PLAYERS];
Thanks for the help!


Re: Vehicle Dialog Help - ғαιιοцт - 05.02.2012

change
CreateVehicle(592, x+4,y+4,z, a, -1, -1, -1);
to
CreateVehicle(592, x+4,y+4,z, a, -1, -1, 99999999);



or try
CreateVehicle(592, x+4,y+4,z, a, -1, -1, 0);
but I'm not sure if that works.

The last parameter is the respawn delay, in seconds.
https://sampwiki.blast.hk/wiki/CreateVehicle


Re: Vehicle Dialog Help - IvancheBG - 05.02.2012

It didnt work.


Re: Vehicle Dialog Help - IvancheBG - 06.02.2012

Someone ??


Re: Vehicle Dialog Help - niels44 - 06.02.2012

maybe you can set your respawn delay to 99999999 XD i think that will work but if your server will be on for a long time then it will respawn yes but this can work XD


Re: Vehicle Dialog Help - IvancheBG - 06.02.2012

Dont you see up there i tried this ? ..


Re: Vehicle Dialog Help - IvancheBG - 07.02.2012

Someone ..


Re: Vehicle Dialog Help - iTorran - 07.02.2012

The vehicle is supposed to respawn when it dies. I dont think you can stop it (simply atleast).


Re: Vehicle Dialog Help - IceCube! - 07.02.2012

If you dont want it to respawn from what I can gather you want this.

OnVehicleDeath(...)
{
DestroyVehicle(vehicleid);
return 1;
}


Re: Vehicle Dialog Help - IvancheBG - 07.02.2012

I tried this but when a vehicle dies all other vehicles with a player driving it dies?I only want the dialog vehicles t o die.