Posts: 673
Threads: 169
Joined: Apr 2008
Reputation:
0
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
Posts: 77
Threads: 15
Joined: Sep 2009
Reputation:
0
You mean that the for example "SF Copcar" is only enterable for police officers?
Posts: 33
Threads: 0
Joined: Sep 2007
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
Posts: 33
Threads: 0
Joined: Sep 2007
Yeah of cource, there's a function GetVehicleModel(vehicleid);
Код:
public IsACopCar(vehicleid)
{
if(GetVehicleModel(vehicleid) == 597)
{
return 1;
}
else return 0;
}
Posts: 2,929
Threads: 160
Joined: Feb 2009
Reputation:
0
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");
}
}
}