Raised This Month: $ Target: $400
 0% 

Ammo per Clip for each Weapon?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ExKiLL
Senior Member
Join Date: Nov 2005
Location: Germany
Old 11-17-2007 , 04:32   Ammo per Clip for each Weapon?
Reply With Quote #1

Hi

i saw the "Awp One Shot" made by xXAvalancheXx -> http://forums.alliedmods.net/showthread.php?t=52776

and i asked him for a little rewrite of the plugin so that i can configure the ammo per clip for the autosniper weapon but i got no answer


now i wanna ask you, if its possible to make a plugin which lets you edit each weapon ammo and clip size ??

e.g. the autosniper max 10/40

or m4a1 45/180

thanks for answer

[img]http://img150.**************/img150/6116/image113rn9.jpg[/img][img]http://img210.**************/img210/7384/image114gd5.jpg[/img]
__________________
193.192.59.43:27015 ----- italy ( 20 )
85.25.150.62:27015 ------ sHclachthaus ( 14 )
85.25.150.62:27055 ------ DeathMatch ( 20 )
85.25.150.62:27035 ------ Kreedz Hangout ( 18 )
85.214.100.160:27015 ---- 24/7 full house | **GG + DM** ( 32 )
93.190.64.150:27015 ----- Superhero (12)
ExKiLL is offline
Old 11-18-2007, 06:20
ExKiLL
This message has been deleted by ExKiLL. Reason: double post
ExKiLL
Senior Member
Join Date: Nov 2005
Location: Germany
Old 11-23-2007 , 18:15   Re: Ammo per Clip for each Weapon?
Reply With Quote #2

*push*
is this possible?
__________________
193.192.59.43:27015 ----- italy ( 20 )
85.25.150.62:27015 ------ sHclachthaus ( 14 )
85.25.150.62:27055 ------ DeathMatch ( 20 )
85.25.150.62:27035 ------ Kreedz Hangout ( 18 )
85.214.100.160:27015 ---- 24/7 full house | **GG + DM** ( 32 )
93.190.64.150:27015 ----- Superhero (12)
ExKiLL is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-23-2007 , 18:54   Re: Ammo per Clip for each Weapon?
Reply With Quote #3

yes
[ --<-@ ] Black Rose is offline
ExKiLL
Senior Member
Join Date: Nov 2005
Location: Germany
Old 12-01-2007 , 13:25   Re: Ammo per Clip for each Weapon?
Reply With Quote #4

could anyone do this?

cant be so hard to code, or?


i tried my skills (allmost 0)

Code:
/home/groups/amxmodx/tmp3/phpJQQG4k.sma(78) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpJQQG4k.sma(111) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpJQQG4k.sma(169) : warning 204: symbol is assigned a value that is never used: "gmsgCurWeapon1"
/home/groups/amxmodx/tmp3/phpJQQG4k.sma(169) : warning 203: symbol is never used: "weapon1"
Header size:            720 bytes
Code size:             4340 bytes
Data size:             1536 bytes
Stack/heap size:      16384 bytes; estimated max. usage=42 cells (168 bytes)
Total requirements:   22980 bytes

4 Warnings.
Done.
Code:
 #include <amxmodx>
 #include <fakemeta>
 #include <cstrike>

 new cv_awp_clip, gmsgCurWeapon, weapon[33], awp_clip[33], awp_bpammo[33];
 new cv_m4a1_clip, gmsgCurWeapon1, weapon1[33], m4a1_clip[33], m4_bpammo[33];

 public plugin_init()
 {
	register_plugin("AWP One Shot","0.11","Avalanche");

	register_event("CurWeapon","event_curweapon","b");
	register_event("AmmoX","event_ammox","b");

	gmsgCurWeapon = get_user_msgid("CurWeapon");
	gmsgCurWeapon1 = get_user_msgid("CurWeapon");
	cv_awp_clip = register_cvar("awp_clip","1");
	cv_m4a1_clip = register_cvar("m4a1_clip","10");

	register_forward(FM_CmdStart,"fw_cmdstart",1);
 }

 // reset values
 public client_putinserver(id)
 {
	weapon[id] = 0;
	awp_clip[id] = 0;
	awp_bpammo[id] = 0;
	m4a1_clip[id] = 0;
 }

 // restrict clip ammo
 public event_curweapon(id)
 {
	new status = read_data(1);

	if(status) weapon[id] = read_data(2);

	// using AWP
	if(read_data(2) == CSW_AWP)
	{
		// current weapon
		if(status)
		{
			// save clip information
			new old_awp_clip = awp_clip[id];
			awp_clip[id] = read_data(3);

			new max_clip = get_pcvar_num(cv_awp_clip);

			// plugin enabled and must restrict ammo
			if(max_clip && awp_clip[id] > max_clip)
			{
				new wEnt = get_weapon_ent(id,CSW_AWP);
				if(pev_valid(wEnt)) cs_set_weapon_ammo(wEnt,max_clip);

				// update HUD
				message_begin(MSG_ONE,gmsgCurWeapon,_,id);
				write_byte(1);
				write_byte(CSW_AWP);
				write_byte(max_clip);
				message_end();

				// don't steal ammo from the player
				if(awp_bpammo[id] && awp_clip[id] > old_awp_clip)
					cs_set_user_bpammo(id,CSW_AWP,awp_bpammo[id]-max_clip+old_awp_clip);

				awp_clip[id] = max_clip;
			}
		}
		else awp_clip[id] = 999;
	}
	
	if(status) weapon[id] = read_data(4);
	
		// using m4
		if(read_data(4) == CSW_M4A1)
		{
			// current weapon
			if(status)
			{
				// save clip information
				new old_m4a1_clip = m4a1_clip[id];
				m4a1_clip[id] = read_data(5);
	
				new max_clip = get_pcvar_num(cv_m4a1_clip);
	
				// plugin enabled and must restrict ammo
				if(max_clip && m4a1_clip[id] > max_clip)
				{
					new wEnt = get_weapon_ent(id,CSW_M4A1);
					if(pev_valid(wEnt)) cs_set_weapon_ammo(wEnt,max_clip);
	
					// update HUD
					message_begin(MSG_ONE,gmsgCurWeapon,_,id);
					write_byte(1);
					write_byte(CSW_M4A1);
					write_byte(max_clip);
					message_end();
	
					// don't steal ammo from the player
					if(m4_bpammo[id] && m4a1_clip[id] > old_m4a1_clip)
						cs_set_user_bpammo(id,CSW_M4A1,m4_bpammo[id]-max_clip+old_m4a1_clip);
	
					m4a1_clip[id] = max_clip;
				}
			}
			else m4a1_clip[id] = 999;
	}
	else if(status) m4a1_clip[id] = 999;
 }

 // delayed record bpammo information
 public event_ammox(id)
 {
	// awp ammo type is 1
	if(read_data(1) == 1)
	{
		static parms[2];
		parms[0] = id;
		parms[1] = read_data(2);

		set_task(0.1,"record_ammo",id,parms,2);
	}
 }

 // delay, because ammox is called right before curweapon
 public record_ammo(parms[])
 {
	awp_bpammo[parms[0]] = parms[1];
 }

 // block reload based on new clip size
 public fw_cmdstart(player,uc_handle,random_seed)
 {
	new max_clip = get_pcvar_num(cv_awp_clip);

	if(weapon[player] == CSW_AWP && max_clip && awp_clip[player] >= max_clip)
	{
		set_uc(uc_handle,UC_Buttons,get_uc(uc_handle,UC_Buttons) & ~IN_RELOAD);
		return FMRES_HANDLED;
	}

	return FMRES_IGNORED;
 }

 // find a player's weapon entity
 stock get_weapon_ent(id,wpnid=0,wpnName[]="")
 {
	// who knows what wpnName will be
	static newName[32];

	// need to find the name
	if(wpnid) get_weaponname(wpnid,newName,31);

	// go with what we were told
	else formatex(newName,31,"%s",wpnName);

	// prefix it if we need to
	if(!equal(newName,"weapon_",7))
		format(newName,31,"weapon_%s",newName);

	new ent;
	while((ent = engfunc(EngFunc_FindEntityByString,ent,"classname",newName)) && pev(ent,pev_owner) != id) {}

	return ent;
 }
but if i put this amxx on my server
still working for awp with 1 shot, but no result on m4

what is the name for the m4 or other weapons?
__________________
193.192.59.43:27015 ----- italy ( 20 )
85.25.150.62:27015 ------ sHclachthaus ( 14 )
85.25.150.62:27055 ------ DeathMatch ( 20 )
85.25.150.62:27035 ------ Kreedz Hangout ( 18 )
85.214.100.160:27015 ---- 24/7 full house | **GG + DM** ( 32 )
93.190.64.150:27015 ----- Superhero (12)

Last edited by ExKiLL; 12-01-2007 at 14:06.
ExKiLL is offline
hazard1337
Senior Member
Join Date: Sep 2006
Old 04-12-2008 , 01:17   Re: Ammo per Clip for each Weapon?
Reply With Quote #5

You probably didnt set the right ammo or something, the code is almost an exact copy (nothing wrong with that)
__________________
[IMG]http://img139.**************/img139/1530/2sejaewg1.gif[/IMG]
If you +/- my K, leave your name.
I do not take requests VIA PM
Click on this before requesting/suggesting
This is your best friend
hazard1337 is offline
Send a message via Skype™ to hazard1337
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 11:13.


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