Raised This Month: $ Target: $400
 0% 

CurrentWeapon X Ham_Item_Deploy [HELP]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
MeliMeli
Senior Member
Join Date: Apr 2022
Location: Brazil
Old 04-26-2023 , 18:03   CurrentWeapon X Ham_Item_Deploy [HELP]
Reply With Quote #1

Hello people, I have a doubt as to how to change a model of a gun. Of course, Ham_Item_Deploy is the best option from what I've seen in several posts researching. But I'm in doubt about a plugin because it uses CurrentWeapon and Ham_item_deploy.

First:

PHP Code:
register_event("CurWeapon","CurrentWeapon","be","1=1"
In this event he:

PHP Code:
public CurrentWeapon(id)
{
     
replace_weapon_models(idread_data(2))

     if(
read_data(2) != CSW_AWP || !g_has_sniper[id])
          return
     
     static 
Float:iSpeed
     
if(g_has_sniper[id])
          
iSpeed get_pcvar_float(cvar_spd_sniper)
     
     static 
weapon[32],Ent
     get_weaponname
(read_data(2),weapon,31)
     
Ent find_ent_by_owner(-1,weapon,id)
     if(
Ent)
     {
          static 
Float:Delay
          Delay 
get_pdata_floatEnt464) * iSpeed
          
if (Delay 0.0)
          {
               
set_pdata_float(Ent46Delay4)
          }
     }

But he also uses Ham_Item_Deploy:

PHP Code:
    for (new 1sizeof WEAPONENTNAMESi++)
    if (
WEAPONENTNAMES[i][0]) RegisterHam(Ham_Item_DeployWEAPONENTNAMES[i], "fw_Item_Deploy_Post"1)
  
public 
fw_Item_Deploy_Post(weapon_ent)
{
    static 
owner
    owner 
fm_cs_get_weapon_ent_owner(weapon_ent)
    
    static 
weaponid
    weaponid 
cs_get_weapon_id(weapon_ent)
    
    
replace_weapon_models(ownerweaponid)
}

replace_weapon_models(idweaponid)
{
    switch (
weaponid)
    {
        case 
CSW_AWP:
        {
            if (
zp_get_user_zombie(id) || zp_get_user_survivor(id))
                return
            
            if(
g_has_sniper[id])
            {
                
set_pev(idpev_viewmodel2sniper_V_MODEL)
                
set_pev(idpev_weaponmodel2sniper_P_MODEL)
                if(
oldweap[id] != CSW_AWP
                {
                    
UTIL_PlayWeaponAnimation(idsniper_DRAW)
                    
set_pdata_float(idm_flNextAttack1.0PLAYER_LINUX_XTRA_OFF)

                    
message_begin(MSG_ONEgmsgWeaponList, {0,0,0}, id)
                    
write_string("weapon_sniperultra")
                    
write_byte(4)
                    
write_byte(90)
                    
write_byte(-1)
                    
write_byte(-1)
                    
write_byte(0)
                    
write_byte(16)
                    
write_byte(CSW_AWP)
                    
message_end()
                }
            }
        }
    }
    
oldweap[id] = weaponid

I noticed that if I remove the curweapon event, in the WeaponPickup event the sniper model defaults. Shouldn't ham_item_deploy switch? And also, currentweapon doesn't change the model every time the weapon is updated, so what is ham_item_deploy going to do?

And worse, will there be 2 functions working to change the model?

Last edited by MeliMeli; 04-26-2023 at 18:03.
MeliMeli is offline
 



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 07:45.


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