View Single Post
al_capote69
New Member
Join Date: Dec 2017
Old 12-11-2017 , 14:55   Re: |HELP| JailBreak MOD : Change CT KNIFE DAMAGE ONLY !
Reply With Quote #7

This Is The Knife Or Taser That I Wan't To Edit The Damge Of It ! And i did put it on the top of the list and still doesn't work !
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <jailbreak_core>
#include <screenfade_util>
#include <fun>

#define set_flag(%1,%2)        (%1 |= (1<<(%2&31)))
#define remove_flag(%1,%2)    (%1 &= ~(1<<(%2&31)))
#define check_flag(%1,%2)    (%1 & (1<<(%2&31)))

new ITEM_IDCLASS_ID;
new const 
ITEM_NAME[] = "Taser";
new const 
ITEM_INFO[] = "Electrocution Shock!";
new const 
ITEM_COST 6000;
new const 
ITEM_TEAM TEAM_GUARDS;

new 
g_user_has_taserg_disallow_taser_dropg_user_paralyzedg_user_alive;

new 
V_TASER_MDL[64] = "models/jailbreak/v_taser.mdl";
new 
P_TASER_MDL[64] = "models/jailbreak/p_taser.mdl";
new 
W_TASER_MDL[64] = "models/jailbreak/w_taser.mdl";

// knife sounds
new const knife_sounds[][] = {
    
"weapons/knife_deploy1.wav",
    
"weapons/knife_hit1.wav",
    
"weapons/knife_hit2.wav",
    
"weapons/knife_hit3.wav",
    
"weapons/knife_hit4.wav",
    
"weapons/knife_hitwall1.wav",
    
"weapons/knife_slash1.wav",
    
"weapons/knife_slash2.wav",
    
"weapons/knife_stab.wav"
}

new const 
taser_sounds_keys[][] = {
    
"TASER_DEPLOY_SND",
    
"TASER_HIT1_SND",
    
"TASER_HIT2_SND",
    
"TASER_HIT3_SND",
    
"TASER_HIT4_SND",
    
"TASER_HITWALL1_SND",
    
"TASER_SLASH1_SND",
    
"TASER_SLASH2_SND",
    
"TASER_STAB_SND"
}

new 
taser_sounds[][64] = {
    
"jailbreak/taser_deploy1.wav",
    
"jailbreak/taser_hit1.wav",
    
"jailbreak/taser_hit2.wav",
    
"jailbreak/taser_hit3.wav",
    
"jailbreak/taser_hit4.wav",
    
"jailbreak/taser_hitwall1.wav",
    
"jailbreak/taser_slash1.wav",
    
"jailbreak/taser_slash2.wav",
    
"jailbreak/taser_stab.wav"
}

new const 
classname[] = "Security Guard";
new const 
classmodel[] = "security_guard";
new const 
classprimarywpns[] = "usp,glock18,deagle,p228,fiveseven";
new const 
classsecwpns[] = "flashbang,smokegrenade";
new const 
classvknifemdl[] = "models/jailbreak/v_taser.mdl";
new const 
classpknifemdl[] = "models/jailbreak/p_taser.mdl";
new const 
classknifesounds[] = "jailbreak/taser";
new const 
classteam TEAM_GUARDS;
new const 
classflag ADMIN_ALL;


stock const XO_CBASEPLAYERWEAPON 4;
stock const m_pPlayer 41;
stock const m_flNextPrimaryAttack 46;
stock const m_flNextSecondaryAttack 47;

public 
plugin_precache()
{
    for(new 
isizeof taser_sounds_keysi++)
    {
        
jb_ini_get_keyvalue("TASER"taser_sounds_keys[i], taser_sounds[i], charsmax(taser_sounds[]));
        
precache_sound(taser_sounds[i]);
    }
    
    
jb_ini_get_keyvalue("TASER""TASER_V_MDL"V_TASER_MDLcharsmax(V_TASER_MDL))
    
precache_model(V_TASER_MDL)
    
    
jb_ini_get_keyvalue("TASER""TASER_P_MDL"P_TASER_MDLcharsmax(P_TASER_MDL))
    
precache_model(P_TASER_MDL)
    
    
jb_ini_get_keyvalue("TASER""TASER_W_MDL"W_TASER_MDLcharsmax(W_TASER_MDL))
    
precache_model(W_TASER_MDL)
}

public 
jb_class_creation()
{
    
CLASS_ID register_jailbreak_class(classnameclassmodel,classprimarywpns,classsecwpns,classflag,
    
classteamclassvknifemdl,classpknifemdl,classknifesounds);
}

public 
plugin_init()
{
    
register_plugin("[JB] PLUGIN:Taser""v1.0""Natsheh");
    
    
ITEM_ID register_jailbreak_shopitem(ITEM_NAMEITEM_INFOITEM_COSTITEM_TEAM_, (1<<(DAY_NONE+1)));
    
    
RegisterHam(Ham_Touch"info_target""fw_touch_knife_pre")
    
RegisterHam(Ham_Item_Deploy"weapon_knife""fw_knife_deploy_post"1)
    
RegisterHam(Ham_TakeDamage"player""fw_player_takedmg_pre")
    
register_forward(FM_EmitSound"fw_EmitSound_pre")
    
RegisterHam(Ham_Spawn"player""fw_player_respawn_post"1)
    
RegisterHam(Ham_Player_PreThink"player""fw_player_prethink_post"1)
    
register_clcmd("drop""clcmd_drop")
    
    
register_event("DeathMsg""eDeathMsg""a");
}

public 
eDeathMsg()
{
    new 
vic read_data(2);
    
    if(
check_flag(g_user_paralyzed,vic))
    {
        new 
wpns[32];
        new 
amount get_user_weapons_ent(vicwpns);
        for(new 
iwentamounti++)
        {
            
went wpns[i];
            
set_pdata_float(wentm_flNextPrimaryAttack, -1.0XO_CBASEPLAYERWEAPON)
            
set_pdata_float(wentm_flNextSecondaryAttack, -1.0XO_CBASEPLAYERWEAPON)
        }
    }
    
    
remove_flag(g_user_has_taser,vic);
    
remove_flag(g_disallow_taser_drop,vic);
    
remove_flag(g_user_paralyzed,vic);
    
remove_flag(g_user_alive,vic);
}

public 
jb_day_started()
{
    
g_user_has_taser 0;
    
g_disallow_taser_drop 0;
    
g_user_paralyzed 0;
}

public 
jb_lr_duel_started()
{
    
g_user_has_taser 0;
    
g_disallow_taser_drop 0;
    
g_user_paralyzed 0;
}

stock get_user_weapons_ent(indexwpns_index[32])
{
    new 
wpns_amount;
    
get_user_weapons(indexwpns_indexwpns_amount)
    
    new 
sWpnname[32];
    for(new 
icswidwpns_amount;i++)
    {
        
cswid wpns_index[i];
        
get_weaponname(cswidsWpnnamecharsmax(sWpnname))
        
wpns_index[i] = find_ent_by_owner(-1sWpnnameindex);
    }
    
    return 
wpns_amount;
}

stock get_user_weapon_ent(index)
{
    new 
cswid get_user_weapon(index);
    if(!
cswid) return 0;
    new 
szWpnname[24];
    
get_weaponname(cswidszWpnnamecharsmax(szWpnname))
    return 
find_ent_by_owner(-1szWpnnameindex);
}

public 
fw_player_prethink_post(const player)
{
    if(!
check_flag(g_user_alive,player) || !check_flag(g_user_paralyzed,player)) return HAM_IGNORED;
    
    static 
iButtoniOldButtonsuserwpn;
    
iButton pev(playerpev_button);
    
iOldButtons pev(playerpev_oldbuttons);
    
    if(
iButton IN_ATTACK && !(iOldButtons IN_ATTACK))
    {
        
userwpn get_user_weapon_ent(player);
        if(
userwpn 0set_pdata_float(userwpnm_flNextPrimaryAttack9999.9XO_CBASEPLAYERWEAPON)
    }
    if(
iButton IN_ATTACK2 && !(iOldButtons IN_ATTACK2))
    {
        
userwpn get_user_weapon_ent(player);
        if(
userwpn 0set_pdata_float(userwpnm_flNextSecondaryAttack9999.9XO_CBASEPLAYERWEAPON)
    }
    if(
iButton IN_FORWARD || iButton IN_BACK || iButton IN_RUN || iButton IN_MOVELEFT || iButton IN_MOVERIGHT)
    {
        
set_pev(playerpev_maxspeed, -1.0)
        
client_print(playerprint_center"you are paralyzed!")
    }
    
    return 
HAM_IGNORED;
}

public 
fw_player_respawn_post(const id)
{
    if(!
is_user_alive(id)) return;
    
    
set_flag(g_user_alive,id);
    
remove_flag(g_user_has_taser,id);
    
remove_flag(g_disallow_taser_drop,id);
    
remove_flag(g_user_paralyzed,id)
    
    if(
jb_get_user_classid(id) != CLASS_ID) return;
    
    
give_taser(id);
    
set_flag(g_disallow_taser_drop,id);
}

public 
fw_EmitSound_pre(id, const channel, const sample[])
{
    if(!(
<= id <= 32)) return FMRES_IGNORED;
    if(!
check_flag(g_user_alive,id) || !check_flag(g_user_has_taser,id)) return FMRES_IGNORED;
    if(
get_user_weapon(id) != CSW_KNIFE) return FMRES_IGNORED;
    
    for(new 
0sizeof knife_soundsi++)
    {
        if(
equal(sampleknife_sounds[i]))
        {
            
emit_sound(idchanneltaser_sounds[i], VOL_NORMATTN_NORM0PITCH_NORM)
            return 
FMRES_SUPERCEDE;
        }
    }
    
    return 
FMRES_IGNORED;
}

public 
clcmd_drop(id)
{
    if(!
check_flag(g_user_alive,id)) return 0;
    if(
check_flag(g_user_paralyzed,id))
    {
        
client_print(idprint_center"you are paralyzed!")
        return 
1;
    }
    if(
get_user_weapon(id) == CSW_KNIFE && check_flag(g_user_has_taser,id) && !check_flag(g_disallow_taser_drop,id))
    {
        
remove_flag(g_user_has_taser,id);
        new 
wEnt;
        while((
wEnt engfunc(EngFunc_FindEntityByStringwEnt"classname""weapon_knife")) > && pev(wEntpev_owner) != id) { }
        if(!
wEnt) return 0;
        
ExecuteHamB(Ham_Item_DeploywEnt);
        
drop_taser(id);
        return 
1;
    }
    return 
0;
}

public 
fw_touch_knife_pre(const ent, const id)
{
    if(!
check_flag(g_user_alive,id)) return HAM_IGNORED;
    
    static 
sWpnname[32]
    
pev(entpev_classnamesWpnname31)
    
    if(
equal(sWpnname"weapon_taser"))
    {
        
engfunc(EngFunc_RemoveEntityent);
        
give_taser(id)
        return 
HAM_SUPERCEDE;
    }
    return 
HAM_IGNORED;
}

public 
fw_knife_deploy_post(const wEnt)
{
    new 
id get_pdata_cbase(wEntm_pPlayerXO_CBASEPLAYERWEAPON);
    if(!
check_flag(g_user_has_taser,id)) return HAM_IGNORED;
    
    
set_pev(idpev_viewmodel2V_TASER_MDL)
    
set_pev(idpev_weaponmodel2P_TASER_MDL)
    
    return 
HAM_HANDLED;
}

drop_taser(id)
{
    new 
ent create_entity("info_target");
    
    if(!
ent) return;
    
    new 
Float:fAim[3] , Float:fOrigin[3];
    
velocity_by_aim(id 64 fAim);
    
pev(id pev_origin fOrigin);
 
    
fOrigin[0] += fAim[0];
    
fOrigin[1] += fAim[1];
    
    
set_pev(entpev_classname"weapon_taser");
    
entity_set_model(entW_TASER_MDL)
    
set_pev(entpev_originfOrigin)
    
set_pev(entpev_solidSOLID_TRIGGER)
    
set_pev(entpev_movetypeMOVETYPE_TOSS);
}

give_taser(id)
{
    
set_flag(g_user_has_taser,id);
    new 
wEnt;
    while((
wEnt engfunc(EngFunc_FindEntityByStringwEnt"classname""weapon_knife")) > && pev(wEntpev_owner) != id) { }
    if(!
wEnt)
    {
        
give_item(id"weapon_knife");
        return 
0;
    }
    
ExecuteHamB(Ham_Item_DeploywEnt);
    return 
1;
}

public 
client_putinserver(id)
{
    
remove_flag(g_user_has_taser,id);
    
remove_flag(g_disallow_taser_drop,id);
    
remove_flag(g_user_paralyzed,id)
}

public 
jb_shop_item_bought(iditemid)
{
    if(
itemid == ITEM_ID)
    {
        
give_taser(id);
        
remove_flag(g_disallow_taser_drop,id)
    }
}

public 
jb_shop_item_postselect(iditemid)
{
    if(
itemid == ITEM_ID)
    {
        if(
check_flag(g_user_has_taser,id))
        {
            return 
JB_MENU_ITEM_UNAVAILABLE;
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
jb_shop_item_preselect(iditemid)
{
    if(
itemid == ITEM_ID)
    {
        if(
check_flag(g_user_has_taser,id))
        {
            return 
JB_MENU_ITEM_UNAVAILABLE;
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
fw_player_takedmg_pre(victiminflictorattackerFloat:damagedamagebits)
{
    if((
attacker <= 0) || inflictor != attacker) return HAM_IGNORED;
    
    if(
get_user_weapon(attacker) != CSW_KNIFE || !check_flag(g_user_has_taser,attacker)) return HAM_IGNORED;    
    
damage random_float(1.010.0);
    
SetHamParamFloat(4damage);
    
electrecuted(victimattackerinflictordamage)
    return 
HAM_SUPERCEDE;
}

public 
task_fadenormal(id)
{
    
UTIL_ScreenFade(id____FFADE_OUT)
    
    if(
check_flag(g_user_alive,id))
    {
        
set_pev(idpev_maxspeed250.0)
        
        new 
wpns[32];
        new 
amount get_user_weapons_ent(idwpns);
        for(new 
iwentamounti++)
        {
            
went wpns[i];
            
set_pdata_float(wentm_flNextPrimaryAttack, -1.0XO_CBASEPLAYERWEAPON)
            
set_pdata_float(wentm_flNextSecondaryAttack, -1.0XO_CBASEPLAYERWEAPON)
        }
    }
    
    
remove_flag(g_user_paralyzed,id)
}

electrecuted(victimattackerinflictorFloat:dmg)
{
    
// fade out 1 sec..
    
UTIL_FadeToBlack(victim0.1truefalse)
    if(!
task_exists(victim))
    {
        
set_flag(g_user_paralyzed,victim)
        
set_task(2.5"task_fadenormal"victim)
    }
    
    static 
Float:origin[3];
    
pev(attackerpev_originorigin)
    
    if(
dmg pev(victimpev_health)) ExecuteHamB(Ham_Killedvictimattacker0);
    else
    {
        
ExecuteHam(Ham_TakeDamagevictiminflictorattackerdmgDMG_SHOCK|DMG_SLOWBURN|DMG_ENERGYBEAM);
    }
    
    
// Lighting
    
engfunc(EngFunc_MessageBeginMSG_PASSVC_TEMPENTITYorigin0)
    
write_byte(TE_DLIGHT)
    
engfunc(EngFunc_WriteCoordorigin[0])
    
engfunc(EngFunc_WriteCoordorigin[1])
    
engfunc(EngFunc_WriteCoordorigin[2])
    
write_byte(10// radius
    
write_byte(125)
    
write_byte(125)
    
write_byte(0)
    
write_byte(5)
    
write_byte(1)
    
message_end()
    
    static 
Float:fview[3];
    
pev(attackerpev_view_ofsfview)
    
    
origin[0] += fview[0];
    
origin[1] += fview[1];
    
origin[2] += fview[2];
    
    
// Sparks
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYorigin0);
    
write_byte(TE_SPARKS)
    
engfunc(EngFunc_WriteCoordorigin[0])
    
engfunc(EngFunc_WriteCoordorigin[1])
    
engfunc(EngFunc_WriteCoordorigin[2])
    
message_end();


Last edited by al_capote69; 12-11-2017 at 14:59.
al_capote69 is offline