gun dealing NPC
#1

Hey, can someone help me to make a NPC that sells weapon's? For example: You type "deal" and then a menu shows up.. and u can buy weapons.
Reply
#2

Just create a npc and make a gun menu command with isplayerinrangeofpoint, not hard
Reply
#3

yes but how i make the gun menu command?
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)