Raised This Month: $ Target: $400
 0% 

2 switchmodel in the same code


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 01-21-2022 , 12:13   2 switchmodel in the same code
Reply With Quote #1

Hello, I would like to be able to make two model changes in this code

PHP Code:


register_event
("CurWeapon""weapon_change""be""1=1")
register_event("Damage""batman_damage""b""2!0")


//----------------------------------------------------------------------------
public sh_hero_init(idheroIDmode)
{
    if ( 
gHeroID != heroID ) return

    switch(
mode) {
        case 
SH_HERO_ADD: {
            
gHasBatman[id] = true
            batman_giveweapons
(id)
            
switch_model(id)
        }
        case 
SH_HERO_DROP: {
            
gHasBatman[id] = false
            batman_dropweapons
(id)
        }
    }

    
sh_debug_message(id1"%s %s"gHeroNamemode "ADDED" "DROPPED")
}

//------------------------------------------------------------------
public weapon_change(id)
{
    
//do nothing if client does not have hero or sh is off
    
if ( !sh_is_active() || !gHasBatman[id] ) return
    
    new 
weaponID read_data(2)
    if (
weaponID !=CSW_KNIFE) return
        
switch_model(id)
        
    
//the read data is reading the weapon the client has out
    
new weaponID read_data(2)
    
//and if the client does not have the m4a1 out just do nothing
    
if (weaponID !=CSW_XM1014) return
        
switch_model(id)
        
    if (
read_data(3) == 0)
        {
        
sh_reload_ammo(id1)
        }
}
//---------------------------------------------------------------------
switch_model(id)
{
    
//if the sh mod is off the client is dead or he does not have the hero we do not want to let him have the weapon model!
    
if (!sh_is_active() || !is_user_alive(id) || !gHasBatman[id] ) return
    
    
//and now we check again if he still has the m4a1 out
    
if (get_user_weapon(id) == CSW_XM1014)
    {
        
//now he has all the requirements to have the weapon model so we also need to give it to him
    
set_pev(idpev_viewmodel2gBatItaca)
    
set_pev(idpev_weaponmodel2gBatItaca2)
    }    
    
    if (
get_user_weapon(id) == CSW_KNIFE)
    {
    
set_pev(idpev_viewmodel2gBatKnife)    
    }

Arje 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 14:31.


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