AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   all weapons Ham Deploy (https://forums.alliedmods.net/showthread.php?t=276313)

by4udilo 12-19-2015 06:05

all weapons Ham Deploy
 
I want change "weapon_knife" to all weapons in cs 1.6 or use another way...(?),How i can do it?



PHP Code:

public plugin_init( )
{
    
register_plugin    "test" "test" "test" )
//    register_event("CurWeapon","Cur_Weapon","be","1=1" ); no want use it
//      and this FwdPlayerPreThink...
    
RegisterHam(Ham_Item_Deploy,  , "Ham_Item_Deploy_Post"1);
}
public 
Ham_Item_Deploy_Post(weapon_ent){
    new 
id get_pdata_cbase(weapon_ent41)
    
// my code...



Rirre 12-19-2015 08:39

Re: all weapons Ham Deploy
 
Code:
#include <amxmodx> #include <hamsandwich> new const g_szWeaponList[][] = {     "weapon_usp",     "weapon_glock18",     "weapon_deagle",     "weapon_p228",     "weapon_elite",     "weapon_fiveseven",     "weapon_m3",     "weapon_xm1014",     "weapon_mp5navy",     "weapon_tmp",     "weapon_p90",     "weapon_mac10",     "weapon_ump45",     "weapon_famas",     "weapon_sg552",     "weapon_ak47",     "weapon_m4a1",     "weapon_aug",     "weapon_scout",     "weapon_awp",     "weapon_g3sg1",     "weapon_sg550",     "weapon_galil",     "weapon_m249",     "weapon_hegrenade",     "weapon_smokegrenade",     "weapon_flashbang",     "weapon_c4",     "weapon_shield" }; // Extra offsets #define linux_weapons_diff  4 #define mac_weapons_diff    linux_weapons_diff // not sure if mac is using the same // CBasePlayerItem #define m_pPlayer           41 #define HOOK_COUNT 1 * (sizeof g_szWeaponList) new HamHook:hamhooks[HOOK_COUNT]; public plugin_precache() {     new count = 0;     for( new i; i < sizeof g_szWeaponList; i++ )     {         hamhooks[count++] = RegisterHam( Ham_Item_Deploy, g_szWeaponList[i], "Ham_Item_Deploy_Post", true );     } } public plugin_init() {     for( new i; i < sizeof hamhooks; i++ )     {         EnableHamForward( hamhooks[i] );     } } public plugin_pause() {     for ( new i; i < sizeof hamhooks; i++ )     {         DisableHamForward( hamhooks[i] );     } } public plugin_unpause() {     for ( new i; i < sizeof hamhooks; i++ )     {         EnableHamForward( hamhooks[i] );     } } public Ham_Item_Deploy_Post( iItem ) {     new iPlayer;     iPlayer = get_pdata_cbase(iItem, m_pPlayer, linux_weapons_diff, mac_weapons_diff);     // do stuff }

by4udilo 12-19-2015 09:11

Re: all weapons Ham Deploy
 
very nice!Very thx!:fox::fox::fox:

Bugsy 12-19-2015 12:34

Re: all weapons Ham Deploy
 
@by4udilo: What exactly are you trying to do? You may not even need to use ItemDeploy.

@Rirre: Is there a reason you are enabling the forwards at plugin_init()? They are enabled upon creation at plugin_precache().

This is pointless and doesn't improve functionality/readability, IMO. Plus, you do not use HOOK_COUNT anywhere else. Why are you multiplying by 1? If you do insist on using a variable to store the number of weapons/hooks, at least use it everywhere that this value is used (in all for loops).
PHP Code:

#define HOOK_COUNT 1 * (sizeof g_szWeaponList)
new HamHook:hamhooks[HOOK_COUNT];

//Just do 
new HamHook:hamhookssizeofg_szWeaponList ) ]; 

What is the purpose of this count variable, why not use i to index hamhooks?
PHP Code:

public plugin_precache()
{
    new 
count 0;

    for( new 
isizeof g_szWeaponListi++ )
    {
        
hamhooks[count++] = RegisterHamHam_Item_Deployg_szWeaponList[i], "Ham_Item_Deploy_Post"true );
    }



by4udilo 12-19-2015 14:08

Re: all weapons Ham Deploy
 
i want delete draw animation in all weapons.

Bugsy 12-19-2015 14:40

Re: all weapons Ham Deploy
 
Like this?

https://forums.alliedmods.net/showpo...0&postcount=13

Bugsy 12-19-2015 18:24

Re: all weapons Ham Deploy
 
I guess I don't understand exactly what you are trying to block. Instead of describing it as 'draw' animation, can you tell me visually what animation you want blocked?

Bugsy 12-20-2015 10:25

Re: all weapons Ham Deploy
 
This code does what is in video 1. What else do you need done besides this?
PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "HLTV bug"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_UpdateClientData"UpdateClientData"1)
}

public 
UpdateClientData(idsendweaponscd)
{
    if( 
sendweapons )
    {
        if( 
get_cd(cdCD_WeaponAnim) )
        {
            
set_cd(cdCD_WeaponAnim0)
        }
    }



by4udilo 12-20-2015 10:44

Re: all weapons Ham Deploy
 
stop trolling,this sh*t delete all animations: reload,shot1,shot2 etc.

Bugsy 12-20-2015 11:08

Re: all weapons Ham Deploy
 
Stop trolling? Ok dude have fun figuring this out.


All times are GMT -4. The time now is 18:00.

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