[Help] Team cars
#1

Okay guys, I have been making TDM script and I got much help here, I need more help hehe

I wanna make team cars.
Here are some codes how I defined my teams.

new gTeam[MAX_PLAYERS];

#define TEAM_POLICE 1
#define TEAM_GROVE 2

SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0) ///<<<<<<<<<<<<<<<<<<<<<<======================= POLICE
{
gTeam[playerid] = TEAM_POLICE;
SetPlayerTeam(playerid,TEAM_POLICE);//You can delete this line if you want to allow team killing...
GameTextForPlayer(playerid,"~b~Police",5,0);
}

else if(classid == 7) ////////////////////<=======================GROVE STREET
{
gTeam[playerid] = TEAM_GROVE;
SetPlayerTeam(playerid,TEAM_GROVE);//Same for this!
GameTextForPlayer(playerid,"~g~Grove Street",5,0);
}
etc etc...
Can anyone help me with this?
Reply
#2

Put your code in [pawn] tags. Anyway here:

pawn Код:
enum TeamCars
{
    car1,
    car2,
}
pawn Код:
new Cars[TeamCars];
Then you need to set some static vehicles.

pawn Код:
Cars[car1] = AddStaticVehicle(439,2505.6946,-1694.7372,13.4526,2.5337,16,16); // Car at Grove
         Cars[car2] = AddStaticVehicle(596,1538.7109,-1644.8483,5.6109,179.1896,0,1); // LSPD Car
And finally

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[car1] )
        {
            if(gTeam[playerid] == TEAM_GROVE)
            {
                SendClientMessage(playerid, COLOUR_GREEN, "You are now driving the Grove Car!");
            }
            else
            {
                SendClientMessage(playerid, COLOUR_RED, "You do not have the keys for this car!");
                RemovePlayerFromVehicle(playerid);
            }
        }
        if(CarCheck == Cars[car2] )
        {
            if(gTeam[playerid] == TEAM_POLICE)
            {
                SendClientMessage(playerid, COLOUR_GREEN, "You are now driving the LSPD Car!");
            }
            else
            {
                SendClientMessage(playerid, COLOUR_RED, "You do not have the keys for this car!");
                RemovePlayerFromVehicle(playerid);
            }
        }
    }
    return 1;
}

Untested. Be sure to change the colours or you will get errors!
Reply
#3

How do I know about those teams>? I mean is it like for skins?
Reply
#4

No the one car is set for anyone in Grove and the other is set for anyone in the LSPD. You cannot drive the LSPD Car if you are apart of Grove and vis versa. You just need to add more yourself.
Reply
#5

Thanks mate!
Reply
#6

No problem.
Reply
#7

I NEED SOMEONE TO MAKE ME A TEAM SYSTEM BECAUSE I DONT KNOW HOW ..AND REALLY I NEED THIS TEAM SYSTEM ...PLEASE HELP
Reply
#8

Quote:
Originally Posted by mitsos1997
Посмотреть сообщение
I NEED SOMEONE TO MAKE ME A TEAM SYSTEM BECAUSE I DONT KNOW HOW ..AND REALLY I NEED THIS TEAM SYSTEM ...PLEASE HELP
easy
pawn Код:
new Team[MAX_PLAYERS];
#define TEAM_1 0
#define TEAM_2 1

if(Team[playerid] == TEAM_1) {
     SendClientMessage(playerid,COLOR,"You are team 1");
}

if(Team[playerid] == TEAM_2) {
     SendClientMessage(playerid,COLOR,"You are team 2");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)