SA-MP Forums Archive
team select - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: team select (/showthread.php?tid=250492)



team select - muhib777 - 23.04.2011

i have two teames

#define TEAM_Rangers 1
#define TEAM_Spetsnaz 2

i can make them switch teams in the game but how do i make it so they have to select a team at the start

can anyone set me a dialog menu at the start with those 2 teams so if they choose it they will stay in it permanently


Re: team select - muhib777 - 23.04.2011

please anyone i need it fast


Re: team select - CrazyBlob - 23.04.2011

learn to script and you can do this in 10minutes


Re: team select - Seven_of_Nine - 23.04.2011

*10 seconds


Re: team select - muhib777 - 23.04.2011

please ive managed to do other stuff this is the one major thing im stuck on and would be greatfull if anyone helped


Re: team select - Seven_of_Nine - 23.04.2011

Click me


Re: team select - xir - 23.04.2011

Here you go

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    SendClientMessage(playerid, -1, "You have choosen the Team Rangers");
                    gTeam[playerid] = 1; // You use gTeam?
                }
                case 1:
                {
                    SendClientMessage(playerid, -1, "You have choosen the Team Spetsnaz");
                    gTeam[playerid] = 2;
                }
            }
        }
        else if(!response) return SendClientMessage(playerid, -1, "You have to choose a team !") && ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST, "Choose a Team","Rangers\nSpetsnaz","Choose","Exit");
    }
    return 0;
}
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST, "Choose a Team","Rangers\nSpetsnaz","Choose","Exit");
    return 1;
}
Don't take the dialog under OnPlayerSpawn because then this dialog will pop up all the time when a player spawns, OnPlayerRequestSpawn is only used when they press "Spawn" buttom in class selection

Enjoy

EDIT: CrazyBlob & Seven_of_Nine stop being such dicks.. Help the guy out..


Re: team select - muhib777 - 23.04.2011

thanks alot xir you know what i meant

but how do i make it so when they click rangers this will happen

AddPlayerClass(0, 1958.33, 1343.12, 15.36, 269.15, 31, 500, 16, 150, 54, 599);
SetPlayerPos(playerid, 191.82862854004,2074.44140625,22.644439697266);

and for spetsnaz

AddPlayerClass(0, 1958.33, 1343.12, 15.36, 269.15, 31, 500, 16, 150, 54, 599);
SetPlayerPos(playerid, 403.69519042969,2535.6623535156,16.545700073242);


Re: team select - xir - 23.04.2011

You can simply do this

pawn Код:
case 0:
{
    SendClientMessage(playerid, -1, "You have choosen the Team Rangers");
    gTeam[playerid] = 1; // You use gTeam?
    SetPlayerSkin(playerid, 1); // Change 1 to the skin ID you want
    SetPlayerPos(playerid, x,y,z); // replace x,y,z with your coordinates
}