gun dealing NPC
#4

Here is an example with y_commands.

pawn Code:
YCMD:deal(playerid, params[], help)
{
    if( help ) return SendClientMessage( playerid, -1, #With this command you can get weapons );
    if( isnull ( params )) ShowPlayerDialog( playerid, 1, DIALOG_STYLE_LIST, " Gun Menu ",
                                                                                        "Deagle\r\n
                                                                                        MP5\r\n
                                                                                        Shotgun\r\n"
, #Select, #Cancel );
    // Change it to your DIALOG ID
    return true;
}


public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] )
{
    switch( dialogid ) // Switch through our dialog ID's
    {
        case 1: // Change it to your DIALOG ID
        {
            if( !response ) return false; // If he click on "Cancel" it will return false
            if( response ) // If he click on "Select"
            {
                switch( listitem ) // Switch through our items
                {
                    case 0: // If he clicks on "Deagle"
                    {
                        GivePlayerWeapon( playerid, 24, 200 ); // Deagle with 200 ammo
                        SendClientMessage( playerid, -1, #Received a DEAGLE  );
                    }
                    case 1: // If he clicks on "MP5"
                    {
                        GivePlayerWeapon( playerid, 29, 200 ); // MP5 with 200 ammo
                        SendClientMessage( playerid, -1, #Received a MP5 );
                    }
                    case 2: // If he clicks on "Shotgun"
                    {
                        GivePlayerWeapon( playerid, 25, 200 ); // Shotgun  with 200 ammo
                        SendClientMessage( playerid, -1, #Received a SHOTGUN );
                    }
                }
            }
        }
    }
    return true;
}
Reply


Messages In This Thread
gun dealing NPC - by Santox14 - 17.10.2011, 16:08
Re: gun dealing NPC - by Dripac - 17.10.2011, 16:09
AW: gun dealing NPC - by Santox14 - 17.10.2011, 17:02
Re: gun dealing NPC - by SmiT - 17.10.2011, 17:19

Forum Jump:


Users browsing this thread: 1 Guest(s)