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

L4D2 - What is the location to put a PHP code (Sorry for my ignorance)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gamer_kanelita
Senior Member
Join Date: Jun 2019
Location: Peru
Old 04-03-2020 , 17:13   L4D2 - What is the location to put a PHP code (Sorry for my ignorance)
Reply With Quote #1

Good to all gamers, sorry for my ignorance but I would like someone to tell me exactly where a PHP code is written, since I see that they are solved by that. Example:

#pragma semicolon 1

#include <sourcemod>
#include <sdkhooks>

#define WITCH_DAMAGE_THRESHOLD 799.0

new Float:inflictedDamage[MAXPLAYERS + 1];


public OnEntityCreated(entity, const String:classname[])
{
if (StrEqual(classname, "witch"))
{
SDKHook(entity, SDKHook_OnTakeDamage, OnWitchTakeDamage);
}
}

public Action:OnWitchTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damageType, &weapon, Float:damageForce[3], Float:damagePosition[3])
{
if (!IsWitch(victim) || !IsSurvivor(attacker) || IsFakeClient(attacker))
return Plugin_Continue;

if (IsMelee(weapon))
{
inflictedDamage[attacker] += damage;
if (inflictedDamage[attacker] >= WITCH_DAMAGE_THRESHOLD)
{
damage = GetConVarFloat(FindConVar("z_witch_health")) - inflictedDamage[attacker] + damage;
inflictedDamage[attacker] = 0.0;
return Plugin_Changed;
}
}
CreateTimer(0.1, ResetDamageCounter);
return Plugin_Continue;
}

public Action:ResetDamageCounter(Handle:timer)
{
for (new i = 1; i <= MaxClients; i++)
{
inflictedDamage[i] = 0.0;
}
}

bool:IsSurvivor(client)
{
return (client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2);
}

bool:IsWitch(entity)
{
if (entity > 0 && IsValidEntity(entity) && IsValidEdict(entity))
{
decl String:strClassName[64];
GetEdictClassname(entity, strClassName, sizeof(strClassName));
return StrEqual(strClassName, "witch");
}
return false;
}

bool:IsMelee(weapon)
{
decl String:classname[64];
GetEdictClassname(weapon, classname, sizeof(classname));
return (StrEqual(classname, "weapon_melee"));
}
gamer_kanelita is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-03-2020 , 19:17   Re: L4D2 - What is the location to put a PHP code (Sorry for my ignorance)
Reply With Quote #2

You mean SourceMod Web compiler ?
https://www.sourcemod.net/compiler.php

There is another Web compiler
https://spider.limetech.io/
__________________
Do not Private Message @me
Bacardi 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 03:06.


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