#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include <
cstrike >
#include < hamsandwich >
#include < fun >
//////////////Poket Knife////////////////////
new const v_poket [ 66 ] = "models/v_knife.mdl"
new const p_poket [ 66 ] = "models/p_knife.mdl"
///////////////////////////////////////////////
//////////////Butcher Knife////////////////////
new const v_butcher [ 66 ] = "models/v_butcher.mdl"
new const p_butcher [ 66 ] = "models/p_butcher.mdl"
///////////////////////////////////////////////
new bool: Knife [ 4 ]
new gravity_pointer
new cvar_gravity
new gravity1
public plugin_init() {
register_clcmd ( "say /knife" , "ShowMenu" );
register_event ( "CurWeapon", "KnifeModelSet", "be", "1=1" );
RegisterHam( Ham_Spawn, "player", "Remove_Knife", 1 )
gravity_pointer = get_cvar_pointer ( "sv_gravity" )
cvar_gravity = get_pcvar_num ( gravity_pointer )
gravity1 = register_cvar ( "gravity_1","400.0" )
/*
cvar_gravity=get_cvar_num("sv_gravity")
Totusi,prima metoda e mai eficienta asa ca folosim pointer-ul
*/
}
public plugin_precache() {
precache_model( v_poket )
precache_model( p_poket )
precache_model ( v_butcher )
precache_model ( p_butcher )
}
public KnifeModelSet(id) {
if( get_user_weapon( id )== CSW_KNIFE ) {
if( Knife [ 1 ] == true ) {
set_pev ( id, pev_viewmodel2, v_poket );
set_pev ( id, pev_weaponmodel2, p_poket );
set_pev ( id, pev_maxspeed, 300.0 );
}
if( Knife [ 2 ] == true ) {
set_pev ( id, pev_viewmodel2, v_butcher );
set_pev ( id, pev_weaponmodel2, p_butcher );
set_user_gravity( id, get_pcvar_float(gravity1) / cvar_gravity);
}
}
else set_user_gravity(id,float(cvar_gravity)/float(cvar_gravity))
}
public ShowMenu( id )
{
new menu = menu_create( "Knife Menu", "knife_handler" );
menu_additem( menu, "\wPro Jumpers \y[\r800 gravity\y]", "", 0 );
menu_additem( menu, "\wGravity Knife \y[\r400Pentru incepatori\y]", "", 0 );
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
menu_setprop( menu, MPROP_NOCOLORS, 1 );
menu_display( id, menu, 0 );
return PLUGIN_HANDLED;
}
public knife_handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_cancel(id);
return PLUGIN_HANDLED;
}
new command[6], name[64], access, callback;
menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);
switch(item)
{
case 0: {
Knife[ 1 ] = true
Knife[ 2 ] = false
Knife[ 3 ] = false
set_pev ( id, pev_maxspeed, 800.0 )
set_pev ( id, pev_viewmodel2, v_poket );
set_pev ( id, pev_weaponmodel2, p_poket );
}
case 1: {
Knife[ 2 ] = true
Knife[ 1 ] = false
Knife[ 3 ] = false
set_pev ( id, pev_viewmodel2, v_butcher );
set_pev ( id, pev_weaponmodel2, p_butcher );
}
}
menu_destroy( menu );
return PLUGIN_HANDLED;
}
public AddHp( id ) {
if( Knife[ 3 ] == true ) {
if( get_user_health( id ) <75 ) {
fm_set_user_health( id, get_user_health(id) + 5 )
}
set_task( 5.0, "AddHp", id )
}
}
public Remove_Knife( id ) {
Knife [ 1 ] = false
Knife [ 2 ] = false
}
stock fm_set_user_health( index, health ) {
health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index);
return 1;
}