21.01.2017, 10:49
PHP код:
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.
}