dialog listbox and input
#2

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new string[124];
    switch(dialogid)
    {
        case 1:
        {
            if(!response) return Kick(playerid);

            if(strlen(inputtext) < 6 || strlen(inputtext) > 32)
            {
                SendClientMessage(playerid, COL_GREY, "Please enter a password that is greater than 6 characters or less than 32 characters.");
                ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Welcome to "ServerName"", "Enter your desired password below to sucessfully register.", "Continue", "Cancel");
                return 1;
            }
            else
            {
                RegisterPlayer(playerid, inputtext);
                PlayerVar[playerid][Authenticated] = 1;
                format(PlayerVar[playerid][Name], MAX_PLAYER_NAME, GetPlayersNameWithUnderScore(playerid));
                format(PlayerVar[playerid][Password], 32, "%s", inputtext);
                format(PlayerVar[playerid][Accent], 32, "American");
                GetPlayerIp(playerid, PlayerVar[playerid][IP], 32);
            }
        }
        case 2:
        {
            if(!response) return Kick(playerid);

            format(string, sizeof(string), "PlayerAccounts/%s.ini", GetPlayersNameWithUnderScore(playerid));
            if(fexist(string))
            {
                if(!strcmp(PlayerVar[playerid][Password], inputtext , false))
                {
                    INI_ParseFile(string, "LoadPlayer_%s", .bExtra = true, .extra = playerid);
                    PlayerVar[playerid][Authenticated] = 1;
                    LoginPlayer(playerid);
                }
                else
                {
                    SendClientMessage(playerid, COL_GREY, "The password you entered does not match, please reconnect for another try.");
                    Kick(playerid);
                }
            }
        }
        case DIALOG_WEAPONS:
        {
            if(response) // If they clicked 'Select' or double-clicked a weapon
            {
                // Give them the weapon
                if(listitem == 0) // They selected the first item - Desert Eagle
                {
                    GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Give them a desert eagle
                }
                if(listitem == 1) // They selected the second item - AK-47
                {
                    GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47
                }
                if(listitem == 2) // They selected the third item - Desert Eagle
                {
                    GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Give them a Combat Shotgun
                }
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
dialog listbox and input - by NicholasA - 25.04.2013, 12:12
Re: dialog listbox and input - by Frede - 25.04.2013, 12:17
Re: dialog listbox and input - by NicholasA - 25.04.2013, 12:43
Re: dialog listbox and input - by Frede - 25.04.2013, 12:48
Re: dialog listbox and input - by NicholasA - 25.04.2013, 12:49
Re: dialog listbox and input - by Frede - 25.04.2013, 12:50
Re: dialog listbox and input - by NicholasA - 25.04.2013, 12:52
Re: dialog listbox and input - by Frede - 25.04.2013, 12:55
Re: dialog listbox and input - by NicholasA - 25.04.2013, 12:56
Re: dialog listbox and input - by Frede - 25.04.2013, 13:01

Forum Jump:


Users browsing this thread: 1 Guest(s)