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

OciXCrom's Custom Shop + API


Post New Thread Reply   
 
Thread Tools Display Modes
romeo72
Member
Join Date: Oct 2021
Old 11-25-2021 , 23:18   Re: OciXCrom's Custom Shop + API
Reply With Quote #311

hello OciXCrom.

perfect ... that's exactly what it was. I deleted the entry in the plugins-cshop.ini. now it works!
many, many thanks for that!

best regards
romeo72 is offline
Fgh
New Member
Join Date: Oct 2021
Old 03-03-2022 , 12:49   Re: OciXCrom's Custom Shop + API
Reply With Quote #312

How can I set a points limit ?
Fgh is offline
maNIaRO
Member
Join Date: Nov 2014
Old 03-13-2022 , 08:31   Re: OciXCrom's Custom Shop + API
Reply With Quote #313

Hi there, very nice plugin.
There is any way to restrict an item from shop, to be available only for VIPS (flag r) ?

Thank you
maNIaRO is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-13-2022 , 08:46   Re: OciXCrom's Custom Shop + API
Reply With Quote #314

cshop_edit -> flag
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
maNIaRO
Member
Join Date: Nov 2014
Old 03-13-2022 , 09:08   Re: OciXCrom's Custom Shop + API
Reply With Quote #315

Quote:
Originally Posted by OciXCrom View Post
cshop_edit -> flag
And when I change map, this setting will remain?
I have tried to disable some item from cshop_edit menu, and after map change, item re-enabled.
maNIaRO is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-13-2022 , 09:11   Re: OciXCrom's Custom Shop + API
Reply With Quote #316

Because you didn't hit the "save" button.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
maNIaRO
Member
Join Date: Nov 2014
Old 03-14-2022 , 07:39   Re: OciXCrom's Custom Shop + API
Reply With Quote #317

Quote:
Originally Posted by OciXCrom View Post
Because you didn't hit the "save" button.
There is no save button during editing an item.
maNIaRO is offline
Old 03-14-2022, 08:59
Bill Gaytes
This message has been deleted by asherkin. Reason: Spam.
brN17
Junior Member
Join Date: Mar 2022
Old 03-14-2022 , 17:42   Re: OciXCrom's Custom Shop + API
Reply With Quote #318

Hello there.
So, I been trying to learn It but since I'm a beginner I'm getting way too confused, I'd aprecciate some scripting help.
I already added a point system plugin to my server and did set in the "cshop_settings.inc" parameters to use points instead of money's game itself.
My question is, how can I add an AMX command to be "buyable"? I mean like, I have SuperHero mod on my server Installed as well, I want to make a shop using "amx_shaddxp" command to allow players to buy a certain amount of XP, this way they can even save points to buy more XP later.
I've seen something like this in some SH server years ago, It was called "/tickets" but I didn't find it anywhere so I decided to make It myself, thx for those who can help me.
brN17 is offline
Old 03-14-2022, 18:05
Bill H. Gaytes
This message has been deleted by asherkin. Reason: Spam.
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-15-2022 , 15:12   Re: OciXCrom's Custom Shop + API
Reply With Quote #319

Quote:
Originally Posted by maNIaRO View Post
There is no save button during editing an item.
Look again. It's literally the first option when you open up the in-game editor.
I'm not talking about when editing specific item. It's in the main editor page and it saves all item edits.

Quote:
Originally Posted by brN17 View Post
Hello there.
So, I been trying to learn It but since I'm a beginner I'm getting way too confused, I'd aprecciate some scripting help.
I already added a point system plugin to my server and did set in the "cshop_settings.inc" parameters to use points instead of money's game itself.
My question is, how can I add an AMX command to be "buyable"? I mean like, I have SuperHero mod on my server Installed as well, I want to make a shop using "amx_shaddxp" command to allow players to buy a certain amount of XP, this way they can even save points to buy more XP later.
I've seen something like this in some SH server years ago, It was called "/tickets" but I didn't find it anywhere so I decided to make It myself, thx for those who can help me.
It's much easier to just add a new shop item that automatically adds X amount of XP when you buy it, rather than giving players access to some command.

I assume your mod has natives for adding XP, so it can be very simple to do. You need to provide the mod's .inc file.
__________________

Last edited by OciXCrom; 03-15-2022 at 15:13.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Old 03-15-2022, 17:32
brN17
This message has been deleted by brN17.
brN17
Junior Member
Join Date: Mar 2022
Old 03-15-2022 , 21:44   Re: OciXCrom's Custom Shop + API
Reply With Quote #320

So, I tried to add in It a code I found from vittu, but they aren't getting to work, not getting any error when compiling, I can see the item on shop, buy it, It actually uses my points, but it doesn't give me the XP, what is wrong there so I can fix?

Code:
#include <amxmodx>
#include <customshop>
#include <cstrike>
#include <fun>

#define PLUGIN_VERSION "3.x"

additem ITEM_XP1
#define XP1_ID "XP"
#define XP1_NAME "1500 XP"
#define XP1_PRICE 100
#define CHECK_OK 1
#define CHECK_BAD 0
#define MAP_TIMELEFT 11

#define TEAM_CT 2
#define TEAM_T 1
#define TEAM_SPEC 0

new cvar_xp
new cvar_xpcost

new bool:g_bHasItem[33]

public plugin_init()
{
	register_plugin("SuperHero XP Shop System", PLUGIN_VERSION, "redemptioN-")
	register_cvar("SuperHero XP Shop System", PLUGIN_VERSION)
	register_cvar("shm_buyxpamt", "1500")
	register_cvar("shm_buyxpcost", "100")
}

public plugin_precache()
	ITEM_XP1 = cshop_register_item("XP", "1500XP", 1)
	
public cshop_item_selected(id, iItem)
{
	if(iItem == ITEM_XP1)
		g_bHasItem[id] = true
}

public cshop_item_removed(id, iItem)
{
	if(iItem == ITEM_XP1)
		g_bHasItem[id] = false
}


public func_buyxp(id)
{
	//initialize variables
	new xpp, xpcost, money
	new numbuys
	new name[33], authid[33]

	cvar_xp = get_cvar_num("shm_buyxpamt")
	cvar_xpcost = get_cvar_num("shm_buyxpcost")

	xpcost	= cvar_xpcost
	xpp	= 0


	if ( CHECK_BUY(id) == CHECK_BAD )
		return PLUGIN_CONTINUE

	money = cs_get_user_money(id)
	get_user_authid(id,authid,32)
	get_user_name(id,name,32)

	//check to see if user has enough cash
	if( money < cvar_xpcost ){
		client_print(id,print_chat,"[SHM APP_VER] Sorry, %s. You need at least $%d to buy exp", name, cvar_xpcost )
		return PLUGIN_CONTINUE
	}

	numbuys = money / cvar_xpcost		//calculate the max number of transactions (originally used in for loop)
	xpp = numbuys * cvar_xp			//calculate how much exp they can buy using numbuys
	xpcost = numbuys * cvar_xpcost		//calculate the cost of the above amount of exp

	//conduct transaction
	console_print(0, "[SHM APP_VER] %s PURCHASED %d XP : COST %d", name, xpp, xpcost)

	cs_set_user_money(  id, (money - xpcost) ,1 )				//subtract money from buys
	server_cmd("amx_shaddxp ^"%s^" %d", authid, xpp)			//add exp for buys

	if( cs_get_user_money(id) < 0 ){
		cs_set_user_money( id, 0, 1 )
	}

	//server_cmd("amx_csay yellow [SHM APP_VER] %s has purchased %d exp.^nTo buy exp say buyxp", name, xpp)

	return PLUGIN_CONTINUE
}()

public CHECK_BUY(id)
{
	new name[33]
	get_user_name(id,name,32)

	//check to make sure specs arent whording money and buying
	//also prevents problems incase users are buying life/armor or if they are revived from the spec team
	if( (get_user_team(id) != TEAM_T) && (get_user_team(id) != TEAM_CT) ){
		client_print(id,print_chat,"[SHM APP_VER] Sorry, %s. Spectators may not make purchases.", name )
		console_print(0, "[SHM APP_VER] CHECK_BUY() failed for reason: user in spec")
		return CHECK_BAD
	}

	//check for invalid IDs
	if( id < 1 || id > 32 ){
		console_print(0, "[SHM APP_VER] CHECK_BUY() failed for reason: Invalid player ID")
		return CHECK_BAD
	}
	if( is_user_bot(id) != 0 ){
		console_print(0, "[SHM APP_VER] CHECK_BUY() failed for reason: User appears to be a bot")
		return CHECK_BAD
	}

	//check if SHmod is disabled
	if( get_cvar_num("sv_superheros") != 1 ){
		console_print(0, "[SHM APP_VER] CHECK_BUY() failed for reason: SHero mod is disabled")
		return CHECK_BAD
	}

	//disable when loading a map
	new time_elasped = (get_cvar_num("mp_timelimit") * 60) - get_timeleft() 
	if( time_elasped < 60 ){
		client_print(id,print_chat,"[SHM APP_VER] Sorry, %s. Please wait until 1 minute after a map change to purchase.", name )
		console_print(0, "[SHM APP_VER] CHECK_BUY() failed for reason: map just changed")
		return CHECK_BAD	
	}

	//disable just before a map change
	if( get_timeleft() < MAP_TIMELEFT ){
		client_print(id,print_chat,"[SHM APP_VER] Sorry, %s. It is too close to the end of the map to purchase.", name )
		console_print(0, "[SHM APP_VER] CHECK_BUY() failed for reason: map change imminent")
		return CHECK_BAD
	}

	return CHECK_OK
}

Last edited by brN17; 03-15-2022 at 23:12.
brN17 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:26.


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