Duel command problem
#1

After the player selects the weapon in the dialog, the message string is not sent.
pawn Код:
CMD:duel (playerid, params[])
{
    new giveid;
    if (gIsDuelActive == 1) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"A duel is already active!");
    if (PlayerInfo[playerid][IsInDuel] == 1) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You are already in a duel!");
    if (sscanf(params, "u", giveid)) return SendClientMessage(playerid, -1, ""RED"USAGE: "WHITE"/duel [ID]");
    if (giveid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Invalid player ID!");
    if (PlayerInfo[giveid][NoDuelRequests] == 1) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"The player has duel requests disabled!");
    if (PlayerInfo[giveid][IsWaiting] == 1) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"The player is waiting for another duel!");
    ShowPlayerDialog(playerid, DIALOG_CHOOSE_WEAPON, DIALOG_STYLE_LIST, ""PREMIUM"Choose weapon for duel:", "• Desert Eagle\n• Sawn Off Shotgun\n• Combat Shotgun\n• Micro SMG/Uzi\n• M4\n• Shotgun", "Select", "Cancel");
    PlayerInfo[playerid][IsWaiting] = 1;
    PlayerInfo[playerid][DuelTargetID] = giveid;
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == DIALOG_CHOOSE_WEAPON)
    {
        if (!response) return 1;
        if (response)
        {
            switch (listitem)
            {
                case 0:
                {
                    gCurrentDuelWeaponID = 24;
                    format(str, sizeof(str), ""RED"[DUEL] "LIGHTBLUE"%s(%d) has challenged you for a duel with "PREMIUM"Desert Eagle"LIGHTBLUE"! (Use /accept or /deny)", GetName(playerid), playerid);
                    SendClientMessage(PlayerInfo[playerid][DuelTargetID], -1, str);
                    PlayerInfo[PlayerInfo[playerid][DuelTargetID]][IsWaiting] = 1;
                }
                case 1:
                {
                    gCurrentDuelWeaponID = 26;
                    format(str, sizeof(str), ""RED"[DUEL] "LIGHTBLUE"%s(%d) has challenged you for a duel with "PREMIUM"Sawn Off Shotgun"LIGHTBLUE"! (Use /accept or /deny)", GetName(playerid), playerid);
                    SendClientMessage(PlayerInfo[playerid][DuelTargetID], -1, str);
                    PlayerInfo[PlayerInfo[playerid][DuelTargetID]][IsWaiting] = 1;
                }
                case 2:
                {
                    gCurrentDuelWeaponID = 27;
                    format(str, sizeof(str), ""RED"[DUEL] "LIGHTBLUE"%s(%d) has challenged you for a duel with "PREMIUM"Combat Shotgun"LIGHTBLUE"! (Use /accept or /deny)", GetName(playerid), playerid);
                    SendClientMessage(PlayerInfo[playerid][DuelTargetID], -1, str);
                    PlayerInfo[PlayerInfo[playerid][DuelTargetID]][IsWaiting] = 1;
                }
                case 3:
                {
                    gCurrentDuelWeaponID = 28;
                    format(str, sizeof(str), ""RED"[DUEL] "LIGHTBLUE"%s(%d) has challenged you for a duel with "PREMIUM"Micro SMG/Uzi"LIGHTBLUE"! (Use /accept or /deny)", GetName(playerid), playerid);
                    SendClientMessage(PlayerInfo[playerid][DuelTargetID], -1, str);
                    PlayerInfo[PlayerInfo[playerid][DuelTargetID]][IsWaiting] = 1;
                }
                case 4:
                {
                    gCurrentDuelWeaponID = 31;
                    format(str, sizeof(str), ""RED"[DUEL] "LIGHTBLUE"%s(%d) has challenged you for a duel with "PREMIUM"M4"LIGHTBLUE"! (Use /accept or /deny)", GetName(playerid), playerid);
                    SendClientMessage(PlayerInfo[playerid][DuelTargetID], -1, str);
                    PlayerInfo[PlayerInfo[playerid][DuelTargetID]][IsWaiting] = 1;
                }
                case 5:
                {
                    gCurrentDuelWeaponID = 25;
                    format(str, sizeof(str), ""RED"[DUEL] "LIGHTBLUE"%s(%d) has challenged you for a duel with "PREMIUM"Shotgun"LIGHTBLUE"! (Use /accept or /deny)", GetName(playerid), playerid);
                    SendClientMessage(PlayerInfo[playerid][DuelTargetID], -1, str);
                    PlayerInfo[PlayerInfo[playerid][DuelTargetID]][IsWaiting] = 1;
                }
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
Duel command problem - by SyntaxQ - 24.05.2014, 04:21
Re: Duel command problem - by Stinged - 24.05.2014, 05:00
Re: Duel command problem - by SyntaxQ - 24.05.2014, 05:17
Re: Duel command problem - by JM_Millers - 24.05.2014, 05:26
Re: Duel command problem - by JM_Millers - 24.05.2014, 05:31
Re: Duel command problem - by JM_Millers - 24.05.2014, 05:43
Re: Duel command problem - by SyntaxQ - 24.05.2014, 05:55
Re: Duel command problem - by JM_Millers - 24.05.2014, 06:00
Re: Duel command problem - by JM_Millers - 24.05.2014, 06:03
Re: Duel command problem - by Threshold - 24.05.2014, 06:05

Forum Jump:


Users browsing this thread: 3 Guest(s)