How to make 17 cars into 1
#1

Rather than defining 17 cars,
How do i make it so i can put it in a command like,

pawn Код:
Public IsACopCar(vehicleid)
{
}
Seen in most roleplay, How would i do that and tell it what cars are copcars, Like the vehicleid,
Not SFPD1 or anything like that, I mean 598 or something,

I dont want to define all 17 cars i just want it to i can do this,

pawn Код:
If (IsPlayerInVehicle(playerid, IsACopCar))
Reply
#2

do you mean something like this?

Код:
public IsACopCar(carid)
{
	new vehicle = GetVehicleModel(carid);
	if(vehicle == yournumberhere)
	{
		return 1;
	}
	return 0;
}
Reply
#3

The function should look like this:

Код:
IsACopCar(vehicleid)
{
	switch(GetVehicleModel(vehicleid))
	{
		case 596..599, 427:
		{
			return 1;
		}
		return 0;
	}
}
Quote:

if(IsACopCar(GetPlayerVehicleid(playerid))
{
//insert code
}

Reply
#4

Well I use this one.

Код:
public IsACopCar(vehicleid)
{
  for(new i=0; i<18; i++)
  {
  if(vehicleid == copv[i])
  {
  return 1;
  }
  }
  return 0;
}
And at OnGameModeInit

Код:
copv[1] = AddStaticVehicleEx
copv[2] =
ETC till 17 in this example
But you could also select all modelids , which is usefull if you only want to use PD vehicles for the PD.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)