Dialog
#1

The problem is when I want to put something in trunk it says this: "Empty Slot (0)" How can I remove that (0) so it will write only empty slot? If weapon is there there will be a number with ammo for example (7..

pawn Код:
if(listitem == 1) // Put in trunk
            {
                for(new i; i<MAX_VEHICLES; i++)
                {
                    new vehicleid = GetClosestVehicle(playerid);
                    new Float: vx, Float:vy, Float:vz;
                    new e, l, a, d, b, bo, o;
                    GetVehicleParamsEx(i,e,l,a,d,b,bo,o);
                    GetVehiclePos(i,vx,vy,vz);
                    GetXYBehindCar(i, vx, vy, 2.5);
                    if(IsPlayerInRangeOfPoint(playerid,2.5,vx,vy,vz))
                    {
                        if(bo > 0)
                        {
                            new tstr[255];
                            format(tstr, sizeof(tstr), "Slot 1 - %s (%d)\nSlot 2 - %s (%d)\nSlot 3 - %s (%d)\nSlot 4 - %s (%d)\nSlot 5 - %s (%d)", GetGunName(iTrunk[vehicleid][tWeapon1]),iTrunk[vehicleid][tAmmo1], GetGunName(iTrunk[vehicleid][tWeapon2]),iTrunk[vehicleid][tAmmo2], GetGunName(iTrunk[vehicleid][tWeapon3]),iTrunk[vehicleid][tAmmo3], GetGunName(iTrunk[vehicleid][tWeapon4]),iTrunk[vehicleid][tAmmo4],GetGunName(iTrunk[vehicleid][tWeapon5]),iTrunk[vehicleid][tAmmo5]);
                            ShowPlayerDialog(playerid, DIALOG_PUT, DIALOG_STYLE_LIST, "Store a weapon", tstr, "Select", "Cancel");
                            return 1;
                        }
                        else
                        {
                            SendClientMessage(playerid, -1,"{FF6A22}INFO: {FFFFFF} Open the trunk before putting something inside.");
                            return 1;
                        }
                    }
                }
            }
Reply
#2

You'll have to do it separately like this:

pawn Код:
if(VehWep1[vehicleid] == 0)
                    {
                        format(string, sizeof(string), "Weapon Compartment 1: {B0FFFF}Empty");
                        SendClientMessage(playerid, 0xFFD99FFF, string);
                    }
                    else
                    {
                        format(string, sizeof(string), "Weapon Compartment 1: {B0FFFF}%s {D99FFF}(%d Ammo)", WeaponNames[VehWep1[vehicleid]], VehWepA1[vehicleid]);
                        SendClientMessage(playerid, 0xFFD99FFF, string);
                    }
Reply
#3

Okay but I need to write this 5x and it's confusing me.. is there a way to do it with loop? I have 5 slots for trunk so I can loop over them and if there is empty slot it will write "Empty Slot" else it will write a name of stored weapon..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)