Need help in /switchclass
#1

Guys i made a /sc (switch class) cmd. But when i type /sc to change class, dialog appears which is great from which i can choose class. But when i choose my next class like sniper, pilot or medic weapons got mixed. Previous class weapons gets mix with next class weapons. Why this is happening.
Please i need help. Help me

Here are my Codes:

pawn Код:
CMD:sc(playerid,params[])
    {
    SetPlayerHealth(playerid,0);
    TogglePlayerControllable(playerid, 0);
    SendClientMessage(playerid, COLOR_BLUE, "You can Now Choose your Class!");
    ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
    SetPlayerVirtualWorld(playerid, 0);
    return 1;
}
Reply
#2

Your OnDialogResponse.....something's messed up in your dialog response, as you mixed list items.
Reply
#3

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 999)
            {
                if(response)
                    {
                if(listitem == 0)
                    {
                    if(GetPlayerScore(playerid) >= 0)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Assault as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Assult Class:", "{F81414}Abilities:\n{FFFFFF}A Solo class, good in infantry attacks.\n\n{F81414}Weapons:\n\n{FFFFFF}Knife\n{FFFFFF}M4\n{FFFFFF}Spaz12\n{FFFFFF}Deagle", "OK","");
                        gPlayerClass[playerid] = ASSAULT;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 4, 1);
                        GivePlayerWeapon(playerid, 27, 500);
                        GivePlayerWeapon(playerid, 24, 500);
                        GivePlayerWeapon(playerid, 31, 700);
                        }
                    }

                if(listitem == 1)
                    {
                    if(GetPlayerScore(playerid) >= 250)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Sniper as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Sniper Class:", "{F81414}Abilities:\n{FFFFFF}A Locater class, Always invisible on map.\n\n{F81414}Weapons:\n\n{FFFFFF}Sniper Rifle\n{FFFFFF}Rifle\n{FFFFFF}Knife\n{FFFFFF}Shotgun", "OK","");
                        gPlayerClass[playerid] = SNIPER;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 4, 1);
                        GivePlayerWeapon(playerid, 34, 400);
                        GivePlayerWeapon(playerid, 25, 200);
                        GivePlayerWeapon(playerid, 33, 300);
                        }
                    else
            {
                SendClientMessage(playerid,COLOR_RED,"You need to be on Rank 2 to get this Class.");

                ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
                TogglePlayerControllable(playerid, 0);
                }
            }

                if(listitem == 2)
                    {
                    if(GetPlayerScore(playerid) >= 400)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Medic as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Medic Class:", "{F81414}Abilities:\n{FFFFFF}A Strong class. Very good on land\nCan heal themselve using /usekit cmd.\n\n{F81414}Weapons:\n\n{FFFFFF}AK47\n{FFFFFF}Silent Pistol\n{FFFFFF}RPG\n{FFFFFF}Desert Eagle", "OK","");
                        gPlayerClass[playerid] = MEDIC;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 30, 400);
                        GivePlayerWeapon(playerid, 23, 400);
                        GivePlayerWeapon(playerid, 35, 2);
                        GivePlayerWeapon(playerid, 24, 300);
                        }
                    else
            {
                SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 3 to get this Class.");

                ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
                TogglePlayerControllable(playerid, 0);
                }
            }
           
            if(listitem == 3)
                    {
                    if(GetPlayerScore(playerid) >= 600)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Engineer as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Engineer Class:", "{F81414}Abilities:\n{FFFFFF}A Solo class, can drice tanks.\n\n{F81414}Weapons:\n\n{FFFFFF}Tec-9\n{FFFFFF}Colt\n{FFFFFF}Knife\n{FFFFFF}Moltov", "OK","");
                        gPlayerClass[playerid] = ENGINEER;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 4, 1);
                        GivePlayerWeapon(playerid, 32, 1000);
                        GivePlayerWeapon(playerid, 22, 700);
                        GivePlayerWeapon(playerid, 18, 2);
                        }
                    else
            {
                SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 4 to get this Class.");

                ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
                TogglePlayerControllable(playerid, 0);
                }
            }

                if(listitem == 4)
                    {
                    if(GetPlayerScore(playerid) >= 800)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Mercenary as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Mercenary Class Class:", "{F81414}Abilities:\n{FFFFFF}A Solo class, can fly sea sparrow.\n\n{F81414}Weapons:\n\n{FFFFFF}Tec-9\n{FFFFFF}Colt\n{FFFFFF}Knife\n{FFFFFF}Moltov", "OK","");
                        gPlayerClass[playerid] = MERCENARY;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 4, 1);
                        GivePlayerWeapon(playerid, 32, 2000);
                        GivePlayerWeapon(playerid, 22, 700);
                        GivePlayerWeapon(playerid, 18, 2);
                        }
                    else
            {
                SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 5 to get this Class.");

                ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
                TogglePlayerControllable(playerid, 0);
                }
            }

                if(listitem == 5)
                    {
                    if(GetPlayerScore(playerid) >= 1500)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Jet Trooper as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Jet Trooper Class:", "{F81414}Abilities:\n{FFFFFF}A Airforce class, Very Good in Air. Can drive Hunter, Hydra & Sea Sparrow.\n\n{F81414}Weapons:\n\n{FFFFFF}Deagle\n{FFFFFF}Tear Gas\n{FFFFFF}Shotgun\n{FFFFFF}9mm", "OK","");
                        gPlayerClass[playerid] = JETTROOPER;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 22, 300);
                        GivePlayerWeapon(playerid, 24, 400);
                        GivePlayerWeapon(playerid, 17, 4);
                        GivePlayerWeapon(playerid, 25, 200);
                        }
                       
                        else
            {
                SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 7 to get this Class.");

                ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
                TogglePlayerControllable(playerid, 0);
                }
            }

                if(listitem == 6)
                    {
                    if(GetPlayerScore(playerid) >= 2000)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Pilot as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Pilot Class:", "{F81414}Abilities:\n{FFFFFF}A Airforce class, Very Good in Air. Can drive Hunter, Hydra & Sea Sparrow.\n\n{F81414}Weapons:\n\n{FFFFFF}Deagle\n{FFFFFF}Tear Gas\n{FFFFFF}Shotgun\n{FFFFFF}9mm", "OK","");
                        gPlayerClass[playerid] = PILOT;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 22, 300);
                        GivePlayerWeapon(playerid, 24, 400);
                        GivePlayerWeapon(playerid, 17, 4);
                        GivePlayerWeapon(playerid, 25, 200);
                        }

                        else
            {
                SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 8 to get this Class.");

                ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
                TogglePlayerControllable(playerid, 0);
                }
            }

                return 1;
        }
                return 1;
    }
And Here:
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(gPlayerFirstSpawn[playerid]==0)
    {
    gPlayerFirstSpawn[playerid] = 1;
   
    ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
    TogglePlayerControllable(playerid, 0);
    }
    else
    {
      ResetPlayerWeapons(playerid);
     
      switch(gPlayerClass[playerid])
        {

            case ASSAULT:
            {
                GivePlayerWeapon(playerid, 4, 1);
                GivePlayerWeapon(playerid, 27, 500);
                GivePlayerWeapon(playerid, 24, 500);
                GivePlayerWeapon(playerid, 31, 700);
            }
            case SNIPER:
            {
                GivePlayerWeapon(playerid, 4, 1);
                GivePlayerWeapon(playerid, 34, 400);
                GivePlayerWeapon(playerid, 25, 200);
                GivePlayerWeapon(playerid, 33, 300);
            }
            case MEDIC:
            {
                GivePlayerWeapon(playerid, 27, 400);
                GivePlayerWeapon(playerid, 23, 400);
                GivePlayerWeapon(playerid, 35, 2);
                GivePlayerWeapon(playerid, 24, 300);
            }
            case ENGINEER:
            {
                GivePlayerWeapon(playerid, 4, 1);
                GivePlayerWeapon(playerid, 32, 1000);
                GivePlayerWeapon(playerid, 22, 700);
                GivePlayerWeapon(playerid, 18, 2);
            }
            case MERCENARY:
            {
                GivePlayerWeapon(playerid, 4, 1);
                GivePlayerWeapon(playerid, 32, 2000);
                GivePlayerWeapon(playerid, 22, 700);
                GivePlayerWeapon(playerid, 18, 2);
            }
            case JETTROOPER:
            {
                GivePlayerWeapon(playerid, 22, 300);
                GivePlayerWeapon(playerid, 24, 400);
                GivePlayerWeapon(playerid, 17, 4);
                GivePlayerWeapon(playerid, 32, 3000);
            }
            case PILOT:
            {
                GivePlayerWeapon(playerid, 22, 300);
                GivePlayerWeapon(playerid, 24, 400);
                GivePlayerWeapon(playerid, 17, 4);
                GivePlayerWeapon(playerid, 25, 200);

            }
        }
    }
    SetPlayerVirtualWorld(playerid, 0);
   
    SetPlayerHealth(playerid,99999);
    SetTimerEx("SpawnKill",10000,0,"i",playerid);
   
    return 1;
}
Now what messed up??
Reply
#4

try this

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 999)
            {
                if(response)
                    {
                if(listitem == 0)
                    {
                    if(GetPlayerScore(playerid) >= 0)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Assault as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Assult Class:", "{F81414}Abilities:\n{FFFFFF}A Solo class, good in infantry attacks.\n\n{F81414}Weapons:\n\n{FFFFFF}Knife\n{FFFFFF}M4\n{FFFFFF}Spaz12\n{FFFFFF}Deagle", "OK","");
                        gPlayerClass[playerid] = ASSAULT;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 4, 1);
                        GivePlayerWeapon(playerid, 27, 500);
                        GivePlayerWeapon(playerid, 24, 500);
                        GivePlayerWeapon(playerid, 31, 700);
                       
                        }
                    return 1;
                    }

                if(listitem == 1)
                    {
                    if(GetPlayerScore(playerid) >= 250)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Sniper as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Sniper Class:", "{F81414}Abilities:\n{FFFFFF}A Locater class, Always invisible on map.\n\n{F81414}Weapons:\n\n{FFFFFF}Sniper Rifle\n{FFFFFF}Rifle\n{FFFFFF}Knife\n{FFFFFF}Shotgun", "OK","");
                        gPlayerClass[playerid] = SNIPER;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 4, 1);
                        GivePlayerWeapon(playerid, 34, 400);
                        GivePlayerWeapon(playerid, 25, 200);
                        GivePlayerWeapon(playerid, 33, 300);

                        }
                    else
            {
                SendClientMessage(playerid,COLOR_RED,"You need to be on Rank 2 to get this Class.");

                ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
                TogglePlayerControllable(playerid, 0);
                return 1;
                }
            }

                if(listitem == 2)
                    {
                    if(GetPlayerScore(playerid) >= 400)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Medic as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Medic Class:", "{F81414}Abilities:\n{FFFFFF}A Strong class. Very good on land\nCan heal themselve using /usekit cmd.\n\n{F81414}Weapons:\n\n{FFFFFF}AK47\n{FFFFFF}Silent Pistol\n{FFFFFF}RPG\n{FFFFFF}Desert Eagle", "OK","");
                        gPlayerClass[playerid] = MEDIC;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 30, 400);
                        GivePlayerWeapon(playerid, 23, 400);
                        GivePlayerWeapon(playerid, 35, 2);
                        GivePlayerWeapon(playerid, 24, 300);
                        }
                    else
            {
                SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 3 to get this Class.");

                ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
                TogglePlayerControllable(playerid, 0);
                return 1;
                }
            }

            if(listitem == 3)
                    {
                    if(GetPlayerScore(playerid) >= 600)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Engineer as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Engineer Class:", "{F81414}Abilities:\n{FFFFFF}A Solo class, can drice tanks.\n\n{F81414}Weapons:\n\n{FFFFFF}Tec-9\n{FFFFFF}Colt\n{FFFFFF}Knife\n{FFFFFF}Moltov", "OK","");
                        gPlayerClass[playerid] = ENGINEER;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 4, 1);
                        GivePlayerWeapon(playerid, 32, 1000);
                        GivePlayerWeapon(playerid, 22, 700);
                        GivePlayerWeapon(playerid, 18, 2);
                        }
                    else
            {
                SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 4 to get this Class.");

                ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
                TogglePlayerControllable(playerid, 0);
                return 1;
                }
            }

                if(listitem == 4)
                    {
                    if(GetPlayerScore(playerid) >= 800)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Mercenary as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Mercenary Class Class:", "{F81414}Abilities:\n{FFFFFF}A Solo class, can fly sea sparrow.\n\n{F81414}Weapons:\n\n{FFFFFF}Tec-9\n{FFFFFF}Colt\n{FFFFFF}Knife\n{FFFFFF}Moltov", "OK","");
                        gPlayerClass[playerid] = MERCENARY;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 4, 1);
                        GivePlayerWeapon(playerid, 32, 2000);
                        GivePlayerWeapon(playerid, 22, 700);
                        GivePlayerWeapon(playerid, 18, 2);
                        }
                    else
            {
                SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 5 to get this Class.");

                ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
                TogglePlayerControllable(playerid, 0);
                return 1;
                }
            }

                if(listitem == 5)
                    {
                    if(GetPlayerScore(playerid) >= 1500)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Jet Trooper as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Jet Trooper Class:", "{F81414}Abilities:\n{FFFFFF}A Airforce class, Very Good in Air. Can drive Hunter, Hydra & Sea Sparrow.\n\n{F81414}Weapons:\n\n{FFFFFF}Deagle\n{FFFFFF}Tear Gas\n{FFFFFF}Shotgun\n{FFFFFF}9mm", "OK","");
                        gPlayerClass[playerid] = JETTROOPER;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 22, 300);
                        GivePlayerWeapon(playerid, 24, 400);
                        GivePlayerWeapon(playerid, 17, 4);
                        GivePlayerWeapon(playerid, 25, 200);
                        }

                        else
            {
                SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 7 to get this Class.");

                ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
                TogglePlayerControllable(playerid, 0);
                return 1;
                }
            }

                if(listitem == 6)
                    {
                    if(GetPlayerScore(playerid) >= 2000)
                        {
                        SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Pilot as your class.");
                        ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Pilot Class:", "{F81414}Abilities:\n{FFFFFF}A Airforce class, Very Good in Air. Can drive Hunter, Hydra & Sea Sparrow.\n\n{F81414}Weapons:\n\n{FFFFFF}Deagle\n{FFFFFF}Tear Gas\n{FFFFFF}Shotgun\n{FFFFFF}9mm", "OK","");
                        gPlayerClass[playerid] = PILOT;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 22, 300);
                        GivePlayerWeapon(playerid, 24, 400);
                        GivePlayerWeapon(playerid, 17, 4);
                        GivePlayerWeapon(playerid, 25, 200);
                        }

                        else
            {
                SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 8 to get this Class.");

                ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
                TogglePlayerControllable(playerid, 0);
                return 1;
                }
            }

                return 1;
        }
                return 1;
    }
Reply
#5

i didn't understand. What did u add??
Reply
#6

Quote:
Originally Posted by iOmar
Посмотреть сообщение
i didn't understand. What did u add??
return 1; after each dialog response so it doesnt mix up with other dialogs i always keep it in my script cuz i had ur same problem
Reply
#7

Oh.. Now i know.. :_ I'll try..
Reply
#8

I fixed it. but I use this cmd for change class

pawn Код:
CMD:sc(playerid,params[])
    {
    TogglePlayerControllable(playerid, 0);
    SendClientMessage(playerid, COLOR_BLUE, "You can Now Choose your Class!");
    ResetPlayerWeapons(playerid);
    ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");
    SetPlayerVirtualWorld(playerid, 0);
    return 1;
}
i want as player will choose class he will be respawn at his base..
Reply
#9

Below your includes:
pawn Код:
new ClassSelected[playerid];
under OnPlayerConnect callback:
pawn Код:
ClassSelected[playerid] = 0;
The command:
pawn Код:
CMD:resetclass(playerid, params[])
{
    ClassSelected[playerid] = 0;
    SendClientMessage(playerid, C_LBLUE, "Class selection when you spawn!");
    return 1;
}
under OnPlayerSpawn callback:

pawn Код:
if(ClassSelected[playerid] == 0)
{
    ClassSelected[playerid] = 1;
    ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class  (Need No Rank)  \nSniper Class  (Need Rank 2) \nMedic Class  (Need Rank 3)  \nEngineer Class  (Need Rank 4) \nMercenary Class  (Need Rank 5 )  \nJet-Trooper Class  (Need Rank 7)  \nPilot Class  (Need Rank 8) ", "Choose","");;
}
E:// Sorry, I misunderstood. If you want the player to respawn at his base after that, then just use SpawnPlayer(playerid); Although I wouldn't use it, because it would get abused (teleporting away when low HP).
Reply
#10

so what will i do?? How to change class with out mixing weapons??
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)