AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Shop System + API (https://forums.alliedmods.net/showthread.php?t=177365)

Exolent[jNr] 01-31-2012 15:58

Shop System + API
 
2 Attachment(s)

Shop System + API
Version 0.0.8
by Exolent



Introduction
This is an advanced management plugin for a Shop menu that is highly extensive.
It allows coders to build a quick and easy shop menu that is customized to their needs.
Cvars
  • shop_menu_title <title>
    - The title of the shop menu that is displayed to players
    - Use "{$money}" to be replaced with the player's actual money
    - Color codes and new lines are supported
    - The default color for the title is yellow
    - Default: "Shop Menu^n\wYou have \y{$money}"
  • shop_chat_tag <tag>
    - The prefix before any message in the chat shown from the Shop plugin
    - Do not include the space in the tag
    - Default: "[SHOP]"
  • shop_spawn_menu <0|1>
    - Shows the shop menu every time you spawn
    - 0 = Disabled
    - 1 = Enabled
    - Default: 0

Client Commands
  • say /shop
    - Opens up the shop menu

Requirements
  • AMX Mod X version 1.8.1 or higher

Installation
You will need to compile this plugin locally with the shop.inc include file.

Once compiled, install the .amxx file like any other plugin.

If you have any chat plugins (color chat, chat tag, etc.) make sure
they are below this plugin in the plugins.ini, or else "/shop" command will not work.

When installing sub-plugins, they must be AFTER shop_api.amxx in the plugins.ini to work!
Shop items appear in the menu in the order of the plugins in the plugins.ini.

Plugin API
See the shop.inc file for all API documentation.
See attached plugins for examples on using the API.

What you can do:
  • Easily add items to the menu, all you have to do is make the items work!
  • Force players to open the menu
  • Override the shop plugin from using CS money to use your own system (point system plugin, unlimited money, etc.)

Generated Cvars
There are cvars generated for every item in the menu.
To see these cvars, run the plugin and sub-plugins on your server once so a config file is generated.
Then, you can go to addons/amxmodx/configs/shop.cfg.
Be sure to read the comments in the file!

Changelog
0.0.1
  • Initial release
0.0.2
  • Fixed multiple pages bug in menu
  • Added shop_print() native
  • Improved efficiency in showing the shop menu
0.0.3
  • Fixed params bug for shop_add_item()
0.0.4
  • Fixed error from last use data
0.0.5
  • Fixed error with item callbacks
0.0.6
  • Added support for handling reset timers and events
0.0.7
  • Added support for handling reset on disconnect
  • Changed shop_item_register_cvar() from stock to native and to use item id instead of short name, and allowed "flags" and "fvalue" parameters.
  • Added generated config file for server owners to see the full cvar list from these plugins.]
0.0.8
  • Fixed bug with new cvar register method
  • Fixed bug with reset data not being prepared on items added
  • Added support for return in shop_item_selected() to be able to disable the purchase
Notes
All example plugins are not going to be updated and are only there for examples.
Any features you may want added (do not ask for items to be made) will be considered and, if reasonable, will be made.
This is not the place to ask for items to be made. Make a topic in Suggestions/Requests.

Exolent[jNr] 01-31-2012 15:58

Re: Shop System + API
 
6 Attachment(s)
Example Plugins
  • shop_item_gravity.sma
    - How simple it can be to add an item to the shop
  • shop_item_multi.sma
    - How a plugin with multiple items should be structured
    - How to use callbacks for allowing items to specific players
    - How to use timers for shop items
  • shop_item_health.sma
    - How to make 1 item with multiple different possibilities
    - How to use callbacks for allowing items to specific players
    - Not fully documented, see other item plugins for documentation
  • shop_item_invis.sma
    - How a plugin with multiple items should be structured
    - How to use callbacks for allowing items to specific players
    - How to use timers for shop items
    - Not fully documented, see other item plugins for documentation
  • shop_money_example1.sma
    - How a point system plugin can use its points as shop money
  • shop_money_example2.sma
    - How to link together another plugin's existing money system with the shop


More item plugins can be found here: Shop Requests

fantarn 01-31-2012 16:00

Re: Shop System + API
 
nice :o

Devil259 01-31-2012 16:14

Re: Shop System + API
 
Another awesome code. :mrgreen:

Doc-Holiday 01-31-2012 16:56

I love you. You just made my battlefield mod shop menu that much easier. Thanks man.

nikhilgupta345 01-31-2012 18:00

Re: Shop System + API
 
Quick Idea: Native shop_client_print or shop_chat or some variation of that, so that the prefix can be used and automatically added to the front of whatever message the person wants to print.

Hope that makes sense.

Exolent[jNr] 02-02-2012 10:46

Re: Shop System + API
 
Updated to v0.0.2:
Quote:

Originally Posted by Exolent[jNr] (Post 1642081)
Changelog
0.0.2
  • Fixed multiple pages bug in menu
  • Added shop_print() native
  • Improved efficiency in showing the shop menu

Also, all example plugins have been moved to the 2nd post.

yokomo 05-03-2012 09:52

Re: Shop System + API
 
Found error when server start:
Code:

L 05/03/2012 - 21:50:29: Start of error session.
L 05/03/2012 - 21:50:29: Info (map "de_dust") (file "addons/amxmodx/logs/error_20120503.log")
L 05/03/2012 - 21:50:29: Invalid params given (6). Expected 4.
L 05/03/2012 - 21:50:29: [AMXX] Displaying debug trace (plugin "shop_item_gravity.amxx")
L 05/03/2012 - 21:50:29: [AMXX] Run time error 25: parameter error
L 05/03/2012 - 21:50:29: [AMXX]    [0] shop_item_gravity.sma::plugin_init (line 21)

Tested with shop_api and shop_item_gravity. Any idea?

Exolent[jNr] 05-03-2012 10:04

Re: Shop System + API
 
Quote:

Originally Posted by yokomo (Post 1701133)
Found error when server start:
Code:

L 05/03/2012 - 21:50:29: Start of error session.
L 05/03/2012 - 21:50:29: Info (map "de_dust") (file "addons/amxmodx/logs/error_20120503.log")
L 05/03/2012 - 21:50:29: Invalid params given (6). Expected 4.
L 05/03/2012 - 21:50:29: [AMXX] Displaying debug trace (plugin "shop_item_gravity.amxx")
L 05/03/2012 - 21:50:29: [AMXX] Run time error 25: parameter error
L 05/03/2012 - 21:50:29: [AMXX]    [0] shop_item_gravity.sma::plugin_init (line 21)

Tested with shop_api and shop_item_gravity. Any idea?

Should be fixed in v0.0.3 now.

poliisi299 05-03-2012 10:16

Re: Shop System + API
 
Great plugin, can you add Health menu ?

+2500 Heatlh 1500$
+5000 Health 3000$
+7500 Health 5000$
+10000 Health 7000$


and the gravity and speed is very nice thank you. and if you can, add invisibly like cs_shop :D


All times are GMT -4. The time now is 00:03.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.