[Tutorial] Team Cars and Team Players
#7

Quote:
Originally Posted by Desertsoulz
Посмотреть сообщение
Please respond, I tried to make an Admin team for CnR

Here's the script.


Код:
#include <a_samp>

#define ADMINS 99
#define ADMINS_COLOR 0xFF00FFAA //Purple
#define COLOR_RED 0xFF0000AA //RED

enum TeamCars
{
ADMINS
}

new gTeam[MAX_PLAYERS];
new Cars[TeamCars];

public OnGameModeInit()
{
    AddPlayerClass(163,2127.6602,2377.6648,10.8203,182.7401,0,0,0,0,0,0);
    AddPlayerClass(164,2127.6602,2377.6648,10.8203,182.7401,0,0,0,0,0,0);

	Cars[ADMINS] = CreateVehicle(522,2091.4963,2361.1116,10.8058,183.7787,85,0,1000); //
	Cars[ADMINS] = CreateVehicle(522,2093.6804,2360.7153,10.8131,180.7032,85,0,1000); //
	Cars[ADMINS] = CreateVehicle(522,2095.8301,2361.1843,10.8129,177.7382,85,0,1000); //
	Cars[ADMINS] = CreateVehicle(522,2098.3806,2361.2388,10.8129,177.9737,85,0,1000); //
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerToTeamColour(playerid);
    return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 99)
    {
        gTeam[playerid] = ADMINS;
    }
}

SetPlayerToTeamColour(playerid)
{
    if(gTeam[playerid] == ADMINS)
    {
        SetPlayerColor(playerid,ADMINS_COLOR); //Purple
    }
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[ADMINS] )
        {
            if(gTeam[playerid] != 99)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You can't drive this car!");
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
Try using

Код:
enum TeamCars
{
ADMIN
}
instead of ADMINS and change every Cars[ADMINS] to Cars[ADMIN]. But don't change any other ADMINS.

Here's the full code with those changed:
Код:
#include <a_samp>

#define ADMINS 99
#define ADMINS_COLOR 0xFF00FFAA //Purple
#define COLOR_RED 0xFF0000AA //RED

enum TeamCars
{
ADMIN
}

new gTeam[MAX_PLAYERS];
new Cars[TeamCars];

public OnGameModeInit()
{
    AddPlayerClass(163,2127.6602,2377.6648,10.8203,182.7401,0,0,0,0,0,0);
    AddPlayerClass(164,2127.6602,2377.6648,10.8203,182.7401,0,0,0,0,0,0);

	Cars[ADMIN] = CreateVehicle(522,2091.4963,2361.1116,10.8058,183.7787,85,0,1000); //
	Cars[ADMIN] = CreateVehicle(522,2093.6804,2360.7153,10.8131,180.7032,85,0,1000); //
	Cars[ADMIN] = CreateVehicle(522,2095.8301,2361.1843,10.8129,177.7382,85,0,1000); //
	Cars[ADMIN] = CreateVehicle(522,2098.3806,2361.2388,10.8129,177.9737,85,0,1000); //
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerToTeamColour(playerid);
    return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 99)
    {
        gTeam[playerid] = ADMINS;
    }
}

SetPlayerToTeamColour(playerid)
{
    if(gTeam[playerid] == ADMINS)
    {
        SetPlayerColor(playerid,ADMINS_COLOR); //Purple
    }
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[ADMIN] )
        {
            if(gTeam[playerid] != 99)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You can't drive this car!");
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
Reply


Messages In This Thread
Team Cars and Team Players - by Emanuel_Rodriguez - 17.07.2010, 20:30
Re: Team Cars and Team Players - by Thebest96 - 17.07.2010, 21:02
Re: Team Cars and Team Players - by [XST]O_x - 17.07.2010, 21:05
Re: Team Cars and Team Players - by Thebest96 - 17.07.2010, 21:08
Re: Team Cars and Team Players - by Desertsoulz - 20.07.2010, 23:35
Re: Team Cars and Team Players - by Scenario - 20.07.2010, 23:46
Re: Team Cars and Team Players - by 3ventic - 26.07.2010, 15:22
Re: Team Cars and Team Players - by R@ger - 26.07.2010, 15:34
Re: Team Cars and Team Players - by Steven82 - 29.07.2010, 19:30
Re: Team Cars and Team Players - by Scenario - 30.07.2010, 03:40
Re: Team Cars and Team Players - by CEZALAND - 31.07.2010, 22:17
Re: Team Cars and Team Players - by sDAAw - 03.08.2010, 22:27
Re: Team Cars and Team Players - by MadalinX5 - 08.08.2010, 10:08
Re: Team Cars and Team Players - by nexco - 21.08.2010, 20:29
Re: Team Cars and Team Players - by bertuspiteri - 22.08.2010, 20:18
Re: Team Cars and Team Players - by Nekrus2 - 22.08.2010, 23:20
Re: Team Cars and Team Players - by sekol - 30.08.2010, 13:17
Re: Team Cars and Team Players - by Yamoo - 30.08.2010, 17:11
Re: Team Cars and Team Players - by Thebest96 - 01.09.2010, 14:47
Re: Team Cars and Team Players - by Thebest96 - 03.09.2010, 06:25
Re: Team Cars and Team Players - by Nekrus2 - 03.09.2010, 16:40
Re: Team Cars and Team Players - by Nekrus2 - 03.09.2010, 16:42
Re: Team Cars and Team Players - by Thebest96 - 03.09.2010, 21:19
Re: Team Cars and Team Players - by tanush - 16.10.2010, 19:11
Re: Team Cars and Team Players - by IndoScripter - 29.10.2010, 12:03
Re: Team Cars and Team Players - by Tessar - 30.10.2010, 19:45
Re: Team Cars and Team Players - by fysssical - 17.11.2010, 15:33
Re: Team Cars and Team Players - by Miado_Hulk - 20.11.2010, 16:36
Re: Team Cars and Team Players - by ollis93 - 21.11.2010, 17:57
Re: Team Cars and Team Players - by EstSampBro - 20.06.2013, 20:12
Re: Team Cars and Team Players - by hitman14 - 12.08.2014, 12:10
Re: Team Cars and Team Players - by killerbigpoint - 10.10.2014, 16:55
Re: Team Cars and Team Players - by TheRaGeLord - 04.01.2015, 12:59
Re: Team Cars and Team Players - by Ankon - 12.10.2015, 03:58

Forum Jump:


Users browsing this thread: 7 Guest(s)