View Single Post
Author Message
mikaelnatan13
Member
Join Date: Apr 2020
Old 07-10-2020 , 17:32   P, V, model file does not work
Reply With Quote #1

p v file of the skin of the weapon does not work stays the weapon with the standard skin

PHP Code:
#include <amxmodx>
#include <fun>
#include <engine>
#include <hamsandwich>
#include <zombieplague>

#define PLUGIN "[ZP] Flame M4A1"
#define VERSION "1.0"
#define AUTHOR "Itzal"

// Models
new const mdl_v[] = "models/v_flame_m4a1.mdl"
new const mdl_p[] = "models/p_flame_m4a1.mdl"

// Macros
new g_MaxPlayers
#define IsValidUser(%1) (1 <= %1 <= g_MaxPlayers)

// Weapon cost
#define WEAPON_COST 15

// Old ZP version?
// #define OLD_VERSION

// ZP default Burn sounds
new const burn_sounds[ ][ ] =
{
    
"zombie_plague/zombie_burn3.wav",
    
"zombie_plague/zombie_burn4.wav",
    
"zombie_plague/zombie_burn5.wav",
    
"zombie_plague/zombie_burn6.wav",
    
"zombie_plague/zombie_burn7.wav"
}

// Item ID,  Flame Sprite, Smoke sprite
new g_ItemIDsprFlamesprSmoke

// Some bools
new bool:g_bFlameM4a133 ]
new 
bool:g_AlreadyBurn33 ]

// Cvars
new cvar_MaxBurnDMGcvar_MinBurnDMGcvar_BurnTimecvar_Delaycvar_OneRound

// Cached Cvars
new cvar_cMaxBurnDMGcvar_cMinBurnDMGcvar_cBurnTimeFloat:cvar_cDelay
new Time33 ]

public 
plugin_init( )
{
    
register_pluginPLUGINVERSIONAUTHOR )

    
// Get maxplayers
    
g_MaxPlayers get_maxplayers( )

    
// CVARs
    
cvar_MaxBurnDMG register_cvar"zp_flamem4_maxdmg""50" )
    
cvar_MinBurnDMG register_cvar"zp_flamem4_mindmg""20" )
    
cvar_BurnTime register_cvar"zp_flamem4_time""12" )    // Real Time = Time/2
    
cvar_Delay register_cvar"zp_flamem4_delay""4.0" )
    
cvar_OneRound register_cvar"zp_flamem4_oneround""1" )

    
// Cache cvars
    
register_event"HLTV""event_round_start""a""1=0""2=0" )

    
// Hook drop
    
register_clcmd"drop""HookDrop" )

    
// Register the extraitem
    
g_ItemID zp_register_extra_item"Flame M4A1"WEAPON_COSTZP_TEAM_HUMAN )

    
// Ham forwards
    
RegisterHamHam_Spawn"player""fw_PlayerSpawn_Post")
    
RegisterHamHam_Killed"player""fw_PlayerKilled_Post")
    
RegisterHamHam_TakeDamage"player""fw_TakeDamage" )

    
// Gamemonitor info
    
static szCvar30 ]
    
formatexszCvarcharsmax(szCvar), "v%s by Javivi"VERSION )
    
register_cvar"zp_flamem4_version"szCvarFCVAR_SERVER|FCVAR_SPONLY )
}

public 
plugin_precache( )
{
    
// Precache flame/smoke sprite
    
sprFlame precache_model"sprites/flame.spr" )
    
sprSmoke precache_model"sprites/black_smoke3.spr" )

    
// Precache Burn sounds
    
for( new 0sizeof burn_soundsi++ )
        
precache_soundburn_sounds] )
}

// Cache CVARs
public event_round_start( )
{
    
cvar_cMaxBurnDMG get_pcvar_numcvar_MaxBurnDMG )
    
cvar_cMinBurnDMG get_pcvar_numcvar_MinBurnDMG )
    
cvar_cBurnTime get_pcvar_numcvar_BurnTime )
    
cvar_cDelay get_pcvar_floatcvar_Delay )
}

public 
client_disconnectid )
{
    if( 
g_bFlameM4a1id ] )
        
g_bFlameM4a1id ] = false

    
// Reset Time Counter
    
Timeid ] = 0
}

public 
HookDropid )
{
    
// If some human drop the FlameM4a1
    
if(is_user_aliveid ) && get_user_weaponid ) == CSW_M4A1 && g_bFlameM4a1 id ] )
    {
        
g_bFlameM4a1id ] = false
    
}
}
/*========================
* Zombie Plague Forwards *
=========================*/
// When someone buy the extraitem
public zp_extra_item_selectediditemid )
{
    if( 
itemid == g_ItemID )
    {
        if( !
zp_has_round_started( ) || g_bFlameM4a1id ] )
        {
            
client_print(idprint_chat"Você não pode comprar M4a1 de fogo neste momento!")

            
#if defined OLD_VERSION

            
zp_set_user_ammo_packsidzp_get_user_ammo_packs(id) + WEAPON_COST )

            
#else

            
return ZP_PLUGIN_HANDLED

            
#endif
        
}
        else
        {
            
// Give auto-shotgun
            
give_itemid"weapon_m4a1" )

            
// Give ammo
            
give_itemid"ammo_buckshot" )
            
give_itemid"ammo_buckshot" )
            
give_itemid"ammo_buckshot" )
            
give_itemid"ammo_buckshot" )

            
// Set FlameM4a1
            
g_bFlameM4a1id ] = true
        
}
    }
    return 
PLUGIN_HANDLED;
}

// When someone is infected
public zp_user_infected_postid )
{
    if( 
g_bFlameM4a1id ] ) // If have a FlameM4a1
        
g_bFlameM4a1id ] = false
}

/*==============
* Ham Forwards *
==============*/
public fw_PlayerSpawn_Postid )
{
    if( 
get_pcvar_numcvar_OneRound ) == && g_bFlameM4a1id ] )
    {
        
client_print(idprint_chat"[ZP] FlameM4a1 bullets are over!")
        
g_bFlameM4a1id ] = false
    
}
}
public 
fw_PlayerKilled_Postvictimattackershouldgib )
{
    if(
g_bFlameM4a1victim ] ) // If have a FlameM4a1
        
g_bFlameM4a1victim ] = false
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if(
IsValidUserattacker ) && victim != attacker && zp_get_user_zombievictim // If attacker is valid and victim is zombie
    
&& g_bFlameM4a1attacker ] && get_user_weaponattacker ) == CSW_M4A1 && !g_AlreadyBurnvictim ] ) // If attacker have the FlameM4a1 and victim is not burned
    
{
        
// Burn / ON
        
g_AlreadyBurnvictim ] = true

        
// Set burn time
        
Timevictim ] = cvar_cBurnTime

        
// Burn victim
        
Burnvictim )

        
// Emit burn sound
        
emit_soundvictimCHAN_VOICEburn_sounds[random_num(0sizeof burn_sounds 1)], 1.0ATTN_NORM0PITCH_NORM )
    }
}

/*======================================================*/
public Burnvictim )
{
    
// Get user origin
    
static Origin] ; get_user_originvictimOrigin )

    
// If burn time is over or victim are in water
    
if( Timevictim ] <= || get_entity_flagsvictim ) & FL_INWATER )
    {
        
// Show Smoke sprite
        
message_beginMSG_PVSSVC_TEMPENTITYOrigin )
        
write_byteTE_SMOKE // TE id
        
write_coordOrigin[0] ) // x
        
write_coordOrigin[1] ) // y
        
write_coordOrigin[2]-50 // z
        
write_shortsprSmoke // sprite
        
write_byterandom_num(1520) ) // scale
        
write_byterandom_num(1020) ) // framerate
        
message_end( )

        
// Delay to allow burn again
        
set_taskcvar_cDelay"Stop"victim )

        
// Exit
        
return
    }
    else
    {
        if( 
cvar_cBurnTime == Timevictim ]) // At half-burntime
        
{
            
// Play another sound
            
emit_soundvictimCHAN_VOICEburn_sounds[random_num(0sizeof burn_sounds 1)], 1.0ATTN_NORM0PITCH_NORM )
        }

        
// Flame sprite
        
message_beginMSG_PVSSVC_TEMPENTITYOrigin )
        
write_byteTE_SPRITE // TE id
        
write_coordOrigin[0]+random_num(-55) ) // x
        
write_coordOrigin[1]+random_num(-55) ) // y
        
write_coordOrigin[2]+random_num(-1010) ) // z
        
write_shortsprFlame // sprite
        
write_byterandom_num(510) ) // scale
        
write_byte255 // brightness
        
message_end( )

        
// Decrease Time
        
Timevictim ]--

        
// Decrease life (random)
        
set_user_healthvictimget_user_healthvictim ) - random_numcvar_cMinBurnDMGcvar_cMaxBurnDMG ) )

        
// Repeat
        
set_task0.5"Burn"victim )
    }
}

public 
Stopvictim )
        
g_AlreadyBurnvictim ] = false // Allow victim to be burn again 
mikaelnatan13 is offline