A auto team picker.
#6

pawn Код:
#include <a_samp>

new MilitaryAirport, Area51, TerroristArea;
new gTeam[MAX_PLAYERS];
new cTeam[1];
new WasSpawned[MAX_PLAYERS];
#define MILITARY 0
#define TERRORIST 1

#define COLOR_GREEN 0x00FF0BFF
#define COLOR_RED 0xFF0000FF

forward SpawnAsTerrorist(playerid);
public SpawnAsTerrorist(playerid);
{
    new random = random(7);
    switch(random)
    {
        case 0: SetSpawnInfo(playerid,TERRORIST,124,-1561.9209,-226.6674,14.1440,33.8733,30,1000,0,0,0,0);
        case 1: SetSpawnInfo(playerid,TERRORIST,125,-1566.6169,-231.2649,14.1440,47.7854,30,1000,0,0,0,0);
        case 2: SetSpawnInfo(playerid,TERRORIST,126,-1571.8624,-236.5135,14.1440,47.7854,30,1000,0,0,0,0);
        case 3: SetSpawnInfo(playerid,TERRORIST,127,-1574.7235,-239.0641,14.1440,47.7854,30,1000,0,0,0,0);
        case 4: SetSpawnInfo(playerid,TERRORIST,111,-1577.8744,-241.9350,14.1440,47.7854,30,1000,0,0,0,0);
        case 5: SetSpawnInfo(playerid,TERRORIST,112,-1581.9219,-245.7941,14.1440,47.7854,30,1000,0,0,0,0);
        case 6: SetSpawnInfo(playerid,TERRORIST,113,-1585.5641,-249.1764,14.1440,47.5974,30,1000,0,0,0,0);
    }
}
forward SpawnAsMilitary(playerid);
public SpawnAsMilitary(playerid);
{
    new random = random(10);
    switch(random)
    {
        case 0: SetSpawnInfo(playerid,MILITARY,165,296.3174,2059.2976,17.6406,183.7194,31,1000,0,0,0,0); // Military Spawn 1
        case 1: SetSpawnInfo(playerid,MILITARY,166,298.5066,2059.1160,17.6406,184.2834,31,1000,0,0,0,0); // Military Spawn 2
        case 2: SetSpawnInfo(playerid,MILITARY,280,300.6361,2059.1563,17.6406,188.7955,31,1000,0,0,0,0); // Military Spawn 3
        case 3: SetSpawnInfo(playerid,MILITARY,281,302.5984,2059.8735,17.6406,181.4634,31,1000,0,0,0,0); // Military Spawn 4
        case 4: SetSpawnInfo(playerid,MILITARY,282,304.9218,2059.5300,17.6406,181.4634,31,1000,0,0,0,0); // Military Spawn 5
        case 5: SetSpawnInfo(playerid,MILITARY,283,306.9520,2059.7734,17.6406,182.2154,31,1000,0,0,0,0); // Military Spawn 6
                // AREA 51
        case 6: SetSpawnInfo(playerid,MILITARY,284,413.6353,2536.8433,19.1484,177.9784,31,1000,0,0,0,0); // Military Spawn 7
        case 7: SetSpawnInfo(playerid,MILITARY,285,413.2689,2530.8328,19.1779,354.4888,31,1000,0,0,0,0); // Military Spawn 8
        case 8: SetSpawnInfo(playerid,MILITARY,286,394.0936,2544.4868,16.5434,98.8297,31,1000,0,0,0,0); // Military Spawn 9
        case 9: SetSpawnInfo(playerid,MILITARY,287,355.1437,2535.2834,16.7147,180.7985,31,1000,0,0,0,0); // Military Spawn 10
    }
}
public OnGameModeInit()
{
    SetGameModeText("PersiousWar");

    AddStaticVehicleEx(520,291.5609,2538.2405,17.5372,180.5756,0,0,5); // Hydra 1 - Military Airport
    AddStaticVehicleEx(520,326.6140,2538.5601,17.5274,179.3083,0,0,5); // Hydra 2 - Military Airport
   
    AddStaticVehicleEx(425,365.7119,2539.2390,17.1910,356.5695,43,0,5); // Cobra 1 - Military Airport
   
    AddStaticVehicleEx(470,324.4907,1981.5381,17.6336,85.1864,43,0,5); // Hummer 1 - Area 51
    AddStaticVehicleEx(470,323.8524,1971.9628,17.6329,89.4741,43,0,5); // Hummer 2 - Area 51
    AddStaticVehicleEx(470,324.0744,1958.9252,17.6347,85.3343,43,0,5); // Hummer 3 - Area 51

    AddStaticVehicleEx(432,279.5623,2027.0767,17.6533,271.0956,43,0,5); // Tank 1 - Area 51
    AddStaticVehicleEx(432,280.8330,2018.9037,17.6533,269.3884,43,0,5); // Tank 2 - Area 51
//----------------------------------------------------------------------------------------------------//

    Area51 = GangZoneCreate(-315.3026, 1564.835, 572.2159, 2207.118);
    MilitaryAirport = GangZoneCreate(-420.4035, 2265.508, 607.2495, 2755.979);
    TerroristArea = GangZoneCreate(-1810.071, -829.1292, -910.8743, 513.8265);
//----------------------------------------------------------------------------------------------------//

    return 1;
}

public OnPlayerSpawn(playerid)
{
    GangZoneShowForPlayer(playerid, Area51, 0x00FF4096);
    GangZoneShowForPlayer(playerid, MilitaryAirport, 0x00FF4096);
    GangZoneShowForPlayer(playerid, TerroristArea, 0xFF000096);
    return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = MILITARY;
    }

    else if(classid == 1)
    {
        gTeam[playerid] = TERRORIST;
    }
     return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    if (WasSpawned[playerid]) cTeam[gTeam[playerid]]--;
    if (cTeam[MILITARY] > cTeam[TERRORIST])
    {
        SpawnAsTerrorist(playerid);
        cTeam[TERRORIST]++;
        SetPlayerTeamFromClass(playerid,TERRORIST);
    }
    else
    {
        SpawnAsMilitary(playerid);
        cTeam[MILITARY]++;
        SetPlayerTeamFromClass(playerid,MILITARY);
    }
    return 1;
}
And under OnPlayerDisconnect, add:
pawn Код:
if (WasSpawned[playerid]) cTeam[gTeam[playerid]]--;
P.S.: Stop bumping.
Reply


Messages In This Thread
A auto team picker. - by persious - 04.10.2011, 20:27
Re: A auto team picker. - by Backwardsman97 - 05.10.2011, 00:18
Re: A auto team picker. - by hittt - 05.10.2011, 10:44
Re: A auto team picker. - by persious - 05.10.2011, 12:45
Re: A auto team picker. - by persious - 05.10.2011, 16:33
Re: A auto team picker. - by hittt - 05.10.2011, 19:51
Re: A auto team picker. - by persious - 05.10.2011, 22:09
Re: A auto team picker. - by Backwardsman97 - 05.10.2011, 22:44
Re: A auto team picker. - by persious - 05.10.2011, 22:47

Forum Jump:


Users browsing this thread: 1 Guest(s)