View Single Post
Plugin Info:     Modification:          Category:         
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-29-2016 , 15:52   OciXCrom's Custom Shop + API
Reply With Quote #1



OciXCrom's Custom Shop + API


Description
  • This plugin adds a unique shop in the game that contains a variety of different settings which makes it highly customizable. The shop has got a special points system that can be activated through the configuration file. It also has an API which allows you to easily add more items, as well as remove some of the default ones.

Installation
  • Bear in mind that the plugin consists of two different files that need to be added in the plugins list.
  • The files custom_shop.amxx and cshop_items.amxx go in the plugins folder. The first one is the main plugin, i.e. the shop can't work without it. The second one contains all the default shop items, so you can decide not to add it if you plan to add your own custom items.
  • The files custom_shop.sma and cshop_items.sma go in the scripting folder. It is highly recommended to compile them locally and replace them with the new .amxx files.
  • The file customshop.inc goes in scripting/include. This is the plugin's API. There you can find all of the functions that are used to create sub-plugins.
  • The file cshop_settings.inc goes in scripting/include.
  • In configs/plugins.ini you need to add only custom_shop.amxx.
  • In configs/plugins-cshop.ini you need to add cshop_items.amxx. All sub-plugins go in that file. You can add them in configs/plugins.ini as well, but they must be placed underneath custom_shop.amxx.

Default items
  • This is a list of all items that are added in the shop by default. Names, prices, limits and everything else can be changed by editing CustomShopItems.ini, which is automatically created in your configs folder after restarting the server with the plugin added. Items can also be changed directly from the server by using the command
  • cshop_edit.
  • +50 Health -- Gives +50 HP.
    • Price: 1500
    • Limit: 5
  • +100 Armor -- Gives +100 AP.
    • Price: 1000
    • Limit: 8
  • Unlimited Clip -- Unlimited bullets for your curent weapon (no reload). This item cannot be activated on a weapon that doesn't use bullets.
    • Price: 3000
    • Limit: 3
  • Unlimited Ammo -- Unlimited backpack ammo for your current weapon. This item cannot be activated on a weapon that doesn't use bullets.
    • Price: 200
    • Limit: 5
  • Bomber -- Gives +20 HE grenades.
    • Price: 1600
    • Limit: 3
  • Silent Footsteps -- You won't make any sounds when walking.
    • Price: 3000
    • Limit: 1
  • Faster Speed -- Increases your speed.
    • Price: 4300
    • Limit: 1
  • Low Gravity -- Allows you to jump higher.
    • Price: 2800
    • Limit: 1
  • Chameleon -- You get a random skin from the enemy team.
    • Price: 9000
    • Limit: 1
  • Drugs (Speed + Health) -- Distorts your screen, increases your speed and adds additional health.
    • Price: 8000
    • Limit: 2
  • Transparency -- Makes you transparent.
    • Price: 2500
    • Limit: 1
  • Invisibility (15 Seconds) -- You become fully invisible for 15 seconds.
    • Price: 16000
    • Limit: 1
  • Double Damage -- Doubles the damage you make.
    • Price: 10000
    • Limit: 1
  • Godmode (5 Seconds) -- You become immortal for 5 seconds.
    • Price: 16000
    • Limit: 1
  • Health Regeneration -- You get +1 HP each second.
    • Price: 1800
    • Limit: 1
  • Armor Regeneration -- You get +10 AP each second.
    • Price: 2000
    • Limit: 1

Admin commands
  • cshop_points <nick|#userid> <amount> -- Gives/Takes points to/from the player.
  • cshop_items -- A list of all registered items.
  • cshop_edit -- Opens the In-Game Shop Editor.
  • cshop_reset_points -- Resets everyone's points.

Settings
  • The settings can be changed in the file configs/CustomShop.ini, and the messages in data/lang/CustomShop.txt.
  • CSHOP_PREFIX -- Prefix for chat messages.
    • DEFAULT: !n[!tCustom Shop!n]
  • CSHOP_TITLE -- Menu title..
    • DEFAULT: \yOciXCrom's \rCustom Shop
  • CSHOP_TITLE_PAGE -- The text that will be added to the title if the menu has more than one page.
    • DEFAULT: \d| \w%page%:\d
  • CSHOP_TEAM_NAMES -- Team names when using %team% in the title.
    • DEFAULT: Unassigned, Terrorist, Counter-Terrorist, Spectator
  • CSHOP_SOUND_ERROR -- Error sound.
    • DEFAULT: buttons/button11.wav
  • CSHOP_SOUND_EXPIRE -- The sound when an item expires.
    • DEFAULT: buttons/blip2.wav
  • CSHOP_SOUND_OPEN -- The sound when you open the shop.
    • DEFAULT:
  • CSHOP_BUYSOUND_TYPE -- 0 = everyone around the player hears the sound when you buy an item; 1 = only the player hears it
    • DEFAULT: 0
  • CSHOP_EXPIRESOUND_TYPE -- 0 = everyone around the player hears the sound when an item expires; 1 = only the player hears it
    • DEFAULT: 0
  • CSHOP_OPENSOUND_TYPE -- 0 = everyone around the player hears the sound when the shop is opened; 1 = only the player hears it
    • DEFAULT: 1
  • CSHOP_COMMANDS -- Commands that open the shop.
    • DEFAULT: say /shop , say_team /shop , customshop
  • CSHOP_PREVPAGE -- Previous page field.
    • DEFAULT: Previous page
  • CSHOP_NEXTPAGE -- Next page field.
    • DEFAULT: Next page
  • CSHOP_EXITMENU -- Exit menu field.
    • DEFAULT: \rClose
  • CSHOP_PERPAGE -- Number of items on each page.
    • DEFAULT: 7
  • CSHOP_FLAG -- If you want the shop to be available for players with a certain flag only.
    • DEFAULT: !
  • CSHOP_TEAM -- If you want the shop to be available for a certain team only.
    • DEFAULT: 0
  • CSHOP_SHOW_TEAMED -- Controls whether items that aren't meant for your team will be displayed in the menu.
    • DEFAULT: 0
  • CSHOP_ITEM_TEAMED -- Text for items that aren't meant for your team.
    • DEFAULT: \r[\yTEAMED\r]
  • CSHOP_SHOW_FLAGGED -- Controls whether items that you don't have access to will be displayed in the menu.
    • DEFAULT: 0
  • CSHOP_ITEM_FLAGGED -- Text for items that you don't have access to.
    • DEFAULT: \r[\yFLAGGED\r]
  • CSHOP_LIMIT_TYPE -- How is the item limit going to work (0 = every players has his own limit; 1 = every team has his own limit; 2 = limit is the same for all players).
    • DEFAULT: 0
  • CSHOP_HIDE_LIMITED -- If you want to hide items that have reached their limit.
    • DEFAULT: 0
  • CSHOP_OPEN_AT_SPAWN -- If you want the shop to be displayed on spawn.
    • DEFAULT: 0
  • CSHOP_REOPEN_AFTER_USE -- Whether the shop will stay open after purchasing an item.
    • DEFAULT: 0
  • CSHOP_POINTS_ENABLE -- Enables/Disables the points system.
    • DEFAULT: 0
  • CSHOP_MONEY_NAME -- Money name.
    • DEFAULT: money
  • CSHOP_POINTS_NAME -- Points name.
    • DEFAULT: points
  • CSHOP_MONEY_CURRENCY -- Money currency.
    • DEFAULT: $
  • CSHOP_POINTS_CURRENCY -- Points currency.
    • DEFAULT: Pts.
  • CSHOP_POINTS_SAVE -- Save points? (1 = yes; 0 = no)
    • DEFAULT: 1
  • CSHOP_SAVE_TYPE -- How to save the points (0 = name; 1 = IP address; 2= SteamID)
    • DEFAULT: 0
  • CSHOP_POINTS_COMMANDS -- Commands that allow you to see how many points you have.
    • DEFAULT: say /points , say_team /points
  • CSHOP_REWARD_NORMAL -- Reward for a normal kill.
    • DEFAULT: 15
  • CSHOP_REWARD_HEADSHOT -- Reward for a headshot kill.
    • DEFAULT: 30
  • CSHOP_REWARD_KNIFE -- Reward for a knife kill.
    • DEFAULT: 50
  • CSHOP_REWARD_VIP -- If you want VIP users to get additional points for each kill
    • DEFAULT: 0
  • CSHOP_VIP_FLAG -- VIP flag for the setting above.
    • DEFAULT: b
  • CSHOP_POINTS_TEAMKILL -- Controls whether you get points for killing teammates.
    • DEFAULT: 0
  • CSHOP_KILL_MESSAGE -- Enables/Disables the message when you kill a player.
    • DEFAULT: 0
  • CSHOP_HUD_ENABLED -- Enables/Disables points being displayed on the HUD.
    • DEFAULT: 0
  • CSHOP_HUD_RED -- Red color amount for the HUD message.
    • DEFAULT: 255
  • CSHOP_HUD_GREEN -- Green color amount for the HUD message.
    • DEFAULT: 255
  • CSHOP_HUD_BLUE -- Blue color amount for the HUD message.
    • DEFAULT: 0
  • CSHOP_HUD_X -- X position for the HUD message.
    • DEFAULT: 0.01
  • CSHOP_HUD_Y -- Y position for the HUD message.
    • DEFAULT: 0.93

Using a currency from another plugin/mod
  • The plugin has the ability to use another plugin's natives instead of default money. In simple terms - you can make the shop work with Ammo Packs, BaseBuilder Credits, JBPacks etc. To achieve that, you need to edit the following lines in the file cshop_settings.inc:

    PHP Code:
    #define get_user_money(%1) cs_get_user_money(%1)
    #define set_user_money(%1,%2) cs_set_user_money(%1, %2) 
  • To make it use Ammo Packs, replace the lines with these:

    PHP Code:
    #define get_user_money(%1) zp_get_user_ammo_packs(%1)
    #define set_user_money(%1,%2) zp_set_user_ammo_packs(%1, %2) 
  • Also, add the natives that you used in both lines:

    PHP Code:
    native zp_get_user_ammo_packs(id)
    native zp_set_user_ammo_packs(idamount
  • Or:

    PHP Code:
    #include <zombieplague> 

Plugin API (customshop.inc)
  • The plugin also has an API, i.e. a library (.inc file), which allows you to make sub-plugins that will add additional items in the shop and many other things. Here's an example of a plugin that adds No Recoil in the shop (removes recoil when shooting).

    PHP Code:
    #include <amxmodx>
    #include <customshop>
    #include <fakemeta>

    #define PLUGIN_VERSION "4.x"

    additem ITEM_NORECOIL
    new bool:g_bNoRecoil[33]

    public 
    plugin_init()
    {
        
    register_plugin("CSHOP: No Recoil"PLUGIN_VERSION"OciXCrom")
        
    register_forward(FM_PlayerPreThink"PreThink")
    }

    public 
    plugin_precache()
        
    ITEM_NORECOIL cshop_register_item("norecoil""No Recoil"120001)

    public 
    cshopItemBought(idiItem)
    {
        if(
    iItem == ITEM_NORECOIL)
            
    g_bNoRecoil[id] = true
    }
        
    public 
    cshopItemRemoved(idiItem)
    {
        if(
    iItem == ITEM_NORECOIL)
            
    g_bNoRecoil[id] = false
    }
        
    public 
    PreThink(id)
    {
        if(
    is_user_alive(id) && g_bNoRecoil[id])
            
    set_pev(idpev_punchangle, {0.00.00.0}) 


Video preview (of an older version)



Translations
  • English: by me (OciXCrom)
  • Macedonian: by me (OciXCrom)
  • Bulgarian: by me (OciXCrom)
  • Spanish: by ACM1PT
  • Hungarian: by vAx
  • Slovakian: by Belo95135
  • Brazilian Portuguese: by addons_zz
  • Romanian: by Craxor
  • Ukrainian: by Leo_BH
  • Russian: by Leo_BH




Last edited by OciXCrom; 03-25-2019 at 11:12. Reason: Restore broken image
OciXCrom is offline
Send a message via Skype™ to OciXCrom