Raised This Month: $12 Target: $400
 3% 

[ZP] Special ammo (Help)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
artos
Senior Member
Join Date: Mar 2010
Old 08-30-2010 , 05:32   [ZP] Special ammo (Help)
Reply With Quote #1

Hi! I wanted to mixed up two plugins, but one function isn't working. Ice bullets should slow down zombie (-50 speed) and turn back to normal in 5 seconds, fire bullets shoud slow down zombie a bit (-20 speed) and turn back to normal in same time.

I don't know what's wrong so please help me. Thanks.

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

#define PLUGIN "[ZP] Flame XM1014"
#define VERSION "1.0"
#define AUTHOR "Javivi, nikhilgupta345"

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

// Weapon cost
#define WEAPON_COST 12
#define WEAPON_COST2 10

// Old 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_ItemIDg_ItemID2sprFlamesprSmoke

// Some bools
new bool:g_bFlameXM101433 ]
new 
bool:HasIce33 ]
new 
bool:g_AlreadySlow33 ]
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_fb_maxdmg""5" )
    
cvar_MinBurnDMG register_cvar"zp_fb_mindmg""1" )
    
cvar_BurnTime register_cvar"zp_fb_time""8" )    // Real Time = Time/2
    
cvar_Delay register_cvar"zp_fb_delay""6.0" )
    
cvar_OneRound register_cvar"zp_fb_oneround""1" )
    
    
// Cache cvars
    
register_event"HLTV""event_round_start""a""1=0""2=0" )
    
    
// Register the extraitem
    
g_ItemID zp_register_extra_item"Fire Bullets"WEAPON_COSTZP_TEAM_HUMAN )
    
g_ItemID2 zp_register_extra_item"Ice Bullets"WEAPON_COST2ZP_TEAM_HUMAN )
    
    
// Ham fwds
    
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_flamexm_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_bFlameXM1014id ] )
        
g_bFlameXM1014id ] = false
    
if( HasIce id ] )    
        
HasIce id ] = false
        
    
// Reset Time Counter
    
Timeid ] = 0
}

/*========================
* Zombie Plague Forwards *
=========================*/
// When someone buy the extraitem
public zp_extra_item_selectediditemid )
{
    if( 
itemid == g_ItemID )
    {
        if( !
zp_has_round_started( ) || g_bFlameXM1014id ] || HasIce id ])
        {
            
client_print(idprint_chat"Round not started yet or you already own special ammo.")
            
            
#if defined OLD_VERSION
            
            
zp_set_user_ammo_packsidzp_get_user_ammo_packs(id) + WEAPON_COST )    
            
            
#else
            
            
return ZP_PLUGIN_HANDLED
            
            
#endif
            
        
}
        else
        {            
            
// Set FlameXM1014
            
g_bFlameXM1014id ] = true
            client_print
(idprint_chat"You bought fire bullets.")
        }
    }
    if( 
itemid == g_ItemID2 )
    {
        if( !
zp_has_round_started( ) || g_bFlameXM1014id ] || HasIce id ])
        {
            
client_print(idprint_chat"Round not started yet or you already own special ammo")
            
            
#if defined OLD_VERSION
            
            
zp_set_user_ammo_packsidzp_get_user_ammo_packs(id) + WEAPON_COST )    
            
            
#else
            
            
return ZP_PLUGIN_HANDLED
            
            
#endif
            
        
}
        else
        {
            
HasIce id ] = true
            client_print
(idprint_chat"You bought ice bullets.")
        }
        
    }

    return 
PLUGIN_HANDLED;
}

// When someone is infected
public zp_user_infected_postid )
{
    if( 
g_bFlameXM1014id ] ) // If have a FlameXM1014
        
g_bFlameXM1014id ] = false
    
if( HasIce id ] )
        
HasIce id ] = false    
    
}

/*==============
* Ham Forwards *
==============*/
public fw_PlayerSpawn_Postid )
{
    if( 
get_pcvar_numcvar_OneRound ) == || g_bFlameXM1014id ] == true || HasIceid ] == true)
    {
        
client_print(idprint_chat"[ZP] Your special ammo ran out!")
        
g_bFlameXM1014id ] = false
        HasIce 
id ] = false
    
}
}
public 
fw_PlayerKilled_Postvictimattackershouldgib )
{
    if(
g_bFlameXM1014victim ] ) // If have a FlameXM1014
        
g_bFlameXM1014victim ] = false
    
if(HasIce victim ] )
    
HasIce victim ] = false
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if(
IsValidUserattacker ) && victim != attacker && zp_get_user_zombievictim // If attacker is valid and victim is zombie
    
&& g_bFlameXM1014attacker ] && !g_AlreadyBurnvictim ] ) // If attacker have the FlameXM1014 and victim is not burned
    
{
        
// Burn / ON
        
g_AlreadyBurnvictim ] = true
        
        
// Set burn time
        
Timevictim ] = cvar_cBurnTime
        
        
// Burn victim
        
Burnvictim )
        
        if( !
g_AlreadySlowvictim ] )
        {
        
set_user_maxspeed(victimget_user_maxspeed(victim) - 20.0)
        
set_task(5.0"ResetSpeed2"victim__"a"1)
        }
        
        
// Emit burn sound        
        
emit_soundvictimCHAN_VOICEburn_sounds[random_num(0sizeof burn_sounds 1)], 1.0ATTN_NORM0PITCH_NORM )  
    }
    if(
IsValidUserattacker ) && victim != attacker && zp_get_user_zombievictim // If attacker is valid and victim is zombie
    
&& HasIceattacker ] && !g_AlreadySlowvictim ] ) // If attacker have the FlameXM1014 and victim is not burned
    
{
        
// Burn / ON
        
g_AlreadySlowvictim ] = true
        
        
// Burn victim
        
set_user_maxspeed(victimget_user_maxspeed(victim) - 50.0)
        
        
set_task(5.0"ResetSpeed"victim__"a"1)
    }
}

public 
ResetSpeed(victim)
{
  
set_user_maxspeed(victimget_user_maxspeed(victim) + 50.0)
  
g_AlreadySlowvictim ] = false
}

public 
ResetSpeed2(victim)
{
  
set_user_maxspeed(victimget_user_maxspeed(victim) + 20.0)
}

/*======================================================*/
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_byte200 // 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 burn again 
__________________
artos is offline
Send a message via Skype™ to artos
almat123
Junior Member
Join Date: Oct 2012
Location: Zombie Is My House :)
Old 10-27-2012 , 09:10   Re: [ZP] Special ammo (Help)
Reply With Quote #2

Give Me Sam + plauins file please
almat123 is offline
Send a message via Skype™ to almat123
Reply



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 21:03.


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