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

Head Gore... What did I do wrong?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Circusbrain
Junior Member
Join Date: Apr 2014
Old 04-29-2014 , 16:07   Head Gore... What did I do wrong?
Reply With Quote #1

I took the original CSS Gore mod and changed things around somehwat, in my opinion making the code more stable because the original was using a lot of RemoveEdict and IsValidEdict commands. I also changed how the deaths are responded to by the plugin, IE, if it's a headshot your model is replaced by a headless ragdoll, if it's a knife kill same, but your head exists and falls to the ground, and if it's a grenade kill, only then does it replace your body with some standard library gibs. The blood and the gibs are the way the original plugin worked, so, the way I look at it, I'm adding potenially 2 models per death and made the code more stable... HOWEVER... the plugin randomly crashes my server, can run for 5 hours, or 5 minutes and crashes completely randomly; map change, player death, player join, or nothing, just, server down, no logs, no nothing, like it's locked up completely.

ANY HELP would be greatly appreciated!?

PHP Code:
//CS:S Head Gore 2

//Terminate:
#pragma semicolon 1

//Includes:
#include <sourcemod>
#include <sdktools>

//Overflow:
static Float:PrethinkBuffer;

//Convars:
new Handle:hGibs;
new 
Handle:hBleedingHp;
new 
Handle:hBleedingFreq;
new 
Handle:hImpactBlood;
new 
Handle:hHeadshotBlood;
new 
Handle:hDeathBlood;

//Misc:
new BloodClient[2000];

//Information:
public Plugin:myinfo =
{

    
//Initialize:
    
name "Head Gore 2",
    
author "CircusBrain",
    
description "Adds Blood & Gore on different kill types",
    
version "2.6",
    
url "http://www.oldtimerscss.com"
}

//Parent to Dead Body:
ParentToBody(ClientParticlebool:Headshot true)
{
    
//Client:
    
if(IsClientConnected(Client))
    {
        
//Declare:
        
decl Body;
        
decl String:tName[64], String:Classname[64], String:ModelPath[64];

        
//Initialize:
        
Body GetEntPropEnt(ClientProp_Send"m_hRagdoll");

        
//Edict:
        
if(IsValidEntity(Body))
        {
            
//Target Name:
            
Format(tNamesizeof(tName), "Body%d"Body);

            
//Find:
            
GetEdictClassname(BodyClassnamesizeof(Classname));

            
//Model:
            
GetClientModel(ClientModelPath64);

            
//Body Exists:
            
if(IsValidEntity(Body) && StrEqual(Classname"cs_ragdoll"false))
            {

                
//Properties:
                
DispatchKeyValue(Body"targetname"tName);
                
GetEntPropString(BodyProp_Data"m_iName"tNamesizeof(tName));

                
//Parent:
                
SetVariantString(tName);
                
AcceptEntityInput(Particle"SetParent"ParticleParticle0);
                if(
Headshot)
                {
                    
//Work-Around:
                    
if(StrContains(ModelPath"sas"false) != -|| StrContains(ModelPath"gsg"false) != -1)
                    {
                        
//Back:
                        
SetVariantString("primary");
                    }
                    else
                    {
                        
//Head:
                        
SetVariantString("forward");
                    }
                }
                else
                {
                    
//Back:
                    
SetVariantString("primary");
                }
                
//Parent:
                
AcceptEntityInput(Particle"SetParentAttachment"ParticleParticle0);
            }
        }
    }
}

//Write:
WriteParticle(EntString:ParticleName[], bool:Death falsebool:Headshot false)
{
    
//Declare:
    
decl Particle;
    
decl String:tName[64];

    
//Initialize:
    
Particle CreateEntityByName("info_particle_system");
    
    
//Validate:
    
if(IsValidEntity(Particle))
    {
        
//Declare:
        
decl Float:Position[3], Float:Angles[3];

        
//Initialize:
        
Angles[0] = GetRandomFloat(0.0360.0);
        
Angles[1] = GetRandomFloat(-15.015.0);
        
Angles[2] = GetRandomFloat(-15.015.0);

        
//Origin:
        
GetEntPropVector(EntProp_Send"m_vecOrigin"Position);

        
//Z Axis:f
        
if(DeathPosition[2] += GetRandomFloat(0.05.0);
        else 
Position[2] += GetRandomFloat(15.035.0);

        
//Send:
        
TeleportEntity(ParticlePositionAnglesNULL_VECTOR);

        
//Target Name:
        
Format(tNamesizeof(tName), "Entity%d"Ent);
        
DispatchKeyValue(Ent"targetname"tName);
        
GetEntPropString(EntProp_Data"m_iName"tNamesizeof(tName));

        
//Properties:
        
DispatchKeyValue(Particle"targetname""CSSParticle");
        
DispatchKeyValue(Particle"parentname"tName);
        
DispatchKeyValue(Particle"effect_name"ParticleName);

        
//Spawn:
        
DispatchSpawn(Particle);
    
        
//Parent:
        
if(Death)
        {
            
//Headshot:
            
if(Headshot)
                
ParentToBody(EntParticle);
            else
                
ParentToBody(EntParticlefalse);
        }
        else
        {
            
//Parent:
            
SetVariantString(tName);
            
AcceptEntityInput(Particle"SetParent"ParticleParticle0);
        }

        
ActivateEntity(Particle);
        
AcceptEntityInput(Particle"start");

        
//Delete:
        
CreateTimer(3.0DeleteParticleParticle);
    }
}

//Delete:
public Action:DeleteParticle(Handle:Timerany:Particle)
{

    
//Validate:
    
if(IsValidEntity(Particle))
    {
        
//Declare:
        
decl String:Classname[64];

        
//Initialize:
        
GetEdictClassname(ParticleClassnamesizeof(Classname));

        
//Is a Particle:
        
if(StrEqual(Classname"info_particle_system"false))
        {
            
//Delete:
            
AcceptEntityInput(Particle"Kill");//RemoveEdict(Particle);
        
}
    }
}

//Decal:
stock Decal(ClientFloat:Direction[3], bool:Bleeding false)
{
    
//Declare:
    
decl Blood;
    
decl String:Angles[128];

    
//Format:
    
Format(Angles128"%f %f %f"Direction[0], Direction[1], Direction[2]);

    
//Blood:
    
Blood CreateEntityByName("env_blood");

    
//Create:
    
if (IsValidEntity(Blood))
    {
        
//Spawn:
        
DispatchSpawn(Blood);

        
//Properties:
        
DispatchKeyValue(Blood"color""0");
        
DispatchKeyValue(Blood"amount""1000");
        
DispatchKeyValue(Blood"spraydir"Angles);
        
DispatchKeyValue(Blood"spawnflags""12");

        
//Timer:
        
if(!Bleeding)
        {
            
//Save & Send:
            
BloodClient[Blood] = Client;
            
CreateTimer(GetRandomFloat(0.11.0), EmitBloodBlood);
        } 
        else 
AcceptEntityInput(Blood"EmitBlood"Client);
    }

    
//Detach:
    
if(Bleeding && IsValidEntity(Blood)) AcceptEntityInput(Blood"Kill");//RemoveEdict(Blood);
}

//Emit Blood:
public Action:EmitBlood(Handle:Timerany:Blood)
{
    
//Emit:
    
if(IsValidEntity(Blood) && IsClientConnected(BloodClient[Blood])) AcceptEntityInput(Blood"EmitBlood"BloodClient[Blood]);

    
//Detatch:
    
if(IsValidEntity(Blood)) AcceptEntityInput(Blood"Kill");//RemoveEdict(Blood);
}

//Direction:
stock CalculateDirection(Float:ClientOrigin[3], Float:AttackerOrigin[3], Float:Direction[3])
{
    
//Declare:
    
decl Float:RatioDiviserFloat:DiviserFloat:MaxCoord;

    
//X, Y, Z:
    
Direction[0] = (ClientOrigin[0] - AttackerOrigin[0]) + GetRandomFloat(-25.025.0);
    
Direction[1] = (ClientOrigin[1] - AttackerOrigin[1]) + GetRandomFloat(-25.025.0);
    
Direction[2] = (GetRandomFloat(-125.0, -75.0));

    
//Greatest Coordinate:
    
if(FloatAbs(Direction[0]) >= FloatAbs(Direction[1])) MaxCoord FloatAbs(Direction[0]);
    else 
MaxCoord FloatAbs(Direction[1]);

    
//Calculate:
    
RatioDiviser GetRandomFloat(100.0250.0);
    
Diviser MaxCoord RatioDiviser;
    
Direction[0] /= Diviser;
    
Direction[1] /= Diviser;

    
//Close:
    
return;
}

//Gib:
stock Gib(Float:Origin[3], Float:Direction[3], String:Model[])
{
    
//Declare:
    
decl EntRoll;
    
decl Float:MaxEnts;
    
decl Float:Velocity[3];

    
//Initialize:
    
Ent CreateEntityByName("prop_physics");
    
MaxEnts = (0.9 GetMaxEntities());
    
Velocity[0] = Direction[0] * 400.0;
    
Velocity[1] = Direction[0] * 400.0;
    
Velocity[2] = Direction[0] * 400.0;
        
    
//Anti-Crash:
    
if(Ent MaxEnts)
    {

        
//Properties:
        
DispatchKeyValue(Ent"model"Model);
        
SetEntProp(EntProp_Send"m_CollisionGroup"1); 

        
//Spawn:
        
DispatchSpawn(Ent);
        
        
//Send:
        
TeleportEntity(EntOriginDirectionVelocity);

        
//Blood:
        
Roll GetRandomInt(15);

        
//blood_advisor_pierce_spray:
        
if(Roll == 1WriteParticle(Ent"blood_advisor_pierce_spray");

        
//blood_advisor_pierce_spray_b:
        
if(Roll == 2WriteParticle(Ent"blood_advisor_pierce_spray_b");

        
//blood_advisor_pierce_spray_c:
        
if(Roll == 3WriteParticle(Ent"blood_advisor_pierce_spray_c");

        
//blood_zombie_split_spray:
        
if(Roll == 4WriteParticle(Ent"blood_zombie_split_spray");

        
//blood_advisor_pierce_spray:
        
if(Roll == 5WriteParticle(Ent"blood_advisor_pierce_spray");

        
//Delete:
        
CreateTimer(GetRandomFloat(15.030.0), RemoveGibEnt);
    }
}


//Random Gib:
stock RandomGib(Float:Origin[3], String:Model[])
{
    
//Declare:
    
decl Float:Direction[3];

    
//Origin:
    
Origin[0] += GetRandomFloat(-10.010.0);
    
Origin[1] += GetRandomFloat(-10.010.0);
    
Origin[2] += GetRandomFloat(-20.020.0);

    
//Direction:
    
Direction[0] = GetRandomFloat(-1.01.0);
    
Direction[1] = GetRandomFloat(-1.01.0);
    
Direction[2] = GetRandomFloat(150.0200.0);

    
//Gib:
    
Gib(OriginDirectionModel);
}

//Remove Gib:
public Action:RemoveGib(Handle:Timerany:Ent)
{
    
//Declare:
    
decl String:Classname[64];

    
//Initialize:
    
if(IsValidEntity(Ent))
    {
        
//Find:
        
GetEdictClassname(EntClassnamesizeof(Classname)); 

        
//Kill:
        
if(StrEqual(Classname"prop_physics"false)) AcceptEntityInput(Ent"Kill");
        if(
StrEqual(Classname"prop_ragdoll"false)) AcceptEntityInput(Ent"Kill");
        if(
StrEqual(Classname"prop_physics_override"false)) AcceptEntityInput(Ent"Kill");
    }
}

//Body:
stock RemoveBody(Client)
{
    
//Declare:
    
decl BodyRagdoll;
    
decl String:Classname[64];

    
//Initialize:
    
BodyRagdoll GetEntPropEnt(ClientProp_Send"m_hRagdoll");
    if(
IsValidEntity(BodyRagdoll))
    {
        
//Find:
        
GetEdictClassname(BodyRagdollClassnamesizeof(Classname)); 

        
//Remove:
        
if(StrEqual(Classname"cs_ragdoll"false)) AcceptEntityInput(BodyRagdoll"Kill");//RemoveEdict(BodyRagdoll);
    
}
}

//Bleed:
public Action:Bleed(Handle:Timerany:Client)
{
    
//Connected:
    
if(IsClientInGame(Client))
    {
        
//Still Hurt:
        
if(GetClientHealth(Client) < 100 && IsPlayerAlive(Client))
        {
            
//Declare:
            
decl Roll;
            
decl Float:Origin[3], Float:Direction[3];

            
//Initialize:
            
Roll GetRandomInt(12);
            
GetClientAbsOrigin(ClientOrigin);
            
Origin[2] += 10.0;
    
            
//Initialize:
            
Direction[0] = GetRandomFloat(-1.01.0);
            
Direction[1] = GetRandomFloat(-1.01.0);

            
//Bleed:
            
if(Roll == 1WriteParticle(Client"blood_zombie_split_spray_tiny");
            if(
Roll == 2WriteParticle(Client"blood_zombie_split_spray_tiny2");

            
//Drips #1:
            
Roll GetRandomInt(12);
            if(
Roll == 1WriteParticle(Client"blood_impact_red_01_droplets");

            
//Drips #2:
            
Roll GetRandomInt(12);
            if(
Roll == 1WriteParticle(Client"blood_impact_red_01_smalldroplets");

            
//Decal:
            
Direction[2] = -1.0;
            
Decal(ClientDirectiontrue);
        }
    }
}

//Damage:
public EventDamage(Handle:Event, const String:Name[], bool:Broadcast)
{
    
//Declare:
    
decl ClientRoll;
    
decl Float:Origin[3];

    
//Initialize:
    
Client GetClientOfUserId(GetEventInt(Event"userid"));
    
GetClientAbsOrigin(ClientOrigin);
    
Origin[2] += 35.0;

    
//Multiplier:
    
for(new 0GetConVarInt(hImpactBlood); X++)
    {
        
//blood_impact_red_01:
        
Roll GetRandomInt(16);
        if(
Roll == 1WriteParticle(Client"blood_impact_red_01");

        
//blood_impact_red_01_droplets:
        
Roll GetRandomInt(16);
        if(
Roll == 2WriteParticle(Client"blood_impact_red_01_droplets");

        
//blood_impact_red_01_smalldroplets:
        
Roll GetRandomInt(16);
        if(
Roll == 3WriteParticle(Client"blood_impact_red_01_smalldroplets");

        
//blood_impact_red_01_goop:
        
Roll GetRandomInt(16);
        if(
Roll == 4WriteParticle(Client"blood_impact_red_01_goop");

        
//blood_impact_red_01_mist:
        
Roll GetRandomInt(16);
        if(
Roll == 5WriteParticle(Client"blood_impact_red_01_mist");

        
//blood_advisor_puncture:
        
Roll GetRandomInt(16);
        if(
Roll == 6WriteParticle(Client"blood_advisor_puncture");

        
//blood_advisor_pierce_spray:
        
Roll GetRandomInt(115);
        if(
Roll == 1WriteParticle(Client"blood_advisor_pierce_spray");

        
//blood_advisor_pierce_spray_b:
        
Roll GetRandomInt(115);
        if(
Roll == 2WriteParticle(Client"blood_advisor_pierce_spray_b");

        
//blood_advisor_pierce_spray_c:
        
Roll GetRandomInt(115);
        if(
Roll == 3WriteParticle(Client"blood_advisor_pierce_spray_c");

        
//blood_zombie_split_spray:
        
Roll GetRandomInt(115);
        if(
Roll == 4WriteParticle(Client"blood_zombie_split_spray");
    }
}    

//Death:
public EventDeath(Handle:Event, const String:Name[], bool:Broadcast)
{
    
//Declare:
    
decl bool:Headshot;
    
decl ClientAttackerKndeath;
    
decl String:Weapon[64], String:ModelPath2[64],String:NewModel[64],String:NewModel2[64];

    
//Initialize:
    
Headshot GetEventBool(Event"headshot");
    
Client GetClientOfUserId(GetEventInt(Event"userid"));
    
Attacker GetClientOfUserId(GetEventInt(Event"attacker"));
    
GetEventString(Event"weapon"Weaponsizeof(Weapon));

    
//Weapons:
    
if(GetConVarBool(hGibs)) 
    {
        
//Check:
        
if(StrContains(Weapon"hegrenade"false) != -1)
        {
            
//Fake Attacker:
            
Attacker 0;
        }
        if(
StrContains(Weapon"knife"false) != -1)
        {
            
//Knife Death:
            
Kndeath 1;
        }

    }

    
//Legit Attacker:
    
if(Attacker != && Attacker != Client)
    {
        if (
Kndeath==|| Headshot)
        {
        
//Model:
            
GetClientModel(ClientModelPath264);
        
            if(
StrContains(ModelPath2"sas"false) != -1)
            {
                
NewModel "models/player/ct_sas1_dc.mdl";
                
NewModel "models/player/ct_sas_head.mdl";
            }
            else if(
StrContains(ModelPath2"gign"false) != -1)
            {
                
NewModel "models/player/ct_gign1_dc.mdl";
                
NewModel2 "models/player/ct_gign_head.mdl";
            }
            else if(
StrContains(ModelPath2"gsg"false) != -1)
            {
                
NewModel "models/player/ct_gsg91_dc.mdl";
                
NewModel2 "models/player/ct_gsg9_head.mdl";
            }
            else if(
StrContains(ModelPath2"urban"false) != -1)
            {
                
NewModel "models/player/ct_urban1_dc.mdl";
                
NewModel2 "models/player/ct_urban_head.mdl";
            }
            else if(
StrContains(ModelPath2"arctic"false) != -1)
            {
                
NewModel "models/player/t_arctic1_dc.mdl";
                
NewModel2 "models/player/t_arctic_head.mdl";
            }
            else if(
StrContains(ModelPath2"guerilla"false) != -1)
            {
                
NewModel "models/player/t_guerilla1_dc.mdl";
                
NewModel2 "models/player/t_guerilla_head.mdl";
            }
            else if(
StrContains(ModelPath2"leet"false) != -1)
            {
                
NewModel "models/player/t_leet1_dc.mdl";
                
NewModel2 "models/player/t_leet_head.mdl";
            }
            else if(
StrContains(ModelPath2"phoenix"false) != -1)
            {
                
NewModel "models/player/t_phoenix1_dc.mdl";
                
NewModel2 "models/player/t_phoenix_head.mdl";
            }

            new 
iEntRagdoll GetEntPropEnt(ClientProp_Send"m_hRagdoll");

            new 
Float:aOrigin],Float:vOrigin],Float:nOrigin],Float:bOrigin];
            
GetClientAbsOrigin(ClientFloat:vOrigin);
            
GetClientAbsAngles(ClientFloat:aOrigin);  

            
nOrigin] = vOrigin];
            
nOrigin] = vOrigin];
            
nOrigin] = vOrigin] - 20.0;

            
bOrigin] = aOrigin];
            
bOrigin] = aOrigin] - 75;
            
bOrigin] = aOrigin];
            if(
IsValidEntity(iEntRagdoll))  
            {  
                
AcceptEntityInput(iEntRagdoll"Kill");
                new 
xEntity CreateEntityByName("prop_ragdoll"); 
                
DispatchKeyValue(xEntity"model"NewModel); 
                
DispatchKeyValue(xEntity"disableshadows""1"); 
                
DispatchSpawn(xEntity); 
                
SetEntProp(xEntityProp_Send"m_usSolidFlags"8); 
                
SetEntProp(xEntityProp_Send"m_CollisionGroup"11); 
                
TeleportEntity(xEntitynOriginbOriginNULL_VECTOR);
                
CreateTimer(GetRandomFloat(15.030.0), RemoveGibxEntity);
                if (
Kndeath==1)
                {
                    
vOrigin[2] += 27;
                    new 
x2Entity CreateEntityByName"prop_physics_override" );
                    
SetEntityModel(x2EntityNewModel2 );
                    
//DispatchKeyValue(x2Entity, "StartDisabled", "false");
                    
DispatchKeyValue(x2Entity"Solid""6"); 
                    
SetEntProp(x2EntityProp_Send"m_CollisionGroup"1);
                    
//SetEntityMoveType(x2Entity, MOVETYPE_VPHYSICS);
                    
DispatchSpawn(x2Entity);
                    
TeleportEntity(x2EntityvOriginbOriginNULL_VECTOR );
                    
CreateTimer(GetRandomFloat(15.030.0), RemoveGibx2Entity);
                }
            }
            
            
//Declare:
            
decl Float:Direction[3];

            
//Multiplier:
            
for(new 0GetConVarInt(hHeadshotBlood); Y++)
            {

                
//Strings:
                
WriteParticle(Client"blood_advisor_puncture_withdraw"truetrue);
                
WriteParticle(Client"blood_antlionguard_injured_heavy_tiny"truetrue);

                
//Droplets:
                
WriteParticle(Client"blood_impact_red_01_smalldroplets"truetrue);
            }

            
//Decals:
            
for(new 0< (10 GetConVarInt(hHeadshotBlood)); X++)
            {

                
//Direction:
                
Direction[0] = GetRandomFloat(-1.01.0);
                
Direction[1] = GetRandomFloat(-1.01.0);
                
Direction[2] = -1.0;

                
//Send:
                
Decal(ClientDirection);//, true);
            
}
        }
        else
        {
            
//Multiplier:
            
for(new 0GetConVarInt(hDeathBlood); Y++)
            {
                
//Declare:
                
decl Roll;

                
//Initialize:
                
Roll GetRandomInt(14);

                
//blood_advisor_pierce_spray:
                
if(Roll == 1) for(new 03X++) WriteParticle(Client"blood_advisor_pierce_spray"true);

                
//blood_advisor_pierce_spray_b:
                
if(Roll == 2) for(new 03X++) WriteParticle(Client"blood_advisor_pierce_spray_b"true);

                
//blood_advisor_pierce_spray_c:
                
if(Roll == 3) for(new 03X++) WriteParticle(Client"blood_advisor_pierce_spray_c"true);

                
//blood_zombie_split_spray:
                
if(Roll == 4) for(new 03X++) WriteParticle(Client"blood_zombie_split_spray"true);
            }
        }
    }
    else
    {
        
//Declare:
        
decl Float:Origin[3];

        
//Origin:
        
GetClientAbsOrigin(ClientOrigin);
        
Origin[2] += 8.5;
            
        
//Gibbies:
        
if(GetConVarBool(hGibs)) 
        {
            
//Animate:
            
RandomGib(Origin"models/Gibs/HGIBS.mdl");
            
RandomGib(Origin"models/Gibs/HGIBS_rib.mdl");
            
RandomGib(Origin"models/Gibs/HGIBS_spine.mdl");
            
RandomGib(Origin"models/Gibs/HGIBS_scapula.mdl");

            
//Remove Body:
            
if(GetConVarBool(hGibs)) RemoveBody(Client);

            
//Declare:
            
decl Float:Direction[3];

            
//Decals:
            
for(new 010X++)
            {
                
//Direction:
                
Direction[0] = GetRandomFloat(-1.01.0);
                
Direction[1] = GetRandomFloat(-1.01.0);
                
Direction[2] = -1.0;

                
//Send:
                
Decal(ClientDirection);
            }
        }
    }

    
//Close:
    
CloseHandle(Event);
}

//Pre-Think:
public OnGameFrame()
{
    
//Think Overflow:
    
if(PrethinkBuffer <= (GetGameTime() - GetConVarInt(hBleedingFreq)))
    {
        
//Refresh:
        
PrethinkBuffer GetGameTime();

        
//Declare:
        
decl MaxPlayers;

        
//Initialize:
        
MaxPlayers GetMaxClients();
    
        
//Loop:
        
for(new Client 1Client <= MaxPlayersClient++)
        {
            
//Connected:
            
if(IsClientInGame(Client))
            {
                
//Alive:
                
if(IsPlayerAlive(Client))
                {
                    
//Damaged:
                    
if(GetClientHealth(Client) <= GetConVarInt(hBleedingHp))
                    {
                            
//Bleed:
                            
CreateTimer(1.0BleedClient);
                    }
                }
            }
        }
    }
}

//Precache:
ForcePrecache(String:ParticleName[])
{
    
//Declare:
    
decl Particle;
    
    
//Initialize:
    
Particle CreateEntityByName("info_particle_system");
    
    
//Validate:
    
if(IsValidEntity(Particle))
    {
        
//Properties:
        
DispatchKeyValue(Particle"effect_name"ParticleName);
        
        
//Spawn:
        
DispatchSpawn(Particle);
        
ActivateEntity(Particle);
        
AcceptEntityInput(Particle"start");
        
        
//Delete:
        
CreateTimer(0.3DeleteParticleParticleTIMER_FLAG_NO_MAPCHANGE);
    }
}

//Map Start:
public OnMapStart()
{
    
//Gibs:
    
PrecacheModel("models/Gibs/HGIBS.mdl"true);
    
PrecacheModel("models/Gibs/HGIBS_rib.mdl"true);
    
PrecacheModel("models/Gibs/HGIBS_spine.mdl"true);
    
PrecacheModel("models/Gibs/HGIBS_scapula.mdl"true);
    
PrecacheModel("models/player/ct_gign1_dc.mdl"); 
    
PrecacheModel("models/player/ct_gsg91_dc.mdl"); 
    
PrecacheModel("models/player/ct_sas1_dc.mdl"); 
    
PrecacheModel("models/player/ct_urban1_dc.mdl"); 
    
PrecacheModel("models/player/t_arctic1_dc.mdl"); 
    
PrecacheModel("models/player/t_guerilla1_dc.mdl"); 
    
PrecacheModel("models/player/t_leet1_dc.mdl"); 
    
PrecacheModel("models/player/t_phoenix1_dc.mdl"); 
    
PrecacheModel("models/player/ct_gign_head.mdl"); 
    
PrecacheModel("models/player/ct_gsg9_head.mdl"); 
    
PrecacheModel("models/player/ct_sas_head.mdl"); 
    
PrecacheModel("models/player/ct_urban_head.mdl"); 
    
PrecacheModel("models/player/t_arctic_head.mdl"); 
    
PrecacheModel("models/player/t_guerilla_head.mdl"); 
    
PrecacheModel("models/player/t_leet_head.mdl"); 
    
PrecacheModel("models/player/t_phoenix_head.mdl"); 
    
    
//Precache:
    
ForcePrecache("blood_impact_red_01_droplets");
    
ForcePrecache("blood_impact_red_01_smalldroplets");
    
ForcePrecache("blood_zombie_split_spray_tiny");
    
ForcePrecache("blood_zombie_split_spray_tiny2");
    
ForcePrecache("blood_impact_red_01");
    
ForcePrecache("blood_impact_red_01_goop");
    
ForcePrecache("blood_impact_red_01_mist");
    
ForcePrecache("blood_advisor_puncture");
    
ForcePrecache("blood_advisor_puncture_withdraw");
    
ForcePrecache("blood_antlionguard_injured_heavy_tiny");
    
ForcePrecache("blood_advisor_pierce_spray");
    
ForcePrecache("blood_advisor_pierce_spray_b");
    
ForcePrecache("blood_advisor_pierce_spray_c");
    
ForcePrecache("blood_zombie_split_spray");
}

//Initation:
public OnPluginStart()
{
    
//Register:
    
PrintToConsole(0"[SM] Head Gore v2.0 by CircusBrain loaded successfully!");

    
//Events:
    
HookEvent("player_hurt"EventDamage);
    
HookEvent("player_death"EventDeath);

    
//Server Variable:
    
CreateConVar("cssgore_version""2.0""Head Gore Version",FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);

    
//Convars:
    
hGibs =  CreateConVar("sm_gibs_enabled""1""Enable/disable skull/limbs/bones/etc.");
    
hBleedingFreq CreateConVar("sm_bleeding_frequency""15""Time between bleeding.");
    
hBleedingHp CreateConVar("sm_bleeding_health""99""HP required to start bleeding.");
    
hImpactBlood CreateConVar("sm_impact_blood_multiplier""2""Multiplier for amount of extra blood on normal impact damage.");
    
hHeadshotBlood CreateConVar("sm_headshot_blood_multiplier""1""Multiplier for amount of extra blood on headshot kills.");
    
hDeathBlood CreateConVar("sm_death_blood_multiplier""1""Multiplier for amount of extra blood on normal deaths.");


Last edited by Circusbrain; 05-04-2014 at 14:13.
Circusbrain is offline
Circusbrain
Junior Member
Join Date: Apr 2014
Old 05-04-2014 , 14:13   Re: Head Gore... What did I do wrong?
Reply With Quote #2

ANY HELP would be greatly appreciated!?

Last edited by Circusbrain; 05-04-2014 at 14:16.
Circusbrain is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 05-05-2014 , 01:51   Re: Head Gore... What did I do wrong?
Reply With Quote #3

You can see this error in your server logs: " error "ED_Alloc: no free edicts" "

In fact, these lines do not relieve an entity index:
AcceptEntityInput(ent, "Kill");
RemoveEdict(ent);

Maximum number of entities is limited to 2048. You can not create multiple entities every second and avoid this error. Also, you can not relieve an existing entity index manually. Make an array of this entitys (20-30 pieces) in HookEvent("round_start", Event_RoundStart) and use them in turn.
To avoid multiple activations of one entity during a short time use a timer. Create a separate timer for each entity. If the timer is INVALID_HANDLE, activate entity and its timer, otherwise do nothing. And don't forget to set the timer back to INVALID_HANDLE, when its time is over.

Last edited by kadet.89; 05-05-2014 at 03:49.
kadet.89 is offline
Send a message via Skype™ to kadet.89
Circusbrain
Junior Member
Join Date: Apr 2014
Old 05-05-2014 , 07:32   Re: Head Gore... What did I do wrong?
Reply With Quote #4

I wish I knew what you were talking about. I think you mean pre build a group of entities and use them when necessary? Can I Spawn the same entity multiple times at the same time?
Circusbrain is offline
Circusbrain
Junior Member
Join Date: Apr 2014
Old 05-05-2014 , 11:53   Re: Head Gore... What did I do wrong?
Reply With Quote #5

Turns out it's anything I seem to do with prop_ragdoll... I broke out my piece of the code to replace the dead body with a headless model and nothing I change/do makes it NOT crash the server with the following error...

CRagdollProp::CreateObjects: Couldn't Lookup Bone phymodel_head
Bad vphysics swap for prop_ragdoll



This is what I keep commenting out, or uncommenting out and no combination works, even just spawning the ragdoll model crashes the server.

PHP Code:
                new xEntity CreateEntityByName("prop_ragdoll");  
                
DispatchKeyValue(xEntity"model"NewModel);
        
DispatchSpawn(xEntity);
                
TeleportEntity(xEntitynOriginbOriginNULL_VECTOR); 
                if (
Kndeath==1)
                {
                    
vOrigin[2] += 27;
                    new 
x2Entity CreateEntityByName("prop_physics_override");
                    
DispatchKeyValue(x2Entity"model"NewModel2); 
                    
DispatchSpawn(x2Entity);
                    
TeleportEntity(x2EntityvOriginbOriginNULL_VECTOR );

                } 
Circusbrain is offline
Circusbrain
Junior Member
Join Date: Apr 2014
Old 05-05-2014 , 11:54   Re: Head Gore... What did I do wrong?
Reply With Quote #6

Turns out it's anything I seem to do with prop_ragdoll... I broke out my piece of the code to replace the dead body with a headless model and nothing I change/do makes it NOT crash the server with the following error...

CRagdollProp::CreateObjects: Couldn't Lookup Bone phymodel_head
Bad vphysics swap for prop_ragdoll



This is what I keep commenting out, or uncommenting out and no combination works, even just spawning the ragdoll model crashes the server.

PHP Code:
                AcceptEntityInput(iEntRagdoll"Kill"); 
                new 
xEntity CreateEntityByName("prop_ragdoll");  
                
DispatchKeyValue(xEntity"model"NewModel);
                
//DispatchKeyValue(xEntity, "disableshadow", "1");
                
DispatchSpawn(xEntity);
                
//SetEntProp(xEntity, Prop_Send, "m_usSolidFlags", 8);  
                //SetEntProp(xEntity, Prop_Send, "m_CollisionGroup", 11);  
                
TeleportEntity(xEntitynOriginbOriginNULL_VECTOR); 
                
CreateTimer(GetRandomFloat(15.030.0), RemoveGibxEntity);
                if (
Kndeath==1)
                {
                    
vOrigin[2] += 27;
                    new 
x2Entity CreateEntityByName("prop_physics_override");
                    
DispatchKeyValue(x2Entity"model"NewModel2); 
                    
//DispatchKeyValue(x2Entity, "disableshadows", "1"); 
                    //SetEntityModel(x2Entity, NewModel2);
                    //DispatchKeyValue(x2Entity, "StartDisabled", "false");
                    //DispatchKeyValue(x2Entity, "Solid", "6"); 
                    //SetEntProp(x2Entity, Prop_Send, "m_CollisionGroup", 1);
                    //SetEntityMoveType(x2Entity, MOVETYPE_VPHYSICS);
                    
DispatchSpawn(x2Entity);
                    
TeleportEntity(x2EntityvOriginbOriginNULL_VECTOR );
                    
CreateTimer(GetRandomFloat(15.030.0), RemoveGibx2Entity);
                } 
I've gone so far as to make it spawn just the ragdoll and the head, and it still crashes.

PHP Code:
                new xEntity CreateEntityByName("prop_ragdoll");  
                
DispatchKeyValue(xEntity"model"NewModel);
        
DispatchSpawn(xEntity);
                
TeleportEntity(xEntitynOriginbOriginNULL_VECTOR); 
                if (
Kndeath==1)
                {
                    
vOrigin[2] += 27;
                    new 
x2Entity CreateEntityByName("prop_physics_override");
                    
DispatchKeyValue(x2Entity"model"NewModel2); 
                    
DispatchSpawn(x2Entity);
                    
TeleportEntity(x2EntityvOriginbOriginNULL_VECTOR );

                } 
Circusbrain is offline
Circusbrain
Junior Member
Join Date: Apr 2014
Old 05-05-2014 , 11:56   Re: Head Gore... What did I do wrong?
Reply With Quote #7

Is it possible the issue CRagdollProp::CreateObjects: Couldn't Lookup Bone phymodel_head is the cause as I am using a headless model...
Circusbrain is offline
Circusbrain
Junior Member
Join Date: Apr 2014
Old 05-05-2014 , 12:28   Re: Head Gore... What did I do wrong?
Reply With Quote #8

I switched to a model with a head, no crash.. sigh.
Circusbrain is offline
Circusbrain
Junior Member
Join Date: Apr 2014
Old 05-05-2014 , 12:40   Re: Head Gore... What did I do wrong?
Reply With Quote #9

So, how do I fix a model that's saying that? do I "add a bone" ?
Circusbrain is offline
Bittersweet
Veteran Member
Join Date: May 2012
Old 05-05-2014 , 17:19   Re: Head Gore... What did I do wrong?
Reply With Quote #10

Quote:
Originally Posted by Circusbrain View Post
So, how do I fix a model that's saying that? do I "add a bone" ?
You could try to edit the model and "skip" the offending part(s): https://developer.valvesoftware.com/wiki/Skip
__________________
Thank you in advance for your help

My plugins:
[CS:S] BOT Swat | [ANY] CVAR Randomizer | [CS:S] SM CS:S Tag Beta | [CS:S] Bot2Player
Awesome & Crucial plugins by other people:
[CS:S/CS:GO] GunGame | [UMC3] Ultimate Mapchooser | [ANY] Server Crontab | [ANY] SM ForceCamera
Bittersweet 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 13:04.


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