Help With In Car Only Commands
#1

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 ^^
Reply
#2

Use GetVehicleModel function.
Reply
#3

tyvm ^^
Reply
#4

i take this?

if(GetVehicleModel(vehicleid) == 411)
Reply
#5

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
}
Reply
#6

Quote:
Originally Posted by Smiths
i take this?

if(GetVehicleModel(vehicleid) == 411)
YAP =]
Reply
#7

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;
	}
Reply
#8

vehicleid is not defined probably?

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

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;
	}
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)