SA-MP Forums Archive
Dialog Not Gives Respone - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog Not Gives Respone (/showthread.php?tid=482855)



Dialog Not Gives Respone - Awankz - 23.12.2013

Nothing Happen After I Click Apply , No Respone From Dialog .

Here My Script : CLICK PLEASE


Re: Dialog Not Gives Respone - Awankz - 23.12.2013

anyone help please ?


Re: Dialog Not Gives Respone - CutX - 23.12.2013

instead of always

PHP код:
if(listitem == 0)
if(
listitem == 1)
if(
listitem == 2
do:

PHP код:
if(listitem == 0)
else if(
listitem == 1)
else if(
listitem == 2
but you could also use a switch, which would be the best + fastest solution for this

PHP код:
switch(listitem)
{
    case 
0
    {
    
//your code
    
}
    case 
1:
    {
    
//your code
    
}
    case 
2:
    {
    
//your code
    
}

also, i'd recommend defining your Dialog id's lie this:

PHP код:
//on top of your script
#define DM_DIALOG 1
#define SOME_DIALOG 2
#define SOME_LIST 3
//and so on, for all your dialogs 
then instead of 1, you write DM_DIALOG:
ShowPlayerDialog(playerid, DM_DIALOG, DIALOG_STYLE_LIST,"Deathmatch Game","1.Terrorist\n2.Counter-Terrorist\n3.Exit Deathmatch", "Apply", "Close");

and in ondialogresponse too:
if(dialogid == DM_DIALOG)


Re: Dialog Not Gives Respone - Awankz - 23.12.2013

ill try


Re: Dialog Not Gives Respone - Awankz - 23.12.2013

Thanks But Not Worked


Re: Dialog Not Gives Respone - park4bmx - 23.12.2013

using dialog ID as 1 is not really a bright idea!
change it some random like 493 so it has less change being affected by other dialog id's
and return 1 at the OnDialogResponse callback


Re: Dialog Not Gives Respone - Awankz - 23.12.2013

can saw in pawn code ?


Re: Dialog Not Gives Respone - Awankz - 23.12.2013

Not Work Man


Re: Dialog Not Gives Respone - DarKKing - 23.12.2013

using dialog ID as 1 is not really a bright idea!
change it some random like 493 so it has less change being affected by other dialog id's
and return 1 at the OnDialogResponse callback this works


Re: Dialog Not Gives Respone - xVIP3Rx - 23.12.2013

I guess that is your first filterscript.. I edited alot of stuff and will mention it for you to learn

1."IsPlayerInDM" can only be false or true (1 or 0) right ? Then it's better to use a bool
2.This is a filterscript ( I guess ), So you don't have to use main() {}
3.I noticed you didn't use tabs.. You should use them instead of spaces, it'll be better arranging your script
4.I changed the dialog id to 32766, You should define it in future if you got more dialogs so you don't mess them up
5.You were making "IsPlayerInDM = 1" then check if it equal 1... It'll be 1 ofcourse.. You should check what you need to check first then do the rest of the stuff..
Tip:
Quote:

Think twice before scripting or you'll script twice before thinking
pawn Код:
//======================================================
//          DEATHMATCH GAME V2.0 BY AWANKZ[SDZ]
//======================================================

#include <a_samp>
#include <zcmd>

#define COLOR_RED 0xAA3333AA
#define COLOR_BLUE 0x33CCFFAA
#define COLOR_ERROR 0xFF6A6AFF
#define COLOR_BOMB 0x96BD6AFF
#define CRYORANGE 0xFF8F59C8

new bool:IsPlayerInDM[MAX_PLAYERS];

public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" Deathmatch Game V2.0 By Awankz[SDZ]");
        print("--------------------------------------\n");
        return 1;
}

public OnFilterScriptExit()
{
        return 1;
}

public OnGameModeInit()
{
//==========================[DEATHMATCH MAP]==========================================
       CreateObject(987, -5.632610, 1580.687988, 11.756023, 0.0000, 0.0000, 168.7500);
       CreateObject(987, -40.638699, 1548.209473, 11.750000, 0.0000, 0.0000, 222.4217);
       CreateObject(987, -33.967506, 1558.158447, 11.750000, 0.0000, 0.0000, 236.2501);
       CreateObject(987, -27.319872, 1568.104736, 11.750000, 0.0000, 0.0000, 236.2501);
       CreateObject(987, -20.672970, 1578.042603, 11.750000, 0.0000, 0.0000, 236.2501);
       CreateObject(987, -17.343763, 1583.044434, 11.750000, 0.0000, 0.0000, 236.2500);
       CreateObject(987, 6.101673, 1578.341675, 11.756023, 0.0000, 0.0000, 168.7500);
       CreateObject(987, 17.840260, 1575.998169, 11.756023, 0.0000, 0.0000, 168.7500);
       CreateObject(987, 29.546432, 1573.721313, 11.756023, 0.0000, 0.0000, 168.7500);
       CreateObject(987, 41.517223, 1573.724487, 11.750000, 0.0000, 0.0000, 180.0000);
       CreateObject(987, 47.460960, 1573.751465, 11.750000, 0.0000, 0.0000, 180.0000);
       CreateObject(987, 55.903973, 1565.259644, 11.750000, 0.0000, 0.0000, 135.0000);
       CreateObject(987, 62.654343, 1555.312012, 11.750000, 0.0000, 0.0000, 124.6095);
       CreateObject(987, 67.224915, 1544.283081, 11.750000, 0.0000, 0.0000, 112.5000);
       CreateObject(987, 68.274925, 1532.319092, 11.750000, 0.0000, 0.0000, 95.2341);
       CreateObject(987, 68.295013, 1520.379761, 11.750000, 0.0000, 0.0000, 90.0000);
       CreateObject(987, 68.298714, 1508.448608, 11.756022, 0.0000, 0.0000, 90.0000);
       CreateObject(987, 63.719688, 1497.425171, 11.750000, 0.0000, 0.0000, 67.5000);
       CreateObject(987, 55.274658, 1488.991699, 11.750000, 0.0000, 0.0000, 45.0000);
       CreateObject(987, 45.343430, 1482.340576, 11.750000, 0.0000, 0.0000, 33.7500);
       CreateObject(987, 34.249229, 1477.847412, 11.750000, 0.0000, 0.0000, 22.5000);
       CreateObject(987, 22.469278, 1475.556152, 11.750000, 0.0000, 0.0000, 11.2500);
       CreateObject(987, 10.769938, 1473.198242, 11.750000, 0.0000, 0.0000, 11.2500);
       CreateObject(987, -1.163247, 1473.936035, 11.756023, 0.0000, 0.0000, 356.5623);
       CreateObject(987, -13.138609, 1473.932129, 11.756022, 0.0000, 0.0000, 0.0000);
       CreateObject(987, -25.061956, 1475.213257, 11.756022, 0.0000, 0.0000, 353.9839);
       CreateObject(987, -36.087261, 1479.759033, 11.750000, 0.0000, 0.0000, 337.5000);
       CreateObject(987, -45.957325, 1486.597534, 11.750000, 0.0000, 0.0000, 325.3906);
       CreateObject(987, -54.389473, 1495.036377, 11.750000, 0.0000, 0.0000, 315.0000);
       CreateObject(987, -62.829426, 1503.562622, 11.750000, 0.0000, 0.0000, 315.0000);
       CreateObject(987, -69.495338, 1513.457642, 11.750000, 0.0000, 0.0000, 303.7500);
       CreateObject(987, -71.271576, 1525.313965, 11.759875, 0.0000, 0.0000, 278.6717);
       CreateObject(987, -61.503384, 1532.050049, 11.750000, 0.0000, 0.0000, 214.6094);
       CreateObject(987, -49.475258, 1540.196289, 11.750000, 0.0000, 0.0000, 213.6728);
       CreateObject(987, -51.582584, 1538.679443, 11.750000, 0.0000, 0.0000, 213.7500);
       CreateObject(3279, -11.713968, 1574.045288, 11.825617, 0.0000, 0.0000, 337.5000);
       CreateObject(3279, -65.122299, 1524.337769, 11.825617, 0.0000, 0.0000, 33.7500);
       CreateObject(3279, 43.704330, 1567.267700, 11.831640, 0.0000, 0.0000, 303.7500);
       CreateObject(11443, -52.786987, 1506.315430, 11.921745, 0.0000, 0.0000, 101.2500);
       CreateObject(3502, 28.324024, 1568.472290, 13.684663, 0.0000, 0.0000, 90.0001);
       CreateObject(3502, 19.579010, 1568.493652, 13.678640, 0.0000, 0.0000, 270.0000);
       CreateObject(3574, -26.521976, 1546.947144, 14.441691, 0.0000, 0.0000, 22.5000);
       CreateObject(7040, -39.221722, 1537.169556, 15.177780, 0.0000, 0.0000, 315.0000);
       CreateObject(688, 30.804390, 1487.432861, 12.067604, 0.0000, 0.0000, 0.0000);
       CreateObject(688, 45.680870, 1494.034424, 12.067604, 0.0000, 0.0000, 0.0000);
       CreateObject(17071, 12.406166, 1481.931274, 14.459307, 0.0000, 0.0000, 135.0000);
       CreateObject(12929, -17.837463, 1483.650391, 11.748013, 0.0000, 0.0000, 168.7500);
       CreateObject(12929, 58.672089, 1551.133179, 11.748013, 0.0000, 0.0000, 292.5000);
       CreateObject(11459, -42.272163, 1497.723267, 11.748177, 0.0000, 0.0000, 348.7500);
       CreateObject(11445, 0.366913, 1562.012207, 11.921745, 0.0000, 0.0000, 135.0000);
       CreateObject(3502, 10.933332, 1569.357666, 13.528435, 0.0000, 0.0000, 258.7500);
       CreateObject(1225, -49.945698, 1507.538086, 12.155755, 0.0000, 0.0000, 0.0000);
       CreateObject(1225, -29.431416, 1539.234741, 12.155755, 0.0000, 0.0000, 0.0000);
       CreateObject(13591, -34.058716, 1516.021973, 12.093266, 0.0000, 0.0000, 45.0000);
       CreateObject(688, 43.908779, 1504.062622, 11.757869, 0.0000, 0.0000, 0.0000);
       CreateObject(13630, 20.703262, 1576.871948, 24.741268, 0.0000, 0.0000, 81.4056);
       CreateObject(3526, -20.024939, 1488.357178, 11.818418, 0.0000, 0.0000, 258.7500);
       CreateObject(3526, -24.459938, 1489.388916, 11.818418, 0.0000, 0.0000, 258.7500);
       CreateObject(3526, 55.886711, 1546.668945, 11.818418, 0.0000, 0.0000, 22.5000);
       CreateObject(3526, 57.567245, 1542.456909, 11.818418, 0.0000, 0.0000, 22.5000);
       CreateObject(3398, -35.358040, 1555.014893, 25.938416, 0.0000, 0.0000, 45.0000);
       CreateObject(3398, 67.279877, 1535.816284, 25.938414, 0.0000, 0.0000, 281.2500);
       CreateObject(3398, -6.256062, 1474.802856, 25.944437, 0.0000, 0.0000, 180.0000);
       CreateObject(3578, -1.481171, 1487.103394, 12.534053, 0.0000, 0.0000, 0.0000);
       CreateObject(3866, 11.677105, 1529.616333, 19.588564, 0.0000, 0.0000, 348.7500);
       CreateObject(3578, 47.632847, 1560.521484, 12.534057, 0.0000, 0.0000, 326.2500);
       CreateObject(2669, -23.334436, 1555.754395, 13.090273, 0.0000, 0.0000, 112.5001);
       CreateObject(8613, -6.354053, 1527.787598, 16.121422, 0.0000, 0.0000, 258.7500);
       CreateObject(1225, -0.839952, 1522.267334, 20.219534, 0.0000, 0.0000, 0.0000);
       CreateObject(1225, 11.106701, 1523.171997, 12.119558, 0.0000, 0.0000, 326.2500);
       CreateObject(1225, -1.282711, 1529.744385, 16.330750, 0.0000, 0.0000, 0.0000);
       CreateObject(11446, 47.705990, 1516.956299, 11.924904, 0.0000, 0.0000, 0.0000);
       CreateObject(11442, 58.822487, 1509.967041, 11.923752, 0.0000, 0.0000, 247.5000);
       CreateObject(11457, 57.804840, 1534.242798, 11.357241, 0.0000, 0.0000, 22.5000);
       CreateObject(11446, -48.316540, 1518.191895, 11.924904, 0.0000, 0.0000, 191.2500);
       CreateObject(944, -18.481148, 1508.437988, 12.634787, 0.0000, 0.0000, 270.0000);
       CreateObject(1685, 27.437439, 1555.632202, 12.500000, 0.0000, 0.0000, 0.0000);
       CreateObject(1685, 29.052761, 1553.859009, 12.500001, 0.0000, 0.0000, 0.0000);
       CreateObject(2633, 1.310471, 1539.991089, 14.324649, 0.0000, 0.0000, 78.7500);
       CreateObject(2633, 0.476570, 1535.861084, 14.324649, 0.0000, 0.0000, 258.7500);
       CreateObject(2633, -0.340814, 1531.710083, 14.324649, 0.0000, 0.0000, 258.7500);
       CreateObject(8615, 3.068629, 1538.022461, 14.199692, 0.0000, 0.0000, 78.7500);
       CreateObject(944, 26.257641, 1523.681396, 12.590451, 0.0000, 0.0000, 270.0000);
//===========================================================================================
       return 1;
}

CMD:deathmatch(playerid, params[])
{
    return ShowPlayerDialog(playerid, 32766, DIALOG_STYLE_LIST,"Deathmatch Game","1.Terrorist\n2.Counter-Terrorist\n3.Exit Deathmatch", "Apply", "Close");
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(listitem)
    {
        case 32766:
        {
            if(!response) return 1;

            switch(listitem)
            {
                case 0:
                {
                    if(IsPlayerInDM[playerid]) return SendClientMessage(playerid, 0xFF0000FF,"/exit before you use this command");
                    if(GetPlayerMoney(playerid) < 15000) return SendClientMessage(playerid,CRYORANGE,".: You do not have enough money ! :.");

                    new name[MAX_PLAYER_NAME+1]; GetPlayerName(playerid, name, sizeof(name));
                    new string[24+MAX_PLAYER_NAME+1]; format(string, sizeof(string), ".: %s Join Terrorist Team :.", name), SendClientMessageToAll(CRYORANGE, string);

                    SendClientMessage(playerid, 0xFF8F59C8,  ".: Use /dmhelp :.");
                    SetPlayerPos(playerid, 60.1784,1553.6521,12.7500);
                    GivePlayerMoney(playerid, -15000);
                    PlayerPlaySound(playerid ,3200,0,0,0);
                    SetPlayerHealth(playerid, 100);
                    SetPlayerArmour(playerid, 100);

                    GivePlayerWeapon(playerid, 24, 18000);
                    GivePlayerWeapon(playerid, 25, 18000);
                    GivePlayerWeapon(playerid, 16, 18000);
                    GivePlayerWeapon(playerid, 28, 18000);
                    GivePlayerWeapon(playerid, 31, 18000);

                    IsPlayerInDM[playerid] = true;
                }
                case 1:
                {
                    if(IsPlayerInDM[playerid]) return SendClientMessage(playerid, 0xFF0000FF,"/exit before you use this command");
                    if(GetPlayerMoney(playerid) < 15000) return SendClientMessage(playerid,CRYORANGE,".: You do not have enough money ! :.");

                    new name[MAX_PLAYER_NAME+1]; GetPlayerName(playerid, name, sizeof(name));
                    new string[24+MAX_PLAYER_NAME+1]; format(string, sizeof(string), ":: %s Join Counter-Terrorist Team ::", name), SendClientMessageToAll(COLOR_BLUE, string);
                    SendClientMessage(playerid, 0xFF8F59C8,  ".: Use /dmhelp :.:");

                    SetPlayerPos(playerid, -20.3245,1484.4280,12.7500);
                    GivePlayerMoney(playerid, -15000);
                    PlayerPlaySound(playerid ,3200,0,0,0);
                    SetPlayerHealth(playerid, 100);
                    SetPlayerArmour(playerid, 100);

                    GivePlayerWeapon(playerid, 24, 18000);
                    GivePlayerWeapon(playerid, 25, 18000);
                    GivePlayerWeapon(playerid, 16, 18000);
                    GivePlayerWeapon(playerid, 28, 18000);
                    GivePlayerWeapon(playerid, 31, 18000);

                    IsPlayerInDM[playerid] = true;
                }
                case 2:
                {
                    IsPlayerInDM[playerid] = false;
                    SpawnPlayer(playerid);
                    ResetPlayerWeapons(playerid);
                }
            }
            return 1;
        }
    }
    return 0;
}