SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 09/07/2012, 07:18 PM   #1
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 695
Reputation: 46
Default Lots of errors with zone capture system

Code:
pawn Code:
/*///////////////////
MWFFA - New Script

Work Started on June 18, 2012

*/
/////////////////

#include <a_samp>
#include <streamer>
#include <irc>
#include <foreach>

//Teams
#define TEAM_DELTA 1
#define TEAM_SPETSNAZ 2
#define TEAM_GIGN 3
#define TEAM_IA 4
#define TEAM_JSDF 5

//Dialogs
#define DIALOG_CTEAM   8343
#define DIALOG_SCLASS   10211
#define DIALOG_SSTEAM   3893

//IRC Stuff
#define IRC_SERVER "irc.mibbit.net"
#define IRC_PORT (6667)
#define IRC_CHANNEL "#MWFFA"

#define BOT_1_NICKNAME "Overlord"
#define BOT_1_REALNAME "SA-MP Bot"
#define BOT_1_USERNAME "Overlord_1"

#define MAX_BOTS (1)

new gBotID[MAX_BOTS], gGroupID;

//Defines
#define MAX_ZONES 50

//Colors
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_PINK 0xFF00FFFF
#define COLOR_GREEN 0x00FF00FF
#define COLOR_AQUA 0x00FFFFFF
#define COLOR_BLACK 0x000000FF
#define COLOR_BLUE 0x0000FFFF

//Skins
#define SKIN_TORENO 295
#define SKIN_WUZIMU 294
#define SKIN_USA 287
#define SKIN_RUSSIA 179
#define SKIN_GIGN 285
#define SKIN_IA 254
#define SKIN_JSDF 57

//Zones
new Z_KACC;
new Z_School;
new Z_Pier;

//Forwards
forward ASKOff(playerid);

//Enums
enum kInfo
{
    HasStreak,
    HasJug,
    HasStrike,
    HasTank,
    HasPackage,
    Streak
}
new StreakInfo[MAX_PLAYERS][kInfo];

enum pInfo
{
    Password,
    Cash,
    Score,
    Admin,
    Points,
    Xp,
    Protected,
    CapturingZone,
    Connects,
    Disconnects
}
new PlayerInfo[MAX_PLAYERS][pInfo];

//Class Variables
new IsSoldier[MAX_PLAYERS];
new IsSniper[MAX_PLAYERS];
new IsMedic[MAX_PLAYERS];
new IsEngineer[MAX_PLAYERS];
new IsPilot[MAX_PLAYERS];
new IsFlamethrower[MAX_PLAYERS];
new IsSpy[MAX_PLAYERS];
new IsScout[MAX_PLAYERS];
new IsPlaneDriver[MAX_PLAYERS];
new IsHeliDriver[MAX_PLAYERS];
new IsGeneral[MAX_PLAYERS];
new IsVIP[MAX_PLAYERS];
new IsAdmin[MAX_PLAYERS];
new IsOwner[MAX_PLAYERS];

//Capture var
new EnteredArea[MAX_PLAYERS];
new CapturedBy; // 0 ( none ) 1 ( Delta ) 2 ( Russia ) 3 - GIGN | 4 - Italian Army | 5 - JSDF
new EnteredArea2[MAX_PLAYERS];
new CapturedBy2; // 0 ( none ) 1 ( Delta ) 2 ( Russia ) 3 - GIGN | 4 - Italian Army | 5 - JSDF
new EnteredArea3[MAX_PLAYERS];
new CapturedBy3; // 0 ( none ) 1 ( Delta ) 2 ( Russia ) 3 - GIGN | 4 - Italian Army | 5 - JSDF
   
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

main()
{
    print("\n----------------------------------");
    print("------- MWFFA Script Loaded --------");
    print("----------------------------------\n");
}

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("MWFFA - World War lll");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
   
    //Zones
    Z_KACC = GangZoneCreate(2438.989, 2560.181, 2782.616, 2885.098);
    Z_School = GangZoneCreate(-2197.686, -281.7203, -2008.414, -68.69224);
    Z_Pier = GangZoneCreate(371.8314, -2108.218, 459.2966, -1654.228);
   
    //IRC
    gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
    IRC_SetIntData(gBotID[0], E_IRC_CONNECT_DELAY, 20);
    gGroupID = IRC_CreateGroup();
   
    SetTimer("AreaCheck", 1000, true);
    return 1;
}

public OnGameModeExit()
{
    print("\n------------------------------------");
    print("------- MWFFA Script unloaded --------");
    print("--------------------------------------\n");
   
    IRC_Quit(gBotID[0], "Overlord (SA-MP Bot) exiting.");
    IRC_DestroyGroup(gGroupID);
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
   
    GangZoneShowForPlayer(playerid, Z_KACC, 0xFF000096);
    GangZoneShowForPlayer(playerid, Z_School, 0xFF800096);
    GangZoneShowForPlayer(playerid, Z_Pier, 0xFFFF0096);
   
    //Select Team
    ShowPlayerDialog(playerid, DIALOG_CTEAM, DIALOG_STYLE_LIST, "Choose Team", "Delta Force (United States)\nSpetsnaz (Russia)\nGIGN (France)\nItalian Army (Italy)\nJapan Self Defense Forces (Japan)", "Select", "");
    return 1;
}

public OnPlayerConnect(playerid)
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string),"*** %s(%d) has joined the server.");
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    PlayerInfo[playerid][Connects]++;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new reasonMsg[20];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    switch(reason)
    {
        case 0: reasonMsg = "Timeout";
        case 1: reasonMsg = "Leaving";
        case 2: reasonMsg = "Kicked/Banned";
    }
   
    new string[70];
    format(string, sizeof(string),"*** %s(%d) has left the server (%s)", pName, playerid, reasonMsg);
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    format(string, sizeof(string),"-| %s(%d) has left the server! (%s) |-", pName, playerid, reasonMsg);
    SendClientMessageToAll(COLOR_PINK, string);
    PlayerInfo[playerid][Disconnects]++;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SendClientMessage(playerid, COLOR_YELLOW, "You are anti-spawn kill protected for 10 seconds");
    PlayerInfo[playerid][Protected] = 1;
    SetTimerEx("ASKOff", 10000, 0, "i", playerid);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    new pNameTwo[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(killerid, pNameTwo, sizeof(pNameTwo));
    new reasonMsg[30];
    if(killerid != INVALID_PLAYER_ID)
    {
        switch (reason)
        {
            case 0: reasonMsg = "Unarmed";
            case 1: reasonMsg = "Brass Knuckles";
            case 2: reasonMsg = "Golf Club";
            case 3: reasonMsg = "Night Stick";
            case 4: reasonMsg = "Knife";
            case 5: reasonMsg = "Baseball Bat";
            case 6: reasonMsg = "Shovel";
            case 7: reasonMsg = "Pool Cue";
            case 8: reasonMsg = "Katana";
            case 9: reasonMsg = "Chainsaw";
            case 10: reasonMsg = "Dildo";
            case 11: reasonMsg = "Dildo";
            case 12: reasonMsg = "Vibrator";
            case 13: reasonMsg = "Vibrator";
            case 14: reasonMsg = "Flowers";
            case 15: reasonMsg = "Cane";
            case 22: reasonMsg = "Pistol";
            case 23: reasonMsg = "Silenced Pistol";
            case 24: reasonMsg = "Desert Eagle";
            case 25: reasonMsg = "Shotgun";
            case 26: reasonMsg = "Sawn-off Shotgun";
            case 27: reasonMsg = "Combat Shotgun";
            case 28: reasonMsg = "MAC-10";
            case 29: reasonMsg = "MP5";
            case 30: reasonMsg = "AK-47";
            case 31: reasonMsg = "M4";
            case 32: reasonMsg = "TEC-9";
            case 33: reasonMsg = "Country Rifle";
            case 34: reasonMsg = "Sniper Rifle";
            case 37: reasonMsg = "Fire";
            case 38: reasonMsg = "Minigun";
            case 41: reasonMsg = "Spray Can";
            case 42: reasonMsg = "Fire Extinguisher";
            case 49: reasonMsg = "Vehicle Collision";
            case 50: reasonMsg = "Vehicle Collision";
            case 51: reasonMsg = "Explosion";
            default: reasonMsg = "Unknown";
        }
       
        StreakInfo[killerid][Streak]++;
        StreakInfo[playerid][Streak] = 0;
        format(string, sizeof(string),"-| You have killed %s(%d) and have earned $250, and 2 score |-", pName, playerid);
        SendClientMessage(killerid, COLOR_YELLOW, string);
        format(string, sizeof(string),"-| You have been killed by %s(%d) and have lost $100 |-", pNameTwo, killerid);
        SendClientMessage(playerid, COLOR_RED, string);
        GivePlayerScore(killerid, 2);
        GivePlayerMoney(killerid, 250);
        GivePlayerMoney(playerid, -100);
        format(string, sizeof(string),"*** %s(%d) has been killed by %s(%d). (%s)", pName, playerid, pNameTwo, killerid, reasonMsg);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
       
        if(GetPlayerTeam(killerid) == GetPlayerTeam(playerid))
        {
            SetPlayerArmour(killerid, 0.0);
            SetPlayerHealth(killerid, 0);
            GameTextForPlayer(killerid, "~r~Killed for Team-Kill & Charged $2500", 8000, 2);
            GameTextForPlayer(playerid, "The teammate who killed you has been killed for team kill!", 4500, 6);
            GivePlayerMoney(killerid, -2500);
        }
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string),"*** %s(%d): %s", pName, playerid, text);
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(kill,4,cmdtext);
    dcmd(radio,5,cmdtext);
    return 1;
}

dcmd_kill(playerid)
{
    new string[100];
    new cRand = random(10000);
    SetPlayerHealth(playerid, 0);
    SetPlayerArmour(playerid, 0.0);
    format(string, sizeof(string), "You have been charged $%d for using /kill", cRand);
    SendClientMessage(playerid, COLOR_RED, string);
    GivePlayerMoney(playerid, -cRand);
    return 1;
}

dcmd_radio(playerid, params[])
{
    new Index;
    new tmp[256];
    tmp = strtok(params, Index);
    new msg = params[1];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
        {
            if(IsPlayerConnected(i))
            {
                SendClientMessage(i, COLOR_GREEN, "[RADIO] %s(%d): %s", name, playerid, msg);
            }
            else SendClientMessage(playerid, COLOR_RED, "ERROR: There is no one on your team right now to talk to.");
        }
    }
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    return 1;
}

public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    return 1;
}

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    if(PlayerInfo[damagedid][Protected] == 1)
    {
        GameTextForPlayer(playerid, "~r~This person is Anti-Spawn kill protected", 5000, 6);
        SetPlayerHealth(damagedid, 100);
        SetPlayerArmour(damagedid, 100.0);
    }
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    if(success)
    {
        printf("RCON login success by IP %s using password %s", ip, password);
    }
    else
    {
        printf("Failed RCON login by IP %s using password %s", ip, password);
    }
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CTEAM)
    {
        ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
        switch(listitem)
        {
            case 0:
            {
                SetPlayerTeam(playerid, TEAM_DELTA);
                SetPlayerColor(playerid, COLOR_BLUE);
                GameTextForPlayer(playerid, "~b~DELTA FORCE", 7500, 6);
                SetPlayerSkin(playerid, SKIN_USA);
            }
            case 1:
            {
                SetPlayerTeam(playerid, TEAM_SPETSNAZ);
                SetPlayerColor(playerid, COLOR_RED);
                GameTextForPlayer(playerid, "~r~SPETSNAZ", 7500, 6);
                SetPlayerSkin(playerid, SKIN_RUSSIA);
            }
            case 2:
            {
                SetPlayerTeam(playerid, TEAM_GIGN);
                SetPlayerColor(playerid, COLOR_GREEN);
                GameTextForPlayer(playerid, "~g~GIGN", 7500, 6);
                SetPlayerSkin(playerid, SKIN_GIGN);
            }
            case 3:
            {
                SetPlayerTeam(playerid, TEAM_IA);
                SetPlayerColor(playerid, COLOR_AQUA);
                GameTextForPlayer(playerid, "ITALIAN ARMY", 7500, 6);
                SetPlayerSkin(playerid, SKIN_IA);
            }
            case 4:
            {
                SetPlayerTeam(playerid, TEAM_JSDF);
                SetPlayerColor(playerid, 0xFF800096);
                GameTextForPlayer(playerid, "Japan Self Defense Forces", 7500, 6);
                SetPlayerSkin(playerid, SKIN_JSDF);
            }
        }
    }
   
    if(dialogid == DIALOG_SCLASS)
    {
        SpawnPlayer(playerid);
        switch(listitem)
        {
            case 0:
            {
                IsSoldier[playerid] = 1;
                GameTextForPlayer(playerid, "Soldier", 5000, 6);
                GivePlayerWeapon(playerid, 4, 1);
                GivePlayerWeapon(playerid, 24, 30);
                GivePlayerWeapon(playerid, 31, 200);
            }
            case 1:
            {
                IsSniper[playerid] = 1;
                GameTextForPlayer(playerid, "Sniper", 5000, 6);
                GivePlayerWeapon(playerid, 3, 1);
                GivePlayerWeapon(playerid, 23, 40);
                GivePlayerWeapon(playerid, 34, 250);
                GivePlayerWeapon(playerid, 17, 20);
            }
            case 2:
            {
                if(PlayerInfo[playerid][Xp] >= 30)
                {
                    IsMedic[playerid] = 1;
                    GameTextForPlayer(playerid, "Medic", 5000, 6);
                    GivePlayerWeapon(playerid, 15, 1);
                    GivePlayerWeapon(playerid, 22, 75);
                    GivePlayerWeapon(playerid, 30, 200);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 30+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 3:
            {
                if(PlayerInfo[playerid][Xp] >= 75)
                {
                    IsEngineer[playerid] = 1;
                    GameTextForPlayer(playerid, "Engineer", 5000, 6);
                    GivePlayerWeapon(playerid, 5, 1);
                    GivePlayerWeapon(playerid, 27, 50);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 43, 40);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 75+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 4:
            {
                if(PlayerInfo[playerid][Xp] >= 120)
                {
                    IsPilot[playerid] = 1;
                    GameTextForPlayer(playerid, "Pilot", 5000, 6);
                    GivePlayerWeapon(playerid, 22, 60);
                    GivePlayerWeapon(playerid, 30, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 120+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 5:
            {
                if(PlayerInfo[playerid][Xp] >= 200)
                {
                    IsFlamethrower[playerid] = 1;
                    GameTextForPlayer(playerid, "Flamethrower", 5000, 6);
                    GivePlayerWeapon(playerid, 18, 20);
                    GivePlayerWeapon(playerid, 24, 75);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 37, 350);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 200+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 6:
            {
                if(PlayerInfo[playerid][Xp] >= 310)
                {
                    IsSpy[playerid] = 1;
                    GameTextForPlayer(playerid, "Spy", 5000, 6);
                    GivePlayerWeapon(playerid, 15, 1);
                    GivePlayerWeapon(playerid, 23, 50);
                    GivePlayerWeapon(playerid, 31, 200);
                    ShowPlayerDialog(playerid, DIALOG_SSTEAM, DIALOG_STYLE_LIST, "Select Disguise Team", "Delta Force (USA)\nSpetsnaz (Russia)\nGIGN (France)\nItalian Army (Italy)\nJapan Self Defense Forces (Japan)", "Select", "Back");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 310+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 7:
            {
                if(PlayerInfo[playerid][Xp] >= 350)
                {
                    IsScout[playerid] = 1;
                    GameTextForPlayer(playerid, "Scout", 5000, 6);
                    GivePlayerWeapon(playerid, 4, 1);
                    GivePlayerWeapon(playerid, 23, 75);
                    GivePlayerWeapon(playerid, 29, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 350+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 8:
            {
                if(PlayerInfo[playerid][Xp] >= 500)
                {
                    IsPlaneDriver[playerid] = 1;
                    GameTextForPlayer(playerid, "Cargo Plane Driver", 5000, 6);
                    GivePlayerWeapon(playerid, 26, 80);
                    GivePlayerWeapon(playerid, 29, 75);
                    GivePlayerWeapon(playerid, 33, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 500+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 9:
            {
                if(PlayerInfo[playerid][Xp] >= 630)
                {
                    IsHeliDriver[playerid] = 1;
                    GameTextForPlayer(playerid, "Helicopter Plane Driver", 5000, 6);
                    GivePlayerWeapon(playerid, 26, 80);
                    GivePlayerWeapon(playerid, 29, 75);
                    GivePlayerWeapon(playerid, 33, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 630+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 10:
            {
                if(PlayerInfo[playerid][Xp] >= 800)
                {
                    IsGeneral[playerid] = 1;
                    GameTextForPlayer(playerid, "General", 5000, 6);
                    GivePlayerWeapon(playerid, 26, 80);
                    GivePlayerWeapon(playerid, 29, 75);
                    GivePlayerWeapon(playerid, 33, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 800+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 11:
            {
                if(PlayerInfo[playerid][Points] >= 1)
                {
                    IsVIP[playerid] = 1;
                    GameTextForPlayer(playerid, "~y~VIP", 5000, 6);
                    GivePlayerWeapon(playerid, 24, 80);
                    GivePlayerWeapon(playerid, 32, 75);
                    GivePlayerWeapon(playerid, 31, 150);
                    GivePlayerWeapon(playerid, 39, 200);
                    GivePlayerWeapon(playerid, 40, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 1+ VIP Points to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 12:
            {
                if(PlayerInfo[playerid][Admin] >= 1)
                {
                    IsAdmin[playerid] = 1;
                    GameTextForPlayer(playerid, "~r~Administrator", 5000, 6);
                    GivePlayerWeapon(playerid, 24, 80);
                    GivePlayerWeapon(playerid, 28, 110);
                    GivePlayerWeapon(playerid, 30, 130);
                    GivePlayerWeapon(playerid, 37, 200);
                    GivePlayerWeapon(playerid, 16, 5);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have Admin level 1+ to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 13:
            {
                if(PlayerInfo[playerid][Admin] == 10)
                {
                    IsOwner[playerid] = 1;
                    GameTextForPlayer(playerid, "~r~Owner", 5000, 6);
                    GivePlayerWeapon(playerid, 22, 999999);
                    GivePlayerWeapon(playerid, 32, 999999);
                    GivePlayerWeapon(playerid, 31, 999999);
                    GivePlayerWeapon(playerid, 38, 999999);
                    GivePlayerWeapon(playerid, 16, 999999);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must be owner to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
        }
    }
   
    //SPY - Select Team
    if(dialogid == DIALOG_SSTEAM)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    SetPlayerColor(playerid, COLOR_BLUE);
                    GameTextForPlayer(playerid, "~b~DELTA FORCE", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_USA);
                }
                case 1:
                {
                    SetPlayerColor(playerid, COLOR_RED);
                    GameTextForPlayer(playerid, "~r~SPETSNAZ", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_RUSSIA);
                }
                case 2:
                {
                    SetPlayerColor(playerid, COLOR_GREEN);
                    GameTextForPlayer(playerid, "~g~GIGN", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_GIGN);
                }
                case 3:
                {
                    SetPlayerColor(playerid, COLOR_AQUA);
                    GameTextForPlayer(playerid, "ITALIAN ARMY", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_IA);
                }
                case 4:
                {
                    SetPlayerColor(playerid, 0xFF800096);
                    GameTextForPlayer(playerid, "Japan Self Defense Forces", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_JSDF);
                }
            }
        }
        else
        {
            //The player has pressed "Select".
            switch(listitem)
            {
                case 0:
                {
                    //Selected Item: "Delta Force (USA)"
                }
                case 1:
                {
                    //Selected Item: "Spetsnaz (Russia)"
                }
                case 2:
                {
                    //Selected Item: "GIGN (France)"
                }
                case 3:
                {
                    //Selected Item: "Italian Army (Italy)"
                }
                case 4:
                {
                    //Selected Item: "Japan Self Defense Forces (Japan)"
                }
            }
        }
    }
    return 0;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

//================= STOCKS ================//
stock GetVehicleSpeed(const vehicleid, bool:mph = false)
{
    new Float:x, Float:y, Float:z;
    GetVehicleVelocity(vehicleid, x, y, z);

    if(mph) return floatround(((floatpower(x, 2)) + (floatpower(y, 2)) + (floatpower(z, 2))) * 100);
    else return floatround((((floatpower(x, 2)) + (floatpower(y, 2)) + (floatpower(z, 2))) * 100) * 1.6);
}

stock GivePlayerScore(playerid, amount, bool:plus = true)
{
    new score = GetPlayerScore(playerid);
   
    if(plus) return SetPlayerScore(playerid, score+amount);
    else return SetPlayerScore(playerid, score-amount);
}

stock IsPlayerInArea(playerid,Float:min_x,Float:min_y,Float:max_x,Float:max_y)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if((X <= max_x && X >= min_x) && (Y <= max_y && Y >= min_y)) return 1;

    return 0;
}

stock TeamColor(playerid)
{
    new color;
    new team;
    team = GetPlayerTeam(playerid);
    if(team == TEAM_DELTA)
    {
        color = COLOR_BLUE;
    }
   
    if(team == TEAM_SPETSNAZ)
    {
        color = COLOR_RED;
    }
   
    if(team == TEAM_GIGN)
    {
        color = COLOR_GREEN;
    }
   
    if(team == TEAM_IA)
    {
        color = COLOR_AQUA;
    }
   
    if(team == TEAM_JSDF)
    {
        color = 0xFF800096;
    }
    return color;
}
   
//============== PUBLICS =================//
public ASKOff(playerid)
{
    PlayerInfo[playerid][Protected] = 0;
    SendClientMessage(playerid, COLOR_RED, "Anti-spawn kill off.");
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100.0);
    return 1;
}

//================ IRC PUBLICS ====================//
public IRC_OnConnect(botid)
{
    printf("*** IRC_OnConnect: Bot ID %d connected!", botid);
    // Join the channel
    if(botid == 1)
    {
        IRC_JoinChannel(botid, IRC_CHANNEL);
        IRC_AddToGroup(gGroupID, botid);
    }
    // Add the bot to the group
    return 1;
}

/*
    Note that this callback is executed whenever a current connection is closed
    OR whenever a connection attempt fails. Reconnecting too fast can flood the
    IRC server and possibly result in a ban. It is recommended to set up
    connection reattempts on a timer, as demonstrated here.
*/


public IRC_OnDisconnect(botid)
{
    printf("*** IRC_OnDisconnect: Bot ID %d disconnected!", botid);
    printf("*** IRC_OnDisconnect: Bot ID %d attempting to reconnect...", botid);
    // Remove the bot from the group
    IRC_RemoveFromGroup(gGroupID, botid);
    return 1;
}

public IRC_OnJoinChannel(botid, channel[])
{
    printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s!", botid, channel);
    return 1;
}

/*
    If the bot cannot immediately rejoin the channel (in the event, for example,
    that the bot is kicked and then banned), you might want to set up a timer
    here as well for rejoin attempts.
*/


public IRC_OnLeaveChannel(botid, channel[], message[])
{
    printf("*** IRC_OnLeaveChannel: Bot ID %d left channel %s (%s)!", botid, channel, message);
    IRC_JoinChannel(botid, channel);
    return 1;
}

public IRC_OnUserDisconnect(botid, user[], host[], message[])
{
    printf("*** IRC_OnUserDisconnect (Bot ID %d): User %s (%s) disconnected! (%s)", botid, user, host, message);
    return 1;
}

public IRC_OnUserJoinChannel(botid, channel[], user[], host[])
{
    printf("*** IRC_OnUserJoinChannel (Bot ID %d): User %s (%s) joined channel %s!", botid, user, host, channel);
    return 1;
}

public IRC_OnUserLeaveChannel(botid, channel[], user[], host[], message[])
{
    printf("*** IRC_OnUserLeaveChannel (Bot ID %d): User %s (%s) left channel %s (%s)!", botid, user, host, channel, message);
    return 1;
}

public IRC_OnUserNickChange(botid, oldnick[], newnick[], host[])
{
    printf("*** IRC_OnUserNickChange (Bot ID %d): User %s (%s) changed his nick to %s!", botid, oldnick, host, newnick);
    return 1;
}

public IRC_OnUserSetChannelMode(botid, channel[], user[], host[], mode[])
{
    printf("*** IRC_OnUserSetChannelMode (Bot ID %d): User %s (%s) on %s set mode: %s!", botid, user, host, channel, mode);
    return 1;
}

public IRC_OnUserSetChannelTopic(botid, channel[], user[], host[], topic[])
{
    printf("*** IRC_OnUserSetChannelTopic (Bot ID %d): User %s (%s) on %s set topic: %s!", botid, user, host, channel, topic);
    return 1;
}

public IRC_OnUserNotice(botid, recipient[], user[], host[], message[])
{
    printf("*** IRC_OnUserNotice (Bot ID %d): User %s (%s) sent notice to %s: %s", botid, user, host, recipient, message);
    return 1;
}

//=================== IRC Commands ===============//
IRCCMD:freeze(botid, channel[], user[], host[], params[])
{
    if(IRC_IsAdmin(botid, channel, user))
    {
        if(!strlen(params)) return IRC_Notice(botid, user, "*** Usage: !freeze (ID) (Reason)");
        new id;
        new Index;
        new tmp[256];
        tmp = strtok(params, Index);
        new reason;
        new string[100];
        new name[MAX_PLAYER_NAME];
        id = strval(tmp);
        reason = params[2];
        if(id == INVALID_PLAYER_ID) return IRC_Notice(botid, user, "*** Invalid player ID");
        else
        {
            GetPlayerName(id, name, sizeof(name));
            TogglePlayerControllable(id, 0);
            format(string, sizeof(string),"*** You have successfully frozen %s(%d)", name, id);
            IRC_Notice(botid, user, string);
            format(string, sizeof(string), "*** IRC Admin %s has frozen %s(%d) for reason %s", user, name, id, reason);
            IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
            format(string, sizeof(string), "-| You have been frozen by IRC Admin %s for reason %s |-", user, reason);
            SendClientMessage(id, COLOR_RED, string);
            format(string, sizeof(string),"-| IRC Admin %s has frozen %s(%d) for reason %s |-", user, name, id, reason);
            SendClientMessageToAll(COLOR_GREEN, string);
        }
    }
    return 1;
}

//================== STRTOK ==================//
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

//Area check
forward AreaCheck();
public AreaCheck()
{
    new gTeam;
    foreach(Player, i);
    {
        //KACC
        if(IsPlayerInArea(i, 2438.989, 2560.181, 2782.616, 2885.098))
        {
            gTeam = GetPlayerTeam(i);
            if(EnteredArea[i] == 0)
            {
                if(gTeam == TEAM_DELTA && CapturedBy == 1 || gTeam == TEAM_SPETSNAZ && CapturedBy == 2 || gTeam == TEAM_GIGN && CapturedBy == 3 || gTeam == TEAM_IA && CapturedBy == 4 || gTeam == TEAM_JSDF && CapturedBy == 5)
                {
                    SendClientMessage(i, COLOR_RED, "This area has already been captured by your team!");
                    EnteredArea[i] = 1;
                }
                else
                {
                    SendClientMessage(i, COLOR_GREEN, "Stay in the zone for 20 seconds to capture it.");
                    GangZoneFlashForAll(Z_KACC, TeamColor(i));
                    SendClientMessageToAll(COLOR_RED, "KACC Military fuels is being taken over!");
                    SetTimer("TakeOver", 20000, 0);
                }
            }
        }
    }
    return 1;
}

//Take over
forward TakeOver()
public TakeOver()
{
    foreach(Player, i);
    {
        new gTeam;
        gTeam = GetPlayerTeam(i));
        if(IsPlayerInArea(i, 2438.989, 2560.181, 2782.616, 2885.098))
        {
            GangZoneStopFlashForAll(Z_KACC);
            GangZoneHideForAll(Z_KACC);
            SetPlayerScore(i, GetPlayerScore(i) + 15);
            PlayerInfo[i][Xp] += 15;
            GivePlayerMoney(i, 3500);
            SendClientMessage(i, COLOR_GREEN, "You have recieved 15 XP and $3500 from the captured zone.");
           
            if(gTeam == TEAM_DELTA)
            {
                GangZoneShowForAll(Z_KACC, COLOR_BLUE);
                SendClientMessageToAll(-1, "Delta Force has captured KACC Military Fuels!");
            }
            else if(gTeam == TEAM_SPETSNAZ)
            {
                GangZoneShowForAll(Z_KACC, COLOR_RED);
                SendClientMessageToAll(-1, "Spetsnaz has captured KACC Military Fuels!");
            }
            else if(gTeam == TEAM_GIGN)
            {
                GangZoneShowForAll(Z_KACC, COLOR_GREEN);
                SendClientMessageToAll(-1, "GIGN has captured KACC Military Fuels!");
            }
            else if(gTeam == TEAM_IA)
            {
                GangZoneShowForAll(Z_KACC, COLOR_AQUA);
                SendClientMessageToAll(-1, "Italian Army has captured KACC Military Fuels!");
            }
            else if(gTeam == TEAM_JSDF)
            {
                GangZoneShowForAll(Z_KACC, 0xFF800096);
                SendClientMessageToAll(-1, "Japan Self Defense Forces has captured KACC Military Fuels!");
            }
        }
    }
    return 1;
}

Errors:
Code:
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(311) : warning 202: number of arguments does not match definition
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(311) : warning 202: number of arguments does not match definition
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(343) : warning 202: number of arguments does not match definition
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(343) : warning 202: number of arguments does not match definition
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(343) : warning 202: number of arguments does not match definition
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(333) : warning 204: symbol is assigned a value that is never used: "msg"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1071) : error 036: empty statement
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1074) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1076) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1077) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1081) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1082) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1086) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1087) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1099) : error 001: expected token: ";", but found "public"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1101) : error 036: empty statement
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1104) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1104) : error 029: invalid expression, assumed zero
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1104) : warning 215: expression has no effect
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1105) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1109) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1110) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1111) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1112) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1143) : warning 203: symbol is never used: "CapturedBy2"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1143) : warning 203: symbol is never used: "CapturedBy3"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1143) : warning 203: symbol is never used: "EnteredArea2"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1143) : warning 203: symbol is never used: "EnteredArea3"
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


17 Errors.
stormchaser206 is offline   Reply With Quote
Old 09/07/2012, 07:30 PM   #2
kepa333
Huge Clucker
 
kepa333's Avatar
 
Join Date: Feb 2012
Location: Slovenia
Posts: 361
Reputation: 16
Default Re: Lots of errors with zone capture system

try this. not tested but should work.


Code:
/*///////////////////
MWFFA - New Script

Work Started on June 18, 2012

*//////////////////

#include <a_samp>
#include <streamer>
#include <irc>
#include <foreach>

//Teams
#define TEAM_DELTA 1
#define TEAM_SPETSNAZ 2
#define TEAM_GIGN 3
#define TEAM_IA 4
#define TEAM_JSDF 5

//Dialogs
#define DIALOG_CTEAM   8343
#define DIALOG_SCLASS   10211
#define DIALOG_SSTEAM   3893

//IRC Stuff
#define IRC_SERVER "irc.mibbit.net"
#define IRC_PORT (6667)
#define IRC_CHANNEL "#MWFFA"

#define BOT_1_NICKNAME "Overlord"
#define BOT_1_REALNAME "SA-MP Bot"
#define BOT_1_USERNAME "Overlord_1"

#define MAX_BOTS (1)

new gBotID[MAX_BOTS], gGroupID;

//Defines
#define MAX_ZONES 50

//Colors
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_PINK 0xFF00FFFF
#define COLOR_GREEN 0x00FF00FF
#define COLOR_AQUA 0x00FFFFFF
#define COLOR_BLACK 0x000000FF
#define COLOR_BLUE 0x0000FFFF

//Skins
#define SKIN_TORENO 295
#define SKIN_WUZIMU 294
#define SKIN_USA 287
#define SKIN_RUSSIA 179
#define SKIN_GIGN 285
#define SKIN_IA 254
#define SKIN_JSDF 57

//Zones
new Z_KACC;
new Z_School;
new Z_Pier;

//Forwards
forward ASKOff(playerid);

//Enums
enum kInfo
{
    HasStreak,
    HasJug,
    HasStrike,
    HasTank,
    HasPackage,
    Streak
}
new StreakInfo[MAX_PLAYERS][kInfo];

enum pInfo
{
    Password,
    Cash,
    Score,
    Admin,
    Points,
    Xp,
    Protected,
    CapturingZone,
    Connects,
    Disconnects
}
new PlayerInfo[MAX_PLAYERS][pInfo];

//Class Variables
new IsSoldier[MAX_PLAYERS];
new IsSniper[MAX_PLAYERS];
new IsMedic[MAX_PLAYERS];
new IsEngineer[MAX_PLAYERS];
new IsPilot[MAX_PLAYERS];
new IsFlamethrower[MAX_PLAYERS];
new IsSpy[MAX_PLAYERS];
new IsScout[MAX_PLAYERS];
new IsPlaneDriver[MAX_PLAYERS];
new IsHeliDriver[MAX_PLAYERS];
new IsGeneral[MAX_PLAYERS];
new IsVIP[MAX_PLAYERS];
new IsAdmin[MAX_PLAYERS];
new IsOwner[MAX_PLAYERS];

//Capture var
new EnteredArea[MAX_PLAYERS];
new CapturedBy; // 0 ( none ) 1 ( Delta ) 2 ( Russia ) 3 - GIGN | 4 - Italian Army | 5 - JSDF

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

main()
{
    print("\n----------------------------------");
    print("------- MWFFA Script Loaded --------");
    print("----------------------------------\n");
}

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("MWFFA - World War lll");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);

    //Zones
    Z_KACC = GangZoneCreate(2438.989, 2560.181, 2782.616, 2885.098);
    Z_School = GangZoneCreate(-2197.686, -281.7203, -2008.414, -68.69224);
    Z_Pier = GangZoneCreate(371.8314, -2108.218, 459.2966, -1654.228);

    //IRC
    gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
    IRC_SetIntData(gBotID[0], E_IRC_CONNECT_DELAY, 20);
    gGroupID = IRC_CreateGroup();

    SetTimer("AreaCheck", 1000, true);
    return 1;
}

public OnGameModeExit()
{
    print("\n------------------------------------");
    print("------- MWFFA Script unloaded --------");
    print("--------------------------------------\n");

    IRC_Quit(gBotID[0], "Overlord (SA-MP Bot) exiting.");
    IRC_DestroyGroup(gGroupID);
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);

    GangZoneShowForPlayer(playerid, Z_KACC, 0xFF000096);
    GangZoneShowForPlayer(playerid, Z_School, 0xFF800096);
    GangZoneShowForPlayer(playerid, Z_Pier, 0xFFFF0096);

    //Select Team
    ShowPlayerDialog(playerid, DIALOG_CTEAM, DIALOG_STYLE_LIST, "Choose Team", "Delta Force (United States)\nSpetsnaz (Russia)\nGIGN (France)\nItalian Army (Italy)\nJapan Self Defense Forces (Japan)", "Select", "");
    return 1;
}

public OnPlayerConnect(playerid)
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string),"*** %s(%d) has joined the server.");
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    PlayerInfo[playerid][Connects]++;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new reasonMsg[20];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    switch(reason)
    {
        case 0: reasonMsg = "Timeout";
        case 1: reasonMsg = "Leaving";
        case 2: reasonMsg = "Kicked/Banned";
    }

    new string[70];
    format(string, sizeof(string),"*** %s(%d) has left the server (%s)", pName, playerid, reasonMsg);
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    format(string, sizeof(string),"-| %s(%d) has left the server! (%s) |-", pName, playerid, reasonMsg);
    SendClientMessageToAll(COLOR_PINK, string);
    PlayerInfo[playerid][Disconnects]++;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SendClientMessage(playerid, COLOR_YELLOW, "You are anti-spawn kill protected for 10 seconds");
    PlayerInfo[playerid][Protected] = 1;
    SetTimerEx("ASKOff", 10000, 0, "i", playerid);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    new pNameTwo[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(killerid, pNameTwo, sizeof(pNameTwo));
    new reasonMsg[30];
    if(killerid != INVALID_PLAYER_ID)
    {
        switch (reason)
        {
            case 0: reasonMsg = "Unarmed";
            case 1: reasonMsg = "Brass Knuckles";
            case 2: reasonMsg = "Golf Club";
            case 3: reasonMsg = "Night Stick";
            case 4: reasonMsg = "Knife";
            case 5: reasonMsg = "Baseball Bat";
            case 6: reasonMsg = "Shovel";
            case 7: reasonMsg = "Pool Cue";
            case 8: reasonMsg = "Katana";
            case 9: reasonMsg = "Chainsaw";
            case 10: reasonMsg = "Dildo";
            case 11: reasonMsg = "Dildo";
            case 12: reasonMsg = "Vibrator";
            case 13: reasonMsg = "Vibrator";
            case 14: reasonMsg = "Flowers";
            case 15: reasonMsg = "Cane";
            case 22: reasonMsg = "Pistol";
            case 23: reasonMsg = "Silenced Pistol";
            case 24: reasonMsg = "Desert Eagle";
            case 25: reasonMsg = "Shotgun";
            case 26: reasonMsg = "Sawn-off Shotgun";
            case 27: reasonMsg = "Combat Shotgun";
            case 28: reasonMsg = "MAC-10";
            case 29: reasonMsg = "MP5";
            case 30: reasonMsg = "AK-47";
            case 31: reasonMsg = "M4";
            case 32: reasonMsg = "TEC-9";
            case 33: reasonMsg = "Country Rifle";
            case 34: reasonMsg = "Sniper Rifle";
            case 37: reasonMsg = "Fire";
            case 38: reasonMsg = "Minigun";
            case 41: reasonMsg = "Spray Can";
            case 42: reasonMsg = "Fire Extinguisher";
            case 49: reasonMsg = "Vehicle Collision";
            case 50: reasonMsg = "Vehicle Collision";
            case 51: reasonMsg = "Explosion";
            default: reasonMsg = "Unknown";
        }

        StreakInfo[killerid][Streak]++;
        StreakInfo[playerid][Streak] = 0;
        format(string, sizeof(string),"-| You have killed %s(%d) and have earned $250, and 2 score |-", pName, playerid);
        SendClientMessage(killerid, COLOR_YELLOW, string);
        format(string, sizeof(string),"-| You have been killed by %s(%d) and have lost $100 |-", pNameTwo, killerid);
        SendClientMessage(playerid, COLOR_RED, string);
        GivePlayerScore(killerid, 2);
        GivePlayerMoney(killerid, 250);
        GivePlayerMoney(playerid, -100);
        format(string, sizeof(string),"*** %s(%d) has been killed by %s(%d). (%s)", pName, playerid, pNameTwo, killerid, reasonMsg);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, string);

        if(GetPlayerTeam(killerid) == GetPlayerTeam(playerid))
        {
            SetPlayerArmour(killerid, 0.0);
            SetPlayerHealth(killerid, 0);
            GameTextForPlayer(killerid, "~r~Killed for Team-Kill & Charged $2500", 8000, 2);
            GameTextForPlayer(playerid, "The teammate who killed you has been killed for team kill!", 4500, 6);
            GivePlayerMoney(killerid, -2500);
        }
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string),"*** %s(%d): %s", pName, playerid, text);
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{

dcmd_kill(playerid)
{
    new string[100];
    new cRand = random(10000);
    SetPlayerHealth(playerid, 0);
    SetPlayerArmour(playerid, 0.0);
    format(string, sizeof(string), "You have been charged $%d for using /kill", cRand);
    SendClientMessage(playerid, COLOR_RED, string);
    GivePlayerMoney(playerid, -cRand);
    return 1;
}

dcmd_radio(playerid, params[])
{
    new Index;
    new tmp[256];
    tmp = strtok(params, Index);
    new msg = params[1];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
        {
            if(IsPlayerConnected(i))
            {
                SendClientMessage(i, COLOR_GREEN, "[RADIO] %s(%d): %s", name, playerid, msg);
            }
            else SendClientMessage(playerid, COLOR_RED, "ERROR: There is no one on your team right now to talk to.");
        }
    }
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    return 1;
}

public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    return 1;
}

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    if(PlayerInfo[damagedid][Protected] == 1)
    {
        GameTextForPlayer(playerid, "~r~This person is Anti-Spawn kill protected", 5000, 6);
        SetPlayerHealth(damagedid, 100);
        SetPlayerArmour(damagedid, 100.0);
    }
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    if(success)
    {
        printf("RCON login success by IP %s using password %s", ip, password);
    }
    else
    {
        printf("Failed RCON login by IP %s using password %s", ip, password);
    }
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CTEAM)
    {
        ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
        switch(listitem)
        {
            case 0:
            {
                SetPlayerTeam(playerid, TEAM_DELTA);
                SetPlayerColor(playerid, COLOR_BLUE);
                GameTextForPlayer(playerid, "~b~DELTA FORCE", 7500, 6);
                SetPlayerSkin(playerid, SKIN_USA);
            }
            case 1:
            {
                SetPlayerTeam(playerid, TEAM_SPETSNAZ);
                SetPlayerColor(playerid, COLOR_RED);
                GameTextForPlayer(playerid, "~r~SPETSNAZ", 7500, 6);
                SetPlayerSkin(playerid, SKIN_RUSSIA);
            }
            case 2:
            {
                SetPlayerTeam(playerid, TEAM_GIGN);
                SetPlayerColor(playerid, COLOR_GREEN);
                GameTextForPlayer(playerid, "~g~GIGN", 7500, 6);
                SetPlayerSkin(playerid, SKIN_GIGN);
            }
            case 3:
            {
                SetPlayerTeam(playerid, TEAM_IA);
                SetPlayerColor(playerid, COLOR_AQUA);
                GameTextForPlayer(playerid, "ITALIAN ARMY", 7500, 6);
                SetPlayerSkin(playerid, SKIN_IA);
            }
            case 4:
            {
                SetPlayerTeam(playerid, TEAM_JSDF);
                SetPlayerColor(playerid, 0xFF800096);
                GameTextForPlayer(playerid, "Japan Self Defense Forces", 7500, 6);
                SetPlayerSkin(playerid, SKIN_JSDF);
            }
        }
    }

    if(dialogid == DIALOG_SCLASS)
    {
        SpawnPlayer(playerid);
        switch(listitem)
        {
            case 0:
            {
                IsSoldier[playerid] = 1;
                GameTextForPlayer(playerid, "Soldier", 5000, 6);
                GivePlayerWeapon(playerid, 4, 1);
                GivePlayerWeapon(playerid, 24, 30);
                GivePlayerWeapon(playerid, 31, 200);
            }
            case 1:
            {
                IsSniper[playerid] = 1;
                GameTextForPlayer(playerid, "Sniper", 5000, 6);
                GivePlayerWeapon(playerid, 3, 1);
                GivePlayerWeapon(playerid, 23, 40);
                GivePlayerWeapon(playerid, 34, 250);
                GivePlayerWeapon(playerid, 17, 20);
            }
            case 2:
            {
                if(PlayerInfo[playerid][Xp] >= 30)
                {
                    IsMedic[playerid] = 1;
                    GameTextForPlayer(playerid, "Medic", 5000, 6);
                    GivePlayerWeapon(playerid, 15, 1);
                    GivePlayerWeapon(playerid, 22, 75);
                    GivePlayerWeapon(playerid, 30, 200);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 30+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 3:
            {
                if(PlayerInfo[playerid][Xp] >= 75)
                {
                    IsEngineer[playerid] = 1;
                    GameTextForPlayer(playerid, "Engineer", 5000, 6);
                    GivePlayerWeapon(playerid, 5, 1);
                    GivePlayerWeapon(playerid, 27, 50);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 43, 40);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 75+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 4:
            {
                if(PlayerInfo[playerid][Xp] >= 120)
                {
                    IsPilot[playerid] = 1;
                    GameTextForPlayer(playerid, "Pilot", 5000, 6);
                    GivePlayerWeapon(playerid, 22, 60);
                    GivePlayerWeapon(playerid, 30, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 120+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 5:
            {
                if(PlayerInfo[playerid][Xp] >= 200)
                {
                    IsFlamethrower[playerid] = 1;
                    GameTextForPlayer(playerid, "Flamethrower", 5000, 6);
                    GivePlayerWeapon(playerid, 18, 20);
                    GivePlayerWeapon(playerid, 24, 75);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 37, 350);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 200+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 6:
            {
                if(PlayerInfo[playerid][Xp] >= 310)
                {
                    IsSpy[playerid] = 1;
                    GameTextForPlayer(playerid, "Spy", 5000, 6);
                    GivePlayerWeapon(playerid, 15, 1);
                    GivePlayerWeapon(playerid, 23, 50);
                    GivePlayerWeapon(playerid, 31, 200);
                    ShowPlayerDialog(playerid, DIALOG_SSTEAM, DIALOG_STYLE_LIST, "Select Disguise Team", "Delta Force (USA)\nSpetsnaz (Russia)\nGIGN (France)\nItalian Army (Italy)\nJapan Self Defense Forces (Japan)", "Select", "Back");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 310+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 7:
            {
                if(PlayerInfo[playerid][Xp] >= 350)
                {
                    IsScout[playerid] = 1;
                    GameTextForPlayer(playerid, "Scout", 5000, 6);
                    GivePlayerWeapon(playerid, 4, 1);
                    GivePlayerWeapon(playerid, 23, 75);
                    GivePlayerWeapon(playerid, 29, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 350+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 8:
            {
                if(PlayerInfo[playerid][Xp] >= 500)
                {
                    IsPlaneDriver[playerid] = 1;
                    GameTextForPlayer(playerid, "Cargo Plane Driver", 5000, 6);
                    GivePlayerWeapon(playerid, 26, 80);
                    GivePlayerWeapon(playerid, 29, 75);
                    GivePlayerWeapon(playerid, 33, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 500+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 9:
            {
                if(PlayerInfo[playerid][Xp] >= 630)
                {
                    IsHeliDriver[playerid] = 1;
                    GameTextForPlayer(playerid, "Helicopter Plane Driver", 5000, 6);
                    GivePlayerWeapon(playerid, 26, 80);
                    GivePlayerWeapon(playerid, 29, 75);
                    GivePlayerWeapon(playerid, 33, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 630+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 10:
            {
                if(PlayerInfo[playerid][Xp] >= 800)
                {
                    IsGeneral[playerid] = 1;
                    GameTextForPlayer(playerid, "General", 5000, 6);
                    GivePlayerWeapon(playerid, 26, 80);
                    GivePlayerWeapon(playerid, 29, 75);
                    GivePlayerWeapon(playerid, 33, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 800+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 11:
            {
                if(PlayerInfo[playerid][Points] >= 1)
                {
                    IsVIP[playerid] = 1;
                    GameTextForPlayer(playerid, "~y~VIP", 5000, 6);
                    GivePlayerWeapon(playerid, 24, 80);
                    GivePlayerWeapon(playerid, 32, 75);
                    GivePlayerWeapon(playerid, 31, 150);
                    GivePlayerWeapon(playerid, 39, 200);
                    GivePlayerWeapon(playerid, 40, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 1+ VIP Points to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 12:
            {
                if(PlayerInfo[playerid][Admin] >= 1)
                {
                    IsAdmin[playerid] = 1;
                    GameTextForPlayer(playerid, "~r~Administrator", 5000, 6);
                    GivePlayerWeapon(playerid, 24, 80);
                    GivePlayerWeapon(playerid, 28, 110);
                    GivePlayerWeapon(playerid, 30, 130);
                    GivePlayerWeapon(playerid, 37, 200);
                    GivePlayerWeapon(playerid, 16, 5);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have Admin level 1+ to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 13:
            {
                if(PlayerInfo[playerid][Admin] == 10)
                {
                    IsOwner[playerid] = 1;
                    GameTextForPlayer(playerid, "~r~Owner", 5000, 6);
                    GivePlayerWeapon(playerid, 22, 999999);
                    GivePlayerWeapon(playerid, 32, 999999);
                    GivePlayerWeapon(playerid, 31, 999999);
                    GivePlayerWeapon(playerid, 38, 999999);
                    GivePlayerWeapon(playerid, 16, 999999);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must be owner to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
        }
    }

    //SPY - Select Team
    if(dialogid == DIALOG_SSTEAM)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    SetPlayerColor(playerid, COLOR_BLUE);
                    GameTextForPlayer(playerid, "~b~DELTA FORCE", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_USA);
                }
                case 1:
                {
                    SetPlayerColor(playerid, COLOR_RED);
                    GameTextForPlayer(playerid, "~r~SPETSNAZ", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_RUSSIA);
                }
                case 2:
                {
                    SetPlayerColor(playerid, COLOR_GREEN);
                    GameTextForPlayer(playerid, "~g~GIGN", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_GIGN);
                }
                case 3:
                {
                    SetPlayerColor(playerid, COLOR_AQUA);
                    GameTextForPlayer(playerid, "ITALIAN ARMY", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_IA);
                }
                case 4:
                {
                    SetPlayerColor(playerid, 0xFF800096);
                    GameTextForPlayer(playerid, "Japan Self Defense Forces", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_JSDF);
                }
            }
        }
        else
        {
            //The player has pressed "Select".
            switch(listitem)
            {
                case 0:
                {
                    //Selected Item: "Delta Force (USA)"
                }
                case 1:
                {
                    //Selected Item: "Spetsnaz (Russia)"
                }
                case 2:
                {
                    //Selected Item: "GIGN (France)"
                }
                case 3:
                {
                    //Selected Item: "Italian Army (Italy)"
                }
                case 4:
                {
                    //Selected Item: "Japan Self Defense Forces (Japan)"
                }
            }
        }
    }
    return 0;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

//================= STOCKS ================//
stock GetVehicleSpeed(const vehicleid, bool:mph = false)
{
    new Float:x, Float:y, Float:z;
    GetVehicleVelocity(vehicleid, x, y, z);

    if(mph) return floatround(((floatpower(x, 2)) + (floatpower(y, 2)) + (floatpower(z, 2))) * 100);
    else return floatround((((floatpower(x, 2)) + (floatpower(y, 2)) + (floatpower(z, 2))) * 100) * 1.6);
}

stock GivePlayerScore(playerid, amount, bool:plus = true)
{
    new score = GetPlayerScore(playerid);

    if(plus) return SetPlayerScore(playerid, score+amount);
    else return SetPlayerScore(playerid, score-amount);
}

stock IsPlayerInArea(playerid,Float:min_x,Float:min_y,Float:max_x,Float:max_y)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if((X <= max_x && X >= min_x) && (Y <= max_y && Y >= min_y)) return 1;

    return 0;
}

stock TeamColor(playerid)
{
    new color;
    new team;
    team = GetPlayerTeam(playerid);
    if(team == TEAM_DELTA)
    {
        color = COLOR_BLUE;
    }

    if(team == TEAM_SPETSNAZ)
    {
        color = COLOR_RED;
    }

    if(team == TEAM_GIGN)
    {
        color = COLOR_GREEN;
    }

    if(team == TEAM_IA)
    {
        color = COLOR_AQUA;
    }

    if(team == TEAM_JSDF)
    {
        color = 0xFF800096;
    }
    return color;
}

//============== PUBLICS =================//
public ASKOff(playerid)
{
    PlayerInfo[playerid][Protected] = 0;
    SendClientMessage(playerid, COLOR_RED, "Anti-spawn kill off.");
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100.0);
    return 1;
}

//================ IRC PUBLICS ====================//
public IRC_OnConnect(botid)
{
    printf("*** IRC_OnConnect: Bot ID %d connected!", botid);
    // Join the channel
    if(botid == 1)
    {
        IRC_JoinChannel(botid, IRC_CHANNEL);
        IRC_AddToGroup(gGroupID, botid);
    }
    // Add the bot to the group
    return 1;
}

/*
    Note that this callback is executed whenever a current connection is closed
    OR whenever a connection attempt fails. Reconnecting too fast can flood the
    IRC server and possibly result in a ban. It is recommended to set up
    connection reattempts on a timer, as demonstrated here.
*/

public IRC_OnDisconnect(botid)
{
    printf("*** IRC_OnDisconnect: Bot ID %d disconnected!", botid);
    printf("*** IRC_OnDisconnect: Bot ID %d attempting to reconnect...", botid);
    // Remove the bot from the group
    IRC_RemoveFromGroup(gGroupID, botid);
    return 1;
}

public IRC_OnJoinChannel(botid, channel[])
{
    printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s!", botid, channel);
    return 1;
}

/*
    If the bot cannot immediately rejoin the channel (in the event, for example,
    that the bot is kicked and then banned), you might want to set up a timer
    here as well for rejoin attempts.
*/

public IRC_OnLeaveChannel(botid, channel[], message[])
{
    printf("*** IRC_OnLeaveChannel: Bot ID %d left channel %s (%s)!", botid, channel, message);
    IRC_JoinChannel(botid, channel);
    return 1;
}

public IRC_OnUserDisconnect(botid, user[], host[], message[])
{
    printf("*** IRC_OnUserDisconnect (Bot ID %d): User %s (%s) disconnected! (%s)", botid, user, host, message);
    return 1;
}

public IRC_OnUserJoinChannel(botid, channel[], user[], host[])
{
    printf("*** IRC_OnUserJoinChannel (Bot ID %d): User %s (%s) joined channel %s!", botid, user, host, channel);
    return 1;
}

public IRC_OnUserLeaveChannel(botid, channel[], user[], host[], message[])
{
    printf("*** IRC_OnUserLeaveChannel (Bot ID %d): User %s (%s) left channel %s (%s)!", botid, user, host, channel, message);
    return 1;
}

public IRC_OnUserNickChange(botid, oldnick[], newnick[], host[])
{
    printf("*** IRC_OnUserNickChange (Bot ID %d): User %s (%s) changed his nick to %s!", botid, oldnick, host, newnick);
    return 1;
}

public IRC_OnUserSetChannelMode(botid, channel[], user[], host[], mode[])
{
    printf("*** IRC_OnUserSetChannelMode (Bot ID %d): User %s (%s) on %s set mode: %s!", botid, user, host, channel, mode);
    return 1;
}

public IRC_OnUserSetChannelTopic(botid, channel[], user[], host[], topic[])
{
    printf("*** IRC_OnUserSetChannelTopic (Bot ID %d): User %s (%s) on %s set topic: %s!", botid, user, host, channel, topic);
    return 1;
}

public IRC_OnUserNotice(botid, recipient[], user[], host[], message[])
{
    printf("*** IRC_OnUserNotice (Bot ID %d): User %s (%s) sent notice to %s: %s", botid, user, host, recipient, message);
    return 1;
}

//=================== IRC Commands ===============//
IRCCMD:freeze(botid, channel[], user[], host[], params[])
{
    if(IRC_IsAdmin(botid, channel, user))
    {
        if(!strlen(params)) return IRC_Notice(botid, user, "*** Usage: !freeze (ID) (Reason)");
        new id;
        new Index;
        new tmp[256];
        tmp = strtok(params, Index);
        new reason;
        new string[100];
        new name[MAX_PLAYER_NAME];
        id = strval(tmp);
        reason = params[2];
        if(id == INVALID_PLAYER_ID) return IRC_Notice(botid, user, "*** Invalid player ID");
        else
        {
            GetPlayerName(id, name, sizeof(name));
            TogglePlayerControllable(id, 0);
            format(string, sizeof(string),"*** You have successfully frozen %s(%d)", name, id);
            IRC_Notice(botid, user, string);
            format(string, sizeof(string), "*** IRC Admin %s has frozen %s(%d) for reason %s", user, name, id, reason);
            IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
            format(string, sizeof(string), "-| You have been frozen by IRC Admin %s for reason %s |-", user, reason);
            SendClientMessage(id, COLOR_RED, string);
            format(string, sizeof(string),"-| IRC Admin %s has frozen %s(%d) for reason %s |-", user, name, id, reason);
            SendClientMessageToAll(COLOR_GREEN, string);
        }
    }
    return 1;
}

//================== STRTOK ==================//
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

//Area check
forward AreaCheck();
public AreaCheck()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
   	{
	    new gTeam;
	    foreach(Player, i);
	    {
	        if(IsPlayerInArea(i, 2438.989, 2560.181, 2782.616, 2885.098))
	        {
	            gTeam = GetPlayerTeam(i);
	            if(EnteredArea[i] == 0)
	            {
	                if(gTeam == TEAM_DELTA && CapturedBy == 1 || gTeam == TEAM_SPETSNAZ && CapturedBy == 2 || gTeam == TEAM_GIGN && CapturedBy == 3 || gTeam == TEAM_IA && CapturedBy == 4 || gTeam == TEAM_JSDF && CapturedBy == 5)
	                {
	                    SendClientMessage(i, COLOR_RED, "This area has already been captured by your team!");
	                    EnteredArea[i] = 1;
	                }
	                else
	                {
	                    SendClientMessage(i, COLOR_GREEN, "Stay in the zone for 20 seconds to capture it.");
	                    GangZoneFlashForAll(Z_KACC, TeamColor(i));
	                    SendClientMessageToAll(COLOR_RED, "KACC Military fuels is being taken over!");
	                    SetTimer("TakeOver", 20000, 0);
	                }
				}
            }
        }
    }
    return 1;
}

//Take over
forward TakeOver();
public TakeOver()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
   	{
	    foreach(Player, i);
	    {
	        new gTeam;
	        gTeam = GetPlayerTeam(i));
	        if(IsPlayerInArea(i, 2438.989, 2560.181, 2782.616, 2885.098))
	        {
	            GangZoneStopFlashForAll(Z_KACC);
	            GangZoneHideForAll(Z_KACC);
	            SetPlayerScore(i, GetPlayerScore(i) + 15);
	            PlayerInfo[i][Xp] += 15;
	            GivePlayerMoney(i, 3500);
	            SendClientMessage(i, COLOR_GREEN, "You have recieved 15 XP and $3500 from the captured zone.");

	            if(gTeam == TEAM_DELTA)
	            {
	                GangZoneShowForAll(Z_KACC, COLOR_BLUE);
	                SendClientMessageToAll(-1, "Delta Force has captured KACC Military Fuels!");
	            }
	            else if(gTeam == TEAM_SPETSNAZ)
	            {
	                GangZoneShowForAll(Z_KACC, COLOR_RED);
	                SendClientMessageToAll(-1, "Spetsnaz has captured KACC Military Fuels!");
	            }
	            else if(gTeam == TEAM_GIGN)
	            {
	                GangZoneShowForAll(Z_KACC, COLOR_GREEN);
	                SendClientMessageToAll(-1, "GIGN has captured KACC Military Fuels!");
	            }
	            else if(gTeam == TEAM_IA)
	            {
	                GangZoneShowForAll(Z_KACC, COLOR_AQUA);
	                SendClientMessageToAll(-1, "Italian Army has captured KACC Military Fuels!");
	            }
	            else if(gTeam == TEAM_JSDF)
	            {
	                GangZoneShowForAll(Z_KACC, 0xFF800096);
	                SendClientMessageToAll(-1, "Japan Self Defense Forces has captured KACC Military Fuels!");
	            }

        }
    }
    return 1;
}
if it works rep plz
__________________
My Works:




kepa333 is offline   Reply With Quote
Old 09/07/2012, 07:42 PM   #3
reh_007
Big Clucker
 
Join Date: Nov 2011
Location: In a ferrari next to you
Posts: 106
Reputation: 3
Default Re: Lots of errors with zone capture system

Why ask 4 rep, Earn it, not ask 4 it.
reh_007 is offline   Reply With Quote
Old 09/07/2012, 07:52 PM   #4
kepa333
Huge Clucker
 
kepa333's Avatar
 
Join Date: Feb 2012
Location: Slovenia
Posts: 361
Reputation: 16
Default Re: Lots of errors with zone capture system

i trying to help.... also i need rep for AD my server...
__________________
My Works:




kepa333 is offline   Reply With Quote
Old 09/07/2012, 07:54 PM   #5
reh_007
Big Clucker
 
Join Date: Nov 2011
Location: In a ferrari next to you
Posts: 106
Reputation: 3
Default Re: Lots of errors with zone capture system

lol .. Work hard 4 it. But yeah, thanks for helping the newbie.
reh_007 is offline   Reply With Quote
Old 09/07/2012, 07:56 PM   #6
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 695
Reputation: 46
Default Re: Lots of errors with zone capture system

I'm not a newbie... I just don't know what the problem is sometimes, BTW testing that script now

EDIT: Got some fixed, but now with your code:
Code:
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(267) : error 017: undefined symbol "GivePlayerScore"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(308) : error 017: undefined symbol "dcmd_kill"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(317) : error 079: inconsistent return types (array & non-array)
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(320) : warning 225: unreachable code
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(320) : error 017: undefined symbol "dcmd_radio"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(324) : error 017: undefined symbol "strtok"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(324) : error 033: array must be indexed (variable "tmp")
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(325) : error 017: undefined symbol "params"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(325) : warning 215: expression has no effect
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(325) : error 001: expected token: ";", but found "]"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(325) : error 029: invalid expression, assumed zero
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(325) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


10 Errors.

Last edited by stormchaser206; 09/07/2012 at 07:59 PM. Reason: Look at the post!
stormchaser206 is offline   Reply With Quote
Old 09/07/2012, 08:05 PM   #7
kepa333
Huge Clucker
 
kepa333's Avatar
 
Join Date: Feb 2012
Location: Slovenia
Posts: 361
Reputation: 16
Default Re: Lots of errors with zone capture system

try to replace
Code:
dcmd_kill
with
Code:
dcmd_kill(playerid,params[])
__________________
My Works:




kepa333 is offline   Reply With Quote
Old 09/07/2012, 08:19 PM   #8
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 695
Reputation: 46
Default Re: Lots of errors with zone capture system

Actually i fixed the params stuff but now:

Code:
pawn Code:
/*///////////////////
MWFFA - New Script

Work Started on June 18, 2012

*/
/////////////////

#include <a_samp>
#include <streamer>
#include <irc>
#include <foreach>

//Teams
#define TEAM_DELTA 1
#define TEAM_SPETSNAZ 2
#define TEAM_GIGN 3
#define TEAM_IA 4
#define TEAM_JSDF 5

//Dialogs
#define DIALOG_CTEAM   8343
#define DIALOG_SCLASS   10211
#define DIALOG_SSTEAM   3893

//IRC Stuff
#define IRC_SERVER "irc.mibbit.net"
#define IRC_PORT (6667)
#define IRC_CHANNEL "#MWFFA"

#define BOT_1_NICKNAME "Overlord"
#define BOT_1_REALNAME "SA-MP Bot"
#define BOT_1_USERNAME "Overlord_1"

#define MAX_BOTS (1)

new gBotID[MAX_BOTS], gGroupID;

//Defines
#define MAX_ZONES 50

//Colors
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_PINK 0xFF00FFFF
#define COLOR_GREEN 0x00FF00FF
#define COLOR_AQUA 0x00FFFFFF
#define COLOR_BLACK 0x000000FF
#define COLOR_BLUE 0x0000FFFF

//Skins
#define SKIN_TORENO 295
#define SKIN_WUZIMU 294
#define SKIN_USA 287
#define SKIN_RUSSIA 179
#define SKIN_GIGN 285
#define SKIN_IA 254
#define SKIN_JSDF 57

//Zones
new Z_KACC;
new Z_School;
new Z_Pier;

//Forwards
forward ASKOff(playerid);

//Enums
enum kInfo
{
    HasStreak,
    HasJug,
    HasStrike,
    HasTank,
    HasPackage,
    Streak
}
new StreakInfo[MAX_PLAYERS][kInfo];

enum pInfo
{
    Password,
    Cash,
    Score,
    Admin,
    Points,
    Xp,
    Protected,
    CapturingZone,
    Connects,
    Disconnects
}
new PlayerInfo[MAX_PLAYERS][pInfo];

//Class Variables
new IsSoldier[MAX_PLAYERS];
new IsSniper[MAX_PLAYERS];
new IsMedic[MAX_PLAYERS];
new IsEngineer[MAX_PLAYERS];
new IsPilot[MAX_PLAYERS];
new IsFlamethrower[MAX_PLAYERS];
new IsSpy[MAX_PLAYERS];
new IsScout[MAX_PLAYERS];
new IsPlaneDriver[MAX_PLAYERS];
new IsHeliDriver[MAX_PLAYERS];
new IsGeneral[MAX_PLAYERS];
new IsVIP[MAX_PLAYERS];
new IsAdmin[MAX_PLAYERS];
new IsOwner[MAX_PLAYERS];

//Capture var
new EnteredArea[MAX_PLAYERS];
new CapturedBy; // 0 ( none ) 1 ( Delta ) 2 ( Russia ) 3 - GIGN | 4 - Italian Army | 5 - JSDF

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

main()
{
    print("\n----------------------------------");
    print("------- MWFFA Script Loaded --------");
    print("----------------------------------\n");
}

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("MWFFA - World War lll");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);

    //Zones
    Z_KACC = GangZoneCreate(2438.989, 2560.181, 2782.616, 2885.098);
    Z_School = GangZoneCreate(-2197.686, -281.7203, -2008.414, -68.69224);
    Z_Pier = GangZoneCreate(371.8314, -2108.218, 459.2966, -1654.228);

    //IRC
    gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
    IRC_SetIntData(gBotID[0], E_IRC_CONNECT_DELAY, 20);
    gGroupID = IRC_CreateGroup();

    SetTimer("AreaCheck", 1000, true);
    return 1;
}

public OnGameModeExit()
{
    print("\n------------------------------------");
    print("------- MWFFA Script unloaded --------");
    print("--------------------------------------\n");

    IRC_Quit(gBotID[0], "Overlord (SA-MP Bot) exiting.");
    IRC_DestroyGroup(gGroupID);
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);

    GangZoneShowForPlayer(playerid, Z_KACC, 0xFF000096);
    GangZoneShowForPlayer(playerid, Z_School, 0xFF800096);
    GangZoneShowForPlayer(playerid, Z_Pier, 0xFFFF0096);

    //Select Team
    ShowPlayerDialog(playerid, DIALOG_CTEAM, DIALOG_STYLE_LIST, "Choose Team", "Delta Force (United States)\nSpetsnaz (Russia)\nGIGN (France)\nItalian Army (Italy)\nJapan Self Defense Forces (Japan)", "Select", "");
    return 1;
}

public OnPlayerConnect(playerid)
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string),"*** %s(%d) has joined the server.");
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    PlayerInfo[playerid][Connects]++;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new reasonMsg[20];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    switch(reason)
    {
        case 0: reasonMsg = "Timeout";
        case 1: reasonMsg = "Leaving";
        case 2: reasonMsg = "Kicked/Banned";
    }

    new string[70];
    format(string, sizeof(string),"*** %s(%d) has left the server (%s)", pName, playerid, reasonMsg);
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    format(string, sizeof(string),"-| %s(%d) has left the server! (%s) |-", pName, playerid, reasonMsg);
    SendClientMessageToAll(COLOR_PINK, string);
    PlayerInfo[playerid][Disconnects]++;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SendClientMessage(playerid, COLOR_YELLOW, "You are anti-spawn kill protected for 10 seconds");
    PlayerInfo[playerid][Protected] = 1;
    SetTimerEx("ASKOff", 10000, 0, "i", playerid);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    new pNameTwo[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(killerid, pNameTwo, sizeof(pNameTwo));
    new reasonMsg[30];
    if(killerid != INVALID_PLAYER_ID)
    {
        switch (reason)
        {
            case 0: reasonMsg = "Unarmed";
            case 1: reasonMsg = "Brass Knuckles";
            case 2: reasonMsg = "Golf Club";
            case 3: reasonMsg = "Night Stick";
            case 4: reasonMsg = "Knife";
            case 5: reasonMsg = "Baseball Bat";
            case 6: reasonMsg = "Shovel";
            case 7: reasonMsg = "Pool Cue";
            case 8: reasonMsg = "Katana";
            case 9: reasonMsg = "Chainsaw";
            case 10: reasonMsg = "Dildo";
            case 11: reasonMsg = "Dildo";
            case 12: reasonMsg = "Vibrator";
            case 13: reasonMsg = "Vibrator";
            case 14: reasonMsg = "Flowers";
            case 15: reasonMsg = "Cane";
            case 22: reasonMsg = "Pistol";
            case 23: reasonMsg = "Silenced Pistol";
            case 24: reasonMsg = "Desert Eagle";
            case 25: reasonMsg = "Shotgun";
            case 26: reasonMsg = "Sawn-off Shotgun";
            case 27: reasonMsg = "Combat Shotgun";
            case 28: reasonMsg = "MAC-10";
            case 29: reasonMsg = "MP5";
            case 30: reasonMsg = "AK-47";
            case 31: reasonMsg = "M4";
            case 32: reasonMsg = "TEC-9";
            case 33: reasonMsg = "Country Rifle";
            case 34: reasonMsg = "Sniper Rifle";
            case 37: reasonMsg = "Fire";
            case 38: reasonMsg = "Minigun";
            case 41: reasonMsg = "Spray Can";
            case 42: reasonMsg = "Fire Extinguisher";
            case 49: reasonMsg = "Vehicle Collision";
            case 50: reasonMsg = "Vehicle Collision";
            case 51: reasonMsg = "Explosion";
            default: reasonMsg = "Unknown";
        }

        StreakInfo[killerid][Streak]++;
        StreakInfo[playerid][Streak] = 0;
        format(string, sizeof(string),"-| You have killed %s(%d) and have earned $250, and 2 score |-", pName, playerid);
        SendClientMessage(killerid, COLOR_YELLOW, string);
        format(string, sizeof(string),"-| You have been killed by %s(%d) and have lost $100 |-", pNameTwo, killerid);
        SendClientMessage(playerid, COLOR_RED, string);
        GivePlayerScore(killerid, 2);
        GivePlayerMoney(killerid, 250);
        GivePlayerMoney(playerid, -100);
        format(string, sizeof(string),"*** %s(%d) has been killed by %s(%d). (%s)", pName, playerid, pNameTwo, killerid, reasonMsg);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, string);

        if(GetPlayerTeam(killerid) == GetPlayerTeam(playerid))
        {
            SetPlayerArmour(killerid, 0.0);
            SetPlayerHealth(killerid, 0);
            GameTextForPlayer(killerid, "~r~Killed for Team-Kill & Charged $2500", 8000, 2);
            GameTextForPlayer(playerid, "The teammate who killed you has been killed for team kill!", 4500, 6);
            GivePlayerMoney(killerid, -2500);
        }
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string),"*** %s(%d): %s", pName, playerid, text);
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(kill,3,cmdtext);
    dcmd(radio,5,cmdtext);
    return 1;
}

dcmd_kill(playerid)
{
    new string[100];
    new cRand = random(10000);
    SetPlayerHealth(playerid, 0);
    SetPlayerArmour(playerid, 0.0);
    format(string, sizeof(string), "You have been charged $%d for using /kill", cRand);
    SendClientMessage(playerid, COLOR_RED, string);
    GivePlayerMoney(playerid, -cRand);
    return 1;
}

dcmd_radio(playerid, params[])
{
    new msg;
    msg = params[2];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
        {
            if(IsPlayerConnected(i))
            {
                SendClientMessage(i, COLOR_GREEN, "[RADIO] %s(%d): %s", name, playerid, msg);
            }
            else SendClientMessage(playerid, COLOR_RED, "ERROR: There is no one on your team right now to talk to.");
        }
    }
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    return 1;
}

public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    return 1;
}

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    if(PlayerInfo[damagedid][Protected] == 1)
    {
        GameTextForPlayer(playerid, "~r~This person is Anti-Spawn kill protected", 5000, 6);
        SetPlayerHealth(damagedid, 100);
        SetPlayerArmour(damagedid, 100.0);
    }
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    if(success)
    {
        printf("RCON login success by IP %s using password %s", ip, password);
    }
    else
    {
        printf("Failed RCON login by IP %s using password %s", ip, password);
    }
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CTEAM)
    {
        ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
        switch(listitem)
        {
            case 0:
            {
                SetPlayerTeam(playerid, TEAM_DELTA);
                SetPlayerColor(playerid, COLOR_BLUE);
                GameTextForPlayer(playerid, "~b~DELTA FORCE", 7500, 6);
                SetPlayerSkin(playerid, SKIN_USA);
            }
            case 1:
            {
                SetPlayerTeam(playerid, TEAM_SPETSNAZ);
                SetPlayerColor(playerid, COLOR_RED);
                GameTextForPlayer(playerid, "~r~SPETSNAZ", 7500, 6);
                SetPlayerSkin(playerid, SKIN_RUSSIA);
            }
            case 2:
            {
                SetPlayerTeam(playerid, TEAM_GIGN);
                SetPlayerColor(playerid, COLOR_GREEN);
                GameTextForPlayer(playerid, "~g~GIGN", 7500, 6);
                SetPlayerSkin(playerid, SKIN_GIGN);
            }
            case 3:
            {
                SetPlayerTeam(playerid, TEAM_IA);
                SetPlayerColor(playerid, COLOR_AQUA);
                GameTextForPlayer(playerid, "ITALIAN ARMY", 7500, 6);
                SetPlayerSkin(playerid, SKIN_IA);
            }
            case 4:
            {
                SetPlayerTeam(playerid, TEAM_JSDF);
                SetPlayerColor(playerid, 0xFF800096);
                GameTextForPlayer(playerid, "Japan Self Defense Forces", 7500, 6);
                SetPlayerSkin(playerid, SKIN_JSDF);
            }
        }
    }

    if(dialogid == DIALOG_SCLASS)
    {
        SpawnPlayer(playerid);
        switch(listitem)
        {
            case 0:
            {
                IsSoldier[playerid] = 1;
                GameTextForPlayer(playerid, "Soldier", 5000, 6);
                GivePlayerWeapon(playerid, 4, 1);
                GivePlayerWeapon(playerid, 24, 30);
                GivePlayerWeapon(playerid, 31, 200);
            }
            case 1:
            {
                IsSniper[playerid] = 1;
                GameTextForPlayer(playerid, "Sniper", 5000, 6);
                GivePlayerWeapon(playerid, 3, 1);
                GivePlayerWeapon(playerid, 23, 40);
                GivePlayerWeapon(playerid, 34, 250);
                GivePlayerWeapon(playerid, 17, 20);
            }
            case 2:
            {
                if(PlayerInfo[playerid][Xp] >= 30)
                {
                    IsMedic[playerid] = 1;
                    GameTextForPlayer(playerid, "Medic", 5000, 6);
                    GivePlayerWeapon(playerid, 15, 1);
                    GivePlayerWeapon(playerid, 22, 75);
                    GivePlayerWeapon(playerid, 30, 200);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 30+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 3:
            {
                if(PlayerInfo[playerid][Xp] >= 75)
                {
                    IsEngineer[playerid] = 1;
                    GameTextForPlayer(playerid, "Engineer", 5000, 6);
                    GivePlayerWeapon(playerid, 5, 1);
                    GivePlayerWeapon(playerid, 27, 50);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 43, 40);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 75+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 4:
            {
                if(PlayerInfo[playerid][Xp] >= 120)
                {
                    IsPilot[playerid] = 1;
                    GameTextForPlayer(playerid, "Pilot", 5000, 6);
                    GivePlayerWeapon(playerid, 22, 60);
                    GivePlayerWeapon(playerid, 30, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 120+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 5:
            {
                if(PlayerInfo[playerid][Xp] >= 200)
                {
                    IsFlamethrower[playerid] = 1;
                    GameTextForPlayer(playerid, "Flamethrower", 5000, 6);
                    GivePlayerWeapon(playerid, 18, 20);
                    GivePlayerWeapon(playerid, 24, 75);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 37, 350);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 200+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 6:
            {
                if(PlayerInfo[playerid][Xp] >= 310)
                {
                    IsSpy[playerid] = 1;
                    GameTextForPlayer(playerid, "Spy", 5000, 6);
                    GivePlayerWeapon(playerid, 15, 1);
                    GivePlayerWeapon(playerid, 23, 50);
                    GivePlayerWeapon(playerid, 31, 200);
                    ShowPlayerDialog(playerid, DIALOG_SSTEAM, DIALOG_STYLE_LIST, "Select Disguise Team", "Delta Force (USA)\nSpetsnaz (Russia)\nGIGN (France)\nItalian Army (Italy)\nJapan Self Defense Forces (Japan)", "Select", "Back");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 310+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 7:
            {
                if(PlayerInfo[playerid][Xp] >= 350)
                {
                    IsScout[playerid] = 1;
                    GameTextForPlayer(playerid, "Scout", 5000, 6);
                    GivePlayerWeapon(playerid, 4, 1);
                    GivePlayerWeapon(playerid, 23, 75);
                    GivePlayerWeapon(playerid, 29, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 350+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 8:
            {
                if(PlayerInfo[playerid][Xp] >= 500)
                {
                    IsPlaneDriver[playerid] = 1;
                    GameTextForPlayer(playerid, "Cargo Plane Driver", 5000, 6);
                    GivePlayerWeapon(playerid, 26, 80);
                    GivePlayerWeapon(playerid, 29, 75);
                    GivePlayerWeapon(playerid, 33, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 500+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 9:
            {
                if(PlayerInfo[playerid][Xp] >= 630)
                {
                    IsHeliDriver[playerid] = 1;
                    GameTextForPlayer(playerid, "Helicopter Plane Driver", 5000, 6);
                    GivePlayerWeapon(playerid, 26, 80);
                    GivePlayerWeapon(playerid, 29, 75);
                    GivePlayerWeapon(playerid, 33, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 630+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 10:
            {
                if(PlayerInfo[playerid][Xp] >= 800)
                {
                    IsGeneral[playerid] = 1;
                    GameTextForPlayer(playerid, "General", 5000, 6);
                    GivePlayerWeapon(playerid, 26, 80);
                    GivePlayerWeapon(playerid, 29, 75);
                    GivePlayerWeapon(playerid, 33, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 800+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 11:
            {
                if(PlayerInfo[playerid][Points] >= 1)
                {
                    IsVIP[playerid] = 1;
                    GameTextForPlayer(playerid, "~y~VIP", 5000, 6);
                    GivePlayerWeapon(playerid, 24, 80);
                    GivePlayerWeapon(playerid, 32, 75);
                    GivePlayerWeapon(playerid, 31, 150);
                    GivePlayerWeapon(playerid, 39, 200);
                    GivePlayerWeapon(playerid, 40, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 1+ VIP Points to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 12:
            {
                if(PlayerInfo[playerid][Admin] >= 1)
                {
                    IsAdmin[playerid] = 1;
                    GameTextForPlayer(playerid, "~r~Administrator", 5000, 6);
                    GivePlayerWeapon(playerid, 24, 80);
                    GivePlayerWeapon(playerid, 28, 110);
                    GivePlayerWeapon(playerid, 30, 130);
                    GivePlayerWeapon(playerid, 37, 200);
                    GivePlayerWeapon(playerid, 16, 5);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have Admin level 1+ to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 13:
            {
                if(PlayerInfo[playerid][Admin] == 10)
                {
                    IsOwner[playerid] = 1;
                    GameTextForPlayer(playerid, "~r~Owner", 5000, 6);
                    GivePlayerWeapon(playerid, 22, 999999);
                    GivePlayerWeapon(playerid, 32, 999999);
                    GivePlayerWeapon(playerid, 31, 999999);
                    GivePlayerWeapon(playerid, 38, 999999);
                    GivePlayerWeapon(playerid, 16, 999999);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must be owner to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
        }
    }

    //SPY - Select Team
    if(dialogid == DIALOG_SSTEAM)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    SetPlayerColor(playerid, COLOR_BLUE);
                    GameTextForPlayer(playerid, "~b~DELTA FORCE", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_USA);
                }
                case 1:
                {
                    SetPlayerColor(playerid, COLOR_RED);
                    GameTextForPlayer(playerid, "~r~SPETSNAZ", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_RUSSIA);
                }
                case 2:
                {
                    SetPlayerColor(playerid, COLOR_GREEN);
                    GameTextForPlayer(playerid, "~g~GIGN", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_GIGN);
                }
                case 3:
                {
                    SetPlayerColor(playerid, COLOR_AQUA);
                    GameTextForPlayer(playerid, "ITALIAN ARMY", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_IA);
                }
                case 4:
                {
                    SetPlayerColor(playerid, 0xFF800096);
                    GameTextForPlayer(playerid, "Japan Self Defense Forces", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_JSDF);
                }
            }
        }
        else
        {
            //The player has pressed "Select".
            switch(listitem)
            {
                case 0:
                {
                    //Selected Item: "Delta Force (USA)"
                }
                case 1:
                {
                    //Selected Item: "Spetsnaz (Russia)"
                }
                case 2:
                {
                    //Selected Item: "GIGN (France)"
                }
                case 3:
                {
                    //Selected Item: "Italian Army (Italy)"
                }
                case 4:
                {
                    //Selected Item: "Japan Self Defense Forces (Japan)"
                }
            }
        }
    }
    return 0;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

//================= STOCKS ================//
stock GetVehicleSpeed(const vehicleid, bool:mph = false)
{
    new Float:x, Float:y, Float:z;
    GetVehicleVelocity(vehicleid, x, y, z);

    if(mph) return floatround(((floatpower(x, 2)) + (floatpower(y, 2)) + (floatpower(z, 2))) * 100);
    else return floatround((((floatpower(x, 2)) + (floatpower(y, 2)) + (floatpower(z, 2))) * 100) * 1.6);
}

stock GivePlayerScore(playerid, amount, bool:plus = true)
{
    new score = GetPlayerScore(playerid);

    if(plus) return SetPlayerScore(playerid, score+amount);
    else return SetPlayerScore(playerid, score-amount);
}

stock IsPlayerInArea(playerid,Float:min_x,Float:min_y,Float:max_x,Float:max_y)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if((X <= max_x && X >= min_x) && (Y <= max_y && Y >= min_y)) return 1;

    return 0;
}

stock TeamColor(playerid)
{
    new color;
    new team;
    team = GetPlayerTeam(playerid);
    if(team == TEAM_DELTA)
    {
        color = COLOR_BLUE;
    }

    if(team == TEAM_SPETSNAZ)
    {
        color = COLOR_RED;
    }

    if(team == TEAM_GIGN)
    {
        color = COLOR_GREEN;
    }

    if(team == TEAM_IA)
    {
        color = COLOR_AQUA;
    }

    if(team == TEAM_JSDF)
    {
        color = 0xFF800096;
    }
    return color;
}
//============== PUBLICS =================//
public ASKOff(playerid)
{
    PlayerInfo[playerid][Protected] = 0;
    SendClientMessage(playerid, COLOR_RED, "Anti-spawn kill off.");
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100.0);
    return 1;
}

//================ IRC PUBLICS ====================//
public IRC_OnConnect(botid)
{
    printf("*** IRC_OnConnect: Bot ID %d connected!", botid);
    // Join the channel
    if(botid == 1)
    {
        IRC_JoinChannel(botid, IRC_CHANNEL);
        IRC_AddToGroup(gGroupID, botid);
    }
    // Add the bot to the group
    return 1;
}

/*
    Note that this callback is executed whenever a current connection is closed
    OR whenever a connection attempt fails. Reconnecting too fast can flood the
    IRC server and possibly result in a ban. It is recommended to set up
    connection reattempts on a timer, as demonstrated here.
*/


public IRC_OnDisconnect(botid)
{
    printf("*** IRC_OnDisconnect: Bot ID %d disconnected!", botid);
    printf("*** IRC_OnDisconnect: Bot ID %d attempting to reconnect...", botid);
    // Remove the bot from the group
    IRC_RemoveFromGroup(gGroupID, botid);
    return 1;
}

public IRC_OnJoinChannel(botid, channel[])
{
    printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s!", botid, channel);
    return 1;
}

/*
    If the bot cannot immediately rejoin the channel (in the event, for example,
    that the bot is kicked and then banned), you might want to set up a timer
    here as well for rejoin attempts.
*/


public IRC_OnLeaveChannel(botid, channel[], message[])
{
    printf("*** IRC_OnLeaveChannel: Bot ID %d left channel %s (%s)!", botid, channel, message);
    IRC_JoinChannel(botid, channel);
    return 1;
}

public IRC_OnUserDisconnect(botid, user[], host[], message[])
{
    printf("*** IRC_OnUserDisconnect (Bot ID %d): User %s (%s) disconnected! (%s)", botid, user, host, message);
    return 1;
}

public IRC_OnUserJoinChannel(botid, channel[], user[], host[])
{
    printf("*** IRC_OnUserJoinChannel (Bot ID %d): User %s (%s) joined channel %s!", botid, user, host, channel);
    return 1;
}

public IRC_OnUserLeaveChannel(botid, channel[], user[], host[], message[])
{
    printf("*** IRC_OnUserLeaveChannel (Bot ID %d): User %s (%s) left channel %s (%s)!", botid, user, host, channel, message);
    return 1;
}

public IRC_OnUserNickChange(botid, oldnick[], newnick[], host[])
{
    printf("*** IRC_OnUserNickChange (Bot ID %d): User %s (%s) changed his nick to %s!", botid, oldnick, host, newnick);
    return 1;
}

public IRC_OnUserSetChannelMode(botid, channel[], user[], host[], mode[])
{
    printf("*** IRC_OnUserSetChannelMode (Bot ID %d): User %s (%s) on %s set mode: %s!", botid, user, host, channel, mode);
    return 1;
}

public IRC_OnUserSetChannelTopic(botid, channel[], user[], host[], topic[])
{
    printf("*** IRC_OnUserSetChannelTopic (Bot ID %d): User %s (%s) on %s set topic: %s!", botid, user, host, channel, topic);
    return 1;
}

public IRC_OnUserNotice(botid, recipient[], user[], host[], message[])
{
    printf("*** IRC_OnUserNotice (Bot ID %d): User %s (%s) sent notice to %s: %s", botid, user, host, recipient, message);
    return 1;
}

//=================== IRC Commands ===============//
IRCCMD:freeze(botid, channel[], user[], host[], params[])
{
    if(IRC_IsAdmin(botid, channel, user))
    {
        if(!strlen(params)) return IRC_Notice(botid, user, "*** Usage: !freeze (ID) (Reason)");
        new id;
        new Index;
        new tmp[256];
        tmp = strtok(params, Index);
        new reason;
        new string[100];
        new name[MAX_PLAYER_NAME];
        id = strval(tmp);
        reason = params[2];
        if(id == INVALID_PLAYER_ID) return IRC_Notice(botid, user, "*** Invalid player ID");
        else
        {
            GetPlayerName(id, name, sizeof(name));
            TogglePlayerControllable(id, 0);
            format(string, sizeof(string),"*** You have successfully frozen %s(%d)", name, id);
            IRC_Notice(botid, user, string);
            format(string, sizeof(string), "*** IRC Admin %s has frozen %s(%d) for reason %s", user, name, id, reason);
            IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
            format(string, sizeof(string), "-| You have been frozen by IRC Admin %s for reason %s |-", user, reason);
            SendClientMessage(id, COLOR_RED, string);
            format(string, sizeof(string),"-| IRC Admin %s has frozen %s(%d) for reason %s |-", user, name, id, reason);
            SendClientMessageToAll(COLOR_GREEN, string);
        }
    }
    return 1;
}

//================== STRTOK ==================//
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

//Area check
forward AreaCheck();
public AreaCheck()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        new gTeam;
        foreach(Player, i);
        {
            if(IsPlayerInArea(i, 2438.989, 2560.181, 2782.616, 2885.098))
            {
                gTeam = GetPlayerTeam(i);
                if(EnteredArea[i] == 0)
                {
                    if(gTeam == TEAM_DELTA && CapturedBy == 1 || gTeam == TEAM_SPETSNAZ && CapturedBy == 2 || gTeam == TEAM_GIGN && CapturedBy == 3 || gTeam == TEAM_IA && CapturedBy == 4 || gTeam == TEAM_JSDF && CapturedBy == 5)
                    {
                        SendClientMessage(i, COLOR_RED, "This area has already been captured by your team!");
                        EnteredArea[i] = 1;
                    }
                    else
                    {
                        SendClientMessage(i, COLOR_GREEN, "Stay in the zone for 20 seconds to capture it.");
                        GangZoneFlashForAll(Z_KACC, TeamColor(i));
                        SendClientMessageToAll(COLOR_RED, "KACC Military fuels is being taken over!");
                        SetTimer("TakeOver", 20000, 0);
                    }
                }
            }
        }
    }
    return 1;
}

//Take over
forward TakeOver();
public TakeOver()
{
    foreach(Player, i);
    {
        new gTeam;
        gTeam = GetPlayerTeam(i));
        if(IsPlayerInArea(i, 2438.989, 2560.181, 2782.616, 2885.098))
        {
            GangZoneStopFlashForAll(Z_KACC);
            GangZoneHideForAll(Z_KACC);
            SetPlayerScore(i, GetPlayerScore(i) + 15);
            PlayerInfo[i][Xp] += 15;
            GivePlayerMoney(i, 3500);
            SendClientMessage(i, COLOR_GREEN, "You have recieved 15 XP and $3500 from the captured zone.");

            if(gTeam == TEAM_DELTA)
            {
                GangZoneShowForAll(Z_KACC, COLOR_BLUE);
                SendClientMessageToAll(-1, "Delta Force has captured KACC Military Fuels!");
            }
            else if(gTeam == TEAM_SPETSNAZ)
            {
                GangZoneShowForAll(Z_KACC, COLOR_RED);
                SendClientMessageToAll(-1, "Spetsnaz has captured KACC Military Fuels!");
            }
            else if(gTeam == TEAM_GIGN)
            {
                GangZoneShowForAll(Z_KACC, COLOR_GREEN);
                SendClientMessageToAll(-1, "GIGN has captured KACC Military Fuels!");
            }
            else if(gTeam == TEAM_IA)
            {
                GangZoneShowForAll(Z_KACC, COLOR_AQUA);
                SendClientMessageToAll(-1, "Italian Army has captured KACC Military Fuels!");
            }
            else if(gTeam == TEAM_JSDF)
            {
                GangZoneShowForAll(Z_KACC, 0xFF800096);
                SendClientMessageToAll(-1, "Japan Self Defense Forces has captured KACC Military Fuels!");
            }
        }
    }
    return 1;
}

Errors:
Code:
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(307) : warning 202: number of arguments does not match definition
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(307) : warning 202: number of arguments does not match definition
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(337) : warning 202: number of arguments does not match definition
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(337) : warning 202: number of arguments does not match definition
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(337) : warning 202: number of arguments does not match definition
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(327) : warning 204: symbol is assigned a value that is never used: "msg"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1066) : warning 219: local variable "i" shadows a variable at a preceding level
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1066) : error 036: empty statement
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1096) : error 036: empty statement
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1099) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1099) : error 029: invalid expression, assumed zero
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1099) : warning 215: expression has no effect
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1100) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1104) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1105) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1106) : error 017: undefined symbol "i"
C:\Users\Keegan\Desktop\gamemodes\MWFFA.pwn(1107) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


9 Errors.
stormchaser206 is offline   Reply With Quote
Old 10/07/2012, 04:12 PM   #9
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 695
Reputation: 46
Default Re: Lots of errors with zone capture system

Bump - Still haven't fixed it
stormchaser206 is offline   Reply With Quote
Old 10/07/2012, 04:23 PM   #10
clarencecuzz
Gangsta
 
Join Date: Jul 2010
Location: Australia
Posts: 928
Reputation: 92
Default Re: Lots of errors with zone capture system

See if this has fixed any errors:
pawn Code:
/*///////////////////
MWFFA - New Script

Work Started on June 18, 2012

*/
/////////////////

#include <a_samp>
#include <streamer>
#include <irc>

//Teams
#define TEAM_DELTA 1
#define TEAM_SPETSNAZ 2
#define TEAM_GIGN 3
#define TEAM_IA 4
#define TEAM_JSDF 5

//Dialogs
#define DIALOG_CTEAM   8343
#define DIALOG_SCLASS   10211
#define DIALOG_SSTEAM   3893

//IRC Stuff
#define IRC_SERVER "irc.mibbit.net"
#define IRC_PORT (6667)
#define IRC_CHANNEL "#MWFFA"

#define BOT_1_NICKNAME "Overlord"
#define BOT_1_REALNAME "SA-MP Bot"
#define BOT_1_USERNAME "Overlord_1"

#define MAX_BOTS (1)

new gBotID[MAX_BOTS], gGroupID;

//Defines
#define MAX_ZONES 50

//Colors
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_PINK 0xFF00FFFF
#define COLOR_GREEN 0x00FF00FF
#define COLOR_AQUA 0x00FFFFFF
#define COLOR_BLACK 0x000000FF
#define COLOR_BLUE 0x0000FFFF

//Skins
#define SKIN_TORENO 295
#define SKIN_WUZIMU 294
#define SKIN_USA 287
#define SKIN_RUSSIA 179
#define SKIN_GIGN 285
#define SKIN_IA 254
#define SKIN_JSDF 57

//Zones
new Z_KACC;
new Z_School;
new Z_Pier;

//Forwards
forward ASKOff(playerid);

//Enums
enum kInfo
{
    HasStreak,
    HasJug,
    HasStrike,
    HasTank,
    HasPackage,
    Streak
}
new StreakInfo[MAX_PLAYERS][kInfo];

enum pInfo
{
    Password,
    Cash,
    Score,
    Admin,
    Points,
    Xp,
    Protected,
    CapturingZone,
    Connects,
    Disconnects
}
new PlayerInfo[MAX_PLAYERS][pInfo];

//Class Variables
new IsSoldier[MAX_PLAYERS];
new IsSniper[MAX_PLAYERS];
new IsMedic[MAX_PLAYERS];
new IsEngineer[MAX_PLAYERS];
new IsPilot[MAX_PLAYERS];
new IsFlamethrower[MAX_PLAYERS];
new IsSpy[MAX_PLAYERS];
new IsScout[MAX_PLAYERS];
new IsPlaneDriver[MAX_PLAYERS];
new IsHeliDriver[MAX_PLAYERS];
new IsGeneral[MAX_PLAYERS];
new IsVIP[MAX_PLAYERS];
new IsAdmin[MAX_PLAYERS];
new IsOwner[MAX_PLAYERS];

//Capture var
new EnteredArea[MAX_PLAYERS];
new CapturedBy; // 0 ( none ) 1 ( Delta ) 2 ( Russia ) 3 - GIGN | 4 - Italian Army | 5 - JSDF

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

main()
{
    print("\n----------------------------------");
    print("------- MWFFA Script Loaded --------");
    print("----------------------------------\n");
}

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("MWFFA - World War lll");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);

    //Zones
    Z_KACC = GangZoneCreate(2438.989, 2560.181, 2782.616, 2885.098);
    Z_School = GangZoneCreate(-2197.686, -281.7203, -2008.414, -68.69224);
    Z_Pier = GangZoneCreate(371.8314, -2108.218, 459.2966, -1654.228);

    //IRC
    gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
    IRC_SetIntData(gBotID[0], E_IRC_CONNECT_DELAY, 20);
    gGroupID = IRC_CreateGroup();

    SetTimer("AreaCheck", 1000, true);
    return 1;
}

public OnGameModeExit()
{
    print("\n------------------------------------");
    print("------- MWFFA Script unloaded --------");
    print("--------------------------------------\n");

    IRC_Quit(gBotID[0], "Overlord (SA-MP Bot) exiting.");
    IRC_DestroyGroup(gGroupID);
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);

    GangZoneShowForPlayer(playerid, Z_KACC, 0xFF000096);
    GangZoneShowForPlayer(playerid, Z_School, 0xFF800096);
    GangZoneShowForPlayer(playerid, Z_Pier, 0xFFFF0096);

    //Select Team
    ShowPlayerDialog(playerid, DIALOG_CTEAM, DIALOG_STYLE_LIST, "Choose Team", "Delta Force (United States)\nSpetsnaz (Russia)\nGIGN (France)\nItalian Army (Italy)\nJapan Self Defense Forces (Japan)", "Select", "");
    return 1;
}

public OnPlayerConnect(playerid)
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string),"*** %s(%d) has joined the server.");
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    PlayerInfo[playerid][Connects]++;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new reasonMsg[20];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    switch(reason)
    {
        case 0: reasonMsg = "Timeout";
        case 1: reasonMsg = "Leaving";
        case 2: reasonMsg = "Kicked/Banned";
    }

    new string[70];
    format(string, sizeof(string),"*** %s(%d) has left the server (%s)", pName, playerid, reasonMsg);
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    format(string, sizeof(string),"-| %s(%d) has left the server! (%s) |-", pName, playerid, reasonMsg);
    SendClientMessageToAll(COLOR_PINK, string);
    PlayerInfo[playerid][Disconnects]++;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SendClientMessage(playerid, COLOR_YELLOW, "You are anti-spawn kill protected for 10 seconds");
    PlayerInfo[playerid][Protected] = 1;
    SetTimerEx("ASKOff", 10000, 0, "i", playerid);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    new pNameTwo[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(killerid, pNameTwo, sizeof(pNameTwo));
    new reasonMsg[30];
    if(killerid != INVALID_PLAYER_ID)
    {
        switch (reason)
        {
            case 0: reasonMsg = "Unarmed";
            case 1: reasonMsg = "Brass Knuckles";
            case 2: reasonMsg = "Golf Club";
            case 3: reasonMsg = "Night Stick";
            case 4: reasonMsg = "Knife";
            case 5: reasonMsg = "Baseball Bat";
            case 6: reasonMsg = "Shovel";
            case 7: reasonMsg = "Pool Cue";
            case 8: reasonMsg = "Katana";
            case 9: reasonMsg = "Chainsaw";
            case 10: reasonMsg = "Dildo";
            case 11: reasonMsg = "Dildo";
            case 12: reasonMsg = "Vibrator";
            case 13: reasonMsg = "Vibrator";
            case 14: reasonMsg = "Flowers";
            case 15: reasonMsg = "Cane";
            case 22: reasonMsg = "Pistol";
            case 23: reasonMsg = "Silenced Pistol";
            case 24: reasonMsg = "Desert Eagle";
            case 25: reasonMsg = "Shotgun";
            case 26: reasonMsg = "Sawn-off Shotgun";
            case 27: reasonMsg = "Combat Shotgun";
            case 28: reasonMsg = "MAC-10";
            case 29: reasonMsg = "MP5";
            case 30: reasonMsg = "AK-47";
            case 31: reasonMsg = "M4";
            case 32: reasonMsg = "TEC-9";
            case 33: reasonMsg = "Country Rifle";
            case 34: reasonMsg = "Sniper Rifle";
            case 37: reasonMsg = "Fire";
            case 38: reasonMsg = "Minigun";
            case 41: reasonMsg = "Spray Can";
            case 42: reasonMsg = "Fire Extinguisher";
            case 49: reasonMsg = "Vehicle Collision";
            case 50: reasonMsg = "Vehicle Collision";
            case 51: reasonMsg = "Explosion";
            default: reasonMsg = "Unknown";
        }

        StreakInfo[killerid][Streak]++;
        StreakInfo[playerid][Streak] = 0;
        format(string, sizeof(string),"-| You have killed %s(%d) and have earned $250, and 2 score |-", pName, playerid);
        SendClientMessage(killerid, COLOR_YELLOW, string);
        format(string, sizeof(string),"-| You have been killed by %s(%d) and have lost $100 |-", pNameTwo, killerid);
        SendClientMessage(playerid, COLOR_RED, string);
        GivePlayerScore(killerid, 2);
        GivePlayerMoney(killerid, 250);
        GivePlayerMoney(playerid, -100);
        format(string, sizeof(string),"*** %s(%d) has been killed by %s(%d). (%s)", pName, playerid, pNameTwo, killerid, reasonMsg);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, string);

        if(GetPlayerTeam(killerid) == GetPlayerTeam(playerid))
        {
            SetPlayerArmour(killerid, 0.0);
            SetPlayerHealth(killerid, 0);
            GameTextForPlayer(killerid, "~r~Killed for Team-Kill & Charged $2500", 8000, 2);
            GameTextForPlayer(playerid, "The teammate who killed you has been killed for team kill!", 4500, 6);
            GivePlayerMoney(killerid, -2500);
        }
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    new string[100];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string),"*** %s(%d): %s", pName, playerid, text);
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(kill,4,cmdtext); //The number between kill and cmdtext should be the length of the command.
    dcmd(radio,5,cmdtext); //Example: radio = 5 letters long. kill = 4 letters long.
    return 1;
}

dcmd_kill(playerid)
{
    new string[100];
    new cRand = random(10000);
    SetPlayerHealth(playerid, 0);
    SetPlayerArmour(playerid, 0.0);
    format(string, sizeof(string), "You have been charged $%d for using /kill", cRand);
    SendClientMessage(playerid, COLOR_RED, string);
    GivePlayerMoney(playerid, -cRand);
    return 1;
}

dcmd_radio(playerid, params[])
{
    new msg;
    msg = params[2];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
        if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
        {
                SendClientMessage(i, COLOR_GREEN, "[RADIO] %s(%d): %s", name, playerid, msg);
            }
            else SendClientMessage(playerid, COLOR_RED, "ERROR: There is no one on your team right now to talk to.");
        }
    }
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    return 1;
}

public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    return 1;
}

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    if(PlayerInfo[damagedid][Protected] == 1)
    {
        GameTextForPlayer(playerid, "~r~This person is Anti-Spawn kill protected", 5000, 6);
        SetPlayerHealth(damagedid, 100);
        SetPlayerArmour(damagedid, 100.0);
    }
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    if(success)
    {
        printf("RCON login success by IP %s using password %s", ip, password);
    }
    else
    {
        printf("Failed RCON login by IP %s using password %s", ip, password);
    }
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CTEAM)
    {
        ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
        switch(listitem)
        {
            case 0:
            {
                SetPlayerTeam(playerid, TEAM_DELTA);
                SetPlayerColor(playerid, COLOR_BLUE);
                GameTextForPlayer(playerid, "~b~DELTA FORCE", 7500, 6);
                SetPlayerSkin(playerid, SKIN_USA);
            }
            case 1:
            {
                SetPlayerTeam(playerid, TEAM_SPETSNAZ);
                SetPlayerColor(playerid, COLOR_RED);
                GameTextForPlayer(playerid, "~r~SPETSNAZ", 7500, 6);
                SetPlayerSkin(playerid, SKIN_RUSSIA);
            }
            case 2:
            {
                SetPlayerTeam(playerid, TEAM_GIGN);
                SetPlayerColor(playerid, COLOR_GREEN);
                GameTextForPlayer(playerid, "~g~GIGN", 7500, 6);
                SetPlayerSkin(playerid, SKIN_GIGN);
            }
            case 3:
            {
                SetPlayerTeam(playerid, TEAM_IA);
                SetPlayerColor(playerid, COLOR_AQUA);
                GameTextForPlayer(playerid, "ITALIAN ARMY", 7500, 6);
                SetPlayerSkin(playerid, SKIN_IA);
            }
            case 4:
            {
                SetPlayerTeam(playerid, TEAM_JSDF);
                SetPlayerColor(playerid, 0xFF800096);
                GameTextForPlayer(playerid, "Japan Self Defense Forces", 7500, 6);
                SetPlayerSkin(playerid, SKIN_JSDF);
            }
        }
    }

    if(dialogid == DIALOG_SCLASS)
    {
        SpawnPlayer(playerid);
        switch(listitem)
        {
            case 0:
            {
                IsSoldier[playerid] = 1;
                GameTextForPlayer(playerid, "Soldier", 5000, 6);
                GivePlayerWeapon(playerid, 4, 1);
                GivePlayerWeapon(playerid, 24, 30);
                GivePlayerWeapon(playerid, 31, 200);
            }
            case 1:
            {
                IsSniper[playerid] = 1;
                GameTextForPlayer(playerid, "Sniper", 5000, 6);
                GivePlayerWeapon(playerid, 3, 1);
                GivePlayerWeapon(playerid, 23, 40);
                GivePlayerWeapon(playerid, 34, 250);
                GivePlayerWeapon(playerid, 17, 20);
            }
            case 2:
            {
                if(PlayerInfo[playerid][Xp] >= 30)
                {
                    IsMedic[playerid] = 1;
                    GameTextForPlayer(playerid, "Medic", 5000, 6);
                    GivePlayerWeapon(playerid, 15, 1);
                    GivePlayerWeapon(playerid, 22, 75);
                    GivePlayerWeapon(playerid, 30, 200);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 30+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 3:
            {
                if(PlayerInfo[playerid][Xp] >= 75)
                {
                    IsEngineer[playerid] = 1;
                    GameTextForPlayer(playerid, "Engineer", 5000, 6);
                    GivePlayerWeapon(playerid, 5, 1);
                    GivePlayerWeapon(playerid, 27, 50);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 43, 40);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 75+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 4:
            {
                if(PlayerInfo[playerid][Xp] >= 120)
                {
                    IsPilot[playerid] = 1;
                    GameTextForPlayer(playerid, "Pilot", 5000, 6);
                    GivePlayerWeapon(playerid, 22, 60);
                    GivePlayerWeapon(playerid, 30, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 120+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 5:
            {
                if(PlayerInfo[playerid][Xp] >= 200)
                {
                    IsFlamethrower[playerid] = 1;
                    GameTextForPlayer(playerid, "Flamethrower", 5000, 6);
                    GivePlayerWeapon(playerid, 18, 20);
                    GivePlayerWeapon(playerid, 24, 75);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 37, 350);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 200+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 6:
            {
                if(PlayerInfo[playerid][Xp] >= 310)
                {
                    IsSpy[playerid] = 1;
                    GameTextForPlayer(playerid, "Spy", 5000, 6);
                    GivePlayerWeapon(playerid, 15, 1);
                    GivePlayerWeapon(playerid, 23, 50);
                    GivePlayerWeapon(playerid, 31, 200);
                    ShowPlayerDialog(playerid, DIALOG_SSTEAM, DIALOG_STYLE_LIST, "Select Disguise Team", "Delta Force (USA)\nSpetsnaz (Russia)\nGIGN (France)\nItalian Army (Italy)\nJapan Self Defense Forces (Japan)", "Select", "Back");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 310+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 7:
            {
                if(PlayerInfo[playerid][Xp] >= 350)
                {
                    IsScout[playerid] = 1;
                    GameTextForPlayer(playerid, "Scout", 5000, 6);
                    GivePlayerWeapon(playerid, 4, 1);
                    GivePlayerWeapon(playerid, 23, 75);
                    GivePlayerWeapon(playerid, 29, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 350+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 8:
            {
                if(PlayerInfo[playerid][Xp] >= 500)
                {
                    IsPlaneDriver[playerid] = 1;
                    GameTextForPlayer(playerid, "Cargo Plane Driver", 5000, 6);
                    GivePlayerWeapon(playerid, 26, 80);
                    GivePlayerWeapon(playerid, 29, 75);
                    GivePlayerWeapon(playerid, 33, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 500+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 9:
            {
                if(PlayerInfo[playerid][Xp] >= 630)
                {
                    IsHeliDriver[playerid] = 1;
                    GameTextForPlayer(playerid, "Helicopter Plane Driver", 5000, 6);
                    GivePlayerWeapon(playerid, 26, 80);
                    GivePlayerWeapon(playerid, 29, 75);
                    GivePlayerWeapon(playerid, 33, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 630+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 10:
            {
                if(PlayerInfo[playerid][Xp] >= 800)
                {
                    IsGeneral[playerid] = 1;
                    GameTextForPlayer(playerid, "General", 5000, 6);
                    GivePlayerWeapon(playerid, 26, 80);
                    GivePlayerWeapon(playerid, 29, 75);
                    GivePlayerWeapon(playerid, 33, 130);
                    GivePlayerWeapon(playerid, 31, 200);
                    GivePlayerWeapon(playerid, 46, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 800+ XP to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 11:
            {
                if(PlayerInfo[playerid][Points] >= 1)
                {
                    IsVIP[playerid] = 1;
                    GameTextForPlayer(playerid, "~y~VIP", 5000, 6);
                    GivePlayerWeapon(playerid, 24, 80);
                    GivePlayerWeapon(playerid, 32, 75);
                    GivePlayerWeapon(playerid, 31, 150);
                    GivePlayerWeapon(playerid, 39, 200);
                    GivePlayerWeapon(playerid, 40, 1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have 1+ VIP Points to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 12:
            {
                if(PlayerInfo[playerid][Admin] >= 1)
                {
                    IsAdmin[playerid] = 1;
                    GameTextForPlayer(playerid, "~r~Administrator", 5000, 6);
                    GivePlayerWeapon(playerid, 24, 80);
                    GivePlayerWeapon(playerid, 28, 110);
                    GivePlayerWeapon(playerid, 30, 130);
                    GivePlayerWeapon(playerid, 37, 200);
                    GivePlayerWeapon(playerid, 16, 5);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must have Admin level 1+ to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
            case 13:
            {
                if(PlayerInfo[playerid][Admin] == 10)
                {
                    IsOwner[playerid] = 1;
                    GameTextForPlayer(playerid, "~r~Owner", 5000, 6);
                    GivePlayerWeapon(playerid, 22, 999999);
                    GivePlayerWeapon(playerid, 32, 999999);
                    GivePlayerWeapon(playerid, 31, 999999);
                    GivePlayerWeapon(playerid, 38, 999999);
                    GivePlayerWeapon(playerid, 16, 999999);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "ERROR: You must be owner to use this class.");
                    ShowPlayerDialog(playerid, DIALOG_SCLASS, DIALOG_STYLE_LIST, "Select Class", "Soldier (0 XP)\nSniper (0 XP)\nMedic (30 XP)\nEngineer (75 XP)\nPilot (120 XP)\nFlamethrower (200 XP)\nSpy (310 XP)\nScout (350 XP)\nCargo plane Driver (500 XP)\nSupply Helicopter Driver (630 XP)\nGeneral (800 XP)\nVIP (1+ VIP Points)\nAdmin (Admin level 1+)\nOwner (Level 10)", "Go!", "");
                }
            }
        }
    }

    //SPY - Select Team
    if(dialogid == DIALOG_SSTEAM)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    SetPlayerColor(playerid, COLOR_BLUE);
                    GameTextForPlayer(playerid, "~b~DELTA FORCE", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_USA);
                }
                case 1:
                {
                    SetPlayerColor(playerid, COLOR_RED);
                    GameTextForPlayer(playerid, "~r~SPETSNAZ", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_RUSSIA);
                }
                case 2:
                {
                    SetPlayerColor(playerid, COLOR_GREEN);
                    GameTextForPlayer(playerid, "~g~GIGN", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_GIGN);
                }
                case 3:
                {
                    SetPlayerColor(playerid, COLOR_AQUA);
                    GameTextForPlayer(playerid, "ITALIAN ARMY", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_IA);
                }
                case 4:
                {
                    SetPlayerColor(playerid, 0xFF800096);
                    GameTextForPlayer(playerid, "Japan Self Defense Forces", 7500, 6);
                    SetPlayerSkin(playerid, SKIN_JSDF);
                }
            }
        }
        else
        {
            //The player has pressed "Select".
            switch(listitem)
            {
                case 0:
                {
                    //Selected Item: "Delta Force (USA)"
                }
                case 1:
                {
                    //Selected Item: "Spetsnaz (Russia)"
                }
                case 2:
                {
                    //Selected Item: "GIGN (France)"
                }
                case 3:
                {
                    //Selected Item: "Italian Army (Italy)"
                }
                case 4:
                {
                    //Selected Item: "Japan Self Defense Forces (Japan)"
                }
            }
        }
    }
    return 0;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

//================= STOCKS ================//
stock GetVehicleSpeed(const vehicleid, bool:mph = false)
{
    new Float:x, Float:y, Float:z;
    GetVehicleVelocity(vehicleid, x, y, z);

    if(mph) return floatround(((floatpower(x, 2)) + (floatpower(y, 2)) + (floatpower(z, 2))) * 100);
    else return floatround((((floatpower(x, 2)) + (floatpower(y, 2)) + (floatpower(z, 2))) * 100) * 1.6);
}

stock GivePlayerScore(playerid, amount, bool:plus = true)
{
    new score = GetPlayerScore(playerid);

    if(plus) return SetPlayerScore(playerid, score+amount);
    else return SetPlayerScore(playerid, score-amount);
}

stock IsPlayerInArea(playerid,Float:min_x,Float:min_y,Float:max_x,Float:max_y)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if((X <= max_x && X >= min_x) && (Y <= max_y && Y >= min_y)) return 1;

    return 0;
}

stock TeamColor(playerid)
{
    new color;
    new team;
    team = GetPlayerTeam(playerid);
    if(team == TEAM_DELTA)
    {
        color = COLOR_BLUE;
    }

    if(team == TEAM_SPETSNAZ)
    {
        color = COLOR_RED;
    }

    if(team == TEAM_GIGN)
    {
        color = COLOR_GREEN;
    }

    if(team == TEAM_IA)
    {
        color = COLOR_AQUA;
    }

    if(team == TEAM_JSDF)
    {
        color = 0xFF800096;
    }
    return color;
}
//============== PUBLICS =================//
public ASKOff(playerid)
{
    PlayerInfo[playerid][Protected] = 0;
    SendClientMessage(playerid, COLOR_RED, "Anti-spawn kill off.");
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100.0);
    return 1;
}

//================ IRC PUBLICS ====================//
public IRC_OnConnect(botid)
{
    printf("*** IRC_OnConnect: Bot ID %d connected!", botid);
    // Join the channel
    if(botid == 1)
    {
        IRC_JoinChannel(botid, IRC_CHANNEL);
        IRC_AddToGroup(gGroupID, botid);
    }
    // Add the bot to the group
    return 1;
}

/*
    Note that this callback is executed whenever a current connection is closed
    OR whenever a connection attempt fails. Reconnecting too fast can flood the
    IRC server and possibly result in a ban. It is recommended to set up
    connection reattempts on a timer, as demonstrated here.
*/


public IRC_OnDisconnect(botid)
{
    printf("*** IRC_OnDisconnect: Bot ID %d disconnected!", botid);
    printf("*** IRC_OnDisconnect: Bot ID %d attempting to reconnect...", botid);
    // Remove the bot from the group
    IRC_RemoveFromGroup(gGroupID, botid);
    return 1;
}

public IRC_OnJoinChannel(botid, channel[])
{
    printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s!", botid, channel);
    return 1;
}

/*
    If the bot cannot immediately rejoin the channel (in the event, for example,
    that the bot is kicked and then banned), you might want to set up a timer
    here as well for rejoin attempts.
*/


public IRC_OnLeaveChannel(botid, channel[], message[])
{
    printf("*** IRC_OnLeaveChannel: Bot ID %d left channel %s (%s)!", botid, channel, message);
    IRC_JoinChannel(botid, channel);
    return 1;
}

public IRC_OnUserDisconnect(botid, user[], host[], message[])
{
    printf("*** IRC_OnUserDisconnect (Bot ID %d): User %s (%s) disconnected! (%s)", botid, user, host, message);
    return 1;
}

public IRC_OnUserJoinChannel(botid, channel[], user[], host[])
{
    printf("*** IRC_OnUserJoinChannel (Bot ID %d): User %s (%s) joined channel %s!", botid, user, host, channel);
    return 1;
}

public IRC_OnUserLeaveChannel(botid, channel[], user[], host[], message[])
{
    printf("*** IRC_OnUserLeaveChannel (Bot ID %d): User %s (%s) left channel %s (%s)!", botid, user, host, channel, message);
    return 1;
}

public IRC_OnUserNickChange(botid, oldnick[], newnick[], host[])
{
    printf("*** IRC_OnUserNickChange (Bot ID %d): User %s (%s) changed his nick to %s!", botid, oldnick, host, newnick);
    return 1;
}

public IRC_OnUserSetChannelMode(botid, channel[], user[], host[], mode[])
{
    printf("*** IRC_OnUserSetChannelMode (Bot ID %d): User %s (%s) on %s set mode: %s!", botid, user, host, channel, mode);
    return 1;
}

public IRC_OnUserSetChannelTopic(botid, channel[], user[], host[], topic[])
{
    printf("*** IRC_OnUserSetChannelTopic (Bot ID %d): User %s (%s) on %s set topic: %s!", botid, user, host, channel, topic);
    return 1;
}

public IRC_OnUserNotice(botid, recipient[], user[], host[], message[])
{
    printf("*** IRC_OnUserNotice (Bot ID %d): User %s (%s) sent notice to %s: %s", botid, user, host, recipient, message);
    return 1;
}

//=================== IRC Commands ===============//
IRCCMD:freeze(botid, channel[], user[], host[], params[])
{
    if(IRC_IsAdmin(botid, channel, user))
    {
        if(!strlen(params)) return IRC_Notice(botid, user, "*** Usage: !freeze (ID) (Reason)");
        new id;
        new Index;
        new tmp[256];
        tmp = strtok(params, Index);
        new reason;
        new string[100];
        new name[MAX_PLAYER_NAME];
        id = strval(tmp);
        reason = params[2];
        if(id == INVALID_PLAYER_ID) return IRC_Notice(botid, user, "*** Invalid player ID");
        else
        {
            GetPlayerName(id, name, sizeof(name));
            TogglePlayerControllable(id, 0);
            format(string, sizeof(string),"*** You have successfully frozen %s(%d)", name, id);
            IRC_Notice(botid, user, string);
            format(string, sizeof(string), "*** IRC Admin %s has frozen %s(%d) for reason %s", user, name, id, reason);
            IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
            format(string, sizeof(string), "-| You have been frozen by IRC Admin %s for reason %s |-", user, reason);
            SendClientMessage(id, COLOR_RED, string);
            format(string, sizeof(string),"-| IRC Admin %s has frozen %s(%d) for reason %s |-", user, name, id, reason);
            SendClientMessageToAll(COLOR_GREEN, string);
        }
    }
    return 1;
}

//================== STRTOK ==================//
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

//Area check
forward AreaCheck();
public AreaCheck()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        new gTeam;
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInArea(i, 2438.989, 2560.181, 2782.616, 2885.098))
            {
                gTeam = GetPlayerTeam(i);
                if(EnteredArea[i] == 0)
                {
                    if(gTeam == TEAM_DELTA && CapturedBy == 1 || gTeam == TEAM_SPETSNAZ && CapturedBy == 2 || gTeam == TEAM_GIGN && CapturedBy == 3 || gTeam == TEAM_IA && CapturedBy == 4 || gTeam == TEAM_JSDF && CapturedBy == 5)
                    {
                        SendClientMessage(i, COLOR_RED, "This area has already been captured by your team!");
                        EnteredArea[i] = 1;
                    }
                    else
                    {
                        SendClientMessage(i, COLOR_GREEN, "Stay in the zone for 20 seconds to capture it.");
                        GangZoneFlashForAll(Z_KACC, TeamColor(i));
                        SendClientMessageToAll(COLOR_RED, "KACC Military fuels is being taken over!");
                        SetTimer("TakeOver", 20000, 0);
                    }
                }
            }
        }
    }
    return 1;
}

//Take over
forward TakeOver();
public TakeOver()
{
    for(new i = 0; i < MAX_PLAYERS; i++) {
    if(IsPlayerConnected(i))
    {
        new gTeam;
        gTeam = GetPlayerTeam(i));
        if(IsPlayerInArea(i, 2438.989, 2560.181, 2782.616, 2885.098))
        {
            GangZoneStopFlashForAll(Z_KACC);
            GangZoneHideForAll(Z_KACC);
            SetPlayerScore(i, GetPlayerScore(i) + 15);
            PlayerInfo[i][Xp] += 15;
            GivePlayerMoney(i, 3500);
            SendClientMessage(i, COLOR_GREEN, "You have recieved 15 XP and $3500 from the captured zone.");

            if(gTeam == TEAM_DELTA)
            {
                GangZoneShowForAll(Z_KACC, COLOR_BLUE);
                SendClientMessageToAll(-1, "Delta Force has captured KACC Military Fuels!");
            }
            else if(gTeam == TEAM_SPETSNAZ)
            {
                GangZoneShowForAll(Z_KACC, COLOR_RED);
                SendClientMessageToAll(-1, "Spetsnaz has captured KACC Military Fuels!");
            }
            else if(gTeam == TEAM_GIGN)
            {
                GangZoneShowForAll(Z_KACC, COLOR_GREEN);
                SendClientMessageToAll(-1, "GIGN has captured KACC Military Fuels!");
            }
            else if(gTeam == TEAM_IA)
            {
                GangZoneShowForAll(Z_KACC, COLOR_AQUA);
                SendClientMessageToAll(-1, "Italian Army has captured KACC Military Fuels!");
            }
            else if(gTeam == TEAM_JSDF)
            {
                GangZoneShowForAll(Z_KACC, 0xFF800096);
                SendClientMessageToAll(-1, "Japan Self Defense Forces has captured KACC Military Fuels!");
            }
        } }
    }
    return 1;
}
clarencecuzz is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] [INC] LGZ 1.3.2 [REL: 11 Jan 2008] | Let's capture the zone! [LDT]LuxurY Includes 106 08/03/2013 04:42 AM
[HELP]Gang Zone Capture the_zohan Scripting Help 9 03/06/2012 03:23 AM
Capture Zone [WTF]Godfather Scripting Help 4 17/05/2012 05:10 AM
Capture a gang zone. oded050 Help Archive 3 07/08/2010 12:17 PM
Lots of errors Klutty Help Archive 7 31/05/2009 09:47 PM


All times are GMT. The time now is 09:01 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.