SA-MP Forums Archive
How to make 17 cars into 1 - 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: How to make 17 cars into 1 (/showthread.php?tid=81618)



How to make 17 cars into 1 - JoeDaDude - 12.06.2009

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))



Re: How to make 17 cars into 1 - Flo_White - 12.06.2009

do you mean something like this?

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



Re: How to make 17 cars into 1 - ziomal396 - 12.06.2009

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
}




Re: How to make 17 cars into 1 - BioFreeze - 12.06.2009

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.