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

Prop take damage plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
InfoTheRalle
Member
Join Date: Sep 2016
Old 10-25-2016 , 05:00   Prop take damage plugin
Reply With Quote #1

Hez Alliedmodders community!,

I need help, found a great plugin i like it so much but got some problems.. maybe somebody can help me hope it so... ah The plugin works fine, props takes damage but!. I want it so that players can damage props but only with a knife?. Maybe its possible?, i use this plugin here: "https://forums.alliedmods.net/showthread.php?p=1618258" want it for my Zombie Server.

Greetings
InfoTheRalle is offline
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 10-25-2016 , 11:06   Re: Prop take damage plugin
Reply With Quote #2

Hi, compile this with your compile.sp file from scripting folder and put it in your plugins folder.


PHP Code:
//Includes:
#include <sdktools>

//Terminate:
#pragma semicolon    1
#pragma compress    0

//Definitions:
#define PLUGINVERSION    "1.01.02"

//Misc
static ColourOffset;
static 
MaxDamage;
static 
MinDamage;

//ConVars:
enum XCVar
{
Handle:CV_MAXDAMAGE,
Handle:CV_MINDAMAGE
}

//Cvar Handle:
static Handle:CVAR[XCVar] = {INVALID_HANDLE,...};

//Plugin Info:
public Plugin:myinfo =
{
name "Prop Damage and effects",
author "Master(D)",
description "Allows props to take damage",
version PLUGINVERSION,
url ""
};

//Initation:
public OnPluginStart()
{

//Print Server If Plugin Start:
PrintToConsole(0"|SM| Prop Damage Successfully Loaded (v%s)!"PLUGINVERSION);

//ConVar Hooks:
CVAR[CV_MAXDAMAGE] = CreateConVar("sm_prop_max_damage""3""enable/disable player connet announce default (1)");

CVAR[CV_MINDAMAGE] = CreateConVar("sm_prop_min_damage""5""enable/disable player disconnet announce default (1)");

//Server Version:
CreateConVar("sm_Prop_Damage_version"PLUGINVERSION"show the version of the zombie mod"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);

//Create Auto Configurate File:
AutoExecConfig(true"Prop_Damage");

//Hook Cvar:
HookConVarChange(CVAR[CV_MAXDAMAGE], MaxChanged);

HookConVarChange(CVAR[CV_MAXDAMAGE], MinChanged);

//Entity Hook:
HookEntityOutput("prop_physics""OnTakeDamage"PropTakeDamage);

//Entity Hook:
HookEntityOutput("func_breakable""OnBreak"PropBreak);

//Entity Hook:
HookEntityOutput("prop_physics""OnBreak"PropBreak);

//Entity Hook:
HookEntityOutput("func_physbox""OnBreak"PropBreak);
}

//Map Start:
public OnMapStart()
{

//Find Offsets:
ColourOffset FindSendPropOffs("CBaseEntity""m_clrRender");

//Set Values:
MaxDamage GetConVarInt(CVAR[CV_MAXDAMAGE]);

MinDamage GetConVarInt(CVAR[CV_MINDAMAGE]);
}

//Max
public MaxChanged(Handle:convar, const String:oldValue[], const String:newValue[])
{

//Initulize:
MaxDamage StringToInt(newValue);
}

//Min
public MinChanged(Handle:convar, const String:oldValue[], const String:newValue[])
{

//Initulize:
MinDamage StringToInt(newValue);
}

//Take Damage Event:
public PropTakeDamage(const String:Output[], CallerActivatorFloat:Delay)
{

//Declare
new String:classname[32];
GetClientWeapon(activatorclassnamesizeof(classname));


//Declare:
new Color[4];

//Initulize:
GetEntDataArray(CallerColourOffsetColor41);

//Declare:
new Random;

if(
MaxDamage MinDamage)
{

//Initulize:
Random GetRandomInt(MinDamageMaxDamage);
}

//Override:
else
{

//Initulize:
Random MaxDamage;
}

//Math:
Color[1] = Color[1] - Random;
Color[2] = Color[2] - Random;

//Is
if(Color[1] <= 20 && Color[2] <= 20 && StrEqual(classname"weapon_knife"))
{

//Declare:
decl Float:fPos[3],Float:dir[3];

//Initulize:
GetEntPropVector(CallerProp_Send"m_vecOrigin"fPos);

//Create Temp Ent:
TE_SetupSparks(fPosdir83);

//Sent Effect:
TE_SendToAll();

//Accept Entity Input:
AcceptEntityInput(Caller"Kill");
}

//Override:
else
{

//Set Colour:
SetEntDataArray(CallerColourOffsetColor41);
}
}

//Take Damage Event:
public PropBreak(const String:Output[], CallerActivatorFloat:Delay)
{

//Declare:
decl Float:fPos[3],Float:dir[3];

//Initulize:
GetEntPropVector(CallerProp_Send"m_vecOrigin"fPos);

//Create Temp Ent:
TE_SetupSparks(fPosdir83);

//Sent Effect:
TE_SendToAll();

Also, tell me how it goes.

Last edited by Nursik; 10-25-2016 at 14:29.
Nursik is offline
InfoTheRalle
Member
Join Date: Sep 2016
Old 10-25-2016 , 11:31   Re: Prop take damage plugin
Reply With Quote #3

Hey Nursik!,

Thanks for your help, I try it tomorrow what you changed yet?.

Greetings
InfoTheRalle is offline
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 10-25-2016 , 11:44   Re: Prop take damage plugin
Reply With Quote #4

Quote:
Originally Posted by InfoTheRalle View Post
Hey Nursik!,

Thanks for your help, I try it tomorrow what you changed yet?.

Greetings
ah, nothing. Just added a semicolon ( ; ) where it was missing.
Nursik is offline
InfoTheRalle
Member
Join Date: Sep 2016
Old 10-25-2016 , 12:47   Re: Prop take damage plugin
Reply With Quote #5

Senicolon?, what is that mate
InfoTheRalle is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 10-25-2016 , 15:07   Re: Prop take damage plugin
Reply With Quote #6

I'm not entirely sure if this would work:
Attached Files
File Type: sp Get Plugin or Get Source (propdamage.sp - 716 views - 483 Bytes)
Mitchell is offline
InfoTheRalle
Member
Join Date: Sep 2016
Old 10-26-2016 , 02:27   Re: Prop take damage plugin
Reply With Quote #7

Hey Mitchell!,

thanks that you try to help me. I tried the Plugin but, the props cant no more movie only with "E" and they dont get damage, is it not possible for you that you modifiy the original sp, and add some lines that only knife can hurt props?, or only the T side maybe...

greetingd
InfoTheRalle is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 10-26-2016 , 08:40   Re: Prop take damage plugin
Reply With Quote #8

Just run both plugins.
Mitchell is offline
InfoTheRalle
Member
Join Date: Sep 2016
Old 10-26-2016 , 09:14   Re: Prop take damage plugin
Reply With Quote #9

I tried it, but with both plugins together props dont get damage and only moveable with "E" and not with bullets too..
InfoTheRalle is offline
InfoTheRalle
Member
Join Date: Sep 2016
Old 10-26-2016 , 09:41   Re: Prop take damage plugin
Reply With Quote #10

Some props are not breakable, i think because there not "prop_physics" tried to fix it self but get a error if i try to compile:

/home/groups/sourcemod/upload_tmp/phpv1JsVL.sp(7) : warning 207: unknown #pragma
/home/groups/sourcemod/upload_tmp/phpv1JsVL.sp(7) : error 038: extra characters on line

added only this here:

//Entity Hook:
HookEntityOutput("prop_physics_multiplayer", "OnTakeDamage", PropTakeDamage);

//Entity Hook:
HookEntityOutput("prop_physics_override", "OnTakeDamage", PropTakeDamage);

mhh is it so hard to modify a plugin
InfoTheRalle 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 19:38.


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