Dialog don't work at all?
#1

pawn Код:
Dialog:BauleMain(playerid, response, listitem, inputtext[])
{
    new vID, WeaponID, WeaponName[50], str[256], arma, ammo;
    WeaponID = GetWeaponIDFromName(WeaponName);
    arma = GetPlayerWeapon(playerid);
    ammo = GetPlayerAmmo(playerid);
    vID = GetNearestVehicle(playerid, 25.0);
    if(!response){ TogVehicleTrunkState(vID); }
    if(response)
    {
        switch(listitem)
        {
            case 0:
            {
            if(Vehicles[vID][Weapon1] != 0)
            {
            TogVehicleTrunkState(vID);
            GivePlayerGun(playerid, Vehicles[vID][Weapon1], Vehicles[vID][Ammo1]);
            format(str, sizeof(str), "Hai preso una %s (Ammo: %d)",  WeaponNameList[WeaponID], Vehicles[vID][Ammo1]);
            SendInfoMessage(playerid, str);
            Vehicles[vID][Weapon1] = 0;
            Vehicles[vID][Ammo1] = 0;
            format(str, sizeof(str), "* %s prende qualcosa dal baule.", GetRoleplayName(playerid));
            SendLocalMessage(playerid, str, Range_Normal, COLOR_RP, COLOR_RP);
            }
            else if(Vehicles[vID][Weapon1] == 0)
            {
            TogVehicleTrunkState(vID);
            if(arma == 0) return SendErrorMessage(playerid, "Non hai nessun'arma in mano.");
            Vehicles[vID][Weapon1] = arma;
            Vehicles[vID][Ammo1] = ammo;
            ResetWeapon(playerid, arma);
            format(str, sizeof(str), "* %s mette qualcosa nel baule.", GetRoleplayName(playerid));
            SendLocalMessage(playerid, str, Range_Normal, COLOR_RP, COLOR_RP);
            }
            }
            case 1:
            {
            if(Vehicles[vID][Weapon2] != 0)
            {
            TogVehicleTrunkState(vID);
            GivePlayerGun(playerid, Vehicles[vID][Weapon2], Vehicles[vID][Ammo2]);
            format(str, sizeof(str), "Hai preso una %s (Ammo: %d)",  WeaponNameList[WeaponID], Vehicles[vID][Ammo2]);
            SendInfoMessage(playerid, str);
            Vehicles[vID][Weapon2] = 0;
            Vehicles[vID][Ammo2] = 0;
            format(str, sizeof(str), "* %s prende qualcosa dal baule.", GetRoleplayName(playerid));
            SendLocalMessage(playerid, str, Range_Normal, COLOR_RP, COLOR_RP);
            }
            else if(Vehicles[vID][Weapon2] == 0)
            {
            TogVehicleTrunkState(vID);
            if(arma == 0) return SendErrorMessage(playerid, "Non hai nessun'arma in mano.");
            Vehicles[vID][Weapon2] = arma;
            Vehicles[vID][Ammo2] = ammo;
            ResetWeapon(playerid, arma);
            format(str, sizeof(str), "* %s mette qualcosa nel baule.", GetRoleplayName(playerid));
            SendLocalMessage(playerid, str, Range_Normal, COLOR_RP, COLOR_RP);
            }
            }
            case 2:
            {
            if(Vehicles[vID][Weapon3] != 0)
            {
            TogVehicleTrunkState(vID);
            GivePlayerGun(playerid, Vehicles[vID][Weapon3], Vehicles[vID][Ammo3]);
            format(str, sizeof(str), "Hai preso una %s (Ammo: %d)",  WeaponNameList[WeaponID], Vehicles[vID][Ammo3]);
            SendInfoMessage(playerid, str);
            Vehicles[vID][Weapon3] = 0;
            Vehicles[vID][Ammo3] = 0;
            format(str, sizeof(str), "* %s prende qualcosa dal baule.", GetRoleplayName(playerid));
            SendLocalMessage(playerid, str, Range_Normal, COLOR_RP, COLOR_RP);
            }
            else if(Vehicles[vID][Weapon3] == 0)
            {
            TogVehicleTrunkState(vID);
            if(arma == 0) return SendErrorMessage(playerid, "Non hai nessun'arma in mano.");
            Vehicles[vID][Weapon3] = arma;
            Vehicles[vID][Ammo3] = ammo;
            ResetWeapon(playerid, arma);
            format(str, sizeof(str), "* %s mette qualcosa nel baule.", GetRoleplayName(playerid));
            SendLocalMessage(playerid, str, Range_Normal, COLOR_RP, COLOR_RP);
            }
            }
        }
    }
    return 1;
}
I don't know why when this dialog is called nothing happens.
The dialog obv show from the command, but when you press something nothing happens.
I use EasyDialog, every other dialog works.
Reply
#2

Debug it. Print inside each case and check if it gets called when you click a listitem.
Reply
#3

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Debug it. Print inside each case and check if it gets called when you click a listitem.
Done that, no listitem is called when I press something in the dialog, even if it's out of the if(Vehicles[vid][Weapon#]

May be this the problem?
pawn Код:
format(str, sizeof(str), "%s - %d munizioni\n%s - %d munizioni\n%s - %d munizioni", WeaponNameList[Vehicles[vID][Weapon1]], Vehicles[vID][Ammo1], WeaponNameList[Vehicles[vID][Weapon2]], Vehicles[vID][Ammo2], WeaponNameList[Vehicles[vID][Weapon2]], Vehicles[vID][Ammo2]);
    Dialog_Show(playerid, BauleMain, DIALOG_STYLE_LIST, "Lista contenuto baule", str, "Preleva/Deposita", "Chiudi");
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)