Raised This Month: $32 Target: $400
 8% 

Shop System + API


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff        Approver:   Arkshine (91)
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-31-2012 , 15:58   Shop System + API
Reply With Quote #1


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.
Attached Files
File Type: inc shop.inc (6.2 KB, 4864 views)
File Type: sma Get Plugin or Get Source (shop_api.sma - 9366 views - 20.1 KB)
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 07-17-2012 at 13:00. Reason: Updated to v0.0.8
Exolent[jNr] is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-31-2012 , 15:58   Re: Shop System + API
Reply With Quote #2

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
Attached Files
File Type: sma Get Plugin or Get Source (shop_money_example1.sma - 1538 views - 1.9 KB)
File Type: sma Get Plugin or Get Source (shop_money_example2.sma - 2239 views - 771 Bytes)
File Type: sma Get Plugin or Get Source (shop_item_health.sma - 2378 views - 1.1 KB)
File Type: sma Get Plugin or Get Source (shop_item_gravity.sma - 2301 views - 1.2 KB)
File Type: sma Get Plugin or Get Source (shop_item_invis.sma - 2175 views - 1.1 KB)
File Type: sma Get Plugin or Get Source (shop_item_multi.sma - 2651 views - 4.9 KB)
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 07-17-2012 at 10:24.
Exolent[jNr] is offline
fantarn
Member
Join Date: Feb 2011
Old 01-31-2012 , 16:00   Re: Shop System + API
Reply With Quote #3

nice
fantarn is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 01-31-2012 , 16:14   Re: Shop System + API
Reply With Quote #4

Another awesome code.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-31-2012 , 16:56  
Reply With Quote #5

I love you. You just made my battlefield mod shop menu that much easier. Thanks man.
Doc-Holiday is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 01-31-2012 , 18:00   Re: Shop System + API
Reply With Quote #6

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.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-02-2012 , 10:46   Re: Shop System + API
Reply With Quote #7

Updated to v0.0.2:
Quote:
Originally Posted by Exolent[jNr] View Post
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.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 02-02-2012 at 10:47.
Exolent[jNr] is offline
Old 02-04-2012, 05:49
echo_cs
This message has been deleted by Arkshine. Reason: Flooding "Nice Plugin" Posts
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 05-03-2012 , 09:52   Re: Shop System + API
Reply With Quote #8

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?
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-03-2012 , 10:04   Re: Shop System + API
Reply With Quote #9

Quote:
Originally Posted by yokomo View Post
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.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
poliisi299
Senior Member
Join Date: May 2011
Old 05-03-2012 , 10:16   Re: Shop System + API
Reply With Quote #10

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

Last edited by poliisi299; 05-03-2012 at 10:17.
poliisi299 is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 18:22.


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