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

Solved AmmoX vs CurWeapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 08-01-2020 , 12:10   AmmoX vs CurWeapon
Reply With Quote #1

Hey there everyone.
So, I am making Unlimited Clip plugin with both Unlimited BP and Clip ammo features defined by CVAR.
I want to know which is best for setting BP ammo ? AmmoX or CurWeapon message ?

Last edited by Abhinash; 08-03-2020 at 15:51.
Abhinash is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 08-01-2020 , 15:42   Re: AmmoX vs CurWeapon
Reply With Quote #2

You should use curweapon because it's updating ammo and ammo type icon, and it's faster, but, of course you can even use hamsandwich to do this.

You should take a look here for unlimited clip: https://forums.alliedmods.net/showpo...82&postcount=2
and here to compare the events:
Curweapon: https://wiki.alliedmods.net/index.ph...ents#CurWeapon
Ammox: https://wiki.alliedmods.net/index.ph...e_Events#AmmoX
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 08-01-2020 at 15:48.
Shadows Adi is offline
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 08-02-2020 , 04:31   Re: AmmoX vs CurWeapon
Reply With Quote #3

I am using this stock and I want to build unlimited clip and unlimited BP ammo functionality both controlled by 1 and 2 in this stock. Can anyone tell me or show me how can I do it.

STOCK --
Code:
give_user_weapon( index , iWeaponTypeID , iClip=0 , iBPAmmo=0 , szWeapon[]="" , maxchars=0 )
{
	if ( !( CSW_P228 <= iWeaponTypeID <= CSW_P90 ) || ( iClip < 0 ) || ( iBPAmmo < 0 ) || !is_user_alive( index ) )
		return -1;
	
	new szWeaponName[ 20 ] , iWeaponEntity , bool:bIsGrenade;
	
	const GrenadeBits = ( ( 1 << CSW_HEGRENADE ) | ( 1 << CSW_FLASHBANG ) | ( 1 << CSW_SMOKEGRENADE ) | ( 1 << CSW_C4 ) );
	
	if ( ( bIsGrenade = bool:!!( GrenadeBits & ( 1 << iWeaponTypeID ) ) ) )
		iClip = clamp( iClip ? iClip : iBPAmmo , 1 );
	
	get_weaponname( iWeaponTypeID , szWeaponName , charsmax( szWeaponName ) );
	
	if ( ( iWeaponEntity = user_has_weapon( index , iWeaponTypeID ) ? find_ent_by_owner( -1 , szWeaponName , index ) : give_item( index , szWeaponName ) ) > 0 )
	{
		if ( iWeaponTypeID != CSW_KNIFE )
		{
			if ( iClip && !bIsGrenade )
				cs_set_weapon_ammo( iWeaponEntity , iClip );
		
			if ( iWeaponTypeID == CSW_C4 ) 
				cs_set_user_plant( index , 1 , 1 );
			else
				cs_set_user_bpammo( index , iWeaponTypeID , bIsGrenade ? iClip : iBPAmmo ); 
		}
		
		if ( maxchars )
			copy( szWeapon , maxchars , szWeaponName[7] );
	}
	
	return iWeaponEntity;
}
Abhinash is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 08-02-2020 , 08:40   Re: AmmoX vs CurWeapon
Reply With Quote #4

Neither. Pdata set on spawn. Working examples: Gungame and Powerplay.
__________________
DJEarthQuake is offline
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 08-02-2020 , 11:04   Re: AmmoX vs CurWeapon
Reply With Quote #5

Quote:
Originally Posted by DJEarthQuake View Post
Neither. Pdata set on spawn. Working examples: Gungame and Powerplay.
Can't understand you bro
Abhinash is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 08-02-2020 , 18:02   Re: AmmoX vs CurWeapon
Reply With Quote #6

Pdata accomplishes unlimited bullets while being called once. CurWeapon can become resource laden.
__________________
DJEarthQuake is offline
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 08-03-2020 , 05:01   Re: AmmoX vs CurWeapon
Reply With Quote #7

Quote:
Originally Posted by DJEarthQuake View Post
Pdata accomplishes unlimited bullets while being called once. CurWeapon can become resource laden.
Alright, can you provide the code for the pdata from Gungame and Powerplay ?
So, that it becomes. A bit easier for me to understand.
Abhinash is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 08-03-2020 , 09:24   Re: AmmoX vs CurWeapon
Reply With Quote #8

Gungame: Uses hash-map to set pdata. All mods.
https://forums.alliedmods.net/showthread.php?t=180714

Powerplay: Uses 2D array to set the Player's Data flags (pdata). Setting 1 integer gives all weapons and more ammo than anybody can shoot.
https://forums.alliedmods.net/showpo...04&postcount=6

Here is a pdata explorer pik I made so developers can explore short of recompiling script to test outcomes it will save a lot of fiddling. Instructions are in the script.
Attached Files
File Type: sma Get Plugin or Get Source (pdata_explorers_pik.sma - 72 views - 2.1 KB)
__________________
DJEarthQuake is offline
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 08-03-2020 , 15:50   Re: AmmoX vs CurWeapon
Reply With Quote #9

Thanks
Abhinash 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 13:00.


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