Raised This Month: $ Target: $400
 0% 

[L4D & L4D2] Tank's Burning Rock


Post New Thread Reply   
 
Thread Tools Display Modes
huangran
Junior Member
Join Date: Oct 2021
Old 01-16-2022 , 01:32   Re: [L4D & L4D2] Tank's Burning Rock
Reply With Quote #71

nice job! Thank you
huangran is offline
NoroHime
Veteran Member
Join Date: Aug 2016
Location: bed
Old 10-31-2022 , 16:48   Re: [L4D & L4D2] Tank's Burning Rock
Reply With Quote #72

rewrite, new syntax, stable, require Left 4 DHooks Direct
if tank burning, he throw burning rock
if burning rock detonate, then explode

PHP Code:
// method to make explosion 1=pipe bomb 2=molotov (requires left4dhooks)
rock_explosion_explosion "1"

// extra explosion particle 1=yes 0=no
rock_explosion_particle "1" 
v1.0 just releases; 1-December-2022
Attached Files
File Type: sp Get Plugin or Get Source (l4d_rock_explosion.sp - 80 views - 4.6 KB)
__________________
NoroHime is offline
NoroHime
Veteran Member
Join Date: Aug 2016
Location: bed
Old 10-31-2022 , 18:04   Re: [L4D & L4D2] Tank's Burning Rock
Reply With Quote #73

rewrite version, i didn't expected the code could be so few lines
require Left 4 DHooks Direct
v1.0.1 less and optimize code; 1-December-2022

PHP Code:
#define PLUGIN_VERSION    "1.0.1"
#define PLUGIN_NAME        "l4d_rock_explosion"
 
#pragma newdecls required
 
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
 
#define PARTICLE_EXPLOSION    "gas_explosion_pump"

ConVar ConVarParticle;            bool bParticle;
ConVar ConVarExplosion;            int iExplosion;

native int L4D_PipeBombPrj(int client, const float vecPos[3], const float vecAng[3]);
native int L4D_MolotovPrj(int client, const float vecPos[3], const float vecAng[3]);

native int L4D_DetonateProjectile(int entity);
forward void L4D_TankRock_OnDetonate(int tankint rock);

/**
 *  v1.0 just releases; 1-December-2022
 *  v1.0.1 less and optimize code; 1-December-2022
 */

public APLRes AskPluginLoad2(Handle myselfbool latechar[] errorint err_max) {
    
MarkNativeAsOptional("L4D_PipeBombPrj");
    
MarkNativeAsOptional("L4D_MolotovPrj");
    
MarkNativeAsOptional("L4D_DetonateProjectile");
    return 
APLRes_Success;
}

public 
Plugin myinfo = {
    
name "[L4D2] Tank Rock Explosion",
    
author "NoroHime",
    
description "",
    
version PLUGIN_VERSION,
};

public 
void OnPluginStart() {

    
CreateConVar                        ("rock_explosion"PLUGIN_VERSION,        "Version of 'Tank Rock Explosion'"FCVAR_DONTRECORD|FCVAR_NOTIFY);
    
ConVarParticle =        CreateConVar("rock_explosion_particle""1",        "extra explosion particle 1=yes 0=no"FCVAR_NOTIFY);
    
ConVarExplosion =        CreateConVar("rock_explosion_explosion""1",        "method to make explosion 1=pipe bomb 2=molotov"FCVAR_NOTIFY);

    
AutoExecConfig(truePLUGIN_NAME);

    
ConVarParticle.AddChangeHook(OnConVarChanged);
    
ConVarExplosion.AddChangeHook(OnConVarChanged);

    
ApplyCvars();
}

public 
void OnMapStart() {
    
PrecacheParticle(PARTICLE_EXPLOSION);
}

void ApplyCvars() {

    
bParticle ConVarParticle.BoolValue;
    
iExplosion ConVarExplosion.IntValue;
}
 
void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue) {
    
ApplyCvars();
}
 
public 
void OnConfigsExecuted() {
    
ApplyCvars();
}

public 
void OnEntityCreated(int entity, const char[] classname) {

    if (
strcmp(classname"tank_rock") == 0
        
SDKHook(entitySDKHook_SpawnPostOnRockSpawn);
}

void OnRockSpawn(int entity) {

    
int owner GetEntPropEnt(entityProp_Data"m_hOwnerEntity");

    if (
IsValidEntity(owner) && GetEntityFlags(owner) & FL_ONFIRE)
        
IgniteEntity(entity999.0);
}

public 
void L4D_TankRock_OnDetonate(int tankint rock) {

    if (
GetEntityFlags(rock) & FL_ONFIRE) {

        
float vPos[3];
        
GetEntPropVector(rockProp_Send"m_vecOrigin"vPos);

        
// ServerCommand("sm_zedtime 0.5");

        
switch (iExplosion) {
            case 
: {

                
int projectile L4D_PipeBombPrj(tankvPosNULL_VECTOR);

                if (
projectile != -1)
                    
L4D_DetonateProjectile(projectile);
            }

            case 
: {

                
int projectile L4D_MolotovPrj(tankvPosNULL_VECTOR);

                if (
projectile != -1)
                    
L4D_DetonateProjectile(projectile);
            }
        }

        if (
bParticle) {
 
            
int particle CreateEntityByName("info_particle_system");
 
            if (
particle != -1) {
 
                
TeleportEntity(particlevPosNULL_VECTORNULL_VECTOR);
 
                
DispatchKeyValue(particle"effect_name"PARTICLE_EXPLOSION);
                
DispatchKeyValue(particle"targetname""particle");
 
                
DispatchSpawn(particle);
                
ActivateEntity(particle);
 
                
AcceptEntityInput(particle"start");
 
                
SetVariantString("OnUser1 !self:Kill::3.0:-1");
                
AcceptEntityInput(particle"AddOutput");
                
AcceptEntityInput(particle"FireUser1");
            }
        }
    }
}

void PrecacheParticle(const char[] sEffectName)
{
    static 
int table INVALID_STRING_TABLE;
    if( 
table == INVALID_STRING_TABLE )
    {
        
table FindStringTable("ParticleEffectNames");
    }
 
    if( 
FindStringIndex(tablesEffectName) == INVALID_STRING_INDEX )
    {
        
bool save LockStringTables(false);
        
AddToStringTable(tablesEffectName);
        
LockStringTables(save);
    }

Attached Files
File Type: sp Get Plugin or Get Source (l4d_rock_explosion.sp - 96 views - 3.8 KB)
__________________

Last edited by NoroHime; 10-31-2022 at 18:06.
NoroHime is offline
Franco20
Member
Join Date: Nov 2022
Old 11-06-2022 , 16:08   Re: [L4D & L4D2] Tank's Burning Rock
Reply With Quote #74

Quote:
Originally Posted by NoroHime View Post
rewrite version, i didn't expected the code could be so few lines
require Left 4 DHooks Direct
v1.0.1 less and optimize code; 1-December-2022

PHP Code:
#define PLUGIN_VERSION    "1.0.1"
#define PLUGIN_NAME        "l4d_rock_explosion"
 
#pragma newdecls required
 
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
 
#define PARTICLE_EXPLOSION    "gas_explosion_pump"

ConVar ConVarParticle;            bool bParticle;
ConVar ConVarExplosion;            int iExplosion;

native int L4D_PipeBombPrj(int client, const float vecPos[3], const float vecAng[3]);
native int L4D_MolotovPrj(int client, const float vecPos[3], const float vecAng[3]);

native int L4D_DetonateProjectile(int entity);
forward void L4D_TankRock_OnDetonate(int tankint rock);

/**
 *  v1.0 just releases; 1-December-2022
 *  v1.0.1 less and optimize code; 1-December-2022
 */

public APLRes AskPluginLoad2(Handle myselfbool latechar[] errorint err_max) {
    
MarkNativeAsOptional("L4D_PipeBombPrj");
    
MarkNativeAsOptional("L4D_MolotovPrj");
    
MarkNativeAsOptional("L4D_DetonateProjectile");
    return 
APLRes_Success;
}

public 
Plugin myinfo = {
    
name "[L4D2] Tank Rock Explosion",
    
author "NoroHime",
    
description "",
    
version PLUGIN_VERSION,
};

public 
void OnPluginStart() {

    
CreateConVar                        ("rock_explosion"PLUGIN_VERSION,        "Version of 'Tank Rock Explosion'"FCVAR_DONTRECORD|FCVAR_NOTIFY);
    
ConVarParticle =        CreateConVar("rock_explosion_particle""1",        "extra explosion particle 1=yes 0=no"FCVAR_NOTIFY);
    
ConVarExplosion =        CreateConVar("rock_explosion_explosion""1",        "method to make explosion 1=pipe bomb 2=molotov"FCVAR_NOTIFY);

    
AutoExecConfig(truePLUGIN_NAME);

    
ConVarParticle.AddChangeHook(OnConVarChanged);
    
ConVarExplosion.AddChangeHook(OnConVarChanged);

    
ApplyCvars();
}

public 
void OnMapStart() {
    
PrecacheParticle(PARTICLE_EXPLOSION);
}

void ApplyCvars() {

    
bParticle ConVarParticle.BoolValue;
    
iExplosion ConVarExplosion.IntValue;
}
 
void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue) {
    
ApplyCvars();
}
 
public 
void OnConfigsExecuted() {
    
ApplyCvars();
}

public 
void OnEntityCreated(int entity, const char[] classname) {

    if (
strcmp(classname"tank_rock") == 0
        
SDKHook(entitySDKHook_SpawnPostOnRockSpawn);
}

void OnRockSpawn(int entity) {

    
int owner GetEntPropEnt(entityProp_Data"m_hOwnerEntity");

    if (
IsValidEntity(owner) && GetEntityFlags(owner) & FL_ONFIRE)
        
IgniteEntity(entity999.0);
}

public 
void L4D_TankRock_OnDetonate(int tankint rock) {

    if (
GetEntityFlags(rock) & FL_ONFIRE) {

        
float vPos[3];
        
GetEntPropVector(rockProp_Send"m_vecOrigin"vPos);

        
// ServerCommand("sm_zedtime 0.5");

        
switch (iExplosion) {
            case 
: {

                
int projectile L4D_PipeBombPrj(tankvPosNULL_VECTOR);

                if (
projectile != -1)
                    
L4D_DetonateProjectile(projectile);
            }

            case 
: {

                
int projectile L4D_MolotovPrj(tankvPosNULL_VECTOR);

                if (
projectile != -1)
                    
L4D_DetonateProjectile(projectile);
            }
        }

        if (
bParticle) {
 
            
int particle CreateEntityByName("info_particle_system");
 
            if (
particle != -1) {
 
                
TeleportEntity(particlevPosNULL_VECTORNULL_VECTOR);
 
                
DispatchKeyValue(particle"effect_name"PARTICLE_EXPLOSION);
                
DispatchKeyValue(particle"targetname""particle");
 
                
DispatchSpawn(particle);
                
ActivateEntity(particle);
 
                
AcceptEntityInput(particle"start");
 
                
SetVariantString("OnUser1 !self:Kill::3.0:-1");
                
AcceptEntityInput(particle"AddOutput");
                
AcceptEntityInput(particle"FireUser1");
            }
        }
    }
}

void PrecacheParticle(const char[] sEffectName)
{
    static 
int table INVALID_STRING_TABLE;
    if( 
table == INVALID_STRING_TABLE )
    {
        
table FindStringTable("ParticleEffectNames");
    }
 
    if( 
FindStringIndex(tablesEffectName) == INVALID_STRING_INDEX )
    {
        
bool save LockStringTables(false);
        
AddToStringTable(tablesEffectName);
        
LockStringTables(save);
    }

download your plugin and when i use it the server crashes when the burning tank throws a rock and hits the survivor and the game crashes :C .
Franco20 is offline
NoroHime
Veteran Member
Join Date: Aug 2016
Location: bed
Old 11-07-2022 , 04:41   Re: [L4D & L4D2] Tank's Burning Rock
Reply With Quote #75

try set rock_explosion_particle to 0, then all entity handle by L4DD, will be safe
__________________
NoroHime is offline
Franco20
Member
Join Date: Nov 2022
Old 11-08-2022 , 11:03   Re: [L4D & L4D2] Tank's Burning Rock
Reply With Quote #76

Quote:
Originally Posted by NoroHime View Post
try set rock_explosion_particle to 0, then all entity handle by L4DD, will be safe
It's still the same, the game crashes when the rock hits the survivor. Does this add-on work for Left 4 Dead 2?
Franco20 is offline
NoroHime
Veteran Member
Join Date: Aug 2016
Location: bed
Old 11-09-2022 , 05:40   Re: [L4D & L4D2] Tank's Burning Rock
Reply With Quote #77

recent i check the crash report stack, actually have this random crash problem, it is hard to fix because random
any way i make detoante OnNextFrame
i will keep playing this many round game to confirm :C
but not encounter your situation, crash happen on many hourse played
-----
attachment file is 1.0.2 newer
Attached Files
File Type: sp Get Plugin or Get Source (l4d_rock_explosion.sp - 149 views - 4.5 KB)
__________________

Last edited by NoroHime; 11-10-2022 at 12:30.
NoroHime is offline
Franco20
Member
Join Date: Nov 2022
Old 04-24-2023 , 12:15   Re: [L4D & L4D2] Tank's Burning Rock
Reply With Quote #78

unfortunately your plugin actually just dumbs you down it doesn't explode and it's a nuisance xd
Franco20 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 00:05.


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