[Tutorial] Creating Custom Class Selection Screen
#1

INTRODUCTION
To get an idea, what we shall be be creating, here is the video : [ame]http://www.youtube.com/watch?v=jTU73Xfhh_Q[/ame]

Custom Class Selection Screen have some advantages, to name few, one may add vehicles, pickups, add custom textdraw.

CODING PART

Before we start coding, we need to create TextDraw's.
I made using Zamaroht's Textdraw Editor

Code :
pawn Code:
new Text:TDClassChooser; //When Player Chooses class [HEADING]
new Text:TDClassChooserBOX; //Box for it
new Text:TDClassChooserAssaulter[MAX_PLAYERS]; //Assaulter Selected
new Text:TDClassChooserSupporter[MAX_PLAYERS];
new Text:TDClassChooserSniper[MAX_PLAYERS];
new Text:TDClassChooserCustom[MAX_PLAYERS];
new Text:TDClassChooserChoosen[MAX_PLAYERS]; //The >  < in class chossing
new Text:TD_HowToSpawn; //Press shift to go up and space to down....

    TDClassChooser = TextDrawCreate(91.000000, 149.000000, "~g~Class ~r~Chooser");
    TextDrawAlignment(TDClassChooser, 2);
    TextDrawBackgroundColor(TDClassChooser, 255);
    TextDrawFont(TDClassChooser, 2);
    TextDrawLetterSize(TDClassChooser, 0.270000, 2.000000);
    TextDrawColor(TDClassChooser, -16776961);
    TextDrawSetOutline(TDClassChooser, 1);
    TextDrawSetProportional(TDClassChooser, 1);
    TextDrawUseBox(TDClassChooser, 1);
    TextDrawBoxColor(TDClassChooser, 255);
    TextDrawTextSize(TDClassChooser, 179.000000, 121.000000);

    TDClassChooserBOX = TextDrawCreate(32.000000, 173.000000, "~n~~n~~n~~n~~n~~n~~n~");
    TextDrawBackgroundColor(TDClassChooserBOX, 255);
    TextDrawFont(TDClassChooserBOX, 1);
    TextDrawLetterSize(TDClassChooserBOX, 0.500000, 1.000000);
    TextDrawColor(TDClassChooserBOX, -1);
    TextDrawSetOutline(TDClassChooserBOX, 0);
    TextDrawSetProportional(TDClassChooserBOX, 1);
    TextDrawSetShadow(TDClassChooserBOX, 1);
    TextDrawUseBox(TDClassChooserBOX, 1);
    TextDrawBoxColor(TDClassChooserBOX, 125);
    TextDrawTextSize(TDClassChooserBOX, 150.000000, 109.000000);

    TD_HowToSpawn                   =TextDrawCreate( 66.000000, 293.000000, "Press ~g~SHIFT ~w~ to go ~g~UP~n~~r~SPACE~w~ to go ~r~DOWN~n~~b~ENTER TO SPAWN");
    TextDrawAlignment           ( TD_HowToSpawn, 2);
    TextDrawBackgroundColor ( TD_HowToSpawn, 255);
    TextDrawFont                ( TD_HowToSpawn, 1);
    TextDrawLetterSize      ( TD_HowToSpawn, 0.300000, 1.300000);
    TextDrawColor               ( TD_HowToSpawn, -1);
    TextDrawSetOutline      ( TD_HowToSpawn, 1);
    TextDrawSetProportional ( TD_HowToSpawn, 1);


    //Under OnPlayerConnect
    TDClassChooserAssaulter[playerid] = TextDrawCreate(55.000000, 174.000000, "~g~Assaulter");
    TextDrawBackgroundColor(TDClassChooserAssaulter[playerid], 255);
    TextDrawFont(TDClassChooserAssaulter[playerid], 2);
    TextDrawLetterSize(TDClassChooserAssaulter[playerid], 0.239999, 1.299999);
    TextDrawColor(TDClassChooserAssaulter[playerid], -1);
    TextDrawSetOutline(TDClassChooserAssaulter[playerid], 1);
    TextDrawSetProportional(TDClassChooserAssaulter[playerid], 1);

    TDClassChooserSupporter[playerid] = TextDrawCreate(56.000000, 188.000000, "Supporter");
    TextDrawBackgroundColor(TDClassChooserSupporter[playerid], 255);
    TextDrawFont(TDClassChooserSupporter[playerid], 2);
    TextDrawLetterSize(TDClassChooserSupporter[playerid], 0.239999, 1.299999);
    TextDrawColor(TDClassChooserSupporter[playerid], -1);
    TextDrawSetOutline(TDClassChooserSupporter[playerid], 1);
    TextDrawSetProportional(TDClassChooserSupporter[playerid], 1);

    TDClassChooserSniper[playerid] = TextDrawCreate(66.000000, 202.000000, "Sniper");
    TextDrawBackgroundColor(TDClassChooserSniper[playerid], 255);
    TextDrawFont(TDClassChooserSniper[playerid], 2);
    TextDrawLetterSize(TDClassChooserSniper[playerid], 0.239999, 1.299999);
    TextDrawColor(TDClassChooserSniper[playerid], -1);
    TextDrawSetOutline(TDClassChooserSniper[playerid], 1);
    TextDrawSetProportional(TDClassChooserSniper[playerid], 1);

    TDClassChooserCustom[playerid] = TextDrawCreate(65.000000, 218.000000, "Custom");
    TextDrawBackgroundColor(TDClassChooserCustom[playerid], 255);
    TextDrawFont(TDClassChooserCustom[playerid], 2);
    TextDrawLetterSize(TDClassChooserCustom[playerid], 0.239999, 1.299999);
    TextDrawColor(TDClassChooserCustom[playerid], -1);
    TextDrawSetOutline(TDClassChooserCustom[playerid], 1);
    TextDrawSetProportional(TDClassChooserCustom[playerid], 1);

    TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 175.000000, "~r~>         <");
    TextDrawBackgroundColor(TDClassChooserChoosen[playerid], 255);
    TextDrawFont(TDClassChooserChoosen[playerid], 1);
    TextDrawLetterSize(TDClassChooserChoosen[playerid], 0.500000, 1.000000);
    TextDrawColor(TDClassChooserChoosen[playerid], 9830550);
    TextDrawSetOutline(TDClassChooserChoosen[playerid], 1);
    TextDrawSetProportional(TDClassChooserChoosen[playerid], 1);

    TDGroupClassChooser[playerid] = CreateTDGroup(TDClassChooser,TDClassChooserBOX,TDClassChooserAssaulter[playerid],TDClassChooserSupporter[playerid],TDClassChooserSniper[playerid],TDClassChooserCustom[playerid],TDClassChooserChoosen[playerid],TD_HowToSpawn);

//From my include, TDGrouper, not necessary.
//If using add
//for(new i=0;i<MAX_GROUPS;++i) tdenum[i][count] = -1;
//In OnGameModeInIt
To add vehicles
pawn Code:
AddStaticVehicle(520,1650.1279,-965.3316,63.4298,328.6633,0,0); // Hydra_1
AddStaticVehicle(520,1657.9375,-965.7026,63.4109,13.6602,0,0); // hydra_2
Now that TextDraw's and vehicles are ready, we will need a variable to know if a player has a valid class or not. So we declare a Global variable for it.

pawn Code:
new type[MAX_PLAYERS];
//You may like to add this to your enum instead of making a new global variable
When Player Connects set type to -1.
Found that it may be more usefull when added under OnPlayerRequestClass also.
pawn Code:
public OnPlayerConnect(playerid)
{
    type[playerid] = -1;
}
We wish to skip player from OnPlayerRequestClass ,so we add
pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
     type[playerid] = -1;
    SetSpawnInfo(playerid,0,0,0,0,0,0,0,0,0,0,0,0);
    SpawnPlayer(playerid);
    return 1;
}
This code will simple spawn player as CJ, at (0,0,0) location and no weapons.

When PlayerSpawn, we will send him to our custom class screen,
pawn Code:
public OnPlayerSpawn(playerid)
{
    if(type[playerid]==-1)
    {
        SetPlayerVirtualWorld(playerid,playerid);//Puts player in a virtual world
        ShowCustomClass(playerid);//Stock we are just going to create
        return 0;
    }
//And all other code when he have a valid class
}
Before creating Stock for custom class, we add variables to store id of pickup(since we need to destroy them)
pawn Code:
new Class_pickup[MAX_PLAYERS][3];
pawn Code:
stock ShowCustomClass(playerid)
{
//Since, at starting layer has choosen assaulter as class, so we need to create pickup here.
//___PICKUP____
    Class_pickup[playerid][0] = CreatePickup(356,1,1654.3134,-955.5966,62.6696,playerid);
    Class_pickup[playerid][1] = CreatePickup(348,1,1656.3134,-955.5966,62.6696,playerid);
    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);
    //__TextDraw__
    TDGroupShowForPlayer(playerid,TDGroupClassChooser[playerid]);//Replace by TextDrawShowForPlayer if not using the include.
    //__PLATYER AND CAMERA__

    TogglePlayerControllable(playerid,false);
    SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,1652.3134,-955.5966,62.6696);
    SetPlayerFacingAngle(playerid,355.7387);
    SetPlayerCameraPos(playerid,1655.4005,-950.2772,62.5974);
    SetPlayerCameraLookAt(playerid,1654.3134,-961.5966,62.6696);
    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
    SetPlayerSkin(playerid,287);
    SetPVarInt(playerid,"AT",0);
}
Mostly all are self explanatory.I used SetPVarInt to create a player variable which tells us the current choosen class by player, which by default is Assaulter (0).

Now, when a player presses shift, space or enter OnPlayerKeyStateChange is called.
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
}
Add
pawn Code:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
to top
To know about this code : https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

We must need to ensure that player does not have a valid class
pawn Code:
if(type[playerid]==-1) //This will ensure it.
{
        new at = GetPVarInt(playerid,"AT");
        new bool:create = false;//Should compiler create new pickup?
//To ensure new pickup's are created only when SHIFT or SPACE is Pressed

        if(PRESSED(KEY_SPRINT))//space
        {
            create = true;
            for(new i=0;i<3;++i) DestroyPickup(Class_pickup[playerid][i]);//Destroy current pickup.
            if(at==3) at=-1;//if layer is at bottom and he pressed space, take him to top.
            ++at;
        }
        else if(PRESSED(KEY_JUMP))//shift
        {
            create = true;
            for(new i=0;i<3;++i) DestroyPickup(Class_pickup[playerid][i]);
            if(at==0) at=4;
            --at;
        }
        else if(PRESSED(KEY_SECONDARY_ATTACK))//enter
        {
            type[playerid] = at;//0=Assaulter,1==Supported,2=Sniper,3=Custom
            new str[50];
            switch(at)
            {
                case 0:
                {
                    format(str,sizeof(str),"You spawned as Assaulter");
                    SetSpawnInfo(...);      //To give weapons, spawn info
                }
                case 1:
                {
                    format(str,sizeof(str),"You spawned as Supporter");
                    SetSpawnInfo(...);
                }
                case 2:
                {
                    format(str,sizeof(str),"You spawned as Sniper");
                    SetSpawnInfo(...);
                }
                case 4:
                {
                    format(str,sizeof(str),"You spawned as Custom Class");
                    SetSpawnInfo(...);
                }

            }
                          TDGroupHideForPlayer(playerid,TDGroupClassChooser[playerid]); //Hide textDraws
            SCM(playerid,-1,str);
            TogglePlayerControllable(playerid,true);
            ClearAnimations(playerid,1);
            SpawnPlayer(playerid);
            return 1;
        }
To change player skin according to the place player is at
pawn Code:
switch(at)
        {
            case 0:
            {
                TextDrawSetString(TDClassChooserAssaulter[playerid],"~g~Assaulter");//Assaulter is green , rest white
                TextDrawSetString(TDClassChooserSupporter[playerid],"~w~Supporter");
                TextDrawSetString(TDClassChooserSniper[playerid],"~w~Sniper");
                TextDrawSetString(TDClassChooserCustom[playerid],"~w~Custom");
                TextDrawDestroy(TDClassChooserChoosen[playerid]);

                TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 174.000000, "~g~>         <");//Change location.

                if (create == true)
                {
                    Class_pickup[playerid][0] = CreatePickup(356,1,1654.3134,-955.5966,62.6696,playerid);//M4 ASSAULT RIFLE
                    Class_pickup[playerid][1] = CreatePickup(348,1,1656.3134,-955.5966,62.6696,playerid);//Desert EAGLE
                    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);//Grenade
                }
                SetPlayerSkin(playerid,287);


            }
            case 1:
            {
                TextDrawSetString(TDClassChooserSupporter[playerid],"~g~Supporter");//Supprter is green , rest white
                TextDrawSetString(TDClassChooserAssaulter[playerid],"~w~Assaulter");
                TextDrawSetString(TDClassChooserSniper[playerid],"~w~Sniper");
                TextDrawSetString(TDClassChooserCustom[playerid],"~w~Custom");
                TextDrawDestroy(TDClassChooserChoosen[playerid]);

                TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 188.000000, "~g~>         <");
                if (create == true)
                {
                    Class_pickup[playerid][0] = CreatePickup(351,1,1654.3134,-955.5966,62.6696,playerid);//Combat Shotgun
                    Class_pickup[playerid][1] = CreatePickup(359,1,1656.3134,-955.5966,62.6696,playerid);//Rocket Launcher
                    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);//Grenade
                }
                SetPlayerSkin(playerid,282);

            }
            case 2:
            {
                TextDrawSetString(TDClassChooserSniper[playerid],"~g~Sniper");//Sniper is green , rest white
                TextDrawSetString(TDClassChooserAssaulter[playerid],"~w~Assaulter");
                TextDrawSetString(TDClassChooserSupporter[playerid],"~w~Supporter");
                TextDrawSetString(TDClassChooserCustom[playerid],"~w~Custom");
                TextDrawDestroy(TDClassChooserChoosen[playerid]);


                TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 202.000000, "~g~>         <");
                if (create == true)
                {
                    Class_pickup[playerid][0] = CreatePickup(358,1,1654.3134,-955.5966,62.6696,playerid);//Sniper
                    Class_pickup[playerid][1] = CreatePickup(353,1,1656.3134,-955.5966,62.6696,playerid);//MP5
                    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);//Grenade
                }
                SetPlayerSkin(playerid,285);
            }
            case 3:
            {
                TextDrawSetString(TDClassChooserCustom[playerid],"~g~Custom");//Custom is green , rest white
                TextDrawSetString(TDClassChooserAssaulter[playerid],"~w~Assaulter");
                TextDrawSetString(TDClassChooserSupporter[playerid],"~w~Supporter");
                TextDrawSetString(TDClassChooserSniper[playerid],"~w~Sniper");
                TextDrawDestroy(TDClassChooserChoosen[playerid]);


                TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 218.000000, "~g~>         <");
                if (create == true)
                {
                    Class_pickup[playerid][0] = CreatePickup(358,1,1654.3134,-955.5966,62.6696,playerid);
                    Class_pickup[playerid][1] = CreatePickup(353,1,1656.3134,-955.5966,62.6696,playerid);
                    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);//Grenade
                }
                SetPlayerSkin(playerid,163);
            }
        }
And to update Textdraw's and location
pawn Code:
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
        TextDrawBackgroundColor(TDClassChooserChoosen[playerid], 255);
        TextDrawFont(TDClassChooserChoosen[playerid], 1);
        TextDrawLetterSize(TDClassChooserChoosen[playerid], 0.500000, 1.000000);
        TextDrawColor(TDClassChooserChoosen[playerid], 9830550);
        TextDrawSetOutline(TDClassChooserChoosen[playerid], 1);
        TextDrawSetProportional(TDClassChooserChoosen[playerid], 1);
        TextDrawShowForPlayer(playerid,TDClassChooserChoosen[playerid]);
        SetPVarInt(playerid,"AT",at);
So, your full OnPlayerKeyStateChange may look like
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(type[playerid]==-1)
    {
        new at = GetPVarInt(playerid,"AT");
        new bool:create = false;

        if(PRESSED(KEY_SPRINT))
        {
            create = true;
            for(new i=0;i<3;++i) DestroyPickup(Class_pickup[playerid][i]);
            if(at==3) at=-1;
            ++at;
        }
        else if(PRESSED(KEY_JUMP))
        {
            create = true;
            for(new i=0;i<3;++i) DestroyPickup(Class_pickup[playerid][i]);
            if(at==0) at=4;
            --at;
        }
        else if(PRESSED(KEY_SECONDARY_ATTACK))
        {
            type[playerid] = at + 1;
            new str[50];
            switch(at)
            {
                case 0:
                {
                    format(str,sizeof(str),"You spawned as Assaulter");
                    SetSpawnInfo(...);
                }
                case 1:
                {
                    format(str,sizeof(str),"You spawned as Supporter");
                    SetSpawnInfo(...);
                }
                case 2:
                {
                    format(str,sizeof(str),"You spawned as Sniper");
                    SetSpawnInfo(...);
                }
                case 4:
                {
                    format(str,sizeof(str),"You spawned as Custom Class");
                    SetSpawnInfo(...);
                }

            }
                         TDGroupHideForPlayer(playerid,TDGroupClassChooser[playerid]);//Hide textdraws
            SCM(playerid,-1,str);
            TogglePlayerControllable(playerid,true);
            ClearAnimations(playerid,1);
            SpawnPlayer(playerid);
            return 1;
        }
        switch(at)
        {
            case 0:
            {
                TextDrawSetString(TDClassChooserAssaulter[playerid],"~g~Assaulter");//Assaulter is green , rest white
                TextDrawSetString(TDClassChooserSupporter[playerid],"~w~Supporter");
                TextDrawSetString(TDClassChooserSniper[playerid],"~w~Sniper");
                TextDrawSetString(TDClassChooserCustom[playerid],"~w~Custom");
                TextDrawDestroy(TDClassChooserChoosen[playerid]);

                TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 174.000000, "~g~>         <");//Change location.

                if (create == true)
                {
                    Class_pickup[playerid][0] = CreatePickup(356,1,1654.3134,-955.5966,62.6696,playerid);//M4 ASSAULT RIFLE
                    Class_pickup[playerid][1] = CreatePickup(348,1,1656.3134,-955.5966,62.6696,playerid);//Desert EAGLE
                    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);//Grenade
                }
                SetPlayerSkin(playerid,287);


            }
            case 1:
            {
                TextDrawSetString(TDClassChooserSupporter[playerid],"~g~Supporter");//Supprter is green , rest white
                TextDrawSetString(TDClassChooserAssaulter[playerid],"~w~Assaulter");
                TextDrawSetString(TDClassChooserSniper[playerid],"~w~Sniper");
                TextDrawSetString(TDClassChooserCustom[playerid],"~w~Custom");
                TextDrawDestroy(TDClassChooserChoosen[playerid]);

                TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 188.000000, "~g~>         <");
                if (create == true)
                {
                    Class_pickup[playerid][0] = CreatePickup(351,1,1654.3134,-955.5966,62.6696,playerid);//Combat Shotgun
                    Class_pickup[playerid][1] = CreatePickup(359,1,1656.3134,-955.5966,62.6696,playerid);//Rocket Launcher
                    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);//Grenade
                }
                SetPlayerSkin(playerid,282);

            }
            case 2:
            {
                TextDrawSetString(TDClassChooserSniper[playerid],"~g~Sniper");//Sniper is green , rest white
                TextDrawSetString(TDClassChooserAssaulter[playerid],"~w~Assaulter");
                TextDrawSetString(TDClassChooserSupporter[playerid],"~w~Supporter");
                TextDrawSetString(TDClassChooserCustom[playerid],"~w~Custom");
                TextDrawDestroy(TDClassChooserChoosen[playerid]);


                TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 202.000000, "~g~>         <");
                if (create == true)
                {
                    Class_pickup[playerid][0] = CreatePickup(358,1,1654.3134,-955.5966,62.6696,playerid);//Sniper
                    Class_pickup[playerid][1] = CreatePickup(353,1,1656.3134,-955.5966,62.6696,playerid);//MP5
                    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);//Grenade
                }
                SetPlayerSkin(playerid,285);
            }
            case 3:
            {
                TextDrawSetString(TDClassChooserCustom[playerid],"~g~Custom");//Custom is green , rest white
                TextDrawSetString(TDClassChooserAssaulter[playerid],"~w~Assaulter");
                TextDrawSetString(TDClassChooserSupporter[playerid],"~w~Supporter");
                TextDrawSetString(TDClassChooserSniper[playerid],"~w~Sniper");
                TextDrawDestroy(TDClassChooserChoosen[playerid]);


                TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 218.000000, "~g~>         <");
                if (create == true)
                {
                    Class_pickup[playerid][0] = CreatePickup(358,1,1654.3134,-955.5966,62.6696,playerid);
                    Class_pickup[playerid][1] = CreatePickup(353,1,1656.3134,-955.5966,62.6696,playerid);
                    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);//Grenade
                }
                SetPlayerSkin(playerid,163);
            }
        }
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
        TextDrawBackgroundColor(TDClassChooserChoosen[playerid], 255);
        TextDrawFont(TDClassChooserChoosen[playerid], 1);
        TextDrawLetterSize(TDClassChooserChoosen[playerid], 0.500000, 1.000000);
        TextDrawColor(TDClassChooserChoosen[playerid], 9830550);
        TextDrawSetOutline(TDClassChooserChoosen[playerid], 1);
        TextDrawSetProportional(TDClassChooserChoosen[playerid], 1);
        TextDrawShowForPlayer(playerid,TDClassChooserChoosen[playerid]);
        SetPVarInt(playerid,"AT",at);
        return 1;
    }
    return 1;
}

And your full code should look like this
pawn Code:
#include <a_samp>
#include <TDgroup>

new Text:TDClassChooser; //When Player Chooses class [HEADING]
new Text:TDClassChooserBOX; //Box for it
new Text:TDClassChooserAssaulter[MAX_PLAYERS]; //Assaulter Selected
new Text:TDClassChooserSupporter[MAX_PLAYERS];
new Text:TDClassChooserSniper[MAX_PLAYERS];
new Text:TDClassChooserCustom[MAX_PLAYERS];
new Text:TDClassChooserChoosen[MAX_PLAYERS]; //The >  < in class chossing
new Text:TD_HowToSpawn; //Press shift to go up and space to down....
new TDGroupClassChooser[MAX_PLAYERS];
new type[MAX_PLAYERS];
new Class_pickup[MAX_PLAYERS][3];

#define SCM SendClientMessage

#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnGameModeInit()
{
    for(new i=0;i<MAX_GROUPS;++i) tdenum[i][count] = -1;

    TDClassChooser = TextDrawCreate(91.000000, 149.000000, "~g~Class ~r~Chooser");
    TextDrawAlignment(TDClassChooser, 2);
    TextDrawBackgroundColor(TDClassChooser, 255);
    TextDrawFont(TDClassChooser, 2);
    TextDrawLetterSize(TDClassChooser, 0.270000, 2.000000);
    TextDrawColor(TDClassChooser, -16776961);
    TextDrawSetOutline(TDClassChooser, 1);
    TextDrawSetProportional(TDClassChooser, 1);
    TextDrawUseBox(TDClassChooser, 1);
    TextDrawBoxColor(TDClassChooser, 255);
    TextDrawTextSize(TDClassChooser, 179.000000, 121.000000);

    TDClassChooserBOX = TextDrawCreate(32.000000, 173.000000, "~n~~n~~n~~n~~n~~n~~n~");
    TextDrawBackgroundColor(TDClassChooserBOX, 255);
    TextDrawFont(TDClassChooserBOX, 1);
    TextDrawLetterSize(TDClassChooserBOX, 0.500000, 1.000000);
    TextDrawColor(TDClassChooserBOX, -1);
    TextDrawSetOutline(TDClassChooserBOX, 0);
    TextDrawSetProportional(TDClassChooserBOX, 1);
    TextDrawSetShadow(TDClassChooserBOX, 1);
    TextDrawUseBox(TDClassChooserBOX, 1);
    TextDrawBoxColor(TDClassChooserBOX, 125);
    TextDrawTextSize(TDClassChooserBOX, 150.000000, 109.000000);
   
    TD_HowToSpawn                   =TextDrawCreate( 66.000000, 293.000000, "Press ~g~SHIFT ~w~ to go ~g~UP~n~~r~SPACE~w~ to go ~r~DOWN~n~~b~ENTER TO SPAWN");
    TextDrawAlignment           ( TD_HowToSpawn, 2);
    TextDrawBackgroundColor ( TD_HowToSpawn, 255);
    TextDrawFont                ( TD_HowToSpawn, 1);
    TextDrawLetterSize      ( TD_HowToSpawn, 0.300000, 1.300000);
    TextDrawColor               ( TD_HowToSpawn, -1);
    TextDrawSetOutline      ( TD_HowToSpawn, 1);
    TextDrawSetProportional ( TD_HowToSpawn, 1);
   
    AddStaticVehicle(520,1650.1279,-965.3316,63.4298,328.6633,0,0); // Hydra_1
    AddStaticVehicle(520,1657.9375,-965.7026,63.4109,13.6602,0,0); // hydra_2
}
public OnPlayerConnect(playerid)
{
    type[playerid] = -1;
     TDClassChooserAssaulter[playerid] = TextDrawCreate(55.000000, 174.000000, "~g~Assaulter");
    TextDrawBackgroundColor(TDClassChooserAssaulter[playerid], 255);
    TextDrawFont(TDClassChooserAssaulter[playerid], 2);
    TextDrawLetterSize(TDClassChooserAssaulter[playerid], 0.239999, 1.299999);
    TextDrawColor(TDClassChooserAssaulter[playerid], -1);
    TextDrawSetOutline(TDClassChooserAssaulter[playerid], 1);
    TextDrawSetProportional(TDClassChooserAssaulter[playerid], 1);

    TDClassChooserSupporter[playerid] = TextDrawCreate(56.000000, 188.000000, "Supporter");
    TextDrawBackgroundColor(TDClassChooserSupporter[playerid], 255);
    TextDrawFont(TDClassChooserSupporter[playerid], 2);
    TextDrawLetterSize(TDClassChooserSupporter[playerid], 0.239999, 1.299999);
    TextDrawColor(TDClassChooserSupporter[playerid], -1);
    TextDrawSetOutline(TDClassChooserSupporter[playerid], 1);
    TextDrawSetProportional(TDClassChooserSupporter[playerid], 1);

    TDClassChooserSniper[playerid] = TextDrawCreate(66.000000, 202.000000, "Sniper");
    TextDrawBackgroundColor(TDClassChooserSniper[playerid], 255);
    TextDrawFont(TDClassChooserSniper[playerid], 2);
    TextDrawLetterSize(TDClassChooserSniper[playerid], 0.239999, 1.299999);
    TextDrawColor(TDClassChooserSniper[playerid], -1);
    TextDrawSetOutline(TDClassChooserSniper[playerid], 1);
    TextDrawSetProportional(TDClassChooserSniper[playerid], 1);

    TDClassChooserCustom[playerid] = TextDrawCreate(65.000000, 218.000000, "Custom");
    TextDrawBackgroundColor(TDClassChooserCustom[playerid], 255);
    TextDrawFont(TDClassChooserCustom[playerid], 2);
    TextDrawLetterSize(TDClassChooserCustom[playerid], 0.239999, 1.299999);
    TextDrawColor(TDClassChooserCustom[playerid], -1);
    TextDrawSetOutline(TDClassChooserCustom[playerid], 1);
    TextDrawSetProportional(TDClassChooserCustom[playerid], 1);

    TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 175.000000, "~r~>         <");
    TextDrawBackgroundColor(TDClassChooserChoosen[playerid], 255);
    TextDrawFont(TDClassChooserChoosen[playerid], 1);
    TextDrawLetterSize(TDClassChooserChoosen[playerid], 0.500000, 1.000000);
    TextDrawColor(TDClassChooserChoosen[playerid], 9830550);
    TextDrawSetOutline(TDClassChooserChoosen[playerid], 1);
    TextDrawSetProportional(TDClassChooserChoosen[playerid], 1);
   
    TDGroupClassChooser[playerid] = CreateTDGroup(TDClassChooser,TDClassChooserBOX,TDClassChooserAssaulter[playerid],TDClassChooserSupporter[playerid],TDClassChooserSniper[playerid],TDClassChooserCustom[playerid],TDClassChooserChoosen[playerid],TD_HowToSpawn);


}

public OnPlayerRequestClass(playerid, classid)
{
    SetSpawnInfo(playerid,0,0,0,0,0,0,0,0,0,0,0,0);
    SpawnPlayer(playerid);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(type[playerid]==-1)
    {
        SetPlayerVirtualWorld(playerid,playerid);//Puts player in a virtual world
        ShowCustomClass(playerid);//Stock we are just going to create
        return 0;
    }
    SCM(playerid,-1,"I spawned");
    return 1;
//And all other code when he have a valid class
}
stock ShowCustomClass(playerid)
{
//Since, at starting layer has choosen assaulter as class, so we need to create pickup here.
//___PICKUP____
    Class_pickup[playerid][0] = CreatePickup(356,1,1654.3134,-955.5966,62.6696,playerid);
    Class_pickup[playerid][1] = CreatePickup(348,1,1656.3134,-955.5966,62.6696,playerid);
    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);
    //__TextDraw__
    TDGroupShowForPlayer(playerid,TDGroupClassChooser[playerid]);//Replace by TextDrawShowForPlayer if not using the include.
    //__PLATYER AND CAMERA__

    TogglePlayerControllable(playerid,false);
    SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,1652.3134,-955.5966,62.6696);
    SetPlayerFacingAngle(playerid,355.7387);
    SetPlayerCameraPos(playerid,1655.4005,-950.2772,62.5974);
    SetPlayerCameraLookAt(playerid,1654.3134,-961.5966,62.6696);
    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
    SetPlayerSkin(playerid,287);

    SetPVarInt(playerid,"AT",0);
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(type[playerid]==-1)
    {
        new at = GetPVarInt(playerid,"AT");
        new bool:create = false;

        if(PRESSED(KEY_SPRINT))
        {
            create = true;
            for(new i=0;i<3;++i) DestroyPickup(Class_pickup[playerid][i]);
            if(at==3) at=-1;
            ++at;
        }
        else if(PRESSED(KEY_JUMP))
        {
            create = true;
            for(new i=0;i<3;++i) DestroyPickup(Class_pickup[playerid][i]);
            if(at==0) at=4;
            --at;
        }
        else if(PRESSED(KEY_SECONDARY_ATTACK))
        {
            type[playerid] = at + 1;
            new str[50];
            switch(at)
            {
                case 0:
                {
                    format(str,sizeof(str),"You spawned as Assaulter");
                    SetSpawnInfo(playerid,0,GetPlayerSkin(playerid),1958,95,0,0,1,6,27,300,32,010);
                }
                case 1:
                {
                    format(str,sizeof(str),"You spawned as Supporter");

                }
                case 2:
                {
                    format(str,sizeof(str),"You spawned as Sniper");

                }
                case 4:
                {
                    format(str,sizeof(str),"You spawned as Custom Class");

                }

            }
            TDGroupHideForPlayer(playerid,TDGroupClassChooser[playerid]);
            SCM(playerid,-1,str);
            TogglePlayerControllable(playerid,true);
            ClearAnimations(playerid,1);
            SpawnPlayer(playerid);
            return 1;
        }
        switch(at)
        {
            case 0:
            {
                TextDrawSetString(TDClassChooserAssaulter[playerid],"~g~Assaulter");//Assaulter is green , rest white
                TextDrawSetString(TDClassChooserSupporter[playerid],"~w~Supporter");
                TextDrawSetString(TDClassChooserSniper[playerid],"~w~Sniper");
                TextDrawSetString(TDClassChooserCustom[playerid],"~w~Custom");
                TextDrawDestroy(TDClassChooserChoosen[playerid]);

                TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 174.000000, "~g~>         <");//Change location.

                if (create == true)
                {
                    Class_pickup[playerid][0] = CreatePickup(356,1,1654.3134,-955.5966,62.6696,playerid);//M4 ASSAULT RIFLE
                    Class_pickup[playerid][1] = CreatePickup(348,1,1656.3134,-955.5966,62.6696,playerid);//Desert EAGLE
                    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);//Grenade
                }
                SetPlayerSkin(playerid,287);


            }
            case 1:
            {
                TextDrawSetString(TDClassChooserSupporter[playerid],"~g~Supporter");//Supprter is green , rest white
                TextDrawSetString(TDClassChooserAssaulter[playerid],"~w~Assaulter");
                TextDrawSetString(TDClassChooserSniper[playerid],"~w~Sniper");
                TextDrawSetString(TDClassChooserCustom[playerid],"~w~Custom");
                TextDrawDestroy(TDClassChooserChoosen[playerid]);

                TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 188.000000, "~g~>         <");
                if (create == true)
                {
                    Class_pickup[playerid][0] = CreatePickup(351,1,1654.3134,-955.5966,62.6696,playerid);//Combat Shotgun
                    Class_pickup[playerid][1] = CreatePickup(359,1,1656.3134,-955.5966,62.6696,playerid);//Rocket Launcher
                    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);//Grenade
                }
                SetPlayerSkin(playerid,282);

            }
            case 2:
            {
                TextDrawSetString(TDClassChooserSniper[playerid],"~g~Sniper");//Sniper is green , rest white
                TextDrawSetString(TDClassChooserAssaulter[playerid],"~w~Assaulter");
                TextDrawSetString(TDClassChooserSupporter[playerid],"~w~Supporter");
                TextDrawSetString(TDClassChooserCustom[playerid],"~w~Custom");
                TextDrawDestroy(TDClassChooserChoosen[playerid]);


                TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 202.000000, "~g~>         <");
                if (create == true)
                {
                    Class_pickup[playerid][0] = CreatePickup(358,1,1654.3134,-955.5966,62.6696,playerid);//Sniper
                    Class_pickup[playerid][1] = CreatePickup(353,1,1656.3134,-955.5966,62.6696,playerid);//MP5
                    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);//Grenade
                }
                SetPlayerSkin(playerid,285);
            }
            case 3:
            {
                TextDrawSetString(TDClassChooserCustom[playerid],"~g~Custom");//Custom is green , rest white
                TextDrawSetString(TDClassChooserAssaulter[playerid],"~w~Assaulter");
                TextDrawSetString(TDClassChooserSupporter[playerid],"~w~Supporter");
                TextDrawSetString(TDClassChooserSniper[playerid],"~w~Sniper");
                TextDrawDestroy(TDClassChooserChoosen[playerid]);


                TDClassChooserChoosen[playerid] = TextDrawCreate(38.000000, 218.000000, "~g~>         <");
                if (create == true)
                {
                    Class_pickup[playerid][0] = CreatePickup(358,1,1654.3134,-955.5966,62.6696,playerid);
                    Class_pickup[playerid][1] = CreatePickup(353,1,1656.3134,-955.5966,62.6696,playerid);
                    Class_pickup[playerid][2] = CreatePickup(342,1,1658.3134,-955.5966,62.6696,playerid);//Grenade
                }
                SetPlayerSkin(playerid,163);
            }
        }
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
        TextDrawBackgroundColor(TDClassChooserChoosen[playerid], 255);
        TextDrawFont(TDClassChooserChoosen[playerid], 1);
        TextDrawLetterSize(TDClassChooserChoosen[playerid], 0.500000, 1.000000);
        TextDrawColor(TDClassChooserChoosen[playerid], 9830550);
        TextDrawSetOutline(TDClassChooserChoosen[playerid], 1);
        TextDrawSetProportional(TDClassChooserChoosen[playerid], 1);
        TextDrawShowForPlayer(playerid,TDClassChooserChoosen[playerid]);
        SetPVarInt(playerid,"AT",at);
        return 1;
    }
    return 1;
}
Reply
#2

wow man great tutorial and awesome script.Fuck yeah its really very very usefull.
Reply
#3

Awesome script..Thanks for sharing.
Reply
#4

Earlier I thought of using Arrow keys instead of Shift and Space, but since it required the use on OnPlayerUpdate, I moved to other keys.
In another version I used arrow keys, but in that one could choose Team as well as class (Left - Right swaps team || Up-Down swaps Class)
Reply
#5

Nice really cool! thanks
Reply
#6

Nice
Reply
#7

Now theres a better thing.
We can use clickable textdraws. But this is also good
Reply
#8

Good job.
Reply
#9

Nice copy and paste!
Seriously, though. This is more like a release than anything. I suggest you read this, especially the part about explanations.

Nice try, though. I'm sure if you spend some more time explaining, it will become a good tutorial.

P.s.
Code:
#define SCM SendClientMessage
Disgusting
Reply
#10

Great Tutorial well explained.
Reply
#11

Quote:
Originally Posted by [HK]Ryder[AN]
View Post
Now theres a better thing.
We can use clickable textdraws. But this is also good
I tried them earlier but somehow it always fails..So I sticked to keyboard keys only.
Reply
#12

That is soo pro tut
Rep
Reply
#13

Epic!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)