public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new str2[150]; format(str2, 150, "Arma\tMunizioni\tDisponibile\n\ Deagle\t9999\tN/D\n\ Shotgun\t9999\tN/D\n\ Mp5\t1000\t%d\n\ M4\t1000\t%d\n\ Sniper\t100\t%d\n", cwdisarmi[0], cwdisarmi[1], cwdisarmi[2]); if(dialogid == 5829) { if(response) { switch(listitem) { case 0: GivePlayerWeapon(playerid, 24, 9999); case 1: GivePlayerWeapon(playerid, 25, 9999); case 2: if(cwdisarmi[0] > 0) { GivePlayerWeapon(playerid, 28, 1000); cwdisarmi[0]--; SendClientMessage(playerid, -1, "a"); } else ShowPlayerDialog(playerid, 5829, DIALOG_STYLE_TABLIST_HEADERS, "Arma n 1", str2, "Vai", ""); case 3: if(cwdisarmi[1] > 0) { GivePlayerWeapon(playerid, 31, 1000); cwdisarmi[1]--; } else ShowPlayerDialog(playerid, 5829, DIALOG_STYLE_TABLIST_HEADERS, "Arma n 1", str2, "Vai", ""); case 4: if(cwdisarmi[2] > 0) { GivePlayerWeapon(playerid, 34, 100); cwdisarmi[1]--; } else ShowPlayerDialog(playerid, 5829, DIALOG_STYLE_TABLIST_HEADERS, "Arma n 1", str2, "Vai", ""); } return ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); } else if(!response) return ShowPlayerDialog(playerid, 5829, DIALOG_STYLE_TABLIST_HEADERS, "Arma n 1", str2, "Vai", ""); } if(dialogid == 5830) { if(response) { switch(listitem) { case 0: if(GetPlayerWeapon(playerid) != 24) GivePlayerWeapon(playerid, 24, 9999), cwtimer[playerid][1] = 1; else ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); case 1: if(GetPlayerWeapon(playerid) != 25) GivePlayerWeapon(playerid, 25, 9999), cwtimer[playerid][1] = 1; else ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); case 2: if(GetPlayerWeapon(playerid) != 28) GivePlayerWeapon(playerid, 28, 9999), cwtimer[playerid][1] = 1; else ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); case 3: if(GetPlayerWeapon(playerid) != 31) GivePlayerWeapon(playerid, 31, 9999), cwtimer[playerid][1] = 1; else ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); case 4: if(GetPlayerWeapon(playerid) != 34) GivePlayerWeapon(playerid, 34, 9999), cwtimer[playerid][1] = 1; else ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); } return 1; } else if(!response) return ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); } return 0; // You MUST return 0 here! Just like OnPlayerCommandText. }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new str2[150];
format(str2, 150, "Arma\tMunizioni\tDisponibile\n\
Deagle\t9999\tN/D\n\
Shotgun\t9999\tN/D\n\
Mp5\t1000\t%d\n\
M4\t1000\t%d\n\
Sniper\t100\t%d\n", cwdisarmi[0], cwdisarmi[1], cwdisarmi[2]);
if(dialogid == 5829)
{
if(response)
{
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, 24, 9999);
case 1: GivePlayerWeapon(playerid, 25, 9999);
case 2:
if(cwdisarmi[0] > 0)
{
GivePlayerWeapon(playerid, 28, 1000);
cwdisarmi[0]--;
SendClientMessage(playerid, -1, "a");
}
case 3:
if(cwdisarmi[1] > 0)
{
GivePlayerWeapon(playerid, 31, 1000);
cwdisarmi[1]--;
}
case 4:
if(cwdisarmi[2] > 0)
{
GivePlayerWeapon(playerid, 34, 100);
cwdisarmi[1]--;
}
}
return ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", "");
}
}
if(dialogid == 5830)
{
if(response)
{
switch(listitem)
{
case 0:
if(GetPlayerWeapon(playerid) != 24)
GivePlayerWeapon(playerid, 24, 9999), cwtimer[playerid][1] = 1;
case 1:
if(GetPlayerWeapon(playerid) != 25)
GivePlayerWeapon(playerid, 25, 9999), cwtimer[playerid][1] = 1;
case 2:
if(GetPlayerWeapon(playerid) != 28)
GivePlayerWeapon(playerid, 28, 9999), cwtimer[playerid][1] = 1;
case 3:
if(GetPlayerWeapon(playerid) != 31)
GivePlayerWeapon(playerid, 31, 9999), cwtimer[playerid][1] = 1;
case 4:
if(GetPlayerWeapon(playerid) != 34)
GivePlayerWeapon(playerid, 34, 9999), cwtimer[playerid][1] = 1;
}
return 1;
}
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
I have taken a really really quick look at it and from first glance it seems that no matter what the case is, you show the very same dialog each time.
When you press a button, a dialog is shown, and when you press that one, it is shown again, etc.. Again, I may be wrong so I looked at it so briefly while walking to the bus. |
forward CWDialog(playerid);
public CWDialog(playerid)
{
new str[15], str2[150];
SendClientMessage(playerid, COLOR_RED, "*** Scegli entro 10 secondi il tuo set d'armi!");
if(GetPlayerWeapon(playerid) == 0)
{
format(str, 15, "Arma n° 1");
cwtimer[playerid][1] = SetTimerEx("CWDialog", 10000, false, "i", playerid);
}
else
format(str, 15, "Arma n° 2");
format(str2, 150, "Arma\tMunizioni\tDisponibile\n\
Deagle\t9999\tN/D\n\
Shotgun\t9999\tN/D\n\
Mp5\t1000\t%d\n\
M4\t1000\t%d\n\
Sniper\t100\t%d\n", cwdisarmi[0], cwdisarmi[1], cwdisarmi[2]);
ShowPlayerDialog(playerid, 5829, DIALOG_STYLE_TABLIST_HEADERS, str, str2, "Vai", "");
return 1;
}
CMD:joincw(playerid, params[])
{
if(!CWmod) return SendClientMessage(playerid, COLOR_RED, "*** L'evento non и attivo!");
//if(pcw[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "*** Sei giа all'evento!");
if(posticw >= 20) return SendClientMessage(playerid, COLOR_RED, "*** Posti finiti!");
if((posticw % 2) == 0)
SettaVarCW(2, playerid);
else
SettaVarCW(3, playerid);
ShowZoneForPlayer(playerid, cwzone, COLOR_RED, -1, COLOR_YELLOW);
pcw[playerid] = 1;
SetPlayerTeam(playerid, 10);
SetPlayerHealth(playerid, 9999);
SetPlayerColor(playerid, COLOR_RED);
SetPlayerPos(playerid, arenacw[idarenacw][4], arenacw[idarenacw][5], arenacw[idarenacw][6]+4);
SetPlayerFacingAngle(playerid, arenacw[idarenacw][7]);
SetPlayerVirtualWorld(playerid, 3804);
SetPlayerInterior(playerid, 0);
ResetPlayerWeapons(playerid);
cwtimer[playerid][1] = SetTimerEx("CWDialog", 5000, false, "i", playerid);
new string[50];
format(string, sizeof string, "*** Posti disponibili nell'evento: %d/20", 20-(++posticw));
SendClientMessageToAll(COLOR_GREEN, string);
return 1;
}
PHP код:
|