SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 17/10/2011, 04:08 PM   #1
Santox14
Big Clucker
 
Join Date: Sep 2011
Posts: 116
Reputation: 1
Default gun dealing NPC

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.
Santox14 is offline   Reply With Quote
Old 17/10/2011, 04:09 PM   #2
Dripac
High-roller
 
Dripac's Avatar
 
Join Date: Apr 2009
Location: Vienna, Austria
Posts: 1,531
Reputation: 256
Default Re: gun dealing NPC

Just create a npc and make a gun menu command with isplayerinrangeofpoint, not hard
Dripac is offline   Reply With Quote
Old 17/10/2011, 05:02 PM   #3
Santox14
Big Clucker
 
Join Date: Sep 2011
Posts: 116
Reputation: 1
Default AW: gun dealing NPC

yes but how i make the gun menu command?
Santox14 is offline   Reply With Quote
Old 17/10/2011, 05:19 PM   #4
SmiT
Huge Clucker
 
Join Date: Oct 2011
Posts: 352
Reputation: 63
Default Re: gun dealing NPC

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;
}
SmiT is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with drug dealing system [SF]RobMob Help Archive 15 02/04/2010 05:07 AM
Car Dealing System Jo1Nt Help Archive 3 14/03/2010 10:13 PM


All times are GMT. The time now is 05:53 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.