SA-MP Forums Archive
[FilterScript] Simple Weapon Shop - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Simple Weapon Shop (/showthread.php?tid=407297)



Simple Weapon Shop - BodyBoardVEVO - 13.01.2013

I'm gonna release my first filescript. It's Simple Weapon Shop.

Commands! /w to open Weapon Shop Dealog
Weapon Shop:
*Health
*Armour
*9mm
*Silence Pistol
*Desert Eagle
*Shotgun
*Sawn-Off Shotgun
*Combat Shotgun
*Micro SMG
*MP5
*Tec-9
*AK-47
*M4
*Country Rifle
*Sniper Rifle


pawn Код:
//Weapon Shop by BodyBoardVEVO

#include <a_samp>

#if defined FILTERSCRIPT

#define WEAPONS 2222
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/w", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, 2222, DIALOG_STYLE_LIST, "Weapon Shop", "Health - $1000\nArmour - $2000\n9mm - $2500\nSilence Pistol - $3000\nDesert Eagle - $3500\nShotgun - $5000\nSawn-Off Shotgun - $8000\nCombat Shotgun - $6500\nMicro SMG - $5000\nMP5 - $5500\nTec-9 - $5000\nAK-47 - $10500\nM4 - $10000\nCountry Rifle - $12000\nSniper Rifle - $12000", "Purchase", "Cancel");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 2222)
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerMoney(playerid, -1000);
                SetPlayerHealth(playerid, 100); //Health
            }
            if(listitem == 1)
            {
                GivePlayerMoney(playerid, -2000);
                SetPlayerArmour(playerid, 100); //Armour
            }
            if(listitem == 2)
            {
                GivePlayerMoney(playerid, -2500);
                GivePlayerWeapon(playerid, 22, 250); //9mm
            }
            if(listitem == 3)
            {
                GivePlayerMoney(playerid, -3000);
                GivePlayerWeapon(playerid, 23, 250); //Silence Pistol
            }
            if(listitem == 4)
            {
                GivePlayerMoney(playerid, -3500);
                GivePlayerWeapon(playerid, 24, 250); //Desert Eagle
            }
            if(listitem == 5)
            {
                GivePlayerMoney(playerid, -5000);
                GivePlayerWeapon(playerid, 25, 250); //Shotgun
            }
            if(listitem == 6)
            {
                GivePlayerMoney(playerid, -8000);
                GivePlayerWeapon(playerid, 26, 250); //Sawn-off
            }
            if(listitem == 7)
            {
                GivePlayerMoney(playerid, -6500);
                GivePlayerWeapon(playerid, 27, 250); //Combat Shotgun
            }
            if(listitem == 8)
            {
                GivePlayerMoney(playerid, -5000);
                GivePlayerWeapon(playerid, 28, 250); //Micro SMG
            }
            if(listitem == 9)
            {
                GivePlayerMoney(playerid, -5500);
                GivePlayerWeapon(playerid, 29, 250); //MP5
            }
            if(listitem == 10)
            {
                GivePlayerMoney(playerid, -5000);
                GivePlayerWeapon(playerid, 32, 250); //Tec-9
            }
            if(listitem == 11)
            {
                GivePlayerMoney(playerid, -10500);
                GivePlayerWeapon(playerid, 30, 250); //AK-47
            }
            if(listitem == 12)
            {
                GivePlayerMoney(playerid, -10000);
                GivePlayerWeapon(playerid, 31, 250); //M4
            }
            if(listitem == 13)
            {
                GivePlayerMoney(playerid, -12000);
                GivePlayerWeapon(playerid, 33, 250); //Country Rifle
            }
            if(listitem == 14)
            {
                GivePlayerMoney(playerid, -12000);
                GivePlayerWeapon(playerid, 34, 250); //Sniper Rifle
            }
        }
        return 1;
    }
    return 1;
}



Re: Simple Weapon Shop - NicholasA - 14.01.2013

Good but in your next FS, think of strange scenarios like when the player does not have the money for it or when the player is in the class selection, it will block the command for him


Re: Simple Weapon Shop - GTAMonster - 14.01.2013

You forgot to add command in your detail. I mean this "/w" i know but some peoples don't know.
Hope you understand.
and good script


Re: Simple Weapon Shop - andreasputrawijaya - 17.06.2013

where this location ?


Re: Simple Weapon Shop - Team_PRO - 17.06.2013

Quote:
Originally Posted by andreasputrawijaya
Посмотреть сообщение
where this location ?
its a command not location type /w to open the gun menu


Re: Simple Weapon Shop - AntonioCroatia - 17.06.2013

Код:
#if defined FILTERSCRIPT

#define WEAPONS 2222
#endif
why you have this if "FILTERSCRIPT" isn't defined

or on top of fs need to be #define FILTERSCRIPT

anyway nice :P


Re: Simple Weapon Shop - AsulKapa - 03.09.2013

where this location ?


Re: Simple Weapon Shop - BodyBoardVEVO - 17.09.2013

Quote:
Originally Posted by AsulKapa
Посмотреть сообщение
where this location ?
Am

It's weapon shop...
Type /w in any location.


Re: Simple Weapon Shop - rogeriomartins - 20.09.2013

Very good!