Custom class selection
#1

Hey, im starting a new FUN server but i will need a little help with the beginning and the class choosing i havent found any tutorial on that maybe someone would help me just pu a few example skind and something and i will continiue later.
Reply
#2

https://sampwiki.blast.hk/wiki/PAWN_for_Beginners

This will help you.
Reply
#3

Add this to top of script
pawn Код:
new gPlayerClass[MAX_PLAYERS];
new PickedClass[MAX_PLAYERS] = 0;

Add this to the bottom of your script.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 10)
            {
                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 == 1)//sniper DONE
{
                        if(GetPlayerScore(playerid) <= 10)//Private

{
                            gPlayerClass[playerid] = SNIPER_CLASS;
                            PickedClass[playerid] = 1;
                            GivePlayerWeapon(playerid, 23, 500);
                            GivePlayerWeapon(playerid, 34, 100);
                            GivePlayerWeapon(playerid, 29, 200);


                    }
                        else
                    {


                    }
                }


                if(listitem == 2)//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);


                    }
                            else
                    {


                    }
                }
                if(listitem == 3)//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);



                    }
                            else
                    {


                    }
                }

                if(listitem == 4)//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);



                    }
                            else
                    {


                    }
                }
                return 1;
        }

Now Add this to OnplayerRequestSpawn or OnPlayerConnect. Not OnplayerSpawn at the dialog will appear each time you die, we don't want that.

pawn Код:
ShowPlayerDialog(playerid, 10, DIALOG_STYLE_LIST, "Classes", "Assault\nSniper\nPilot\nEngineer\nPyroman", "Select", "Cancel");

    return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)