SA-MP Forums Archive
Class = Car?! - 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: Class = Car?! (/showthread.php?tid=136031)



Class = Car?! - ScottCFR - 22.03.2010

Ok how would i identify if a player is in thier "Teams" vehicle. Something like:

Код:
If(IsPlayergTeam(playerid) == TEAM_POLICE)
{
    IsPLayerInAnyVehicle(playerid)
    {
That's kinda how i think it might be setup


Re: Class = Car?! - dococ - 22.03.2010

Are the team cars different? For example, a Sultan is for team "x" while a Huntley is for the other team?


Re: Class = Car?! - Zimon95 - 22.03.2010

Well, you can create a function to check if a vehicle is of a team by vehicle id's.
Example:
pawn Код:
forward IsAGrooveCar(carid);
public IsAGrooveCar(carid)
{
    if((carid>= 4) && (carid<= 6)){return 1;}
  return 0;
}
Then, in on PlayerStateChange callback:
pawn Код:
new carid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
 if(IsAGrooveCar(carid))
 {
 //Do something
 }



Re: Class = Car?! - ScottCFR - 22.03.2010

Quote:
Originally Posted by Dococ
Are the team cars different? For example, a Sultan is for team "x" while a Huntley is for the other team?
Well i want to set them so "Drug Dealers" can't enter SFPD only the Police can.
also so Police can't enter "Drug Dealers" cars.


Re: Class = Car?! - dococ - 22.03.2010

Quote:
Originally Posted by ScottCFR
Quote:
Originally Posted by Dococ
Are the team cars different? For example, a Sultan is for team "x" while a Huntley is for the other team?
Well i want to set them so "Drug Dealers" can't enter SFPD only the Police can.
also so Police can't enter "Drug Dealers" cars.
Quote:
Originally Posted by Zimon95
Well, you can create a function to check if a vehicle is of a team by vehicle id's.
Example:
pawn Код:
forward IsAGrooveCar(carid);
public IsAGrooveCar(carid)
{
    if((carid>= 4) && (carid<= 6)){return 1;}
  return 0;
}
Then, in on PlayerStateChange callback:
pawn Код:
new carid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
 if(IsAGrooveCar(carid))
 {
 //Do something
 }



Re: Class = Car?! - ScottCFR - 22.03.2010

Quote:
Originally Posted by Zimon95
Well, you can create a function to check if a vehicle is of a team by vehicle id's.
Example:
pawn Код:
if((carid>= 4) && (carid<= 6)){return 1;}
  return 0;
Do i go by model in SA-MP or the order they are in my server?


Re: Class = Car?! - Zimon95 - 22.03.2010

They go by the order in your script, so the first AddStaticVehicle is ID 1, and so on...


Re: Class = Car?! - ScottCFR - 22.03.2010

Quote:
Originally Posted by Zimon95
They go by the order in your script, so the first AddStaticVehicle is ID 1, and so on...
Ok, Thanks