Raised This Month: $66 Target: $400
 16% 

Enemy Requisitions


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff        Approver:   v3x (159)
DarkRaven
New Member
Join Date: Apr 2006
Old 04-09-2006 , 01:56   Enemy Requisitions
Reply With Quote #1

Code:
	Allows the purchase of 'enemy' weapons while in the buyzone and
	within 'buy time' at inflated prices. The respective scoped rifles
	aren't available due to being 'too rare' to be purchasable. 
	Team say or bind a key to 'fixer' to bring up the menu.
	
	HISTORY:
	
	v. 1.0 - Compiled without errors. Yeah me!
	v. 1.1 - Fixed all logic errors. Stupid floatround not working as
		it should with the floatround_ceil method. ><
	v. 1.2 - Cleaned up code. Unfortunately generates 8 warnings total
		due the the way cs_get_user_team(id) is used. Final version
		unless someone needs a fix.
	v. 1.3 - Further code cleaning, thanks to VEN.
		
	COMMANDS:
	
	say_team ('u') fixer - brings up the menu
	fixer	- brings up the menu
	
	CVARS:
	
	amx_enemyreq - turns the plugin on and off (default : on "1")
	amx_ereq_mult - the inflation of prices as a multiplier (default : 5x "5.0")
	amx_ereq_allow - a bitwise sum of purchaseble items (default : all allowed "15")
			eg.
			1 - Pistol
			2 - SMG
			4 - Light Rifle
			8 - Main Rifle
	amx_ereq_vary - enables the black market not to have rifles in stock based on a fixed 
			percentage which is run though each round per person. More people
			equals a better chance of one being available. (default : on "1")
Attached Files
File Type: sma Get Plugin or Get Source (enmyreq.sma - 1919 views - 7.3 KB)
DarkRaven is offline
Send a message via AIM to DarkRaven
VEN
Veteran Member
Join Date: Jan 2005
Old 04-09-2006 , 09:13  
Reply With Quote #2

Code:
register_event("ResetHUD","new_round","b")
This event can't be used for catching new round. Use that:
Code:
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")

Code:
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4
You initialize that variable many times so better make it global.

Code:
set_task((get_cvar_float("mp_buytime")*60), "buy_over", 0, params, 0, "a", 1)
Do not use task in that case because:
1. mp_buytime may be changed while task is running so task needs to be changed accordingly
2. round may finish before end of the task so task needs to be removed

Therefore better create a global variable, store round start time to it and when someone trying to purchase something check if (current_time - round_start_time) < mp_buytime * 60
VEN is offline
techwg
Senior Member
Join Date: Dec 2005
Old 04-09-2006 , 15:18  
Reply With Quote #3

I want this it sounds cool, but i cant get it to work. I am not a noob either. But i tried everything and the plugin si "working" but the command does not even work
and my amx_search mod does not show any amx commands with fixer in it ??
__________________
techwg is offline
Janet Jackson
Veteran Member
Join Date: Mar 2005
Location: far, far away from here
Old 04-09-2006 , 15:26  
Reply With Quote #4

Very nice idea.
__________________
Janet Jackson is offline
techwg
Senior Member
Join Date: Dec 2005
Old 04-09-2006 , 16:27  
Reply With Quote #5

ok i got it working now. your descrition of the cvar's was not helpful. I was using the words as you used 1x, on,off etc . . . i had to look at the source code and see what the default settings are set on to figure it out.
__________________
techwg is offline
DarkRaven
New Member
Join Date: Apr 2006
Old 04-09-2006 , 16:53  
Reply With Quote #6

@ VEN

Code:
register_event("ResetHUD","new_round","b")
Does what it is meant to do. I was not aware that it was improper to use the ResetHUD event to catch the start of the round, as I have seen other popular and approved plugins use it. As for
Code:
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4
I guess I brain farted on that, thanks for the catch. Lastly,
Code:
set_task((get_cvar_float("mp_buytime")*60), "buy_over", 0, params, 0, "a", 1)
I see the exploit that your method would avoid. Unfortunately, I am not skilled enough in Small to capture the current and round start times. Additionally, unless an admin changes the round buy time during buy time (which I imagine is a rather rare event), then the exploit is non existant and I'm not sure how it would react on a truncated round.

Thanks for all the tips.

@techwg

I changed the cvar descriptions in hope they are more clear now.
DarkRaven is offline
Send a message via AIM to DarkRaven
techwg
Senior Member
Join Date: Dec 2005
Old 04-09-2006 , 17:26  
Reply With Quote #7

Thanks
__________________
techwg is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 04-10-2006 , 11:42  
Reply With Quote #8

Quote:
I was not aware that it was improper to use the ResetHUD event to catch the start of the round, as I have seen other popular and approved plugins use it.
Many people confuses new round/round start/player spawn events.

Lets's see what happens.
Code:
register_event("ResetHUD","new_round","b")
In fact "ResetHUD" is a message which server sends to every connected client on server join, player spawn and round restart (using sv_restart(round) CVAR).
This means that "new_round" function in most cases will be called often.
If server contain for example 32 connected players you'll get a lot of tasks which controls "bBuyTime" variable while only one task is needed for that.

If player would connect at the middle of the round you'll get "bBuyTime = true" while in some cases it should be false.

Since buy time countdown starts on round start (freezetime end) you should use
Code:
register_logevent("logevent_round_start", 2, "1=Round_Start")
instead of "ResetHUD" event.

Quote:
I'm not sure how it would react on a truncated round.
Very simple. It would mess "bBuyTime" variable and therefore plugin's buy time. I do not think it's hard to imagine what could happen.

Let's say plugin uses logevent which listed above and task method.
Imagine two lines. The first line represents "life" of the 1st task and the second one represents 2nd task's "life". Where line exists "bBuyTime" variable is true.
Code:
1-----------------0
            1------------------0
                       ^ first task falses bBuyTime
Quote:
I am not skilled enough in Small to capture the current and round start times.
This have nothing to do with "non-basics" of the scripting language (by the way Small renamed to Pawn since version 3). Use round start logevent and "get_gametime" native.
The only trick which needed is allowing to buy while freezetime exists. Freezetime is a time between new round and round start events. You can find new round event in my previous post.
VEN is offline
techwg
Senior Member
Join Date: Dec 2005
Old 07-03-2006 , 21:58   Re: Enemy Requisitions
Reply With Quote #9

i need my krieg please add the zoomes rifles Krieg, and Bullpup
__________________
techwg is offline
genipalla
Member
Join Date: Feb 2007
Location: Albania
Old 02-21-2007 , 20:47   Re: Enemy Requisitions
Reply With Quote #10

This sounds very familiar as a plugin i am sure i have seen it befor just cant remember when..... Oh and if you want to add the bullop and krieg try using some of the coding from the WEAPONS MOD im sure it usees familiare coding exept for the required admin level take a look at that it might work?? not sure though
__________________

CS SOURCE
genipalla is offline
Reply


Thread Tools
Display Modes

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 01:36.


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