SA-MP Forums Archive
2 Dialogs not working properly ! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 2 Dialogs not working properly ! (/showthread.php?tid=387890)



Class Selection/Team Selection not working !!!!!!!!!!!!!!! - Eminem 2ka9 - 26.10.2012

I Need the server to do this: Start server up, *Team selection dialog appears* Click team, click next, *Class selection dialog appears* click class, click ok. *Spawned at chosen teams primary spawn point*. But it does not do this. My server only shows the team selection dialog, I click next but the class selection dialog doesn't appear, only the default sa-mp class selection, but it's blank and the spawn button doesn't work.

Basically each team has a different spawn point so I will give you them.
pawn Код:
AddPlayerClass(73,187.383438, 1931.711059, 17.705003, 0, 0, 0, 0, 0, 0, 0); // GERMANY
    AddPlayerClass(254,-430.193237, 2240.529296, 42.983383, 0, 0, 0, 0, 0, 0, 0); // IRAQ
    AddPlayerClass(285,-92.667526, 1226.703247, 19.742187, 0, 0, 0, 0, 0, 0, 0); // RUSSIA
    AddPlayerClass(287,414.370117, 2534.738281, 19.148437, 0, 0, 0, 0, 0, 0, 0); // USA
    AddPlayerClass(206,-251.1134,2600.3315,62.8582,359.2632,0,0,0,0,0,0); // BANGLA

These are my dialog responses
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_TEAMS) //TEAM SELECTION ////////////////////////////////////////////////////////////
    {
        if(response)
        {
            if(listitem == 0)
            {
                SetPlayerSkin(playerid, 179);
                SendClientMessage(playerid, GREEN, "Welcome to GERMANY");
                SetPlayerColor(playerid, TEAM_GERMANY_COLOR);
                gTeam[playerid] = TEAM_GERMANY;
            }
            if(listitem == 1)
            {
                SendClientMessage(playerid, GREEN, "Welcome to IRAQ");
                SetPlayerSkin(playerid, 128);
                GameTextForPlayer(playerid,"~p~Taliban Cell",1000,4);
                SetPlayerColor(playerid, TEAM_IRAQ_COLOR);
                gTeam[playerid] = TEAM_IRAQ;
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, GREEN, "Welcome to Russia");
                SetPlayerSkin(playerid, 206);
                GameTextForPlayer(playerid,"~r~Soviet Union",1000,4);
                SetPlayerColor(playerid, TEAM_RUSSIA_COLOR);
                gTeam[playerid] = TEAM_RUSSIA;
            }
        }
    }
    if(dialogid == 60) // CLASS SELECTION //////////////////////////////////////////////
    {
        if(response)
        {
            if(GetPlayerScore(playerid) <= 0)//Private
            {

                gPlayerClass[playerid] = ASSAULT_CLASS;
                PickedClass[playerid] = 1;
                GivePlayerWeapon(playerid, 24, 200);
                GivePlayerWeapon(playerid, 31, 500);
                GivePlayerWeapon(playerid, 17, 5);
            }
            if(listitem == 0)//sniper DONE
            {
                if(GetPlayerScore(playerid) <= 10)//Private
                {
                    SendClientMessage(playerid, RED, "You spawned as Sniper..");
                    gPlayerClass[playerid] = SNIPER_CLASS;
                    PickedClass[playerid] = 1;
                    GivePlayerWeapon(playerid, 23, 500);
                    GivePlayerWeapon(playerid, 34, 100);
                    GivePlayerWeapon(playerid, 29, 200);
                }
            }
            if(listitem == 1)//pilot DONE
            {
                if(GetPlayerScore(playerid) <= 1150)//Lieutenant Colonel
                {
                    gPlayerClass[playerid] = AIRMAN_CLASS;
                    PickedClass[playerid] = 1;
                    GivePlayerWeapon(playerid, 22, 50);
                    GivePlayerWeapon(playerid, 29, 500);
                    GivePlayerWeapon(playerid, 16, 5);
                }
            }
            if(listitem == 2)//Engineer
            {
                if(GetPlayerScore(playerid) <= 250)//Sergeant
                {
                    gPlayerClass[playerid] = ENGINEER_CLASS;
                    PickedClass[playerid] = 1;
                    GivePlayerWeapon(playerid, 22, 100);
                    GivePlayerWeapon(playerid, 32, 500);
                    GivePlayerWeapon(playerid, 35, 5);
                }
            }
            if(listitem == 3)//FlameThrower
            {
                if(GetPlayerScore(playerid) <= 400)//CAPTAIN
                {
                    gPlayerClass[playerid] = FLAMETHROWER_CLASS;
                    PickedClass[playerid] = 1;
                    GivePlayerWeapon(playerid, 24, 200);
                    GivePlayerWeapon(playerid, 30, 200);
                    GivePlayerWeapon(playerid, 37, 200);
                }
            }
        }
    }
    return 1;
}

And finally, this is my OnPlayerConnect
pawn Код:
ShowPlayerDialog(playerid, DIALOG_TEAMS, DIALOG_STYLE_LIST, "Choose a Team", "USA\nTaliban\nEurope\nOther\nOther", "Choose","");
   
ShowPlayerDialog(playerid, 60, DIALOG_STYLE_LIST, "Choose a Class", "Assault\nSniper\nPilot\nEngineer\nPyroman", "Choose","");
Do you see any problem? If you want an idea of what I want, start this server up: 93.190.141.10:6699


Re: 2 Dialogs not working properly ! - V1ceC1ty - 26.10.2012

What is "DIALOG_TEAMS" defined as? 60?


Re: 2 Dialogs not working properly ! - Eminem 2ka9 - 26.10.2012

No, dialog_teams is the ID of the teams response dialog. ID 60 is the ID of the class selection dialog. I tried turning player spectating on and it done something, still the default sa-mp spawning thing appears and it is blank


Re: 2 Dialogs not working properly ! - V1ceC1ty - 26.10.2012

Yes but in your script somewhere you will have "#define DIALOG_TEAMS (number)" right, what is that number


Re: 2 Dialogs not working properly ! - Eminem 2ka9 - 26.10.2012

Oh yeah sorry,
pawn Код:
#define DIALOG_TEAMS 3



Re: 2 Dialogs not working properly ! - V1ceC1ty - 26.10.2012

Alright, just checking. So in your OnPlayerConnect callback you have both dialogs being shown one after the other, OnDialogResponse needs to be called after the first Dialog is been selected.


Just a quick edit from here: https://sampwiki.blast.hk/wiki/OnDialogResponse
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_TEAMS)
    {
        if(response) // If they clicked 'Yes' or pressed enter
        {
            ShowPlayerDialog(playerid, 60, DIALOG_STYLE_LIST, "Choose a Class", "Assault\nSniper\nPilot\nEngineer\nPyroman", "Choose","");
        }
        else // Pressed ESC or clicked cancel
        {
            SendClientMessage(playerid, COLOR_RED, "You MUST choose a class!.");
        }
        return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    }
 
    return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}



Re: 2 Dialogs not working properly ! - Yamakei - 26.10.2012

Reviewing your problem. After they select a class you don't have them being teleported anywhere.


Re: 2 Dialogs not working properly ! - xplor09edy - 26.10.2012

Quote:
Originally Posted by Yamakei
Посмотреть сообщение
Reviewing your problem. After they select a class you don't have them being teleported anywhere.
I'm sure this can't be any problem


Re: 2 Dialogs not working properly ! - V1ceC1ty - 26.10.2012

Quote:
Originally Posted by Yamakei
Посмотреть сообщение
Reviewing your problem. After they select a class you don't have them being teleported anywhere.
You need to add in your own SetPlayerPos when they respond to the new dialogs


Re: 2 Dialogs not working properly ! - Eminem 2ka9 - 26.10.2012

Ok, I will give you my script right now.. Edit it if you wish and fix it ! I done a few things to it though(Dialog response is at bottom)

pawn Код:
// This is a comment
// uncomment the line elow if you want to write a filterscript
//#define FILTERSCRIPTt

#include <a_samp>
#include <zcmd>
#define DIALOG_TEAMS 3

#define SNIPER_CLASS 1

#define AIRMAN_CLASS 2

#define FLAMETHROWER_CLASS 3

#define ASSAULT_CLASS 4

#define ENGINEER_CLASS 5

#define COLOR_WHITE 0xFFFFFFFF

#define COL_GREEN          "{6EF83C}"

#define COL_WHITE          "{FFFFFF}"

#define COLOR_RED          0xAA3333AA

#define COLOR_GREEN        0x33AA33AA
new gPlayerClass[MAX_PLAYERS];
new PickedClass[MAX_PLAYERS] = 0;

new Text3D:private[MAX_PLAYERS];
new Text3D:major[MAX_PLAYERS];
new Text3D:captain[MAX_PLAYERS];


// This has to be 0 and 1 btw
#define TEAM_GERMANY 0
#define TEAM_IRAQ 1
#define TEAM_RUSSIA 2
#define TEAM_USA 3
#define TEAM_BANGLADESH 4

#define TEAM_GERMANY_COLOR 0x80FF8096 // Bright Green
#define TEAM_IRAQ_COLOR 0x9400D3AA // Bright Purple
#define TEAM_RUSSIA_COLOR 0xFF0000AA //Bright Red
#define TEAM_USA_COLOR 0x0015FFAA //Bright Blue
#define TEAM_BANGLADESH_COLOR 0x00FFFFAA //Cyan color

#define ORANGE  0xFF6600
#define GREEN      0x15FF00AA
#define RED       0xFF0000AA
#define BLUE      0x0015FFAA


new gTeam[MAX_PLAYERS];
new GZ_ZONE1;
new GZ_ZONE2;
new GZ_ZONE3;
new GZ_ZONE4;
new GZ_ZONE5;
new Text:Web;
new Text:CODTU;

main( ) { }



public OnGameModeInit()
    {
    SetWorldTime(12);
    // Don't use these lines if it's a filterscript
    SetGameModeText("Call of Duty: Retribution");
    //admin base
    AddPlayerClass(73,187.383438, 1931.711059, 17.705003, 0, 0, 0, 0, 0, 0, 0); // GERMANY
    AddPlayerClass(254,-430.193237, 2240.529296, 42.983383, 0, 0, 0, 0, 0, 0, 0); // IRAQ
    AddPlayerClass(285,-92.667526, 1226.703247, 19.742187, 0, 0, 0, 0, 0, 0, 0); // RUSSIA
    AddPlayerClass(287,414.370117, 2534.738281, 19.148437, 0, 0, 0, 0, 0, 0, 0); // USA
    AddPlayerClass(206,-251.1134,2600.3315,62.8582,359.2632,0,0,0,0,0,0); // BANGLA
   
    CreateObject(12805, 450.12, 2492.50, 29.37,   0.00, 0.00, 93.00);
    CreateObject(11556, 463.46, 2436.15, 15.54,   0.00, 0.00, 0.00);
    CreateObject(8210, 443.87, 2555.44, 18.44,   0.00, 0.00, 0.00);
    CreateObject(8210, 388.57, 2555.32, 18.53,   0.00, 0.00, 0.00);
    CreateObject(8210, 333.17, 2555.41, 18.47,   0.00, 0.00, 0.00);
    CreateObject(8210, 277.84, 2555.58, 18.55,   0.00, 0.00, 0.00);
    CreateObject(8210, 250.53, 2527.54, 18.58,   0.00, 0.00, -90.00);
    CreateObject(3749, 251.69, 2492.31, 21.03,   0.00, 0.00, -90.00);
    CreateObject(8210, 251.34, 2458.26, 18.47,   0.00, 0.00, -90.00);
    CreateObject(3749, 260.63, 2432.48, 21.26,   0.00, 0.00, 0.00);
    CreateObject(3749, 279.72, 2432.43, 21.26,   0.00, 0.00, 0.00);
    CreateObject(8210, 314.35, 2434.42, 18.47,   0.00, 0.00, 0.00);
    CreateObject(8210, 350.86, 2433.92, 18.36,   0.00, 0.00, 0.00);
    CreateObject(14407, 378.00, 2460.87, 16.55,   0.00, 0.00, 0.00);
    CreateObject(14407, 377.99, 2454.21, 21.02,   0.00, 0.00, 0.00);
    CreateObject(3425, 370.45, 2459.58, 26.34,   0.00, 0.00, 0.00);
    CreateObject(3279, 455.12, 2542.68, 17.32,   0.00, 0.00, 0.00);
    CreateObject(3279, 308.21, 2546.39, 15.75,   0.00, 0.00, 0.00);
    CreateObject(3279, 304.19, 2445.32, 15.45,   0.00, 0.00, 0.00);
    CreateObject(5461, 326.07, 2474.99, 19.69,   0.00, 0.00, 0.00);
    CreateObject(8210, -154.53, 2671.51, 64.10,   0.00, 0.00, 90.00);
    CreateObject(8210, -154.36, 2725.08, 64.17,   0.00, 0.00, 90.00);
    CreateObject(8210, -154.34, 2780.14, 64.06,   0.00, 0.00, 90.00);
    CreateObject(3749, -152.17, 2635.84, 68.36,   0.00, 0.00, 90.00);
    CreateObject(8210, -173.92, 2609.87, 61.67,   0.00, 0.00, 40.00);
    CreateObject(8210, -222.50, 2592.13, 63.66,   0.00, 0.00, 0.00);
    CreateObject(8210, -332.90, 2734.03, 65.49,   0.00, 0.00, 90.00);
    CreateObject(8210, -333.27, 2679.84, 65.51,   0.00, 0.00, 90.00);
    CreateObject(987, -333.86, 2648.56, 62.82,   0.00, 0.00, 84.00);
    CreateObject(3749, -337.21, 2639.41, 68.64,   0.00, 0.00, 81.00);
    CreateObject(8210, -317.49, 2614.30, 66.19,   0.00, 0.00, -36.00);
    CreateObject(987, -295.27, 2597.87, 62.29,   0.00, 0.00, -40.00);
    CreateObject(4726, 227.39, 1978.48, 16.61,   0.00, 0.00, 0.00);
    CreateObject(14414, 283.82, 1864.74, 19.33,   0.00, 0.00, 0.00);
    CreateObject(14414, 287.70, 1864.77, 19.30,   0.00, 0.00, 0.00);


////vehicles
//Newly Added !=]
AddStaticVehicle(470,-509.7989,2561.1223,53.4068,271.5563,43,0); //
AddStaticVehicle(470,-528.3273,2612.1770,53.4064,267.8813,43,0); //
AddStaticVehicle(470,-756.1857,2754.0479,45.7653,266.6166,43,0); //
AddStaticVehicle(528,-850.6580,2747.1724,45.8864,183.6479,28,122); //
AddStaticVehicle(528,-904.2847,2703.0391,42.4127,47.4209,28,122); //
AddStaticVehicle(520,-43.9305,1173.0770,20.4471,87.7100,44,74); //
AddStaticVehicle(528,-85.8011,1370.7318,10.3176,190.0137,106,94); //
AddStaticVehicle(528,282.7239,1343.5084,10.6299,354.8342,106,94); //
AddStaticVehicle(528,274.3759,1341.8696,10.6268,356.0974,106,94); //
AddStaticVehicle(433,262.7326,1344.7644,11.0226,357.2455,69,72); //
AddStaticVehicle(433,664.3554,1726.7543,7.4289,218.5208,69,72); //
AddStaticVehicle(470,658.5470,1721.1454,6.9869,41.7828,52,13); //
AddStaticVehicle(470,654.3136,1717.5702,6.9914,41.4657,52,13); //
AddPlayerClass(206,644.3044,1695.2173,6.9922,117.0882,0,0,0,0,0,0); // 528
AddStaticVehicle(528,635.4548,1677.6578,7.0359,36.0471,49,83); //
AddStaticVehicle(490,1122.5281,1006.9773,11.1280,116.6644,66,88); //
AddStaticVehicle(470,982.1502,1075.7723,10.8017,93.0049,116,61); //
AddStaticVehicle(470,980.9160,1098.0331,10.8116,92.3346,116,61); //



CreateVehicle(425, 364.9720, 2538.0386, 17.3092, 184.0000, -1, -1, 100);
CreateVehicle(520, 268.3366, 2543.3374, 17.3024, 180.0000, -1, -1, 100);
CreateVehicle(476, 291.3607, 2543.9614, 17.9113, 180.0000, -1, -1, 100);
CreateVehicle(476, 325.6700, 2542.9197, 17.9014, 180.0000, -1, -1, 100);
CreateVehicle(470, 307.6615, 2536.2375, 16.7011, 180.0000, -1, -1, 100);
CreateVehicle(470, 341.9824, 2485.3606, 16.3706, 0.0000, -1, -1, 100);
CreateVehicle(470, 354.5155, 2538.9507, 16.6278, 180.0000, -1, -1, 100);
CreateVehicle(470, 346.0322, 2539.6531, 16.4340, 180.0000, -1, -1, 100);
CreateVehicle(432, 394.7015, 2446.0923, 16.3876, 0.0000, -1, -1, 100);
CreateVehicle(432, 412.9508, 2446.7751, 16.3942, 0.0000, -1, -1, 100);
CreateVehicle(433, 386.3125, 2538.8696, 17.0323, 180.0000, -1, -1, 100);
CreateVehicle(487, 405.3329, 2460.6536, 29.8349, 0.0000, -1, -1, 100);
CreateVehicle(487, 358.2871, 2490.4832, 28.4258, 0.0000, -1, -1, 100);
CreateVehicle(520, -233.0517, 2660.5913, 63.4347, 180.0000, -1, -1, 100);
CreateVehicle(520, -212.9728, 2660.0635, 63.3981, 180.0000, -1, -1, 100);
CreateVehicle(425, -310.0828, 2680.3740, 63.4143, 0.0000, -1, -1, 100);
CreateVehicle(433, -228.6775, 2732.7085, 63.1814, 0.0000, -1, -1, 100);
CreateVehicle(447, -213.0086, 2733.2693, 62.8845, 0.0000, -1, -1, 100);
CreateVehicle(432, -241.5271, 2774.7251, 62.4544, 180.0000, -1, -1, 100);
CreateVehicle(432, -165.8552, 2686.1375, 62.3629, 90.0000, -1, -1, 100);
CreateVehicle(490, -167.0429, 2669.7322, 63.3088, 90.0000, -1, -1, 100);
CreateVehicle(490, -167.6152, 2658.3682, 63.9821, 90.0000, -1, -1, 100);
CreateVehicle(601, -209.4082, 2602.3862, 62.5926, 0.0000, -1, -1, 100);
CreateVehicle(470, -221.6009, 2602.7659, 62.6025, 0.0000, -1, -1, 100);
CreateVehicle(470, -235.3760, 2602.4441, 62.6025, 0.0000, -1, -1, 100);
CreateVehicle(470, -30.2696, 2342.0266, 24.0237, 0.0000, -1, -1, 100);
CreateVehicle(470, 172.9899, 1930.0182, 18.2039, 180.0000, -1, -1, 100);
CreateVehicle(470, 179.8932, 1930.0627, 17.7880, 180.0000, -1, -1, 100);
CreateVehicle(447, 201.4775, 1884.5150, 17.8194, 0.0000, -1, -1, 100);
CreateVehicle(447, 224.4239, 1885.0465, 17.8200, 0.0000, -1, -1, 100);
CreateVehicle(425, 226.4783, 1981.5138, 19.6279, 90.0000, -1, -1, 100);
CreateVehicle(500, 291.5969, 1902.0576, 17.8286, 0.0000, -1, -1, 100);
CreateVehicle(520, 278.9262, 1956.3839, 18.4331, -90.0000, -1, -1, 100);
CreateVehicle(520, 277.8458, 1990.0569, 18.4299, -90.0000, -1, -1, 100);
CreateVehicle(520, 278.8977, 2024.7052, 18.7303, -91.0000, -1, -1, 100);
CreateVehicle(487, 330.2691, 1857.7391, 18.1296, 0.0000, -1, -1, 100);
CreateVehicle(487, 333.2515, 1896.5369, 18.1270, 0.0000, -1, -1, 100);
CreateVehicle(487, 279.7356, 1929.3915, 17.8241, 0.0000, -1, -1, 100);
CreateVehicle(487, 184.9452, 1811.2323, 17.8343, 0.0000, -1, -1, 100);
CreateVehicle(599, 364.3433, 1937.1143, 17.8183, 90.0000, -1, -1, 100);
CreateVehicle(599, 361.9468, 1971.8999, 17.8273, 90.0000, -1, -1, 100);
CreateVehicle(476, 302.6609, 2051.3438, 18.7014, 180.0000, -1, -1, 100);
CreateVehicle(476, 314.9147, 2051.6223, 18.7380, 180.0000, -1, -1, 100);
CreateVehicle(470, -362.5944, 2198.6367, 42.3802, 0.0000, -1, -1, 100);
CreateVehicle(470, -385.9617, 2195.3948, 42.0191, -90.0000, -1, -1, 100);
CreateVehicle(476, -469.1991, 2232.9861, 46.2906, 180.0000, -1, -1, 100);
CreateVehicle(522, -423.4416, 2225.9443, 42.0162, 0.0000, -1, -1, 100);
CreateVehicle(522, -391.5645, 2221.8062, 42.0169, -90.0000, -1, -1, 100);
CreateVehicle(522, -387.9488, 2212.1982, 42.0161, -84.0000, -1, -1, 100);
CreateVehicle(522, -356.3287, 2200.4702, 42.0732, 0.0000, -1, -1, 100);
CreateVehicle(500, -401.1270, 2224.9727, 42.6239, 178.0000, -1, -1, 100);
CreateVehicle(447, -431.6691, 2226.2529, 42.6071, 0.0000, -1, -1, 100);
CreateVehicle(432, -414.3075, 2216.2314, 42.6262, -90.0000, -1, -1, 100);
CreateVehicle(520, -417.4319, 2200.1738, 43.2283, -180.0000, -1, -1, 100);
CreateVehicle(425, -435.6116, 2198.7466, 43.2201, 185.0000, -1, -1, 100);
CreateVehicle(433, -395.0356, 2258.6289, 42.3966, 0.0000, -1, -1, 100);
CreateVehicle(451, 221.7199, 1863.8215, 12.7346, 0.0000, -1, -1, 100);
CreateVehicle(541, 206.1917, 1862.7610, 12.7361, 0.0000, -1, -1, 100);
CreateVehicle(521, 212.9610, 1859.4684, 12.7341, 0.0000, -1, -1, 100);
CreateVehicle(521, 216.1067, 1919.4802, 17.2262, 178.0000, -1, -1, 100);
CreateVehicle(521, 208.1374, 1919.6757, 17.2258, 180.0000, -1, -1, 100);
CreateVehicle(432, 119.3823, 1904.0291, 18.7829, 0.0000, -1, -1, 100);
CreateVehicle(432, 331.1017, 1923.9956, 17.8223, 84.0000, -1, -1, 100);
CreateVehicle(432, -86.7391, 1351.6979, 10.5394, 0.0000, -1, -1, 100);
CreateVehicle(432, -139.5564, 1182.1930, 19.9293, 0.0000, -1, -1, 100);
CreateVehicle(432, -150.3058, 1182.0281, 19.6261, 0.0000, -1, -1, 100);
CreateVehicle(447, -164.6117, 1227.7975, 19.9327, 0.0000, -1, -1, 100);
CreateVehicle(447, -101.6055, 1060.4777, 19.9173, 0.0000, -1, -1, 100);
CreateVehicle(433, -157.4107, 1130.3845, 20.2373, 0.0000, -1, -1, 100);
CreateVehicle(451, -110.7150, 1131.7701, 19.3377, 0.0000, -1, -1, 100);
CreateVehicle(487, -31.4146, 1180.0289, 19.5603, 0.0000, -1, -1, 100);
CreateVehicle(490, -146.5359, 1125.2842, 19.9334, 0.0000, -1, -1, 100);
CreateVehicle(490, -92.3016, 1160.1515, 19.9357, -90.0000, -1, -1, 100);
CreateVehicle(470, -141.0147, 1085.7773, 19.3232, 0.0000, -1, -1, 100);
CreateVehicle(470, -152.8062, 1086.1261, 19.6248, 0.0000, -1, -1, 100);
CreateVehicle(425, -82.7839, 1122.1613, 20.5346, 0.0000, -1, -1, 100);
CreateVehicle(520, -49.4360, 1121.0028, 20.5321, 0.0000, -1, -1, 100);
CreateVehicle(520, -83.3086, 1075.9781, 20.5282, -90.0000, -1, -1, 100);
CreateVehicle(470, -142.0169, 1213.3082, 19.6301, 0.0000, -1, -1, 100);
CreateVehicle(470, -89.6595, 1216.6346, 19.6188, 0.0000, -1, -1, 100);

GZ_ZONE1 = GangZoneCreate(-319.3359375,2654.296875,-128.90625,2815.4296875);

GZ_ZONE2 = GangZoneCreate(-2.9296875,1731.4453125,386.71875,2056.640625);

GZ_ZONE3 = GangZoneCreate(-304.6875,1031.25,14.6484375,1221.6796875);

GZ_ZONE4 = GangZoneCreate(102.5390625,2408.203125,465.8203125,2622.0703125);

GZ_ZONE5 = GangZoneCreate(-468.75,2185.546875,-316.40625,2293.9453125);
UsePlayerPedAnims();
   
return 1;
}

public OnGameModeExit()
{
    return 1;
}



public OnPlayerConnect(playerid)
{
TogglePlayerSpectating(playerid,true);
ShowPlayerDialog(playerid, DIALOG_TEAMS, DIALOG_STYLE_LIST, "Choose a Team", "USA\nTaliban\nEurope\nOther\nOther", "Choose","");
   
   
   
GameTextForPlayer(playerid,"~g~Call of Duty ~r~ Retribution ~n~ ~b~ by ~w~ Virmana!",5000,5);

SetPlayerMapIcon( playerid, 1, 213.708129,1896.449096,16.587989, 62, 0, MAPICON_GLOBAL );
SetPlayerMapIcon( playerid, 2, -401.761535,2238.729492,42.429687, 58, 0, MAPICON_GLOBAL );
SetPlayerMapIcon( playerid, 3, -135.124938,1143.156860,19.742187, 60, 0, MAPICON_GLOBAL );
SetPlayerMapIcon( playerid, 4, 266.765167,2504.968261,16.484375, 61, 0, MAPICON_GLOBAL );
SetPlayerMapIcon( playerid, 5, -226.190475,2710.950927,62.976562, 58, 0, MAPICON_GLOBAL );

new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "** %s Joined The Server!", name);
SendClientMessageToAll(GREEN, string);
   
Web = TextDrawCreate(495.000000, 10.000000, "Team Deathmatch");
TextDrawBackgroundColor(Web, 255);
TextDrawFont(Web, 1);
TextDrawLetterSize(Web, 0.330000, 1.200000);
TextDrawColor(Web, 10040319);
TextDrawSetOutline(Web, 0);
TextDrawSetProportional(Web, 1);
TextDrawSetShadow(Web, 1);

CODTU = TextDrawCreate(2.000000, 437.000000, "Call of Duty: Retribution");
TextDrawBackgroundColor(CODTU, 255);
TextDrawFont(CODTU, 2);
TextDrawLetterSize(CODTU, 0.330000, 1.000000);
TextDrawColor(CODTU, 10040319);
TextDrawSetOutline(CODTU, 0);
TextDrawSetProportional(CODTU, 1);
TextDrawSetShadow(CODTU, 1);

TextDrawShowForPlayer(playerid, Web);
TextDrawShowForPlayer(playerid, CODTU);
SendClientMessage(playerid, RED, "Welcome Back! Type /Cmds or /Help for Useful Commands");

return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));

    format(string, sizeof(string), "** %s has left the server", name);
    SendClientMessageToAll(RED, string);

    return 1;
}

public OnPlayerSpawn(playerid)
{

    if(GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) < 150)
    {
    private[playerid] = Create3DTextLabel("Private", GREEN,0,0,0,70.5,1);
    }
    if(GetPlayerScore(playerid) >= 150 && GetPlayerScore(playerid) < 350)
    {
     major[playerid] = Create3DTextLabel("Major", GREEN,0,0,0,70.5,1);
    }
    if(GetPlayerScore(playerid) >= 350 && GetPlayerScore(playerid) < 500)
    {
     captain[playerid] = Create3DTextLabel("Captain", GREEN,0,0,0,70.5,1);
}

    if(gTeam[playerid] == TEAM_GERMANY) {
            SendClientMessage(playerid, RED,"You have Chosen Germany as your Team!");
            SetPlayerArmour(playerid, 100);
            GivePlayerWeapon(playerid,16,50000);
            GivePlayerWeapon(playerid,26,50000);
            GivePlayerWeapon(playerid,28,50000);
            GivePlayerWeapon(playerid,34,50000);
            new Text3D:label7 = Create3DTextLabel("Germany",TEAM_GERMANY_COLOR, 30.0, 40.0, 50.0, 40.0, 0);
            Attach3DTextLabelToPlayer(label7, playerid, 0.0, 0.0, 0.4);
            SetPlayerTeam(playerid, 0);
        }
    if(gTeam[playerid] == TEAM_IRAQ) {
            SendClientMessage(playerid, RED,"You have Chosen Taliban Cell as your Team!");
            SetPlayerArmour(playerid, 100);
            GivePlayerWeapon(playerid,16,50000);
            GivePlayerWeapon(playerid,26,50000);
            GivePlayerWeapon(playerid,28,50000);
            GivePlayerWeapon(playerid,34,50000);
            new Text3D:label7 = Create3DTextLabel("Taliban Cell",TEAM_IRAQ_COLOR, 30.0, 40.0, 50.0, 40.0, 0);
            Attach3DTextLabelToPlayer(label7, playerid, 0.0, 0.0, 0.4);
            SetPlayerTeam(playerid, 1);
    }
    if(gTeam[playerid] == TEAM_RUSSIA) {
            SendClientMessage(playerid, RED,"You have Chosen Soviet Union as your Team!");
            SetPlayerArmour(playerid, 100);
            GivePlayerWeapon(playerid,16,50000);
            GivePlayerWeapon(playerid,26,50000);
            GivePlayerWeapon(playerid,28,50000);
            GivePlayerWeapon(playerid,34,50000);
            new Text3D:label7 = Create3DTextLabel("Soviet Union",TEAM_RUSSIA_COLOR, 30.0, 40.0, 50.0, 40.0, 0);
            Attach3DTextLabelToPlayer(label7, playerid, 0.0, 0.0, 0.4);
            SetPlayerTeam(playerid, 2);
    }
    if(gTeam[playerid] == TEAM_USA) {
            SendClientMessage(playerid, RED,"You have Chosen USA as your Team!");
            SetPlayerArmour(playerid, 100);
            GivePlayerWeapon(playerid,16,50000);
            GivePlayerWeapon(playerid,26,50000);
            GivePlayerWeapon(playerid,28,50000);
            GivePlayerWeapon(playerid,34,50000);
            new Text3D:label7 = Create3DTextLabel("United States of America",TEAM_USA_COLOR, 30.0, 40.0, 50.0, 40.0, 0);
            Attach3DTextLabelToPlayer(label7, playerid, 0.0, 0.0, 0.4);
            SetPlayerTeam(playerid, 3);
    }
    if(gTeam[playerid] == TEAM_BANGLADESH) {
            SendClientMessage(playerid, RED,"You have Chosen European Alliance as your Team!");
            SetPlayerArmour(playerid, 100);
            GivePlayerWeapon(playerid,16,50000);
            GivePlayerWeapon(playerid,26,50000);
            GivePlayerWeapon(playerid,28,50000);
            GivePlayerWeapon(playerid,34,50000);
            new Text3D:label7 = Create3DTextLabel("European Aliance",TEAM_BANGLADESH_COLOR, 30.0, 40.0, 50.0, 40.0, 0);
            Attach3DTextLabelToPlayer(label7, playerid, 0.0, 0.0, 0.4);
            SetPlayerTeam(playerid, 4);
    }
    GangZoneShowForAll(GZ_ZONE1, 0x80FFFF96);
    GangZoneShowForAll(GZ_ZONE2, 0x80FF803E);
    GangZoneShowForAll(GZ_ZONE3, 0xFF00003E);
    GangZoneShowForAll(GZ_ZONE4, 0x0000A03E);
    GangZoneShowForAll(GZ_ZONE5, 0x8000803E);
    return 1;
   
}

public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
    SendClientMessage(playerid, RED, "You Lost $1000 for Dying!");
    GivePlayerMoney(playerid, -2500);
    GivePlayerMoney(killerid, 5500);
    GameTextForPlayer(playerid, "~r~Wasted",2500,3);
    SendClientMessage(killerid, GREEN, "Good Job - You got 5500$ and +3 Scores as a Reward!");
// Adds 3 to this killer's score.
    if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) + 3);
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

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

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    return 1;
}

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

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

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

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}
public OnPlayerRequestClass(playerid)
{
TogglePlayerSpectating(playerid, true);
ShowPlayerDialog(playerid, 60, DIALOG_STYLE_LIST, "Choose a Class", "Assault\nSniper\nPilot\nEngineer\nPyroman", "Choose","");
TogglePlayerSpectating(playerid, false);
    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 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)
{
    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 OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}


//////////////////////////////////////////////

CMD:r(playerid,params[]) {
#pragma unused params
if(isnull(params)) return SendClientMessage(playerid, ORANGE, "USAGE: /R [text] to talk in Team Chat");
new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name));
new string[128];
format(string, sizeof(string), "[R][Team Chat] %s: %s", Name, params[0]);
printf("%s", string);

for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid]) SendClientMessage(i, RED, string);
}
return 1;
}

CMD:myteam(playerid, params[])
{
if(gTeam[playerid] == TEAM_GERMANY)
{
SendClientMessage(playerid, RED, "Class Verification: You are Apart of Germany Team");
}
else if(gTeam[playerid] == TEAM_IRAQ)
{
SendClientMessage(playerid, RED, "Class Verification: You are Apart of Taliban Cell");
}
else if(gTeam[playerid] == TEAM_RUSSIA)
{
SendClientMessage(playerid, RED, "Class Verification: You are Apart of Soviet Union");
}
else if(gTeam[playerid] == TEAM_USA)
{
SendClientMessage(playerid, RED, "Class Verification: You are Apart of United States of America");
}
else if(gTeam[playerid] == TEAM_BANGLADESH)
{
SendClientMessage(playerid, RED, "Class Verification: You are Apart of European Alliance Team");
}
return 1;
}





CMD:cmds(playerid, params[])
{
ShowPlayerDialog(playerid, RED, DIALOG_STYLE_MSGBOX, "{FFFF00}General Player Commands","{FFFF00}/R || /MyTeam || /MyRank || /Duel [ID] [Weapon [Cash] || /W || /Objective\n/Help  || /Admins || /NeonShop || /Kill || /Rules || /St || /Report [ID] || /BankTele ||","I accept","");
return 1;
}


CMD:objective(playerid, params[]) {
ShowPlayerDialog(playerid, RED, DIALOG_STYLE_MSGBOX, "{FFFF00}Objective","{F0F0F0}||Increase Rank /Myrank, /Ranks|| \n{F0F0F0}||Defend your Base|| \n{F0F0F0}||Earn Score By killing Players||\n{F0F0F0}||Have Fun!||","Ok","");
return 1;
}
CMD:help(playerid, params[])
{
ShowPlayerDialog(playerid, RED, DIALOG_STYLE_MSGBOX, "{FFFF00}Help","{F0F0F0}Read /Cmds /Rules /Objective For More Info","Ok","");
return 1;
}
CMD:gc(playerid, params[])
{
ShowPlayerDialog(playerid, RED, DIALOG_STYLE_MSGBOX, "{FFFF00}Group Commands","{F0F0F0}||/Gleave /Ginvite /Gregister /Gleader /Gjoin\n/Gkick /Gm /Glist /Groups","Ok","");
return 1;
}

CMD:rules(playerid, params[])
{
ShowPlayerDialog(playerid, RED, DIALOG_STYLE_MSGBOX, "{FFFF00}Rules","{F0F0F0}/Do not Spawn Kill \n/Do not disrespect Players/Staff \n/Do not Park over People \n/Do not use Any Hacks \n/Do not Swear \n/C-BUG IS ALLOWED)","Ok","");
return 1;
}
CMD:st(playerid, params[])
{
SetPlayerHealth(playerid, 0.0);
ForceClassSelection(playerid);
SendClientMessage(playerid, RED,"Class Selection: Select your New Team!");
return 1;
}


//============================Dialog System===================================//
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_TEAMS) //THIS IS LIKE 673 ////////////////////////////////////////////////////////////
    {
        if(response)
        {
            TogglePlayerSpectating(playerid, false);
            if(listitem == 0)
            {
                SetPlayerSkin(playerid, 179);
                SendClientMessage(playerid, GREEN, "Welcome to GERMANY");
                SetPlayerColor(playerid, TEAM_GERMANY_COLOR);
                gTeam[playerid] = TEAM_GERMANY;
            }
            if(listitem == 1)
            {
                SendClientMessage(playerid, GREEN, "Welcome to Taliban Cell");
                SetPlayerSkin(playerid, 128);
                GameTextForPlayer(playerid,"~p~Taliban Cell",1000,4);
                SetPlayerColor(playerid, TEAM_IRAQ_COLOR);
                gTeam[playerid] = TEAM_IRAQ;
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, GREEN, "Welcome to Russia");
                SetPlayerSkin(playerid, 206);
                GameTextForPlayer(playerid,"~r~Soviet Union",1000,4);
                SetPlayerColor(playerid, TEAM_RUSSIA_COLOR);
                gTeam[playerid] = TEAM_RUSSIA;
            }
        }
    }
    if(dialogid == 60)
    {
        if(response)
        {
            TogglePlayerSpectating(playerid, false);
            if(GetPlayerScore(playerid) <= 0)//Private
            {

                gPlayerClass[playerid] = ASSAULT_CLASS;
                PickedClass[playerid] = 1;
                GivePlayerWeapon(playerid, 24, 200);
                GivePlayerWeapon(playerid, 31, 500);
                GivePlayerWeapon(playerid, 17, 5);
            }
            if(listitem == 0)//sniper DONE
            {
                if(GetPlayerScore(playerid) <= 10)//Private
                {
                    SendClientMessage(playerid, RED, "You spawned as Sniper..");
                    gPlayerClass[playerid] = SNIPER_CLASS;
                    PickedClass[playerid] = 1;
                    GivePlayerWeapon(playerid, 23, 500);
                    GivePlayerWeapon(playerid, 34, 100);
                    GivePlayerWeapon(playerid, 29, 200);
                }
            }
            if(listitem == 1)//pilot DONE
            {
                if(GetPlayerScore(playerid) <= 1150)//Lieutenant Colonel
                {
                    gPlayerClass[playerid] = AIRMAN_CLASS;
                    PickedClass[playerid] = 1;
                    GivePlayerWeapon(playerid, 22, 50);
                    GivePlayerWeapon(playerid, 29, 500);
                    GivePlayerWeapon(playerid, 16, 5);
                }
            }
            if(listitem == 2)//Engineer
            {
                if(GetPlayerScore(playerid) <= 250)//Sergeant
                {
                    gPlayerClass[playerid] = ENGINEER_CLASS;
                    PickedClass[playerid] = 1;
                    GivePlayerWeapon(playerid, 22, 100);
                    GivePlayerWeapon(playerid, 32, 500);
                    GivePlayerWeapon(playerid, 35, 5);
                }
            }
            if(listitem == 3)//FlameThrower
            {
                if(GetPlayerScore(playerid) <= 400)//CAPTAIN
                {
                    gPlayerClass[playerid] = FLAMETHROWER_CLASS;
                    PickedClass[playerid] = 1;
                    GivePlayerWeapon(playerid, 24, 200);
                    GivePlayerWeapon(playerid, 30, 200);
                    GivePlayerWeapon(playerid, 37, 200);
                }
            }
        }
    }
    return 1;
}