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

Integrating HNS XP with Custom Shop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MaNaReaver
Member
Join Date: Apr 2020
Location: India
Old 06-19-2020 , 15:45   Integrating HNS XP with Custom Shop
Reply With Quote #1

Hey everyone at AM

Recently, I added OciXCrom's Custom Shop and use the points system on my server. Although things are great, I wanted the points system to be integrated with Exolent's HNS XP v0.03b, which has its own XP system to buy upgrades. As two currencies would complicate the game, it would be amazing to have an integration with these two plugins for HNS.

I believe the easier way to do this would be to add a native function to read Exolent's XP nvault and use that for Custom Shop, as Exolent's plugin is quite comprehensive and has a lot of sub-plugins for each upgrade. However, I'm not a really good scripter, and would need some help with it

Here are the plugins for reference:
Exolent's HNS XP Plugin
OciXCrom's Custom Shop Plugin

Thank you for helping with this request!
MaNaReaver is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-20-2020 , 08:25   Re: Integrating HNS XP with Custom Shop
Reply With Quote #2

scripting/include/cshop_settings.inc:

Code:
#if defined _cshop_settings_included     #endinput #endif #include <hnsxp> #define _cshop_settings_included #define DEFAULT_SOUND "items/gunpickup2.wav" #define FLAG_ADMIN ADMIN_BAN #define LANG_TYPE LANG_SERVER #define MAX_ITEMS 100 /*     * Change the lines below if you want to use a native for your money currency, e.g. Ammo Packs, BaseBuilder Credits, JBPacks, etc.     * Example (%1 = id | %2 = amount):         native zp_get_user_ammo_packs(id)         native zp_set_user_ammo_packs(id, amount)         #define get_user_money(%1) zp_get_user_ammo_packs(%1)         #define set_user_money(%1,%2) zp_set_user_ammo_packs(%1, %2) */ #define get_user_money(%1) hnsxp_get_user_xp(%1) #define set_user_money(%1,%2) hnsxp_set_user_xp(%1, %2) /* Don't touch this line unless you know what you're doing */ #define take_user_money(%1,%2) set_user_money(%1, get_user_money(%1) - %2)

Then recompile custom_shop.sma.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
MaNaReaver
Member
Join Date: Apr 2020
Location: India
Old 06-21-2020 , 17:21   Re: Integrating HNS XP with Custom Shop
Reply With Quote #3

Hey OciXCrom,

Sorry for the delay in getting back! I recompiled cshop with the updated inc file, however, there are still 2 vaults running, and the currency value between the custom shop and the ability shop are different from each other and are not updated consecutively.

For example, when you buy something from the shop, the respective value isn't changing for the ability shop, and vice-versa. Similarly, as the currencies function differently and have their own system, they provide awards that may differ from each other. Also, the xp/points aren't saved in their respective vaults, for some reason after the change.

Are there any other upgrade plugins that could possibly work better for such a situation? If not, are there any alternatives that can work out, instead of rewriting the XP plugin?

Thanks and best regards
MaNaReaver is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-21-2020 , 18:23   Re: Integrating HNS XP with Custom Shop
Reply With Quote #4

Forgot to mention that you need to disable the points system in the Custom Shop.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
MaNaReaver
Member
Join Date: Apr 2020
Location: India
Old 06-22-2020 , 05:29   Re: Integrating HNS XP with Custom Shop
Reply With Quote #5

Disabling the points system worked out great. However, it seems that the nfvault used by Exolent in his XP plugin doesn't save XP properly, and the values return back to 0 after restarting.

It seems that many people faced the same problem with his 0.03b version, and unfortunately, there haven't been any fixes.

Can you please have a look at the save system, and see if things are working? Really appreciate your time and effort on this.
MaNaReaver is offline
MaNaReaver
Member
Join Date: Apr 2020
Location: India
Old 06-29-2020 , 18:14   Re: Integrating HNS XP with Custom Shop
Reply With Quote #6

Quote:
Originally Posted by MaNaReaver View Post
Disabling the points system worked out great. However, it seems that the nfvault used by Exolent in his XP plugin doesn't save XP properly, and the values return back to 0 after restarting.

It seems that many people faced the same problem with his 0.03b version, and unfortunately, there haven't been any fixes.

Can you please have a look at the save system, and see if things are working? Really appreciate your time and effort on this.
This integration works fine on 0.0.1 though, so I guess it's not a problem. However, I was facing the same issue on the Custom Shop Donate plugin, where it says you don't have enough points to donate others. Can you check it out?
MaNaReaver is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-29-2020 , 19:16   Re: Integrating HNS XP with Custom Shop
Reply With Quote #7

Which plugin is that?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
MaNaReaver
Member
Join Date: Apr 2020
Location: India
Old 06-29-2020 , 19:27   Re: Integrating HNS XP with Custom Shop
Reply With Quote #8

Quote:
Originally Posted by OciXCrom View Post
Which plugin is that?
This one: Custom Shop Points Donate
MaNaReaver is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-30-2020 , 07:50   Re: Integrating HNS XP with Custom Shop
Reply With Quote #9

That one uses the built-in Custom Shop points which you're not using.

Code:
#include <amxmodx> #include <amxmisc> #include <cromchat> #include <cstrike> #include <customshop> #define PLUGIN "Points Donate" #define VERSION "1.0" #define AUTOR "iceeedR" #if defined client_disconnected     #define client_disconnect client_disconnected #endif #if !defined MAX_PLAYERS const MAX_PLAYERS = 32 #endif /* Edit by OciXCrom: made the plugin donate points from Custom Shop instead of money */ new const Prefix[] = "Allied Donators" new DonateTarget[MAX_PLAYERS +1] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTOR);     register_clcmd("say /donate", "DonateCmd")     register_clcmd("plugin_donate", "DonateHandler") } public client_disconnect(id) {     DonateTarget[id] = 0 // just for secure } public DonateCmd(id) {     new szItem[64]     formatex(szItem, charsmax(szItem), "\y[\w%s\d - \rDonate Menu \y ]", Prefix)     new iMenu = menu_create(szItem, "donate_handler")     new iPlayers[MAX_PLAYERS], iNum     get_players(iPlayers, iNum, "e", (cs_get_user_team(id) == CS_TEAM_T) ? "TERRORIST" : "CT")     for(new i, szTempid[10], iPlayer;i < iNum;i++)     {         iPlayer = iPlayers[i]         if(iPlayer != id)         {             num_to_str(iPlayer, szTempid, charsmax(szTempid))             get_user_name(iPlayer, szItem, charsmax(szItem))             menu_additem(iMenu, szItem, szTempid)         }     }     menu_display(id, iMenu)     return PLUGIN_HANDLED } public donate_handler(id, iMenu, iItem) {     if(iItem == MENU_EXIT)     {         menu_destroy(iMenu)         return PLUGIN_HANDLED     }     new iData[6], szItemName[MAX_PLAYERS * 2], iAccess, iCallback     menu_item_getinfo(iMenu, iItem, iAccess, iData, charsmax(iData), szItemName, charsmax(szItemName), iCallback)     DonateTarget[id] = str_to_num(iData)     if(!DonateTarget[id])     {         client_print_color(id, print_team_default, "%s This player does not exist.", Prefix)         menu_display(id, iMenu)         DonateTarget[id] = 0         return PLUGIN_HANDLED     }     client_cmd(id, "messagemode plugin_donate")     client_print_color(id, print_team_default, "%s Type how much you want to give.", Prefix)     return PLUGIN_HANDLED } public DonateHandler(id) {     new szValue[8]     read_argv(1, szValue, charsmax(szValue))     new iValue = str_to_num(szValue)     new iPlayerMoney = get_user_money(id)     if( iPlayerMoney < iValue || iValue <= 0)     {         client_print_color(id, print_team_default, "%s You do not have enough money.", Prefix)         return PLUGIN_CONTINUE     }     set_user_money(DonateTarget[id], get_user_money(DonateTarget[id]) + iValue)     set_user_money(id, iPlayerMoney - iValue)     new szNameGiver[MAX_PLAYERS]     get_user_name( id, szNameGiver, charsmax( szNameGiver))     new szNameReceiver[MAX_PLAYERS]     get_user_name(DonateTarget[id], szNameReceiver, charsmax(szNameReceiver))     new iPlayers[MAX_PLAYERS], iNum     get_players(iPlayers, iNum, "e", (cs_get_user_team(id) == CS_TEAM_T) ? "TERRORIST" : "CT")     for(new i;i < iNum;i++)     {         client_print_color(iPlayers[i], print_team_default, "%s^x04 %s^x01 donated^x04 $%i^x01 for^x04 %s.", Prefix, szNameGiver, iValue, szNameReceiver)     }     client_cmd(DonateTarget[id], "spk ^"items/9mmclip1.wav^"")     DonateTarget[id] = 0     return PLUGIN_HANDLED }
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
MaNaReaver
Member
Join Date: Apr 2020
Location: India
Old 06-30-2020 , 15:58   Re: Integrating HNS XP with Custom Shop
Reply With Quote #10

Quote:
Originally Posted by OciXCrom View Post
That one uses the built-in Custom Shop points which you're not using.

Code:
#include <amxmodx> #include <amxmisc> #include <cromchat> #include <cstrike> #include <customshop> #define PLUGIN "Points Donate" #define VERSION "1.0" #define AUTOR "iceeedR" #if defined client_disconnected     #define client_disconnect client_disconnected #endif #if !defined MAX_PLAYERS const MAX_PLAYERS = 32 #endif /* Edit by OciXCrom: made the plugin donate points from Custom Shop instead of money */ new const Prefix[] = "Allied Donators" new DonateTarget[MAX_PLAYERS +1] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTOR);     register_clcmd("say /donate", "DonateCmd")     register_clcmd("plugin_donate", "DonateHandler") } public client_disconnect(id) {     DonateTarget[id] = 0 // just for secure } public DonateCmd(id) {     new szItem[64]     formatex(szItem, charsmax(szItem), "\y[\w%s\d - \rDonate Menu \y ]", Prefix)     new iMenu = menu_create(szItem, "donate_handler")     new iPlayers[MAX_PLAYERS], iNum     get_players(iPlayers, iNum, "e", (cs_get_user_team(id) == CS_TEAM_T) ? "TERRORIST" : "CT")     for(new i, szTempid[10], iPlayer;i < iNum;i++)     {         iPlayer = iPlayers[i]         if(iPlayer != id)         {             num_to_str(iPlayer, szTempid, charsmax(szTempid))             get_user_name(iPlayer, szItem, charsmax(szItem))             menu_additem(iMenu, szItem, szTempid)         }     }     menu_display(id, iMenu)     return PLUGIN_HANDLED } public donate_handler(id, iMenu, iItem) {     if(iItem == MENU_EXIT)     {         menu_destroy(iMenu)         return PLUGIN_HANDLED     }     new iData[6], szItemName[MAX_PLAYERS * 2], iAccess, iCallback     menu_item_getinfo(iMenu, iItem, iAccess, iData, charsmax(iData), szItemName, charsmax(szItemName), iCallback)     DonateTarget[id] = str_to_num(iData)     if(!DonateTarget[id])     {         client_print_color(id, print_team_default, "%s This player does not exist.", Prefix)         menu_display(id, iMenu)         DonateTarget[id] = 0         return PLUGIN_HANDLED     }     client_cmd(id, "messagemode plugin_donate")     client_print_color(id, print_team_default, "%s Type how much you want to give.", Prefix)     return PLUGIN_HANDLED } public DonateHandler(id) {     new szValue[8]     read_argv(1, szValue, charsmax(szValue))     new iValue = str_to_num(szValue)     new iPlayerMoney = get_user_money(id)     if( iPlayerMoney < iValue || iValue <= 0)     {         client_print_color(id, print_team_default, "%s You do not have enough money.", Prefix)         return PLUGIN_CONTINUE     }     set_user_money(DonateTarget[id], get_user_money(DonateTarget[id]) + iValue)     set_user_money(id, iPlayerMoney - iValue)     new szNameGiver[MAX_PLAYERS]     get_user_name( id, szNameGiver, charsmax( szNameGiver))     new szNameReceiver[MAX_PLAYERS]     get_user_name(DonateTarget[id], szNameReceiver, charsmax(szNameReceiver))     new iPlayers[MAX_PLAYERS], iNum     get_players(iPlayers, iNum, "e", (cs_get_user_team(id) == CS_TEAM_T) ? "TERRORIST" : "CT")     for(new i;i < iNum;i++)     {         client_print_color(iPlayers[i], print_team_default, "%s^x04 %s^x01 donated^x04 $%i^x01 for^x04 %s.", Prefix, szNameGiver, iValue, szNameReceiver)     }     client_cmd(DonateTarget[id], "spk ^"items/9mmclip1.wav^"")     DonateTarget[id] = 0     return PLUGIN_HANDLED }
Yeah, I forgot that I was using the money system instead of the points one. This works great, thanks!

By the way, is there a way to show XP under the Money section in Player List?
Image for reference: https://imgur.com/a/buWlYac

Last edited by MaNaReaver; 06-30-2020 at 15:59.
MaNaReaver is offline
Old 06-30-2020, 16:07
OciXCrom
This message has been deleted by OciXCrom.
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 17:49.


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