30.03.2015, 18:20
PHP код:
#include <a_samp>
#define DIALOG_COMMANDS 1 // This is alternative defining. I prefer enums but however..
#include <zcmd> // You have to download zcmd.inc and include it to use this command:
CMD:commands(playerid,params[])
{
ShowPlayerDialog(playerid,DIALOG_COMMANDS,DIALOG_STYLE_LIST,"Choose your command","- Heal\n- Suicide\n- Deagle\n- You Command","Choose","");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_COMMANDS:
{
if(response)
{
switch(listitem)
{
case 0:
{
SetPlayerHealth(playerid,100); //Healing player
SendClientMessage(playerid,-1,"You have been healed"); // done healing
}
case 1:
{
SetPlayerHealth(playerid,0);
SendClientMessage(playerid,-1,"You did suicide");
}
case 2:
{
GivePlayerWeapon(playerid,24,500);
SendClientMessage(playerid,-1,"We gave you desert eagle");
}
case 3:
{
// Do some other commands
}
}
}
}
}
return 1;
}