/cmds in dialogbox
#7

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(playeriddialogidresponselistiteminputtext[])
{
    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;

Here is an example. Download ZCMD: https://sampforum.blast.hk/showthread.php?tid=91354
Reply


Messages In This Thread
/cmds in dialogbox - by NviDa - 30.03.2015, 17:48
Re: /cmds in dialogbox - by CalvinC - 30.03.2015, 17:52
Re: /cmds in dialogbox - by NviDa - 30.03.2015, 17:57
Re : /cmds in dialogbox - by Wassimo - 30.03.2015, 17:58
Re: /cmds in dialogbox - by CalvinC - 30.03.2015, 18:09
Re: /cmds in dialogbox - by NviDa - 30.03.2015, 18:12
Re: /cmds in dialogbox - by NoDi522 - 30.03.2015, 18:20
Re: /cmds in dialogbox - by CalvinC - 30.03.2015, 18:34

Forum Jump:


Users browsing this thread: 2 Guest(s)