11.08.2010, 22:10
how can i make a team not be able to use cars
what should i put after that
Code:
if(gTeam[playerid] == TEAM_HIDER)
if(gTeam[playerid] == TEAM_HIDER)
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(gTeam[playerid] == TEAM_HIDER)
{
RemovePlayerFromVehicle(playerid);
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) |
if (gTeam[playerid] == TEAM_HIDER) |
RemovePlayerFromVehicle(playerid); |
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if (gPlayer_Team[playerid] == TEAM_COP && vehicleid == 497 && !ispassenger) { //If I enter a police marvick and I am the driver, NOT a passager SendClientMessage(playerid, COLOR_SRED, "You are not a cop and cannot drive this!"); //Send a message RemovePlayerFromVehicle(playerid); //Remove me } return 1; }
Checks if the person enters a vehicle, if so:
If the person team is equal to whatever value the constant TEAM_HIDER contains, example 1. If so: Forces the player to be removed from the vehicle that they are in. A complete example: Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if (gPlayer_Team[playerid] == TEAM_COP && vehicleid == 497 && !ispassenger) { //If I enter a police marvick and I am the driver, NOT a passager SendClientMessage(playerid, COLOR_SRED, "You are not a cop and cannot drive this!"); //Send a message RemovePlayerFromVehicle(playerid); //Remove me } return 1; } |
Are you positive that your team is TEAM_HIDER ?
Look up at the top and find the: #define TEAM_HIDER And should be a number there like 1, and be sure your team is also set to that number. As well as your setting the gTeam to a value and not leaving it standing as null. |
#define TEAM_HIDER 0
static gTeam[MAX_PLAYERS];