SA-MP Forums Archive
[Help]Weapon buy system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help]Weapon buy system (/showthread.php?tid=301652)



[Help]Weapon buy system - Sfor$ahil - 05.12.2011

Can anyone give me hint how to make /buy system for DM server so a dialog box appear and players can buy guns for cash? and also tell me how if one player kill someone all his money transfer to the murderer.. Please help me


Re: [Help]Weapon buy system - -Rebel Son- - 05.12.2011

pawn Код:
#define DIALOG_GUNLIST   19934

ShowPlayerDialog(playerid, DIALOG_GUNLIST, DIALOG_STYLE_LIST, "Choose gun", "gun1\ngun2\ngun3\ngun4\ngun5\ngun6\ngun7\ngun8\ngun9", "buy", "close");

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_GUNLIST){
        if(response){
            switch(listitem)){
                case 0:
                {
                    //Selected Item: "gun1"
                }
                case 1:
                {
                    //Selected Item: "gun2"
                }
                case 2:
                {
                    //Selected Item: "gun3"
                }
                case 3:
                {
                    //Selected Item: "gun4"
                }
                case 4:
                {
                    //Selected Item: "gun5"
                }
                case 5:
                {
                    //Selected Item: "gun6"
                }
                case 6:
                {
                    //Selected Item: "gun7"
                }
                case 7:
                {
                    //Selected Item: "gun8"
                }
                case 8:
                {
                    //Selected Item: "gun9"
                }
            }
        }
        else{
            //The player has pressed "buy".
            switch(listitem{
                case 0:
                {
                    //Selected Item: "gun1"
                }
                case 1:
                {
                    //Selected Item: "gun2"
                }
                case 2:
                {
                    //Selected Item: "gun3"
                }
                case 3:
                {
                    //Selected Item: "gun4"
                }
                case 4:
                {
                    //Selected Item: "gun5"
                }
                case 5:
                {
                    //Selected Item: "gun6"
                }
                case 6:
                {
                    //Selected Item: "gun7"
                }
                case 7:
                {
                    //Selected Item: "gun8"
                }
                case 8:
                {
                    //Selected Item: "gun9"
                }
            }
        }
    }
    return 0;
}