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

[L4D2]Can someone make this into a plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rekcah
Member
Join Date: Jun 2019
Old 07-01-2020 , 17:55   [L4D2]Can someone make this into a plugin
Reply With Quote #1

Its pretty self explanatory, im not skilled enough to do it myself.https://www.reddit.com/r/l4d2/commen...m_source=share
rekcah is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 07-01-2020 , 18:04   Re: [L4D2]Can someone make this into a plugin
Reply With Quote #2

PHP Code:
/*
*    Rochelle Tank
*    Copyright (C) 2020 Silvers
*
*    This program is free software: you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation, either version 3 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/



#define PLUGIN_VERSION         "0.2"

/*======================================================================================
    Plugin Info:

*    Name      :    [L4D2] Rochelle Tank
*    Author    :    SilverShot
*    Descrp    :    ...
*    Link      :    https://forums.alliedmods.net/showthread.php?t=325668
*    Plugins   :    https://sourcemod.net/plugins.php?exact=exact&sortby=title&search=1&author=Silvers 

========================================================================================
    Change Log:

0.2 (11-Jul-2020)
    - Fixed clone not disappearing when the tank dies.

0.1 (01-Jul-2020)
    - Initial release.

======================================================================================*/

#include <sourcemod>
#include <sdktools>

#define EF_BONEMERGE             (1 << 0)
#define EF_NOSHADOW              (1 << 4)
#define EF_BONEMERGE_FASTCULL    (1 << 7)
#define EF_PARENT_ANIMATES       (1 << 9)

#define MODEL_ROCHELLE            "models/survivors/survivor_producer.mdl"

int g_iClones[MAXPLAYERS+1];

public 
Plugin myinfo =
{
    
name "[L4D2] Rochelle Tank",
    
author "SilverShot",
    
description "...",
    
version "0.1",
    
url "https://sourcemod.net/plugins.php?exact=exact&sortby=title&search=1&author=Silvers"
}

public 
void OnPluginStart()
{
    
HookEvent("player_death"Event_Death);
    
HookEvent("tank_spawn"Event_TankSpawn);
}

public 
void Event_Death(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    if( 
client )
    {
        if( 
g_iClones[client] && EntRefToEntIndex(g_iClones[client]) != INVALID_ENT_REFERENCE )
        {
            
AcceptEntityInput(g_iClones[client], "Kill");
            
g_iClones[client] = 0;
        }
    }
}

public 
void Event_TankSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int tank GetClientOfUserId(event.GetInt("userid"));

    
// int clone = CreateEntityByName(g_bCrazy ? "prop_dynamic" : "commentary_dummy");
    
int clone = CreateEntityByName("prop_dynamic");
    
SetEntityModel(clone, MODEL_ROCHELLE);
    
DispatchSpawn(clone);
    
g_iClones[tank] = EntIndexToEntRef(clone);

    
SetEntityRenderMode(tankRENDER_NONE);
    
SetAttached(clone, tank);
}

// Lux: As a note this should only be used for dummy entity other entities need to remove EF_BONEMERGE_FASTCULL flag.
/*
*    Recreated "SetAttached" entity input from "prop_dynamic_ornament"
*/
stock void SetAttached(int iEntToAttachint iEntToAttachTo)
{
    
SetVariantString("!activator");
    
AcceptEntityInput(iEntToAttach"SetParent"iEntToAttachTo);

    
SetEntityMoveType(iEntToAttachMOVETYPE_NONE);

    
SetEntProp(iEntToAttachProp_Send"m_fEffects"EF_BONEMERGE|EF_NOSHADOW|EF_BONEMERGE_FASTCULL|EF_PARENT_ANIMATES);

    
// Thanks smlib for flag understanding
    
int iFlags GetEntProp(iEntToAttachProp_Data"m_usSolidFlags"2);
    
iFlags iFlags |= 0x0004;
    
SetEntProp(iEntToAttachProp_Data"m_usSolidFlags"iFlags2);

    
TeleportEntity(iEntToAttachview_as<float>({0.00.00.0}), view_as<float>({0.00.00.0}), NULL_VECTOR);


Change Log:
Code:
0.2 (11-Jul-2020)
    - Fixed clone not disappearing when the tank dies.

0.1 (01-Jul-2020)
    - Initial release.

Pretty funny with the crazy face animations:


Assume people will request changes, so leaving here for now. Can make into a full plugin at some point.
__________________

Last edited by Silvers; 07-11-2020 at 11:05.
Silvers is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 07-02-2020 , 00:47   Re: [L4D2]Can someone make this into a plugin
Reply With Quote #3

LMC handles the backend functions for bonemerging to players and infected.
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Alex101192
Senior Member
Join Date: Aug 2018
Old 07-02-2020 , 04:15   Re: [L4D2]Can someone make this into a plugin
Reply With Quote #4

Quote:
Originally Posted by Silvers View Post
PHP Code:
#include <sourcemod>
#include <sdktools>

#define EF_BONEMERGE             (1 << 0)
#define EF_NOSHADOW              (1 << 4)
#define EF_BONEMERGE_FASTCULL    (1 << 7)
#define EF_PARENT_ANIMATES       (1 << 9)

#define MODEL_ROCHELLE            "models/survivors/survivor_producer.mdl"

public Plugin myinfo =
{
    
name "[L4D2] Rochelle Tank",
    
author "SilverShot",
    
description "...",
    
version "0.1",
    
url "https://sourcemod.net/plugins.php?exact=exact&sortby=title&search=1&author=Silvers"
}

public 
void OnPluginStart()
{
    
HookEvent("tank_spawn"Event_TankSpawn);
}

public 
void Event_TankSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int tank GetClientOfUserId(event.GetInt("userid"));

    
// int clone = CreateEntityByName(g_bCrazy ? "prop_dynamic" : "commentary_dummy");
    
int clone = CreateEntityByName("prop_dynamic");
    
SetEntityModel(clone, MODEL_ROCHELLE);
    
DispatchSpawn(clone);

    
SetEntityRenderMode(tankRENDER_NONE);
    
SetAttached(clone, tank);
}

// Lux: As a note this should only be used for dummy entity other entities need to remove EF_BONEMERGE_FASTCULL flag.
/*
*    Recreated "SetAttached" entity input from "prop_dynamic_ornament"
*/
stock void SetAttached(int iEntToAttachint iEntToAttachTo)
{
    
SetVariantString("!activator");
    
AcceptEntityInput(iEntToAttach"SetParent"iEntToAttachTo);

    
SetEntityMoveType(iEntToAttachMOVETYPE_NONE);

    
SetEntProp(iEntToAttachProp_Send"m_fEffects"EF_BONEMERGE|EF_NOSHADOW|EF_BONEMERGE_FASTCULL|EF_PARENT_ANIMATES);

    
// Thanks smlib for flag understanding
    
int iFlags GetEntProp(iEntToAttachProp_Data"m_usSolidFlags"2);
    
iFlags iFlags |= 0x0004;
    
SetEntProp(iEntToAttachProp_Data"m_usSolidFlags"iFlags2);

    
TeleportEntity(iEntToAttachview_as<float>({0.00.00.0}), view_as<float>({0.00.00.0}), NULL_VECTOR);


Pretty funny with the crazy face animations:


This might break when the tank dies not cleaning up the clone anim. Assume people will request changes, so leaving here for now. Can make into a full plugin at some point.
lol what is this ahahah xD
Alex101192 is offline
rekcah
Member
Join Date: Jun 2019
Old 07-02-2020 , 20:13   Re: [L4D2]Can someone make this into a plugin
Reply With Quote #5

Thankyou silvers.
rekcah is offline
BlackSabbarh
Senior Member
Join Date: Sep 2018
Old 11-03-2021 , 03:52   Re: [L4D2]Can someone make this into a plugin
Reply With Quote #6

Quote:
Originally Posted by Silvers View Post
PHP Code:
/*
*    Rochelle Tank
*    Copyright (C) 2020 Silvers
*
*    This program is free software: you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation, either version 3 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/



#define PLUGIN_VERSION         "0.2"

/*======================================================================================
    Plugin Info:

*    Name      :    [L4D2] Rochelle Tank
*    Author    :    SilverShot
*    Descrp    :    ...
*    Link      :    https://forums.alliedmods.net/showthread.php?t=325668
*    Plugins   :    https://sourcemod.net/plugins.php?exact=exact&sortby=title&search=1&author=Silvers 

========================================================================================
    Change Log:

0.2 (11-Jul-2020)
    - Fixed clone not disappearing when the tank dies.

0.1 (01-Jul-2020)
    - Initial release.

======================================================================================*/

#include <sourcemod>
#include <sdktools>

#define EF_BONEMERGE             (1 << 0)
#define EF_NOSHADOW              (1 << 4)
#define EF_BONEMERGE_FASTCULL    (1 << 7)
#define EF_PARENT_ANIMATES       (1 << 9)

#define MODEL_ROCHELLE            "models/survivors/survivor_producer.mdl"

int g_iClones[MAXPLAYERS+1];

public 
Plugin myinfo =
{
    
name "[L4D2] Rochelle Tank",
    
author "SilverShot",
    
description "...",
    
version "0.1",
    
url "https://sourcemod.net/plugins.php?exact=exact&sortby=title&search=1&author=Silvers"
}

public 
void OnPluginStart()
{
    
HookEvent("player_death"Event_Death);
    
HookEvent("tank_spawn"Event_TankSpawn);
}

public 
void Event_Death(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    if( 
client )
    {
        if( 
g_iClones[client] && EntRefToEntIndex(g_iClones[client]) != INVALID_ENT_REFERENCE )
        {
            
AcceptEntityInput(g_iClones[client], "Kill");
            
g_iClones[client] = 0;
        }
    }
}

public 
void Event_TankSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int tank GetClientOfUserId(event.GetInt("userid"));

    
// int clone = CreateEntityByName(g_bCrazy ? "prop_dynamic" : "commentary_dummy");
    
int clone = CreateEntityByName("prop_dynamic");
    
SetEntityModel(clone, MODEL_ROCHELLE);
    
DispatchSpawn(clone);
    
g_iClones[tank] = EntIndexToEntRef(clone);

    
SetEntityRenderMode(tankRENDER_NONE);
    
SetAttached(clone, tank);
}

// Lux: As a note this should only be used for dummy entity other entities need to remove EF_BONEMERGE_FASTCULL flag.
/*
*    Recreated "SetAttached" entity input from "prop_dynamic_ornament"
*/
stock void SetAttached(int iEntToAttachint iEntToAttachTo)
{
    
SetVariantString("!activator");
    
AcceptEntityInput(iEntToAttach"SetParent"iEntToAttachTo);

    
SetEntityMoveType(iEntToAttachMOVETYPE_NONE);

    
SetEntProp(iEntToAttachProp_Send"m_fEffects"EF_BONEMERGE|EF_NOSHADOW|EF_BONEMERGE_FASTCULL|EF_PARENT_ANIMATES);

    
// Thanks smlib for flag understanding
    
int iFlags GetEntProp(iEntToAttachProp_Data"m_usSolidFlags"2);
    
iFlags iFlags |= 0x0004;
    
SetEntProp(iEntToAttachProp_Data"m_usSolidFlags"iFlags2);

    
TeleportEntity(iEntToAttachview_as<float>({0.00.00.0}), view_as<float>({0.00.00.0}), NULL_VECTOR);


Change Log:
Code:
0.2 (11-Jul-2020)
    - Fixed clone not disappearing when the tank dies.

0.1 (01-Jul-2020)
    - Initial release.

Pretty funny with the crazy face animations:


Assume people will request changes, so leaving here for now. Can make into a full plugin at some point.

with this could change the skin to a common infected? example of a hunter?
BlackSabbarh is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 11-03-2021 , 07:58   Re: [L4D2]Can someone make this into a plugin
Reply With Quote #7

Yes is possible, I think that the only issue is that when they die the ragdoll appears as a normal common.
But in this case, you can use the "dissolve infected" plugin combined.

Here is a snippet, I didn't test but is something like that.
Attached Files
File Type: sp Get Plugin or Get Source (testhunter.sp - 151 views - 4.6 KB)
__________________
Marttt is offline
BlackSabbarh
Senior Member
Join Date: Sep 2018
Old 11-03-2021 , 17:11   Re: [L4D2]Can someone make this into a plugin
Reply With Quote #8

Quote:
Originally Posted by Marttt View Post
Yes is possible, I think that the only issue is that when they die the ragdoll appears as a normal common.
But in this case, you can use the "dissolve infected" plugin combined.

Here is a snippet, I didn't test but is something like that.

hi, if it works perfectly, could you please add a random switch to have a common infected virus combined with hunter?
BlackSabbarh is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 11-03-2021 , 23:00   Re: [L4D2]Can someone make this into a plugin
Reply With Quote #9

Didn't understand, but if you want something "random", just do something like that "OnEntityCreated"

Example: 10% chance.

PHP Code:
public void OnEntityCreated(int entity, const char[] classname)
{
    if (
StrEqual(classname"infected") && 10 >= GetRandomInt(0100))
        
SDKHook(entitySDKHook_SpawnPostOnSpawnPostCommon);

__________________

Last edited by Marttt; 11-03-2021 at 23:01.
Marttt 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 20:01.


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