SA-MP Forums Archive
Help With In Car Only Commands - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help With In Car Only Commands (/showthread.php?tid=91535)



Help With In Car Only Commands - Smiths - 15.08.2009

Ok i have this :

Код:
		 	if(strcmp(cmdtext, "/testcmds", true, 5) == 0) {
	  	if(IsPlayerInAnyVehicle(playerid))
			{
			SendClientMessage(playerid,COLOR_YELLOW,"You Are In A Car.");
		}
			else
		{
			SendClientMessage(playerid,0xAA3333AA,"You Are Not In A Car.");
		}
			return 1;
	}
But i want to make the command working only in Taxi.... now idk what to do..

Sorry for my english ^^


Re: Help With In Car Only Commands - Correlli - 15.08.2009

Use GetVehicleModel function.


Re: Help With In Car Only Commands - Smiths - 15.08.2009

tyvm ^^


Re: Help With In Car Only Commands - Smiths - 15.08.2009

i take this?

if(GetVehicleModel(vehicleid) == 411)



Re: Help With In Car Only Commands - Correlli - 15.08.2009

Quote:
Originally Posted by Smiths
i take this?

if(GetVehicleModel(vehicleid) == 411)
411 is modelid for Infernus, but you said you need it for taxi, so:

pawn Код:
if(GetVehicleModel(vehicleid) == 420)
{
// code
}



Re: Help With In Car Only Commands - or_yagoda - 15.08.2009

Quote:
Originally Posted by Smiths
i take this?

if(GetVehicleModel(vehicleid) == 411)
YAP =]



Re: Help With In Car Only Commands - Smiths - 15.08.2009

i got a error in this code:

Код:
		 	if(strcmp(cmdtext, "/testcmds", true, 5) == 0) {
	  	if(GetVehicleModel(vehicleid) == 420)
		{
			SendClientMessage(playerid,0xAA3333AA,"You Are In A Taxi.");
		}
			else
		{
			SendClientMessage(playerid,0xAA3333AA,"You Are Not In A Taxi.");
		}
			return 1;
	}



Re: Help With In Car Only Commands - Correlli - 15.08.2009

vehicleid is not defined probably?

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
// code
}
}



Re: Help With In Car Only Commands - Smiths - 15.08.2009

Ok cool now its working! when i am not in a taxi it say You are not in a Taxi. and when i am in a taxi it say You Are In A Taxi... But when i am in an other vehicle it say nothing... Why? look my code:

Код:
		 	if(strcmp(cmdtext, "/testcmds", true, 5) == 0) {
   if(IsPlayerInAnyVehicle(playerid))
			{
			if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 420){
		SendClientMessage(playerid,0xAA3333AA,"You Are In A Taxi.");
		}
		}
			else
		{
			SendClientMessage(playerid,0xAA3333AA,"You Are Not In A Taxi.");
		}
			return 1;
	}



Re: Help With In Car Only Commands - Correlli - 15.08.2009

Hope this helps you:
pawn Код:
if(strcmp(cmdtext, "/testcmds", true, 5) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
SendClientMessage(playerid,0xAA3333AA,"You Are In A Taxi.");
}
else
{
SendClientMessage(playerid,0xAA3333AA,"You Are Not In A Taxi.");
}
}
else
{
SendClientMessage(playerid,0xAA3333AA,"You Are Not In A Vehicle.");
}
return 1;
}