Raised This Month: $ Target: $400
 0% 

Solved CT death gib


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GetReady
Junior Member
Join Date: Feb 2025
Old 06-16-2025 , 12:14   CT death gib
Reply With Quote #1

I need a not so simple plugin.Only CT players gib on death but only when they get killed with headshot.Anyone can help me with this request?

Last edited by GetReady; 07-08-2025 at 09:31.
GetReady is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 06-16-2025 , 21:19   Re: CT death gib
Reply With Quote #2

Quote:
Originally Posted by GetReady View Post
I need a not so simple plugin.Only CT players gib on death but only when they get killed with headshot.Anyone can help me with this request?
I used this plugin for editing from <VeCo>, check out the cvars that are used:https://forums.alliedmods.net/showthread.php?t=107215

I left all the models so you can combine them or add your own gibs.

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

#define HIT_HEAD 1

#define BREAK_GLASS       0x01
#define BREAK_METAL       0x02
#define BREAK_FLESH       0x04
#define BREAK_WOOD        0x08
#define BREAK_CONCRETE    0x40

new const g_sz_Const_GibModels[][] =
{
    
"models/hgibs.mdl",
    
"models/glassgibs.mdl",
    
"models/woodgibs.mdl",
    
"models/metalplategibs.mdl",
    
"models/cindergibs.mdl",
    
"models/ceilinggibs.mdl",
    
"models/computergibs.mdl",
    
"models/rockgibs.mdl",
    
"models/bookgibs.mdl",
    
"models/garbagegibs.mdl",
    
"models/bonegibs.mdl",
    
"models/cactusgibs.mdl",
    
"models/webgibs.mdl"
}

new const 
g_i_Const_GibMaterials[sizeof g_sz_Const_GibModels] =
{
    
BREAK_FLESH,
    
BREAK_GLASS,
    
BREAK_WOOD,
    
BREAK_METAL,
    
BREAK_CONCRETE,
    
BREAK_CONCRETE,
    
BREAK_METAL,
    
BREAK_CONCRETE,
    
BREAK_FLESH,
    
BREAK_FLESH,
    
BREAK_FLESH,
    
BREAK_WOOD,
    
BREAK_FLESH
}

new 
g_i_CacheGibsMdl[sizeof g_sz_Const_GibModels],
    
g_i_CacheAvailableGibs[sizeof g_sz_Const_GibModels], g_i_CacheAvailableNum,
    
g_p_Cvar_GibTypeg_p_Cvar_GibSpreadg_p_Cvar_GibCountg_p_Cvar_GibLife

public plugin_precache() {
    for(new 
0sizeof g_sz_Const_GibModelsi++)
        
g_i_CacheGibsMdl[i] = precache_model(g_sz_Const_GibModels[i])
}

public 
plugin_init()
{
    
register_plugin("Gib Death (CT Headshot Only)""2.1""<VeCo>/Edit Pukovnik (Uzviseni Bog) HS ONLY")

    
g_p_Cvar_GibType register_cvar("gib_type""abcdefghijklm")
    
g_p_Cvar_GibSpread register_cvar("gib_spread""10")
    
g_p_Cvar_GibCount register_cvar("gib_count""8")
    
g_p_Cvar_GibLife register_cvar("gib_life""30")

    
register_logevent("LogEvent_RoundStart"2"1=Round_Start")
    
RegisterHam(Ham_Killed"player""HamHook_Player_Killed_Post"1)
    
set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
}

public 
LogEvent_RoundStart()
{
    
g_i_CacheAvailableNum 0

    
new sz_CacheCvar_Type[42]
    
get_pcvar_string(g_p_Cvar_GibTypesz_CacheCvar_Typecharsmax(sz_CacheCvar_Type))

    new 
i_CacheCvar_StrLen strlen(sz_CacheCvar_Type)

    for(new 
0i_CacheCvar_StrLeni++)
    {
        if(
sz_CacheCvar_Type[i] > 'm' || sz_CacheCvar_Type[i] < 'a') continue
        
g_i_CacheAvailableGibs[g_i_CacheAvailableNum++] = sz_CacheCvar_Type[i] - 'a'
    
}
}

public 
HamHook_Player_Killed_Post(idkillershouldgib)
{
    if(!
is_user_connected(id) || cs_get_user_team(id) != CS_TEAM_CT)
        return 
HAM_IGNORED

    
new weaponhitplace
    get_user_attacker
(idweaponhitplace)
    if(
hitplace != HIT_HEAD)
        return 
HAM_IGNORED

    entity_set_int
(idEV_INT_effectsentity_get_int(idEV_INT_effects) | EF_NODRAW)

    new 
i_GetGib g_i_CacheAvailableGibs[(g_i_CacheAvailableNum 1) ? random(g_i_CacheAvailableNum) : 0]
    new 
i_v_Origin[3]
    
get_user_origin(idi_v_Origin)

    
message_begin(MSG_PVSSVC_TEMPENTITYi_v_Origin)
    
write_byte(TE_BREAKMODEL)
    
write_coord(i_v_Origin[0])
    
write_coord(i_v_Origin[1])
    
write_coord(i_v_Origin[2] + 16)
    
write_coord(32)
    
write_coord(32)
    
write_coord(32)
    
write_coord(0)
    
write_coord(0)
    
write_coord(25)
    
write_byte(get_pcvar_num(g_p_Cvar_GibSpread))
    
write_short(g_i_CacheGibsMdl[i_GetGib])
    
write_byte(get_pcvar_num(g_p_Cvar_GibCount))
    
write_byte(get_pcvar_num(g_p_Cvar_GibLife))
    
write_byte(g_i_Const_GibMaterials[i_GetGib])
    
message_end()

    return 
HAM_HANDLED

gib_death.sma

Models.zip
Uzviseni Bog is offline
GetReady
Junior Member
Join Date: Feb 2025
Old 06-17-2025 , 05:20   Re: CT death gib
Reply With Quote #3

Thank you,but is there simpler way for this,without all this lines from VeCo gib plugin?I just need classic gib with flash.
GetReady is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 06-17-2025 , 07:51   Re: CT death gib
Reply With Quote #4

You only need to use
PHP Code:
SetHamParamInteger(32
__________________
I made a new zombie mod for 2025 with unique lasermine.
Look at the video below.

https://www.youtube.com/shorts/Uzixo25SqDw

Perfect balanced mod with good items.Look at the video below.

https://www.youtube.com/shorts/vcQ2HMf847I
Krtola is offline
Send a message via Skype™ to Krtola
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 06-17-2025 , 08:55   Re: CT death gib
Reply With Quote #5

Quote:
Originally Posted by GetReady View Post
Thank you,but is there simpler way for this,without all this lines from VeCo gib plugin?I just need classic gib with flash.
In the previous code, you could change the gibs effect using the cvar gib_type "abcdefghijklm", where:

a - flesh
b - glass
c - wood
d - metal
e - cinder block
f - ceiling tile
g - computer parts
h - rocks
i - books
j - garbage
k - bones
l - plant
m - web

I've removed that. Now just use:
PHP Code:
new const g_sz_Const_GibModel[] = "models/hgibs.mdl";
new const 
g_i_Const_GibMaterial BREAK_FLESH
You can find other gibs if you want, but I think they're rare.

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

#define HIT_HEAD 1
#define BREAK_FLESH 0x04

new const g_sz_Const_GibModel[] = "models/hgibs.mdl";
new const 
g_i_Const_GibMaterial BREAK_FLESH;

new 
g_i_CacheGibMdl,
    
g_p_Cvar_GibSpreadg_p_Cvar_GibCountg_p_Cvar_GibLife;

public 
plugin_precache() {
    
g_i_CacheGibMdl precache_model(g_sz_Const_GibModel);
}

public 
plugin_init()
{
    
register_plugin("Gib Death""2.1""<VeCo>/Edit Pukovnik (Uzviseni Bog) HS ONLY");

    
g_p_Cvar_GibSpread register_cvar("gib_spread""10");
    
g_p_Cvar_GibCount register_cvar("gib_count""8");
    
g_p_Cvar_GibLife register_cvar("gib_life""30");

    
RegisterHam(Ham_Killed"player""HamHook_Player_Killed_Post"1);
    
set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET);
}

public 
HamHook_Player_Killed_Post(idkillershouldgib)
{
    if(!
is_user_connected(id) || cs_get_user_team(id) != CS_TEAM_CT)
        return 
HAM_IGNORED;

    new 
weaponhitplace;
    
get_user_attacker(idweaponhitplace);
    if(
hitplace != HIT_HEAD)
        return 
HAM_IGNORED;

    
entity_set_int(idEV_INT_effectsentity_get_int(idEV_INT_effects) | EF_NODRAW);

    new 
i_v_Origin[3];
    
get_user_origin(idi_v_Origin);

    
message_begin(MSG_PVSSVC_TEMPENTITYi_v_Origin);
    
write_byte(TE_BREAKMODEL);
    
write_coord(i_v_Origin[0]);
    
write_coord(i_v_Origin[1]);
    
write_coord(i_v_Origin[2] + 16);
    
write_coord(32);
    
write_coord(32);
    
write_coord(32);
    
write_coord(0);
    
write_coord(0);
    
write_coord(25);
    
write_byte(get_pcvar_num(g_p_Cvar_GibSpread));
    
write_short(g_i_CacheGibMdl);
    
write_byte(get_pcvar_num(g_p_Cvar_GibCount));
    
write_byte(get_pcvar_num(g_p_Cvar_GibLife));
    
write_byte(g_i_Const_GibMaterial);
    
message_end();

    return 
HAM_HANDLED;

gib_death.sma
Uzviseni Bog is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 06-19-2025 , 18:49   Re: CT death gib
Reply With Quote #6

Quote:
Originally Posted by GetReady View Post
I need a not so simple plugin.Only CT players gib on death but only when they get killed with headshot.Anyone can help me with this request?
Quote:
Originally Posted by GetReady View Post
I just need classic gib with flash.
Code:
gib_team 1
  • gib_team -1. Disable
  • gib_team 0. Allows both teams gib (headshots).
  • gib_team 1. Allows T to gib CT.
  • gib_team 2. Allows CT to gib T.

Code:
#include amxmodx #include hamsandwich #define PLUGIN   "GIB_TEAM" #define VERSION  "0.0.1" #define AUTHOR   "SPiNX" #define URL      "github.com/djearthquake" new bool:bRegistered new HamHook:XKill, Xcvar public plugin_init() {     #if AMXX_VERSION_NUM >= 179 && AMXX_VERSION_NUM <= 190     register_plugin(PLUGIN, VERSION, AUTHOR)     #else     register_plugin(PLUGIN, VERSION, AUTHOR, URL)     #endif     XKill = RegisterHam(Ham_Killed, "player", "HamHook_Player_Killed_Pre", 0);     Xcvar = register_cvar("gib_team", "0"); //OFF=-1 | ALL=0 | T=1 | CT=2 } public client_authorized(id, const authid[]) {     if(equal(authid, "BOT")  && !bRegistered)     {         set_task(0.1, "@register", id);     } } @register(ham_bot) {     if(is_user_connected(ham_bot))     {         bRegistered = true;         RegisterHamFromEntity(Ham_Killed, ham_bot, "HamHook_Player_Killed_Pre", 0 );         server_print("%s|%s|%s hambot from %N", PLUGIN, VERSION, AUTHOR, ham_bot)     } } public HamHook_Player_Killed_Pre(id, killer, shouldgib) {     new weapon, hitplace;     new cvar = get_pcvar_num(Xcvar)     if(cvar>-1)     if(is_user_connected(id))     {         get_user_attacker(id, weapon, hitplace);     }     if(hitplace == HIT_HEAD)     {         if(!cvar)         {             SetHamParamInteger(3, 2)         }         if(is_user_connected(killer) && get_user_team(killer) == cvar)         {             SetHamParamInteger(3, 2)         }     } } public plugin_end() {     DisableHamForward(XKill) }

Last edited by DJEarthQuake; 06-19-2025 at 18:57.
DJEarthQuake is offline
GetReady
Junior Member
Join Date: Feb 2025
Old 06-20-2025 , 14:28   Re: CT death gib
Reply With Quote #7

Thank you all.All example works.
GetReady is offline
Reply


Thread Tools
Display Modes

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 20:45.


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