Raised This Month: $32 Target: $400
 8% 

ZP Extra Item assasin PROBLEM


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
surikata
Junior Member
Join Date: Jan 2018
Old 09-15-2018 , 11:05   ZP Extra Item assasin PROBLEM
Reply With Quote #1

Hello, I added regen hp for kill, double jump, speed and dmg lives in my plugin but somehow it does not work. Please anybody advise me?

Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
#include <fakemeta_util>
#include <zombieplague>
#include <engine>
#include <cstrike>

#define PLUGIN "[ZP] Extra Item: Assasin"
#define VERSION "1.1"
#define SPEED 5.0 
new const GRAVITY = 0.1
#define ASSASIN_KILLHP 1000	// Kolik zivotu dostane assasin za kill
#define ASSASIN_JUMPS 2	// Pocet skoku navic pro assasina
#define ASSASIN_MAXHP 20000 



new MaAssasina[ 33 ] = false;

new jumpnum[ 33 ] = 0



// Extra Item ID
new g_item_zforce

// PCVars
new pCvarAdditionalHealth, pCvarDmgMultiplier, pCvarGlowRed, pCvarGlowGreen, pCvarGlowBlue

// Player Variables
new gHasZForce[33]

// Credits to joaquimandrade
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame

// Extra Item name, cost and sound
new const g_item_name[] = "Zombie Force" // Item name
new const g_item_cost = 200 // Item cost
new const sound_force[] = "zombie_plague/buy_force.wav" // Sound
new const model_force[] = "models/player/assasin/assasin.mdl" // Model

public plugin_init()
{
register_plugin("[ZP] Extra Item: Assasin", "1.0", "eXcalibur.007")

g_item_zforce = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_ZOMBIE)

pCvarAdditionalHealth = register_cvar("zp_zforce_additional_health", "5000")
pCvarDmgMultiplier = register_cvar("zp_zforce_dmg_multi", "2.2")
pCvarGlowRed = register_cvar("zp_zforce_glow_red", "255")
pCvarGlowGreen = register_cvar("zp_zforce_glow_green", "32")
pCvarGlowBlue = register_cvar("zp_zforce_glow_blue", "82")

RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage_Pre")
RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_Player_ResetMaxSpeed_Post", 1)
RegisterHam(Ham_Killed, "player", "fw_Killed_Post", 1)


}

public plugin_precache()
{
precache_sound(sound_force)
precache_model(model_force)
}

public zp_extra_item_selected(player, itemid)
{
if(itemid == g_item_zforce)
{
if ( gHasZForce[ player ] )
{
zp_set_user_ammo_packs( player, zp_get_user_ammo_packs( player ) + g_item_cost )
client_print( player, print_center, "Uz mas Assasina!" )
return PLUGIN_HANDLED;
}
gHasZForce[player] = true

// Set player's health, gravity, etc.
set_user_health(player, get_user_health(player) + get_pcvar_num(pCvarAdditionalHealth))
set_user_gravity( player, GRAVITY );
ScreenFade( player, 0.8, 255, 32, 82, 80 );
set_user_rendering(player, kRenderFxGlowShell, get_pcvar_num(pCvarGlowRed), get_pcvar_num(pCvarGlowGreen), get_pcvar_num(pCvarGlowBlue), kRenderNormal, 25)
set_hudmessage(255, 32, 82 , -1.0, -1.0, 0, 6.0, 6.0)
show_hudmessage(player, "+DMG +RYCHLOST +5000HP +GRAVITACE")
// Plays a sound
emit_sound(player, CHAN_BODY, sound_force, 1.0, ATTN_NORM, 0, PITCH_NORM)
//Model
cs_set_user_model(player,"assasin")

static szName[32]
get_user_name(player, szName, charsmax(szName))

set_hudmessage(255, 32, 82 , 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1)
show_hudmessage(0, "%s se stal Assasinem!!", szName)

}
}

public fw_TakeDamage_Pre(victim, inflictor, attacker, Float:damage, damage_type)
{ 
if(!is_user_connected(attacker) || !is_user_connected(victim))
return HAM_IGNORED

if(get_user_weapon(attacker) == CSW_KNIFE && gHasZForce[attacker])
{
SetHamParamFloat( 4, damage * get_pcvar_float(pCvarDmgMultiplier) )
}
return HAM_IGNORED
}

public fw_Player_ResetMaxSpeed_Post(player)
{
if(!is_user_connected(player) || !is_user_alive(player) || !gHasZForce[player])
return

static Float:iMaxSpeed; iMaxSpeed = get_user_maxspeed(player)

// Not moving(Doesn't need to change since it's not moving)
if(iMaxSpeed != 10.0)
{
set_user_maxspeed(player,SPEED)
}
}
public remove_user_gHasZForce( id )
{
jumpnum[ id ] = 0
MaAssasina[ id ] = false
gHasZForce[ id ] = false
client_print( id, print_center, "Assasin ti na nove kolo vyprsel..." );

}

public fw_Killed_Post(victim, attacker)
{
if(!is_user_connected(victim))
return HAM_IGNORED

if(gHasZForce[victim])
gHasZForce[victim] = false

return HAM_IGNORED
} 
public event_death( ) 
{ 
new attacker = read_data( 1 ); 
new victim = read_data( 2 ); 

if( !is_user_alive( victim ) )
{
if( gHasZForce[ victim ] )
{
client_set_variables( victim );
}
}
if( is_user_alive( attacker ) )
{
if( gHasZForce[ attacker ] )
{
new iHealth = get_user_health( attacker ) 

if( iHealth >= ASSASIN_MAXHP ) // Health limit (bugfix)
{
return;
}
else
{
client_print( attacker, print_center, "+ %s HP", ASSASIN_KILLHP );
set_user_health( attacker, get_user_health( attacker ) + ASSASIN_KILLHP );
ScreenFade( attacker, 0.8, 255, 32, 82, 80 );
}
}
}
} 

public client_PreThink( id )
{
if( !is_user_alive( id ) ) 
return PLUGIN_CONTINUE;

if ( gHasZForce[ id ] )
{
new nbut = get_user_button( id )
new obut = get_user_oldbutton( id )
if(( nbut & IN_JUMP ) && !( get_entity_flags( id ) & FL_ONGROUND ) && !( obut & IN_JUMP ) )
{
if( jumpnum[ id ] < ASSASIN_JUMPS ) 
{

jumpnum[ id ]++
return PLUGIN_CONTINUE
}
}
if( ( nbut & IN_JUMP ) && ( get_entity_flags( id ) & FL_ONGROUND ) )
{
jumpnum[ id ] = 0
return PLUGIN_CONTINUE;
}
}
return PLUGIN_CONTINUE;
}



stock client_set_variables( i )
{
if( !is_user_connected( i ) || is_user_bot( i ) )
return;


cs_set_user_zoom( i, CS_RESET_ZOOM, 1 )

jumpnum[ i ]	= 0;

MaAssasina[ i ]	= false;
gHasZForce[ i ]	= false;

}

stock ScreenFade( plr, Float:fDuration, red, green, blue, alpha )
{
new i = plr ? plr : get_maxplayers( );
if( !i )
{
return 0;
}

message_begin( plr ? MSG_ONE : MSG_ALL, get_user_msgid( "ScreenFade" ), {0, 0, 0}, plr );
write_short( floatround( 4096.0 * fDuration, floatround_round ) );
write_short( floatround( 4096.0 * fDuration, floatround_round ) );
write_short( 4096 );
write_byte( red );
write_byte( green );
write_byte( blue );
write_byte( alpha );
message_end( );

return 1;

}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1029\\ f0\\ fs16 \n\\ par }
*/
surikata 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 09:32.


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