How to do this like roleplay
#1

On roleplays, They have this: public IsACopCar
So like it makes all cars with the id 597 = SF Cop Car,
And w.e, How would i do that, So i can make all cars in my server with id 597,
Like that, So i can make, IsACopCar, for certain team only, I think you should know what i mean,
If not ask, Il try explain a bit better
Reply
#2

You mean that the for example "SF Copcar" is only enterable for police officers?
Reply
#3

Each car in your script has itown ID, you can make a small check it it's a copcar for example, easiest way to do it:

At the top of the script:
Код:
new copcar1,copcar2;
forward IsACopCar(vehicleid);
Then:
Код:
copcar1 = AddStaticVehicle(model,coords,colours);
copcar2 = AddStaticVehicle(models,coords,colours);
Код:
public IsACopCar(vehicleid)
{
   if(vehicleid == copcar1 || vehicleid == copcar2)
   {
      return 1;
   }
   else return 0;
}
That is the check, you can put IsACopCar under "OnPlayerEnterVehicle" for example.

Hope that helped
Reply
#4

Quote:
Originally Posted by svorpyx
You mean that the for example "SF Copcar" is only enterable for police officers?
Yes that
Quote:
Originally Posted by SaYrOn
Each car in your script has itown ID, you can make a small check it it's a copcar for example, easiest way to do it:

At the top of the script:
Код:
new copcar1,copcar2;
forward IsACopCar(vehicleid);
Isent there a way to use the vehicle model id? like for example: 597,
Thats the SF Copcar, Rather than naming each vehicle i have on my server
Then:
Код:
copcar1 = AddStaticVehicle(model,coords,colours);
copcar2 = AddStaticVehicle(models,coords,colours);
Код:
public IsACopCar(vehicleid)
{
   if(vehicleid == copcar1 || vehicleid == copcar2)
   {
      return 1;
   }
   else return 0;
}
That is the check, you can put IsACopCar under "OnPlayerEnterVehicle" for example.

Hope that helped
Is there a way to use the vehicle model id, Like 597 is the SF Copcar,
Is there a way to do it that way, Rather than naming all my vehicles,
Reply
#5

Yeah of cource, there's a function GetVehicleModel(vehicleid);

Код:
public IsACopCar(vehicleid)
{
   if(GetVehicleModel(vehicleid) == 597)
   {
      return 1;
   }
   else return 0;
}
Reply
#6

Quote:
Originally Posted by SaYrOn
Yeah of cource, there's a function GetVehicleModel(vehicleid);

Код:
public IsACopCar(vehicleid)
{
   if(GetVehicleModel(vehicleid) == 597)
   {
      return 1;
   }
   else return 0;
}
Thankyou
How would i use that to set that vehicle model to team only,
How would i use, IsCopCar
Reply
#7

Under OnPlayerStateChange:

if(newstate == PLAYER_STATE_DRIVER)
{
if(GetVehicleModel(vehicleid) == 597)
{
if(gTeam[playerid] == TEAM_COP)
{
// Do your thing
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR, ">> You aren't a cop");
}
}
}
Reply
#8

Quote:
Originally Posted by » RэРиR «
Under OnPlayerStateChange:

if(newstate == PLAYER_STATE_DRIVER)
{
if(GetVehicleModel(vehicleid) == 597)
{
if(gTeam[playerid] == TEAM_COP)
{
// Do your thing
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR, ">> You aren't a cop");
}
}
}
How about for using IsACopCar instead of GetVehicleModel?
Reply
#9

Yes that will work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)