Stop a Team From Using Cars?
#1

how can i make a team not be able to use cars
Code:
if(gTeam[playerid] == TEAM_HIDER)
what should i put after that
Reply
#2

pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(gTeam[playerid] == TEAM_HIDER)
    {
     RemovePlayerFromVehicle(playerid);
    }
Reply
#3

Quote:
Originally Posted by Kitten
View Post
pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(gTeam[playerid] == TEAM_HIDER)
    {
     RemovePlayerFromVehicle(playerid);
    }
Help Define this and stuff please
Reply
#4

Quote:

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)

Checks if the person enters a vehicle, if so:

Quote:

if (gTeam[playerid] == TEAM_HIDER)

If the person team is equal to whatever value the constant TEAM_HIDER contains, example 1.

If so:

Quote:

RemovePlayerFromVehicle(playerid);

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;
}
Hope this helps.
Reply
#5

Quote:
Originally Posted by mrmuffins
View Post
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;
}
Hope this helps.
How Can i Make it so it wont let the team in ANY cars?
Reply
#6

That was just an explanation and example.

Kitten's post works for that.

Quote:
Originally Posted by Kitten
View Post
pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(gTeam[playerid] == TEAM_HIDER)
    {
     RemovePlayerFromVehicle(playerid);
    }
Reply
#7

Quote:
Originally Posted by mrmuffins
View Post
That was just an explanation and example.

Kitten's post works for that.
Okay When i use kittens it doesnt work it wont remove me from the car
Reply
#8

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.
Reply
#9

Quote:
Originally Posted by mrmuffins
View Post
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.
Yeah its TEAM_HIDER 0 i dont know whats wrong
Reply
#10

at top
pawn Code:
#define TEAM_HIDER 0
after
pawn Code:
static gTeam[MAX_PLAYERS];
my code works perfect on my gamemode

if not show my ur script i guess?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)