Problem with ID
#1

Hey, I tried creating a enter/exit door system but I'm stuck because everytime I type a different ID in this dialog I keep getting ID 0.
pawn Код:
CMD:door(playerid, params[])
{
    new string[128];
    if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_DARKRED,"[SERVER] {FFFFFF}You aren't authorized to use this command.");
    for(new x;x<MAX_DOORS;x++)
    {
    if(DoorInfo[x][Text] == 0)
    {
    format(string, sizeof(string), "Available door ID %d", x);
    ShowPlayerDialog(playerid, DIALOG_DOORID,DIALOG_STYLE_INPUT,"Door ID",string,"Ok","Close");
    break;
    }
    }
    return 1;
}
For example if I just typed ID 1 in the dialog above, and I press exterior, I get ID 0 standard
pawn Код:
if(dialogid == DIALOG_DOORID)
    {
    if(response)
    {
    sscanf(inputtext[4], "d", doorid);
    ShowPlayerDialog(playerid, DIALOG_DOORS,DIALOG_STYLE_LIST,"Edit Door","Exterior\nInterior\nName\nCustom Interior\nGarage Ability\nDelete","Choose","Close");
    }
    }
    if(dialogid == DIALOG_DOORS)
    {
    if(response)
    {
    switch(listitem)
        {
            case 0:
            {
            GetPlayerPos(playerid, DoorInfo[doorid][ExteriorX], DoorInfo[doorid][ExteriorY], DoorInfo[doorid][ExteriorZ]);
            GetPlayerFacingAngle(playerid, DoorInfo[doorid][ExteriorA]);
            DoorInfo[doorid][ExteriorVW] = GetPlayerVirtualWorld(playerid);
            DoorInfo[doorid][ExteriorInt] = GetPlayerInterior(playerid);
            SendClientMessage(playerid, COLOR_WHITE, "You've successfully changed the exterior.");
            CreateDoor(doorid);
            SaveDoors();
            }
            case 1:
            {
            }
            case 2:
            {
            ShowPlayerDialog(playerid, DIALOG_DOORNAME,DIALOG_STYLE_INPUT,"Door Name","Type the door name below.","Ok","Close");
            }
            case 3:
            {
            GetPlayerPos(playerid, DoorInfo[doorid][InteriorX], DoorInfo[doorid][InteriorY], DoorInfo[doorid][InteriorZ]);
            GetPlayerFacingAngle(playerid, DoorInfo[doorid][InteriorA]);
            DoorInfo[doorid][InteriorInt] = GetPlayerInterior(playerid);
            DoorInfo[doorid][InteriorVW] = GetPlayerVirtualWorld(playerid);
            DoorInfo[doorid][CustomInterior] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "You've successfully set a custom interior.");
            SaveDoors();
            }
            case 4:
            {
            if(DoorInfo[doorid][Vehicle] == 0)
            {
            DoorInfo[doorid][Vehicle] = 1;
            SendClientMessage(playerid, COLOR_WHITE,"Vehicle Ability in this door is successfully enabled.");
            SaveDoors();
            }
            if(DoorInfo[doorid][Vehicle] == 1)
            {
            DoorInfo[doorid][Vehicle] = 0;
            SendClientMessage(playerid, COLOR_WHITE,"Vehicle Ability in this door is successfully disabled.");
            SaveDoors();
            }
            }
            case 5:
            {
            new string[128];
            DestroyPickup(DoorInfo[doorid][Pickup]);
            Delete3DTextLabel(DoorInfo[doorid][TextID]);
            DoorInfo[doorid][Text] = 0;
            DoorInfo[doorid][CustomInterior] = 0;
            DoorInfo[doorid][ExteriorVW] = 0;
            DoorInfo[doorid][ExteriorInt] = 0;
            DoorInfo[doorid][InteriorVW] = 0;
            DoorInfo[doorid][InteriorInt] = 0;
            DoorInfo[doorid][ExteriorX] = 0;
            DoorInfo[doorid][ExteriorY] = 0;
            DoorInfo[doorid][ExteriorZ] = 0;
            DoorInfo[doorid][ExteriorA] = 0;
            DoorInfo[doorid][InteriorX] = 0;
            DoorInfo[doorid][InteriorY] = 0;
            DoorInfo[doorid][InteriorZ] = 0;
            DoorInfo[doorid][InteriorA] = 0;
            DoorInfo[doorid][Vehicle] = 0;
            DoorInfo[doorid][Pass] = 0;
            DoorInfo[doorid][Locked] = 0;
            SaveDoors();
            format(string, sizeof(string), "You've successfully deleted door %d.", doorid);
            SendClientMessage(playerid, COLOR_WHITE, string);
            }
        }
    }
    }
    if(dialogid == DIALOG_DOORNAME)
    {
    if(response)
    {
    new doorname[128];
    sscanf(inputtext[128], "s[128]",doorname);
    strmid(DoorInfo[doorid][Text], doorname, 0, strlen(doorname), 256);
    SendClientMessage(playerid, COLOR_WHITE, "You've successfully changed the name of the door.");
    CreateDoor(doorid);
    SaveDoors();
    }
    }
Reply
#2

Try this maybe?

pawn Код:
if(dialogid == DIALOG_DOORID)
    {
        if(response)
        {
            new doorID;
            if (sscanf(inputtext[4], "d", doorID))
            {
                cmd_door(playerid, "\1");
            }
            else {
                SetPVarInt(playerid, "EditingDoor", doorID);
                ShowPlayerDialog(playerid, DIALOG_DOORS,DIALOG_STYLE_LIST,"Edit Door","Exterior\nInterior\nName\nCustom Interior\nGarage Ability\nDelete","Choose","Close");
            }
        }
    }
    if(dialogid == DIALOG_DOORS)
    {
        if(response)
        {
            doorid = GetPVarInt(playerid, "EditingDoor");
            switch(listitem)
            {
                case 0:
                {
                    GetPlayerPos(playerid, DoorInfo[doorid][ExteriorX], DoorInfo[doorid][ExteriorY], DoorInfo[doorid][ExteriorZ]);
                    GetPlayerFacingAngle(playerid, DoorInfo[doorid][ExteriorA]);
                    DoorInfo[doorid][ExteriorVW] = GetPlayerVirtualWorld(playerid);
                    DoorInfo[doorid][ExteriorInt] = GetPlayerInterior(playerid);
                    SendClientMessage(playerid, COLOR_WHITE, "You've successfully changed the exterior.");
                    CreateDoor(doorid);
                    SaveDoors();
                }
                case 1:
                {
                }
                case 2:
                {
                    ShowPlayerDialog(playerid, DIALOG_DOORNAME,DIALOG_STYLE_INPUT,"Door Name","Type the door name below.","Ok","Close");
                }
                case 3:
                {
                    GetPlayerPos(playerid, DoorInfo[doorid][InteriorX], DoorInfo[doorid][InteriorY], DoorInfo[doorid][InteriorZ]);
                    GetPlayerFacingAngle(playerid, DoorInfo[doorid][InteriorA]);
                    DoorInfo[doorid][InteriorInt] = GetPlayerInterior(playerid);
                    DoorInfo[doorid][InteriorVW] = GetPlayerVirtualWorld(playerid);
                    DoorInfo[doorid][CustomInterior] = 1;
                    SendClientMessage(playerid, COLOR_WHITE, "You've successfully set a custom interior.");
                    SaveDoors();
                }
                case 4:
                {
                    if(DoorInfo[doorid][Vehicle] == 0)
                    {
                        DoorInfo[doorid][Vehicle] = 1;
                        SendClientMessage(playerid, COLOR_WHITE,"Vehicle Ability in this door is successfully enabled.");
                        SaveDoors();
                    }
                    if(DoorInfo[doorid][Vehicle] == 1)
                    {
                        DoorInfo[doorid][Vehicle] = 0;
                        SendClientMessage(playerid, COLOR_WHITE,"Vehicle Ability in this door is successfully disabled.");
                        SaveDoors();
                    }
                }
                case 5:
                {
                    new string[128];
                    DestroyPickup(DoorInfo[doorid][Pickup]);
                    Delete3DTextLabel(DoorInfo[doorid][TextID]);
                    DoorInfo[doorid][Text] = 0;
                    DoorInfo[doorid][CustomInterior] = 0;
                    DoorInfo[doorid][ExteriorVW] = 0;
                    DoorInfo[doorid][ExteriorInt] = 0;
                    DoorInfo[doorid][InteriorVW] = 0;
                    DoorInfo[doorid][InteriorInt] = 0;
                    DoorInfo[doorid][ExteriorX] = 0;
                    DoorInfo[doorid][ExteriorY] = 0;
                    DoorInfo[doorid][ExteriorZ] = 0;
                    DoorInfo[doorid][ExteriorA] = 0;
                    DoorInfo[doorid][InteriorX] = 0;
                    DoorInfo[doorid][InteriorY] = 0;
                    DoorInfo[doorid][InteriorZ] = 0;
                    DoorInfo[doorid][InteriorA] = 0;
                    DoorInfo[doorid][Vehicle] = 0;
                    DoorInfo[doorid][Pass] = 0;
                    DoorInfo[doorid][Locked] = 0;
                    SaveDoors();
                    format(string, sizeof(string), "You've successfully deleted door %d.", doorid);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                }
            }
        }
    }
    if(dialogid == DIALOG_DOORNAME)
    {
        if(response)
        {
            strmid(DoorInfo[doorid][Text], params, 0, strlen(params), 256);
            SendClientMessage(playerid, COLOR_WHITE, "You've successfully changed the name of the door.");
            CreateDoor(doorid);
            SaveDoors();
        }
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)