AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   CS Store + API (https://forums.alliedmods.net/showthread.php?t=216813)

Blizzard_87 05-25-2013 21:45

CS Store + API
 
4 Attachment(s)
http://i.blzd.tk/CSStore.png
v1.0.3
by Blizzard_87

ThreadStart
http://i.blzd.tk/desc.png
CS Store is like the default buy menu, but with a difference.
your currency is Credits which is earned by killing enemies,
the prices of guns/items should always be high as once you purchase
them they are stored into your inventory permanetly, and can be equiped
every round ( but only once ), items/guns can also be refunded or gifted.
http://i.blzd.tk/api.png
To use the API function you need to include the file thats attached cs-store.inc
into the plugin you want it to work in. then use these natives
get_user_credits( id ); will return the players current credits
give_user_credits( id, 100 ); will return giving the player 100 more credits
save_user_credits( id ); will return saving the users current credit count
Example Of Using API
http://i.blzd.tk/commands.png
say /store - opens up the CS Store Main Menu to select a catagory to buy from.
say /shop - opens up the CS Store Main Menu to select a catagory to buy from.
say /inv - opens up the CS Store Inventory Menu to select either Equip, Refund, Gift ( to player ).
say /inventory - opens up the CS Store Inventory Menu to select either Equip, Refund, Gift ( to player ).
say /credits - enables or disables showing the HUD Message of how many credits you have.
say /help - opens up a MOTD window showing the plugin commands and what they do.
http://i.blzd.tk/cvars.png
Spoiler
http://i.blzd.tk/credits.png

ConnorMcleod
- enum optimize and nVault save/load optimize.
- suggesting putting stocks in sma instead of inc file.
hornet - help with API
http://i.blzd.tk/notice.png
You must compile this plugin locally with provided include file. - now you can compile from Get Plugin Link

You must place csstore.cfg file in your addons\amxmodx\configs\ directory.

I've Added The CS Store Logo image incase my hosting of the image is ever disrupted.
Change Log


File Download Count
85 + Current

ThreadStart
.

Closer456 05-25-2013 23:21

Re: CS Store
 
Wow.. really nice!
Can you add custom weapons too?

Blizzard_87 05-25-2013 23:29

Re: CS Store
 
Quote:

Originally Posted by Closer456 (Post 1958509)
Wow.. really nice!
Can you add custom weapons too?

thanks..

and not yet will see how it goes first.

WhyThis 05-26-2013 01:06

Re: CS Store
 
Good job man . I'm waiting for last man standing ....

Kia 05-26-2013 02:31

AW: CS Store
 
Add natives so you can give credits using other plugins.
Anyway, great Job.

Blizzard_87 05-26-2013 03:30

Re: AW: CS Store
 
Quote:

Originally Posted by Kia (Post 1958559)
Add natives so you can give credits using other plugins.
Anyway, great Job.

Thanks. I wanted to add that feature. But need to read more about how to do natives first before attempting to add them.

Kia 05-26-2013 03:35

Re: CS Store
 
Sure, it's not hard.

First we need to register our library where our functions are inside.
PHP Code:

public plugin_natives() {
register_library("csstore"

Now, to add a function which can be used by others we use the "register_native"-function.
PHP Code:

register_native("get_user_credits","_func_get_credits"

Here a simple example for such a function

PHP Code:

public _func_get_points(id)
{
    return 
iSkillPoints[get_param(1)]


Or for setting points

PHP Code:

public _func_set_points(idvalue)
{
    new 
plr get_param(1);
    
iSkillPoints[plr] = max(0get_param(2));
    
Save_MySql(plr);
    return 
iSkillPoints[plr];


That's about the functions, now we need to make our include file.

At first we look what AMXX Version is used and use the correct one to register our library.

PHP Code:

#if defined _skill_included
    #endinput
#endif

#define _skill_included

#if AMXX_VERSION_NUM >= 175
    #pragma reqlib skillpoints
    #if !defined AMXMODX_NOAUTOLOAD
        #pragma loadlib skillpoints
    #endif
#else
    #pragma library skillpoints
#endif 

Then we add our natives like this

PHP Code:

native get_user_skill(id


Blizzard_87 05-26-2013 03:57

Re: CS Store
 
Thanks. I'll try adding it to update when I understand it.

ConnorMcLeod 05-26-2013 04:20

Re: CS Store
 
.inc is useless and prevent people from compiling plugin from site, so from using your plugin, put functions directly in sma could be better ;)

indradullanov 05-26-2013 04:22

Re: CS Store
 
Add Weapon CSO please


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

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