Convert in EasyDialog
#1

How must be This codes when they'll convert in EastDialog

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 2013:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                    if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid,-1,"You purchased a Spraycan for $100!");
                    GivePlayerWeapon(playerid, 41, 100);
                    GivePlayerMoney(playerid, -100);
                    }
                    case 1:
                    {
                    if(GetPlayerMoney(playerid) <50) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a Baseball Bat for $50!");
                    GivePlayerWeapon(playerid, 5, 1);
                    GivePlayerMoney(playerid, -50);
                    }
                    case 2:
                    {
                    if(GetPlayerMoney(playerid) <70) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a Golf Club for $70!");
                    GivePlayerWeapon(playerid, 2, 1);
                    GivePlayerMoney(playerid, -70);
                    }
                    case 3:
                    {
                    if(GetPlayerMoney(playerid) <70) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a Shovel for $70!");
                    GivePlayerWeapon(playerid, 6, 1);
                    GivePlayerMoney(playerid, -70);
                    }
                    case 4:
                    {
                    if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a Katana for $100!");
                    GivePlayerWeapon(playerid, 8, 1);
                    GivePlayerMoney(playerid, -100);
                    }
                    case 5:
                    {
                    if(GetPlayerMoney(playerid) <60) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a Camera for $60!");
                    GivePlayerMoney(playerid, -60);
                    GivePlayerWeapon(playerid, 43, 100);
                    }
                    case 6:
                    {
                    if(GetPlayerMoney(playerid) <350) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a Mask for $350! ((/maskon & /maskoff))");
                    GivePlayerMoney(playerid, -350);
                    (HasBoughtMask[playerid] = 1);
                    }
                    case 7:
                    {
                    if(GetPlayerMoney(playerid) <10) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    new Float:pHealth;
                    GetPlayerHealth(playerid, Float:pHealth);
                    SendClientMessage(playerid, -1, "You purchased a pack of Ruffles for $10! ((+20 HP))");
                    ApplyAnimation(playerid,"VENDING", "vend_eat1_P",4.1,0,1,1,1,1,1);
                    GivePlayerMoney(playerid, -10);
                    SetPlayerHealth(playerid, pHealth+20);
                    }
                    case 8:
                    {
                    if(GetPlayerMoney(playerid) <10) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    new Float:pHealth;
                    GetPlayerHealth(playerid, Float:pHealth);
                    SendClientMessage(playerid, -1, "You purchased a bottle of Coca-Cola for $10! ((+10 HP))");
                    GivePlayerMoney(playerid, -10);
                    SetPlayerHealth(playerid, pHealth+10);
                    }
                    case 9:
                    {
                    if(GetPlayerMoney(playerid) <15) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    new Float:pHealth;
                    GetPlayerHealth(playerid, Float:pHealth);
                    SendClientMessage(playerid, -1, "You purchased a Cheese Burger for $15! ((+30 HP))");
                    ApplyAnimation(playerid,"VENDING", "vend_eat1_P",4.1,0,1,1,1,1,1);
                    GivePlayerMoney(playerid, -15);
                    SetPlayerHealth(playerid, pHealth+30);
                    }
                    case 10:
                    {
                    if(GetPlayerMoney(playerid) <40) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a box of cigars for $40! ((/cigar))");
                    GivePlayerMoney(playerid, -40);
                    (HasBoughtCigar[playerid] = 1);
                    }
                    case 11:
                    {
                    if(GetPlayerMoney(playerid) <20) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a bottle of beer for $20!");
                    GivePlayerMoney(playerid, -20);
                    (HasBoughtBeer[playerid] = 1);
                    }
                }
            }
        }
       
    }
    return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(!response) {
        DeletePVar(playerid,"range");
        DeletePVar(playerid,"limit");
        DeletePVar(playerid,"fine");
        DeletePVar(playerid,"selected");
        return 1;
    }
    switch(dialogid)
    {
        //======================================================
        //                      Main menu
        //======================================================
        case DIALOG_MAIN:
        {
            switch(listitem)
            {
                case 0: ShowPlayerDialog(playerid,DIALOG_RANGE,DIALOG_STYLE_INPUT,"Insert a range","Please insert a range (recommended: 20-30)","OK","Cancel");
                case 1:
                {
                    new cam = GetClosestCamera(playerid);
                    if(cam == -1) return SendClientMessage(playerid,COLOR_RED,"No nearby cameras found!");
                    SendClientMessageEx(playerid,COLOR_GREEN,"sis","The closest cameraID is ID: ",cam,".");
                }
                case 2:
                {
                    new cam = GetClosestCamera(playerid);
                    if(cam == -1) return SendClientMessage(playerid,COLOR_RED,"No nearby cameras found!");
                    SetPVarInt(playerid,"selected",cam);
                    ShowPlayerDialog(playerid,DIALOG_EDIT,DIALOG_STYLE_LIST,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor","Change angle\nChange range\nChange speedlimit\nChange fine\nToggle mph mode\nAdd/Remove/Edit textlabel\n{FF1400}Delete camera","OK","Cancel");
                }
                case 3:
                {
                    new cam = GetClosestCamera(playerid);
                    if(cam == -1) return SendClientMessage(playerid,COLOR_RED,"No nearby cameras found!");
                    DestroySpeedCam(cam);
                    SendClientMessage(playerid,COLOR_GREEN,"Camera has been removed.");
                    DeletePVar(playerid,"selected");
                }
                case 4:
                {
                    for(new i = 0;i<loaded_cameras +1;i++)
                    {
                        if(SpeedCameras[i][_active] == true)
                        {
                            DestroySpeedCam(i);
                        }
                    }
                    SendClientMessage(playerid,COLOR_GREEN,"All speedcameras have been removed.");
                }
            }
        }
        //======================================================
        //                  Making a speedcam
        //======================================================
        case DIALOG_RANGE:
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_RANGE,DIALOG_STYLE_INPUT,"Insert a range","Please insert a range (recommended: 20-30)","OK","Cancel");
            SetPVarInt(playerid,"range",strval(inputtext));
            ShowPlayerDialog(playerid,DIALOG_LIMIT,DIALOG_STYLE_INPUT,"Insert a speedlimit","Please insert a speedlimit","OK","Cancel");
        }
        case DIALOG_LIMIT:
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_LIMIT,DIALOG_STYLE_INPUT,"Insert a speedlimit","Please insert a speedlimit","OK","Cancel");
            SetPVarInt(playerid,"limit",strval(inputtext));
            ShowPlayerDialog(playerid,DIALOG_FINE,DIALOG_STYLE_INPUT,"Insert a fine","Please insert a fine","OK","Cancel");
        }
        case DIALOG_FINE:
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_FINE,DIALOG_STYLE_INPUT,"Insert a fine","Please insert a fine","OK","Cancel");
            SetPVarInt(playerid,"fine",strval(inputtext));
            new Float:x,Float:y,Float:z,Float:angle;
            GetPlayerPos(playerid,x,y,z);GetPlayerFacingAngle(playerid,angle);
            angle = angle + 180;if(angle > 360){angle = angle - 360;}
            new id = CreateSpeedCam(x,y,z -3,angle,GetPVarInt(playerid,"range"),GetPVarInt(playerid,"limit"),GetPVarInt(playerid,"fine"),CAMERA_USEMPH);
            SetPlayerPos(playerid,x,y+2,z);
            DeletePVar(playerid,"range");
            DeletePVar(playerid,"limit");
            DeletePVar(playerid,"fine");
            SetPVarInt(playerid,"selected",id);
            ShowPlayerDialog(playerid,DIALOG_EDIT,DIALOG_STYLE_LIST,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor","Change angle\nChange range\nChange speedlimit\nChange fine\nToggle mph mode\nAdd/Remove/Edit textlabel\n{FF1400}Delete camera","OK","Cancel");
        }

        //======================================================
        //                      Edit menu
        //======================================================
        case DIALOG_EDIT:
        {
            switch(listitem)
            {
                case 0: ShowPlayerDialog(playerid,DIALOG_EANGLE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Angle","Please enter a new angle","OK","Cancel");
                case 1: ShowPlayerDialog(playerid,DIALOG_ERANGE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Range","Please enter a new range","OK","Cancel");
                case 2: ShowPlayerDialog(playerid,DIALOG_ELIMIT,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Speedlimit","Please enter a new speedlimit","OK","Cancel");
                case 3: ShowPlayerDialog(playerid,DIALOG_EFINE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Fine","Please enter a new fine","OK","Cancel");
                case 4: ShowPlayerDialog(playerid,DIALOG_ETYPE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Mph/Kmh","enter 1 to use mph and 0 for kmh","OK","Cancel");
                case 5: ShowPlayerDialog(playerid,DIALOG_LABEL,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Textlabel","Please fill in the text you want to attach, or leave it empty to remove an existing label!","OK","Cancel");
                case 6:
                {
                    DestroySpeedCam(GetPVarInt(playerid,"selected"));
                    SendClientMessage(playerid,COLOR_GREEN,"Camera has been removed.");
                    DeletePVar(playerid,"selected");
                }
            }
        }

        //======================================================
        //                 Editing a speedcam
        //======================================================
        case DIALOG_EANGLE:
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_EANGLE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Angle","Please enter a new angle","OK","Cancel");
            new id = GetPVarInt(playerid,"selected");
            new rot = strval(inputtext);
            rot = rot + 180;
            if (rot > 360)
            {
                rot = rot - 360;
            }
            SpeedCameras[id][_rot] = rot;
            SetObjectRot(SpeedCameras[id][_objectid],0,0,rot);
            SaveCamera(id);
            SendClientMessageEx(playerid,COLOR_GREEN,"sisis","The angle of cameraID ",id," has succesfully been updated to ",strval(inputtext),".");
        }
        case DIALOG_ERANGE:
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_ERANGE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Range","Please enter a new range","OK","Cancel");
            new id = GetPVarInt(playerid,"selected");
            SpeedCameras[id][_range] = strval(inputtext);
            SaveCamera(id);
            SendClientMessageEx(playerid,COLOR_GREEN,"sisis","The range of cameraID ",id," has succesfully been updated to ",strval(inputtext),".");
        }
        case DIALOG_ELIMIT:
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_ELIMIT,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Speedlimit","Please enter a new Speedlimit","OK","Cancel");
            new id = GetPVarInt(playerid,"selected");
            SpeedCameras[id][_limit] = strval(inputtext);
            SaveCamera(id);
            SendClientMessageEx(playerid,COLOR_GREEN,"sisis","The speedlimit of cameraID ",id," has succesfully been updated to ",strval(inputtext),".");
        }
        case DIALOG_EFINE:
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_EFINE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Fine","Please enter a new fine","OK","Cancel");
            new id = GetPVarInt(playerid,"selected");
            SpeedCameras[id][_fine] = strval(inputtext);
            SaveCamera(id);
            SendClientMessageEx(playerid,COLOR_GREEN,"sisis","The fine of cameraID ",GetPVarInt(playerid,"selected")," has succesfully been updated to ",strval(inputtext),".");
        }
        case DIALOG_ETYPE:
        {
            if(!strlen(inputtext) || strval(inputtext) != 0 && strval(inputtext) != 1) return ShowPlayerDialog(playerid,DIALOG_ETYPE,DIALOG_STYLE_INPUT,"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Mph/Kmh","enter 1 to use mph and 0 for kmh","OK","Cancel");
            new id = GetPVarInt(playerid,"selected");
            SpeedCameras[id][_usemph] = strval(inputtext);
            if(strval(inputtext) == 1)
            {
                SendClientMessageEx(playerid,COLOR_GREEN,"sis","CameraID ",GetPVarInt(playerid,"selected")," does now meassure speed in mph.");
            } else {
                SendClientMessageEx(playerid,COLOR_GREEN,"sis","CameraID ",GetPVarInt(playerid,"selected")," does now meassure speed in kmh.");
            }
        }
        case DIALOG_LABEL:
        {
            new id = GetPVarInt(playerid,"selected");
            if(!strlen(inputtext))
            {
                if(SpeedCameras[id][_activelabel] == true)
                {
                    Delete3DTextLabel(SpeedCameras[id][_label]);
                    SpeedCameras[id][_activelabel] = false;
                    SpeedCameras[id][_labeltxt] = 0;
                }
                SendClientMessageEx(playerid,COLOR_GREEN,"sis","The textlabel of cameraID ",GetPVarInt(playerid,"selected")," has succesfully been removed.");
            } else {
                if(SpeedCameras[id][_activelabel] == true)
                {
                    format(SpeedCameras[id][_labeltxt],128,"%s",inputtext);
                    UpdateCameraLabel(SpeedCameras[id][_label],inputtext);
                } else {
                    SpeedCameras[id][_activelabel] = true;
                    format(SpeedCameras[id][_labeltxt],128,"%s",inputtext);
                    SpeedCameras[id][_label] = AttachLabelToCamera(id,inputtext);
                }
                SendClientMessageEx(playerid,COLOR_GREEN,"sisss","The textlabel of cameraID ",GetPVarInt(playerid,"selected")," has succesfully been updated to ",inputtext,".");
            }
            SaveCamera(id);
        }
    }
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new string[256];
    switch(dialogid)
    {
        case 12346:
        {
            if(response)
            {
                if(strlen(inputtext))
                {
                    new tmp[64];
                    strmid(tmp, inputtext, 0, strlen(inputtext), 255);
                    OnPlayerLogin_(playerid,tmp);//
                } //
                else
                {
                    new loginstring[256];
                    SendClientMessage(playerid, COLOR_WHITE, "SERVER: You have to entry your password");
                    format(loginstring,sizeof(loginstring),"{FFFFFF}[Bulgarian] {32cd32}[Red County] {FF0000}[Roleplay]\n{FFFFFF}Pleaes entry your password.");
                    ShowPlayerDialog(playerid,12347,DIALOG_STYLE_PASSWORD,"Login:",loginstring,"Login","Exit"); // this is Bugged
             }
            }
            else
            {
                Kick(playerid);
            }
        }
        case 12347:
        {
            if(response)
            {
                if(strlen(inputtext))
                {
                    new tmp[64];
                    strmid(tmp, inputtext, 0, strlen(inputtext), 255);
                    OnPlayerLogin_(playerid,tmp);//
                } //
                else
                {
                    new loginstring[256];
                    SendClientMessage(playerid, COLOR_WHITE, "SERVER: You have to entry your password");
                    format(loginstring,sizeof(loginstring),"{FFFFFF}[Bulgarian] {32cd32}[Red County] {FF0000}[Roleplay]\n{FFFFFF}Pleaes entry your password.");
                    ShowPlayerDialog(playerid,12347,DIALOG_STYLE_PASSWORD,"Login:",loginstring,"Login","Exit"); // this is Bugged
             }
            }
            else
            {
                Kick(playerid);
            }
        }
        case 12345:
        {
            if(response)
            {
                if(strlen(inputtext))
                {
                    format(string, sizeof(string), "%s.ini", PlayerName(playerid));
                    if(dini_Exists(string))
                    {
                        SendClientMessage(playerid, COLOR_YELLOW, "Това име е заето, сменето го с друго!");
                        return 1;
                    }
                    new tmp[64];
                    strmid(tmp, inputtext, 0, strlen(inputtext), 255);
                    OnPlayerRegister(playerid, tmp);
                }
                else
                {
                    new regstring[256];
                    format(regstring,sizeof(regstring),"{FFFFFF}[Bulgarian] {32cd32}[Red County] {FF0000}[Roleplay]\n{FFFFFF}Това име не е регистрирано. Въведи парола за да го регистрираш.");
                    ShowPlayerDialog(playerid,12345,DIALOG_STYLE_PASSWORD,"Регистрация:",regstring,"Регистрирай","Излез");
                }
            }
            else
            {
                Kick(playerid);
            }
        }
        case 525:
        {
            if(response)
            {
                SetPlayerPos(playerid, EvnTp[playerid][0],EvnTp[playerid][1],EvnTp[playerid][2]);
                ResetPlayerWeapons(playerid);
                SetPlayerColor(playerid, COLOR_EVENT);
                ResetPlayerWeaponsEx(playerid);
                SetPlayerVirtualWorld(playerid, 1);
                SetPlayerHealth(playerid, 100);
                SetPlayerArmour(playerid, 100);
                SendClientMessage(playerid,0x00FF00FF, "Ти прие поканата си и оръжията ти бяха премахнати!");
            }
            else
            {
                SendClientMessage(playerid,COLOR_GRAD1, "Ти отказа поканата в евента!");
            }
        }
        case 30://aoc
        {
            if(response)
            {//Main gate/ Water Gate/ Spec Gate/ View Gate/ Locker door / Up door
                if(listitem == 0)
                {
                }
                if(listitem == 1)
                {
                }
                if(listitem == 2)
                {
                }
                if(listitem == 3)
                {
                }
                if(listitem == 4)
                {
                }
                if(listitem == 5)
                {
                }
            }
            else
            {
            }
            return 1;
        }
        case 31:
        {
            if(response)
            {//Main gate/ Water Gate/ Spec Gate/ View Gate/ Locker door / Up door
                if(listitem == 0)
                {
                }
                if(listitem == 1)
                {
                }
                if(listitem == 2)
                {
                }
                if(listitem == 3)
                {
                }
                if(listitem == 4)
                {
                }
                if(listitem == 5)
                {
                }
                return 1;
            }
            else
            {
            }
        }
    }
    return 1;
}
Please help me i really need from this
Reply
#2

Help ?
Reply
#3

His example explains everything I believe.

This code
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1)
    {
        if (response)
        {
            SendClientMessageToAll(-1, inputtext);
        }
        else SendClientMessage(playerid, -1, "You've canceled the dialog.");
    }
    return 1;
}

ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Announce", "Enter your message below.", "Announce", "Cancel");
Becomes

pawn Код:
Dialog:Test(playerid, response, listitem, inputtext[])
{
    if (response)
    {
        SendClientMessageToAll(-1, inputtext);
    }
    else SendClientMessage(playerid, -1, "You've canceled the dialog.");
    return 1;
}

ShowDialog(playerid, Show:Test, DIALOG_STYLE_INPUT, "Announce", "Enter your message below.", "Announce", "Cancel");
Reply
#4

I Try but my pawno crash ((
Reply
#5

Did you remove the OnDialogResponse callback before trying to compile?
Reply
#6

pawn Код:
Dialog:Test(playerid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 2013:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                    if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid,-1,"You purchased a Spraycan for $100!");
                    GivePlayerWeapon(playerid, 41, 100);
                    GivePlayerMoney(playerid, -100);
                    }
                    case 1:
                    {
                    if(GetPlayerMoney(playerid) <50) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a Baseball Bat for $50!");
                    GivePlayerWeapon(playerid, 5, 1);
                    GivePlayerMoney(playerid, -50);
                    }
                    case 2:
                    {
                    if(GetPlayerMoney(playerid) <70) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a Golf Club for $70!");
                    GivePlayerWeapon(playerid, 2, 1);
                    GivePlayerMoney(playerid, -70);
                    }
                    case 3:
                    {
                    if(GetPlayerMoney(playerid) <70) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a Shovel for $70!");
                    GivePlayerWeapon(playerid, 6, 1);
                    GivePlayerMoney(playerid, -70);
                    }
                    case 4:
                    {
                    if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a Katana for $100!");
                    GivePlayerWeapon(playerid, 8, 1);
                    GivePlayerMoney(playerid, -100);
                    }
                    case 5:
                    {
                    if(GetPlayerMoney(playerid) <60) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a Camera for $60!");
                    GivePlayerMoney(playerid, -60);
                    GivePlayerWeapon(playerid, 43, 100);
                    }
                    case 6:
                    {
                    if(GetPlayerMoney(playerid) <350) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a Mask for $350! ((/maskon & /maskoff))");
                    GivePlayerMoney(playerid, -350);
                    (HasBoughtMask[playerid] = 1);
                    }
                    case 7:
                    {
                    if(GetPlayerMoney(playerid) <10) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    new Float:pHealth;
                    GetPlayerHealth(playerid, Float:pHealth);
                    SendClientMessage(playerid, -1, "You purchased a pack of Ruffles for $10! ((+20 HP))");
                    ApplyAnimation(playerid,"VENDING", "vend_eat1_P",4.1,0,1,1,1,1,1);
                    GivePlayerMoney(playerid, -10);
                    SetPlayerHealth(playerid, pHealth+20);
                    }
                    case 8:
                    {
                    if(GetPlayerMoney(playerid) <10) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    new Float:pHealth;
                    GetPlayerHealth(playerid, Float:pHealth);
                    SendClientMessage(playerid, -1, "You purchased a bottle of Coca-Cola for $10! ((+10 HP))");
                    GivePlayerMoney(playerid, -10);
                    SetPlayerHealth(playerid, pHealth+10);
                    }
                    case 9:
                    {
                    if(GetPlayerMoney(playerid) <15) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    new Float:pHealth;
                    GetPlayerHealth(playerid, Float:pHealth);
                    SendClientMessage(playerid, -1, "You purchased a Cheese Burger for $15! ((+30 HP))");
                    ApplyAnimation(playerid,"VENDING", "vend_eat1_P",4.1,0,1,1,1,1,1);
                    GivePlayerMoney(playerid, -15);
                    SetPlayerHealth(playerid, pHealth+30);
                    }
                    case 10:
                    {
                    if(GetPlayerMoney(playerid) <40) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a box of cigars for $40! ((/cigar))");
                    GivePlayerMoney(playerid, -40);
                    (HasBoughtCigar[playerid] = 1);
                    }
                    case 11:
                    {
                    if(GetPlayerMoney(playerid) <20) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                    SendClientMessage(playerid, -1, "You purchased a bottle of beer for $20!");
                    GivePlayerMoney(playerid, -20);
                    (HasBoughtBeer[playerid] = 1);
                    }
                }
            }
        }
       
    }
    return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
pawn Код:
CMD:buy(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 7.0, 2246.4563,53.0431,26.6671)) return SendClientMessage(playerid,-1,"You need to be in a 24/7 store."); // change the co-ords to the ones you want
    ShowDialog(playerid, Show:Test ,DIALOG_STYLE_LIST,"24/7 Store","Spraycan [$100]\nBat [$50]\nGolf Club [$70]\nShovel [$70]\nKatana [$100]\nCamera [$60]\nMask [$350]\nRuffles [$10]\nCoca-Cola [$10]\nCheeseburger [$15]\nCigarettes [$40]\nBeer [$20]","Purchase","Exit");
    return 1;
}
Where's the my wrong ?
Reply
#7

Of course, it will crash your compiler. Look at your code, you have dialogid when the callback does not. You don't need to check if the dialog id is that at all since that include does it itself, just check if the player press enter (response) or esc (!response) and do something!

pawn Код:
Dialog:Test(playerid, response, listitem, inputtext[])
{
    if(response)
    {
        switch(listitem)
        {
            case 0:
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                SendClientMessage(playerid,-1,"You purchased a Spraycan for $100!");
                GivePlayerWeapon(playerid, 41, 100);
                GivePlayerMoney(playerid, -100);
            }
            case 1:
            {
                if(GetPlayerMoney(playerid) <50) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                SendClientMessage(playerid, -1, "You purchased a Baseball Bat for $50!");
                GivePlayerWeapon(playerid, 5, 1);
                GivePlayerMoney(playerid, -50);
            }
            case 2:
            {
                if(GetPlayerMoney(playerid) <70) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                SendClientMessage(playerid, -1, "You purchased a Golf Club for $70!");
                GivePlayerWeapon(playerid, 2, 1);
                GivePlayerMoney(playerid, -70);
            }
            case 3:
            {
                if(GetPlayerMoney(playerid) <70) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                SendClientMessage(playerid, -1, "You purchased a Shovel for $70!");
                GivePlayerWeapon(playerid, 6, 1);
                GivePlayerMoney(playerid, -70);
            }
            case 4:
            {
                if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                SendClientMessage(playerid, -1, "You purchased a Katana for $100!");
                GivePlayerWeapon(playerid, 8, 1);
                GivePlayerMoney(playerid, -100);
            }
            case 5:
            {
                if(GetPlayerMoney(playerid) <60) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                SendClientMessage(playerid, -1, "You purchased a Camera for $60!");
                GivePlayerMoney(playerid, -60);
                GivePlayerWeapon(playerid, 43, 100);
            }
            case 6:
            {
                if(GetPlayerMoney(playerid) <350) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                SendClientMessage(playerid, -1, "You purchased a Mask for $350! ((/maskon & /maskoff))");
                GivePlayerMoney(playerid, -350);
                (HasBoughtMask[playerid] = 1);
            }
            case 7:
            {
                if(GetPlayerMoney(playerid) <10) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                new Float:pHealth;
                GetPlayerHealth(playerid, Float:pHealth);
                SendClientMessage(playerid, -1, "You purchased a pack of Ruffles for $10! ((+20 HP))");
                ApplyAnimation(playerid,"VENDING", "vend_eat1_P",4.1,0,1,1,1,1,1);
                GivePlayerMoney(playerid, -10);
                SetPlayerHealth(playerid, pHealth+20);
            }
            case 8:
            {
                if(GetPlayerMoney(playerid) <10) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                new Float:pHealth;
                GetPlayerHealth(playerid, Float:pHealth);
                SendClientMessage(playerid, -1, "You purchased a bottle of Coca-Cola for $10! ((+10 HP))");
                GivePlayerMoney(playerid, -10);
                SetPlayerHealth(playerid, pHealth+10);
            }
            case 9:
            {
                if(GetPlayerMoney(playerid) <15) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                new Float:pHealth;
                GetPlayerHealth(playerid, Float:pHealth);
                SendClientMessage(playerid, -1, "You purchased a Cheese Burger for $15! ((+30 HP))");
                ApplyAnimation(playerid,"VENDING", "vend_eat1_P",4.1,0,1,1,1,1,1);
                GivePlayerMoney(playerid, -15);
                SetPlayerHealth(playerid, pHealth+30);
            }
            case 10:
            {
                if(GetPlayerMoney(playerid) <40) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                SendClientMessage(playerid, -1, "You purchased a box of cigars for $40! ((/cigar))");
                GivePlayerMoney(playerid, -40);
                (HasBoughtCigar[playerid] = 1);
            }
            case 11:
            {
                if(GetPlayerMoney(playerid) <20) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
                SendClientMessage(playerid, -1, "You purchased a bottle of beer for $20!");
                GivePlayerMoney(playerid, -20);
                (HasBoughtBeer[playerid] = 1);
            }
        }
    }
    return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
Reply
#8

I try, doesnt work again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)