Dialog Help (Spawning - Class)
#1

This is what i need help with and what i need the server to do: When the player starts up the server, I need a dialog, showing the "Class" that the person want's to spawn as, once the person picks what they wanna spawn as, then another dialog appears showing where they wish to spawn! I already have all the codes, it's just i need to order them correctly and code it properly so this works, thanks you can work with these if you wish so thanks again!;0 working on call of duty TDM.


I need to show these in a Dialog (My Teams - Spawning)
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    gPlayerClass[playerid] = ASSAULT_CLASS;

   
    SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
    SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
    SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
    SetPlayerFacingAngle(playerid, 270 );
    ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); //smooth dancing
    CreateExplosion(212.9525,1822.9084,6.4141, 11, 10.0);

    // TEAM STUFF
    if(classid == TEAM_GERMANY) {
        SetPlayerSkin(playerid, 179);
        GameTextForPlayer(playerid,"~g~GERMANY",1000,4);
        SetPlayerColor(playerid, TEAM_GERMANY_COLOR);
        gTeam[playerid] = TEAM_GERMANY;
    }
    if(classid == TEAM_IRAQ) {
        SetPlayerSkin(playerid, 128);
        GameTextForPlayer(playerid,"~p~Taliban Cell",1000,4);
        SetPlayerColor(playerid, TEAM_IRAQ_COLOR);
        gTeam[playerid] = TEAM_IRAQ;
    }
    if(classid == TEAM_RUSSIA) {
        SetPlayerSkin(playerid, 206);
        GameTextForPlayer(playerid,"~r~Soviet Union",1000,4);
        SetPlayerColor(playerid, TEAM_RUSSIA_COLOR);
        gTeam[playerid] = TEAM_RUSSIA;
    }
    if(classid == TEAM_USA) {
        SetPlayerSkin(playerid, 287);
        GameTextForPlayer(playerid,"~b~United States of America",1000,4);
        SetPlayerColor(playerid, TEAM_USA_COLOR);
        gTeam[playerid] = TEAM_USA;
    }
    if(classid == TEAM_BANGLADESH) {
        SetPlayerSkin(playerid, 285);
        GameTextForPlayer(playerid,"~p~European Alliance",1000,4);
        SetPlayerColor(playerid, TEAM_BANGLADESH_COLOR);
        gTeam[playerid] = TEAM_BANGLADESH;
    }
    return 1;
}



This one is in a dialog already, I need it to show first. This is my (Class Selection) Basically just giving weapons nothing special.

pawn Код:
//============================Dialog System===================================//
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 60)
            {
                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

{
                            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);


                    }
                        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;
        }

And this is the dialog appearing at request spawn. Now, how do I make all this code do this: Person starts up server, first it asks what class you wanna use, and then another dialog shows up telling you where you wanna spawn. How would i do this? I will be releasing my TDM script soon.
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    ShowPlayerDialog(playerid, 60, DIALOG_STYLE_LIST, "Choose a Class", "Assault\nSniper\nPilot\nEngineer\nPyroman", "Choose","");
    return 1;
}
Reply
#2

I have tried to put the dialog, at the OnPlayerSpawn function.
but I have't tried to put that at
OnPlayerConnect
Reply
#3

OnPlayerSpawn would be kinda messed. The player would need to spawn first and then request where they want to spawn and the class they wanna use lol... OnPlayerRequest Class may won't work at all, since you would just be reopening the dialog each time u click spawn. I just need to code all put in order and the first one converted into a dialog.. thanks tho
Reply
#4

PHP код:
public OnPlayerConnect(playerid)
{
   
ShowPlayerDialog(playerid60DIALOG_STYLE_LIST"Choose a Class""Assault\nSniper\nPilot\nEngineer\nPyroman""Choose","");
}
return 
1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)