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

CS/CZ Ricochet v2.01


Post New Thread Reply   
 
Thread Tools Display Modes
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 09-16-2009 , 10:35   Re: CS/CZ Ricochet v2.0
Reply With Quote #51

Can you add "ric_angle" by weapon classes ?

ric_pistols 1
ric_angle_pistols 30
ric_shotguns 1
ric_angle_shotguns 40
ric_smgs 1
ric_angle_smgs 35
ric_rifles 1
ric_angle_rifles 20
ric_snipers 1
ric_angle_snipers 5

these are just example cvar values
Costin83 is offline
Send a message via Yahoo to Costin83
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-16-2009 , 10:57   Re: CS/CZ Ricochet v2.0
Reply With Quote #52

Quote:
Originally Posted by Costin83 View Post
Can you add "ric_angle" by weapon classes ?

ric_pistols 1
ric_angle_pistols 30
ric_shotguns 1
ric_angle_shotguns 40
ric_smgs 1
ric_angle_smgs 35
ric_rifles 1
ric_angle_rifles 20
ric_snipers 1
ric_angle_snipers 5

these are just example cvar values
Yes!
Added in to do list!
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 09-16-2009 , 12:17   Re: CS/CZ Ricochet v2.0
Reply With Quote #53

Thanks OT for taking my opinion in consideration.
Now it will be a little more realistic
Costin83 is offline
Send a message via Yahoo to Costin83
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 10-12-2009 , 19:04   Re: CS/CZ Ricochet v2.01
Reply With Quote #54

Readded the plugin with small improvements. Can be moved to approved now.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
sign92
Member
Join Date: Aug 2009
Old 12-22-2009 , 17:54   Re: CS/CZ Ricochet v2.01
Reply With Quote #55

Can you add a cvar for turning off damage to the shooter? In example when you stay against the wall and shoot you hurt yourself.
sign92 is offline
justincase
Senior Member
Join Date: Dec 2008
Old 03-02-2010 , 17:02   Re: CS/CZ Ricochet v2.01
Reply With Quote #56

for some reason this one also crashes my cs 1.6
idk whats happening .. maybe im missing sprites or something
justincase is offline
Gorrr
Junior Member
Join Date: Jan 2010
Old 05-17-2010 , 14:31   Re: CS/CZ Ricochet v2.01
Reply With Quote #57

I have a problem every 20-180 seconds:
L 05/17/2010 - 00:56:57: Start of error session.
L 05/17/2010 - 00:56:57: Info (map "de_train") (file "addons/amxmodx/logs/error_20100517.log")
L 05/17/2010 - 00:56:57: [CSTRIKE] Player out of range (0)
L 05/17/2010 - 00:56:57: [AMXX] Displaying debug trace (plugin "ricochet.amxx")
L 05/17/2010 - 00:56:57: [AMXX] Run time error 10: native error (native "cs_get_user_money")
L 05/17/2010 - 00:56:57: [AMXX] [0] 51539.attach::fw_killed (line 136)
L 05/17/2010 - 01:034: [CSTRIKE] Player out of range (0)
L 05/17/2010 - 01:034: [AMXX] Displaying debug trace (plugin "ricochet.amxx")
L 05/17/2010 - 01:034: [AMXX] Run time error 10: native error (native "cs_get_user_money")
L 05/17/2010 - 01:034: [AMXX] [0] 51539.attach::fw_killed (line 136)
Gorrr is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 09-24-2010 , 14:53   Re: CS/CZ Ricochet v2.01
Reply With Quote #58

o.O
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
ExAnimo
Junior Member
Join Date: Nov 2010
Location: Russia
Old 12-04-2010 , 12:35   Re: CS/CZ Ricochet v2.01
Reply With Quote #59

Please add chance in the form of percent of probability of a successful ricochet
ExAnimo is offline
Old 03-21-2012, 17:36
dOme
This message has been deleted by dOme. Reason: gkvhjb
intercostal_noisE
Member
Join Date: May 2014
Old 08-06-2014 , 12:19   Re: CS/CZ Ricochet v2.01
Reply With Quote #60

I've added percantual chance ... here's the code:


PHP Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

#define PLUGIN    "Ricochet"
#define AUTHOR    "OT"
#define VERSION    "2.01"

#define MAX_PLAYERS            32

#define BS_IGNORE_WEAPONS    (1<<CSW_KNIFE)
#define    HIT_SHIELD            8
#define MAX_MONEY            16000

const BS_PISTOLS      =    ((1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE))
const 
BS_SHOTGUN       =    ((1<<CSW_XM1014)|(1<<CSW_M3))
const 
BS_SUBMGS       =    ((1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_MP5NAVY)|(1<<CSW_TMP)|(1<<CSW_P90))
const 
BS_RIFLES        =   ((1<<CSW_AUG)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_M249)|(1<<CSW_M4A1)|(1<<CSW_SG552)|(1<<CSW_AK47))
const 
BS_SNIPERS    =   ((1<<CSW_SCOUT)|(1<<CSW_SG550)|(1<<CSW_AWP)|(1<<CSW_G3SG1))

#define floatclamp(%1, %2, %3)     Float:(%2 <= %1 <= %3) ? Float:(%1) : Float:(%1 <= %2) ? Float:(%2) : Float:(%3)
#define ANGLE_RIC_MAX_COS        floatcos( (90.0 - floatclamp(get_pcvar_float(pcv_angles), 0.0, 90.0) ), degrees)

/*
C : concrete        
D : dirt    
G : grate      - metal like 
M : metal 
N : snow
P : computer    
S : slosh      - noroi
T : tile      - tigla
V : ventilation          
W : wood        
Y : glass
*/

new const material_array[] = 
{
    
'C''D''G''M''N''P''S''T''V''W''Y'
}

#define MATERIAL_CONCRETE    (1<<0)
#define MATERIAL_DIRT        (1<<1)
#define MATERIAL_GRATE        (1<<2)
#define MATERIAL_METAL        (1<<3)
#define MATERIAL_SNOW        (1<<4)
#define MATERIAL_COMPUTER    (1<<5)
#define MATERIAL_SLOSH        (1<<6)
#define MATERIAL_TILE        (1<<7)
#define MATERIAL_VENTS        (1<<8)
#define MATERIAL_WOOD        (1<<9)
#define MATERIAL_GLASS        (1<<10)

new const sounds[8][] =
{
    
"player/headshot1.wav",
    
"player/headshot2.wav",
    
"player/headshot3.wav",
    
"player/bhit_flesh-1.wav",
    
"player/bhit_kevlar-1.wav",
    
"player/bhit_helmet-1.wav",
    
"weapons/ric_metal-1.wav",
    
"weapons/ric_metal-2.wav"
}


new 
pcv_damage_percent
new pcv_angles
new pcv_chance
new pcv_pistols
new pcv_shotgun
new pcv_smgs
new pcv_rifles
new pcv_snipers
new pcv_tracers
new pcv_materials
new pcv_extramoney

new pcv_ff

new g_maxplayers

new decal_shot1

new last_ric_shooter[MAX_PLAYERS 1] = {0, ...}

//stock beampoint

public plugin_precache()
{
    for (new 
i=0;i<8;i++)
    {
        
precache_sound(sounds[i])
    }
    
    
//beampoint = precache_model("sprites/laserbeam.spr")
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("ricochet_version"VERSIONFCVAR_SERVER FCVAR_SPONLY)
    
    
pcv_damage_percent register_cvar("ric_damage_percent""75")
    
pcv_angles            register_cvar("ric_angle""30")
       
pcv_chance           register_cvar("ric_chance""10")
    
pcv_tracers           register_cvar("ric_tracers""1")
    
    
pcv_pistols           register_cvar("ric_pistols""1")
    
pcv_shotgun           register_cvar("ric_shotguns",    "1")
    
pcv_smgs           register_cvar("ric_smgs""1")
    
pcv_rifles           register_cvar("ric_rifles""1")
    
pcv_snipers           register_cvar("ric_snipers""1")
    
    
pcv_materials       register_cvar("ric_materials",         "2047")
    
    
pcv_extramoney       register_cvar("ric_money",             "100")
    
    
pcv_ff             get_cvar_pointer("mp_friendlyfire")
    
    
RegisterHam(Ham_TraceAttack"worldspawn""fw_traceattack")
    
RegisterHam(Ham_TraceAttack"func_breakable""fw_traceattack")
    
RegisterHam(Ham_Killed"player""fw_killed"1)
    
    
g_maxplayers get_maxplayers()
    
    
decal_shot1 engfuncEngFunc_DecalIndex"{shot1" )
}

public 
fw_killed(idkillergib)
{
    if (
killer == last_ric_shooter[id])
    {
        
cs_set_user_money(killerclamp(cs_get_user_money(killer) + get_pcvar_num(pcv_extramoney), 0MAX_MONEY), 1)
    }
    
    return 
HAM_IGNORED
}

public 
fw_traceattack(entattackerFloat:damageFloat:direction[3], thdlbits)
{
if (
random(10) <= get_pcvar_num(pcv_chance)) {
    
    if (!(
<= attacker <= g_maxplayers))
        return 
HAM_IGNORED
    
    
new weapon get_user_weapon(attacker)
    
    if (
BS_IGNORE_WEAPONS & (1<<weapon))
        return 
HAM_IGNORED
    
    
if (BS_PISTOLS & (1<<weapon) && !get_pcvar_num(pcv_pistols))
        return 
HAM_IGNORED
    
    
if (BS_SHOTGUN & (1<<weapon) && !get_pcvar_num(pcv_shotgun))
        return 
HAM_IGNORED
    
    
if (BS_SUBMGS & (1<<weapon) && !get_pcvar_num(pcv_smgs))
        return 
HAM_IGNORED
    
    
if (BS_RIFLES & (1<<weapon) && !get_pcvar_num(pcv_rifles))
        return 
HAM_IGNORED
    
    
if (BS_SNIPERS & (1<<weapon) && !get_pcvar_num(pcv_snipers))
        return 
HAM_IGNORED
    
    
new Float:origin[3],Float:end[3], Float:start[3], traceFloat:fraction
    
    pev
(attackerpev_originorigin)
    
pev(attackerpev_view_ofsstart)
    
    
xs_vec_add(originstartstart)
    
    
get_tr2(thdlTR_vecEndPosend)
    
    if (
point_contents(end) == CONTENTS_SKY)
        return 
HAM_IGNORED
    
    trace 
create_tr2()
    
    
engfunc(EngFunc_TraceLinestartendDONT_IGNORE_MONSTERSattackertrace)
    
get_tr2(traceTR_flFractionfraction)
    
    if (
is_breakable(ent) == 0)
    {
        new 
Float:virtualend[3], texture_name[64], texture_type
        
        xs_vec_sub
(endstartvirtualend)
        
xs_vec_mul_scalar(virtualend16000.0virtualend)
        
xs_vec_add(virtualendstartvirtualend)
        
        
engfunc(EngFunc_TraceTexture0startvirtualendtexture_namecharsmax(texture_name))
        
texture_type dllfunc(DLLFunc_PM_FindTextureTypetexture_name)
        
        for (new 
i=0;i<sizeof(material_array);i++)
        {
            if (
material_array[i] == texture_type)
            {
                if ( !(
clamp(get_pcvar_num(pcv_materials), 0power(2sizeof(material_array)) - 1) & texture_type ) )
                {
                    
free_tr2(trace)
                    return 
HAM_IGNORED
                
}
                
                break
            }
        }
    }
    else
    {
        
free_tr2(trace)
        return 
HAM_IGNORED
    
}
    
    if (
fraction != 1.0)
    {
        if (
get_tr2(traceTR_pHit) != 0)
        {
            if (
<= get_tr2(traceTR_pHit) <= g_maxplayers)
            {
                
last_ric_shooter[get_tr2(traceTR_pHit)] = 0
            
}
            
            
free_tr2(trace)
            return 
HAM_IGNORED
        
}
        else
        {
            
get_tr2(traceTR_vecPlaneNormalorigin)
            
get_tr2(traceTR_vecEndPosend)
            
            
xs_vec_sub(startendstart)
            
            
xs_vec_normalize(startstart)
            
            
free_tr2(trace)
            
            return (
xs_vec_dot(startorigin) <= ANGLE_RIC_MAX_COS) ? HAM_SUPERCEDE HAM_IGNORED
        
}
    }
    
    
get_tr2(thdlTR_vecPlaneNormalorigin)
    
    
xs_vec_sub(startendstart)
    
    
xs_vec_normalize(startstart)
    
    
fraction xs_vec_dot(startorigin)
    
    if (
fraction ANGLE_RIC_MAX_COS)
    {
        
free_tr2(trace)
        return 
HAM_IGNORED
    
}
    
xs_vec_mul_scalar(originfractionorigin)
    
xs_vec_sub(originstartstart)
    
xs_vec_mul_scalar(start, (1-(fraction*fraction))/xs_vec_len(start), start)
    
xs_vec_add(originstartorigin)
    
    
xs_vec_mul_scalar(origin16000.0origin)
    
xs_vec_add(originendorigin)
    
    
msg_ricochet(end)
    
    
engfunc(EngFunc_TraceLineendoriginDONT_IGNORE_MONSTERS, -1trace)
    
    
get_tr2(traceTR_vecEndPosorigin)
    
    if (
get_pcvar_num(pcv_tracers))
        
msg_tracer(endorigin)
    
    new 
hit get_tr2(traceTR_pHit)
    
    if (
hit > -1)
    {
        
ExecuteHamB(Ham_TraceAttackhitattacker, (damage * (floatclamp(get_pcvar_float(pcv_damage_percent), 0.0100.0)) / 100.0 ), endtracebits)
        
        if (
<= hit <= g_maxplayers)
        {
            if (
cs_get_user_team(attacker) != cs_get_user_team(hit))
            {
                
last_ric_shooter[hit] = attacker
                
                
new CsArmorType:armor
                
new hitgroup get_tr2(traceTR_iHitgroup)
                
                
cs_get_user_armor(hitarmor)
                
                switch (
hitgroup)
                {
                    case 
HIT_SHIELD:
                    {
                        
emit_sound(hitCHAN_BODYsounds[random(2)], VOL_NORMATTN_STATIC0PITCH_NORM)
                    }
                    case 
HIT_HEAD:
                    {
                        if (
armor == CS_ARMOR_VESTHELM)
                        {
                            
emit_sound(hitCHAN_BODYsounds[5], VOL_NORMATTN_STATIC0PITCH_NORM)
                        }
                        else
                        {
                            
emit_sound(hitCHAN_BODYsounds[random(3)], VOL_NORMATTN_STATIC0PITCH_NORM)
                        }
                    }
                    case 
HIT_STOMACHHIT_CHEST:
                    {
                        if (
armor == CS_ARMOR_KEVLAR || armor == CS_ARMOR_VESTHELM)
                        {
                            
emit_sound(hitCHAN_BODYsounds[4], VOL_NORMATTN_STATIC0PITCH_NORM)
                        }
                        else
                        {
                            
emit_sound(hitCHAN_BODYsounds[3], VOL_NORMATTN_STATIC0PITCH_NORM)
                        }
                    }
                    default:
                    {
                        
emit_sound(hitCHAN_BODYsounds[3], VOL_NORMATTN_STATIC0PITCH_NORM)
                    }
                }
                
            }
            else
            {
                if (
get_pcvar_num(pcv_ff))
                {
                    
last_ric_shooter[hit] = attacker
                    
                    
new CsArmorType:armor
                    
new hitgroup get_tr2(traceTR_iHitgroup)
                    
                    
cs_get_user_armor(hitarmor)
                    
                    switch (
hitgroup)
                    {
                        case 
HIT_SHIELD:
                        {
                            
emit_sound(hitCHAN_BODYsounds[random(2)], VOL_NORMATTN_STATIC0PITCH_NORM)
                        }
                        case 
HIT_HEAD:
                        {
                            if (
armor == CS_ARMOR_VESTHELM)
                            {
                                
emit_sound(hitCHAN_BODYsounds[5], VOL_NORMATTN_STATIC0PITCH_NORM)
                            }
                            else
                            {
                                
emit_sound(hitCHAN_BODYsounds[random(3)], VOL_NORMATTN_STATIC0PITCH_NORM)
                            }
                        }
                        case 
HIT_STOMACHHIT_CHEST:
                        {
                            if (
armor == CS_ARMOR_KEVLAR || armor == CS_ARMOR_VESTHELM)
                            {
                                
emit_sound(hitCHAN_BODYsounds[4], VOL_NORMATTN_STATIC0PITCH_NORM)
                            }
                            else
                            {
                                
emit_sound(hitCHAN_BODYsounds[3], VOL_NORMATTN_STATIC0PITCH_NORM)
                            }
                        }
                        default:
                        {
                            
emit_sound(hitCHAN_BODYsounds[3], VOL_NORMATTN_STATIC0PITCH_NORM)
                        }
                    }
                }
                else
                {
                    
emit_sound(hitCHAN_BODYsounds[4], VOL_NORMATTN_STATIC0PITCH_NORM)
                }
            }
        }
    }
    else
    {
        
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYorigin0)
        
write_byte(TE_GUNSHOTDECAL)
        
engfunc(EngFunc_WriteCoordorigin[0])
        
engfunc(EngFunc_WriteCoordorigin[1])
        
engfunc(EngFunc_WriteCoordorigin[2])
        
write_short(0)
        
write_byte(decal_shot1 random(5))
        
message_end()
        
        
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYorigin0)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordorigin[0])
        
engfunc(EngFunc_WriteCoordorigin[1])
        
engfunc(EngFunc_WriteCoordorigin[2])
        
message_end()
    }
    
    
free_tr2(trace)
}
    return 
HAM_IGNORED
}

stock msg_ricochet(Float:origin[3])
{
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYorigin0)
    
write_byte(TE_ARMOR_RICOCHET)
    
engfunc(EngFunc_WriteCoordorigin[0])
    
engfunc(EngFunc_WriteCoordorigin[1])
    
engfunc(EngFunc_WriteCoordorigin[2])
    
write_byte(3)
    
message_end()
}

/*stock draw_line(Float:start[3], Float:end[3])
{
    engfunc(EngFunc_MessageBegin, MSG_ALL, SVC_TEMPENTITY, Float:{0.0,0.0,0.0}, 0)
    write_byte(TE_BEAMPOINTS)
    engfunc(EngFunc_WriteCoord, start[0])
    engfunc(EngFunc_WriteCoord, start[1])
    engfunc(EngFunc_WriteCoord, start[2])
    engfunc(EngFunc_WriteCoord, end[0])
    engfunc(EngFunc_WriteCoord, end[1])
    engfunc(EngFunc_WriteCoord, end[2])
    write_short(beampoint)
    write_byte(0)
    write_byte(0)
    write_byte(25)
    write_byte(10)
    write_byte(0)
    write_byte(255)
    write_byte(255)
    write_byte(255)
    write_byte(127)
    write_byte(1)
    message_end()    
}*/

stock msg_tracer(Floatorigin[3], Floatend[3]) 

    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYorigin0//  MSG_PAS MSG_BROADCAST 
    
write_byte(TE_TRACER
    
engfunc(EngFunc_WriteCoordorigin[0]) 
    
engfunc(EngFunc_WriteCoordorigin[1]) 
    
engfunc(EngFunc_WriteCoordorigin[2]) 
    
engfunc(EngFunc_WriteCoordend[0]) 
    
engfunc(EngFunc_WriteCoordend[1]) 
    
engfunc(EngFunc_WriteCoordend[2]) 
    
message_end() 
}

stock is_breakable(ent)
{
    if (
ent == 0)
        return 
0
    
    
if ((((entity_get_float(entEV_FL_health) > 0.0) || (entity_get_int(entEV_INT_rendermode) == 4)) && (entity_get_float(entEV_FL_takedamage) > 0.0) && !(entity_get_int(entEV_INT_spawnflags) & SF_BREAK_TRIGGER_ONLY)))
        return 
1
    
    
return 0


cvar ric_chance ( <0 -10> standard is 10)

Last edited by intercostal_noisE; 08-06-2014 at 12:21.
intercostal_noisE is offline
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 11:18.


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