#include <a_samp>
#define DIALOG_HOME 1
#define FILTERSCRIPT
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/menu", cmdtext, true) == 0)
{
ShowPlayerDialog(playerid, DIALOG_HOME, DIALOG_STYLE_LIST, "Home Menu", "Kill\nHeal\nWeapons\nCars\nTeleport", "Ok", "Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_HOME)
{
switch(listitem)
{
case 0:{SetPlayerHealth(playerid, 0.0);}
case 1:{SetPlayerHealth(playerid, 100.0); SetPlayerArmour(playerid, 100.0);}
case 2:{SetPlayerHealth(playerid, 0.0);}
case 3:{SetPlayerHealth(playerid, 0.0);}
case 4:{SetPlayerHealth(playerid, 0.0);}
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_HOME)
{
if(response)
{
switch(listitem)
{
case 0:{SetPlayerHealth(playerid, 0.0);}
case 1:{SetPlayerHealth(playerid, 100.0); SetPlayerArmour(playerid, 100.0);}
case 2:{SetPlayerHealth(playerid, 0.0);}
case 3:{SetPlayerHealth(playerid, 0.0);}
case 4:{SetPlayerHealth(playerid, 0.0);}
}
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_HOME)
{
if(!response) return 1;
switch(listitem)
{
case 0:
{
SetPlayerHealth(playerid, 0.0);
return 1;
}
case 1:
{
SetPlayerHealth(playerid, 100.0);
SetPlayerArmour(playerid, 100.0);
return 1;
}
case 2:
{
SetPlayerHealth(playerid, 0.0);
return 1;
}
case 3:
{
SetPlayerHealth(playerid, 0.0);
return 1;
}
case 4:
{
SetPlayerHealth(playerid, 0.0);
return 1;
}
}
}
return 1;
}
If you are using OnDialogResponse in several loaded filterscripts, change 'return 1;' to 'return 0;' in the very end of the callback in every filterscript.
By using 'return 1' in the very end of OnDialogResponse, it will stop checking other filterscripts except of the first loaded with OnDialogResponse, even if the target dialog ID is not inthat script. |