31.01.2010, 02:24
All depends on your team system. If you have a team system already then post it otherwist heres a simple example.
PlayerTeam[MAX_PLAYERS];
VehicleTeam[MAX_VEHICLES];
#define Team0 0
#define Team1 1
public OnGameModeInit()
{
new vehicle = AddStaticVehicle(...);
VehicleTeam[vehicle] = Team0;
....
}
//I assume by a team vehicle you only want people on that team to be able to use it.
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(PlayerTeam[playerid] != VehicleTeam[GetPlayerVehicleID(playerid)])
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0xAA0000AA, "Vehicle does not match team");
}
}
}
PlayerTeam[MAX_PLAYERS];
VehicleTeam[MAX_VEHICLES];
#define Team0 0
#define Team1 1
public OnGameModeInit()
{
new vehicle = AddStaticVehicle(...);
VehicleTeam[vehicle] = Team0;
....
}
//I assume by a team vehicle you only want people on that team to be able to use it.
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(PlayerTeam[playerid] != VehicleTeam[GetPlayerVehicleID(playerid)])
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0xAA0000AA, "Vehicle does not match team");
}
}
}