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

[HELP] Opinions Regarding CS:GO Gore Plug-in


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 03-30-2015 , 03:46   [HELP] Opinions Regarding CS:GO Gore Plug-in
Reply With Quote #1

Hey, I've made a small and basic CS:GO gore plug-in that enhances the blood when a player is killed by a head shot for a personal game server.

I took things from CS:GO Goremod.

My questions are the next ones.

Is the Force Precaching OK and really required (at OnMapStart)?
Is the entity removal way OK?
Is the blood particle creation OK? The way I am using DispatchKeyValue, DispatchSpawn, ActivateEntity and AcceptEntityInput?

With much thanks.

PHP Code:
#include <sourcemod>
#include <sdktools>

public OnPluginStart() {
    
HookEvent("player_death"OnPlayerDeath);
}

public 
OnMapStart() {
    
PrecacheParticle("blood_impact_heavy");
    
PrecacheParticle("blood_impact_goop_heavy");
    
PrecacheParticle("blood_impact_red_01_chunk");
    
PrecacheParticle("blood_impact_headshot_01c");
    
PrecacheParticle("blood_impact_headshot_01b");
    
PrecacheParticle("blood_impact_headshot_01d");
    
PrecacheParticle("blood_impact_basic");
    
PrecacheParticle("blood_impact_medium");
    
PrecacheParticle("blood_impact_red_01_goop_a");
    
PrecacheParticle("blood_impact_red_01_goop_b");
    
PrecacheParticle("blood_impact_goop_medium");
    
PrecacheParticle("blood_impact_red_01_goop_c");
    
PrecacheParticle("blood_impact_red_01_drops");
    
PrecacheParticle("blood_impact_drops1");
    
PrecacheParticle("blood_impact_red_01_backspray");
}

public 
OnPlayerDeath(Handle:pEvent, const String:EventName[], bool:NoBroadcast) {
    static 
ClientIterator;

    if (
GetEventBool(pEvent"headshot")) {
        
Client GetClientOfUserId(GetEventInt(pEvent"userid"));

        for (
Iterator 0Iterator 3Iterator++) {
            
CreateParticle(Client"blood_impact_red_01_backspray");
            
CreateParticle(Client"blood_impact_drops1");
            
CreateParticle(Client"blood_impact_red_01_drops");
        }

        
CreateParticle(Client"blood_impact_red_01_goop_c");
        
CreateParticle(Client"blood_impact_goop_medium");
        
CreateParticle(Client"blood_impact_red_01_goop_b");
        
CreateParticle(Client"blood_impact_red_01_goop_a");
        
CreateParticle(Client"blood_impact_medium");
        
CreateParticle(Client"blood_impact_basic");
        
CreateParticle(Client"blood_impact_heavy");
        
CreateParticle(Client"blood_impact_goop_heavy");
        
CreateParticle(Client"blood_impact_red_01_chunk");
        
CreateParticle(Client"blood_impact_headshot_01c");
        
CreateParticle(Client"blood_impact_headshot_01b");
        
CreateParticle(Client"blood_impact_headshot_01d");
    }
}

public 
Action:KillParticle(Handle:pTimerParticle) {
    
AcceptEntityInput(Particle"kill");
}

SpawnParticle(ParticleString:Name[]) {
    
DispatchKeyValue(Particle"effect_name"Name);
    
DispatchSpawn(Particle);
    
ActivateEntity(Particle);
    
AcceptEntityInput(Particle"start");
}

PrecacheParticle(String:Name[]) {
    static 
Particle;

    
Particle CreateEntityByName("info_particle_system");
    if (
Particle != INVALID_ENT_REFERENCE) {
        
SpawnParticle(ParticleName);
        
CreateTimer(1.0KillParticleParticleTIMER_FLAG_NO_MAPCHANGE);
    }
}

CreateParticle(ClientString:Name[]) {
    static 
Float:Origin[3], Particle;

    
Particle CreateEntityByName("info_particle_system");
    if (
Particle != INVALID_ENT_REFERENCE) {
        
GetEntPropVector(ClientProp_Send"m_vecOrigin"Origin);
        
Origin[2] += GetRandomFloat(5.030.0);

        
TeleportEntity(ParticleOriginNULL_VECTORNULL_VECTOR);

        
SpawnParticle(ParticleName);
        
CreateTimer(1.0KillParticleParticleTIMER_FLAG_NO_MAPCHANGE);
    }

__________________

Last edited by claudiuhks; 03-31-2015 at 10:43.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 03-30-2015 , 04:21   Re: [HELP] Opinions Regarding CS:GO Gore Plug-in
Reply With Quote #2

The biggest problem here is your function naming convention.
__________________
asherkin is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 03-31-2015 , 10:29   Re: [HELP] Opinions Regarding CS:GO Gore Plug-in
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
The biggest problem here is your function naming convention.
OK.

This plug-in actually causes a problem.

Code:
Entity 457 is not a CBaseEntity
   AcceptEntityInput(Particle, "kill") @ KillParticle(Handle:pTimer, Particle)
How can I fix this problem? It rarely appears on a 32-players game server and I am afraid I can't reproduce it locally...

Anyways, I am going to try with any other entity removal way.

PHP Code:
public Action:KillParticle(Handle:pTimerParticle) {
    static 
String:Name[32];

    if (
IsValidEdict(Particle)) {
        
GetEdictClassname(ParticleNamesizeof(Name));

        if (
strcmp(Name"info_particle_system"false) == 0)
            
RemoveEdict(Particle);
    }

__________________

Last edited by claudiuhks; 03-31-2015 at 11:10.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
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:21.


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