AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved AmmoX vs CurWeapon (https://forums.alliedmods.net/showthread.php?t=326466)

Abhinash 08-01-2020 12:10

AmmoX vs CurWeapon
 
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 ?

Shadows Adi 08-01-2020 15:42

Re: AmmoX vs CurWeapon
 
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

Abhinash 08-02-2020 04:31

Re: AmmoX vs CurWeapon
 
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;
}


DJEarthQuake 08-02-2020 08:40

Re: AmmoX vs CurWeapon
 
Neither. Pdata set on spawn. Working examples: Gungame and Powerplay.

Abhinash 08-02-2020 11:04

Re: AmmoX vs CurWeapon
 
Quote:

Originally Posted by DJEarthQuake (Post 2712697)
Neither. Pdata set on spawn. Working examples: Gungame and Powerplay.

Can't understand you bro

DJEarthQuake 08-02-2020 18:02

Re: AmmoX vs CurWeapon
 
Pdata accomplishes unlimited bullets while being called once. CurWeapon can become resource laden.

Abhinash 08-03-2020 05:01

Re: AmmoX vs CurWeapon
 
Quote:

Originally Posted by DJEarthQuake (Post 2712773)
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.

DJEarthQuake 08-03-2020 09:24

Re: AmmoX vs CurWeapon
 
1 Attachment(s)
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.

Abhinash 08-03-2020 15:50

Re: AmmoX vs CurWeapon
 
Thanks


All times are GMT -4. The time now is 13:44.

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