Used this on start then Action:OnUseHook and Action: Physbox_TakeDamage
PHP Code:
public OnEntityCreated(entity, const String:classname[])
{
if ( StrEqual( classname, "func_physbox" ) )
{
SDKHook( entity, SDKHook_OnTakeDamage, Physbox_TakeDamage );
}
else
{
SDKHook(entity, SDKHook_Use, OnUseHook);
}
}
But unfortunately it didn't work even when I changed some stuff here and there
Attaching the source code for you to look into as I am trying to make it work day after day with no results ;/ (the .sp is that has your part of code like you posted not the one with your part edited)
///This is the edited part of your code that I tried and didn't work aswell :/
PHP Code:
public Action:Physbox_TakeDamage( entity, &attacker, &inflictor, &Float:damage, &damagetype )
{
if (!G_bConfigLoaded && G_bRoundTransition && !IsValidEdict( entity ))
{
if (damagetype == DMG_GENERIC)
{
for (new index = 0; index < entArraySize; index++)
{
if (entArray[index][ent_entityid] == Entity_GetHammerID(entity))
{
if (entArray[index][ent_chat])
{
new String:name[64];
GetEntityClassname(entity,name, sizeof(name));
if ( entArray[index][ent_mode] == 2 && entArray[index][ent_cooldowntime] <= -1 )
{
for ( new ply = 1; ply <= MaxClients; ply++ )
{
if ( IsClientConnected( ply ) && IsClientInGame( ply ) )
{
if (!GetConVarBool(G_hCvar_ModeTeamOnly) || (GetConVarBool(G_hCvar_ModeTeamOnly) && GetClientTeam(ply) == GetClientTeam(attacker) || !IsPlayerAlive(ply) || CheckCommandAccess(ply, "entWatch_chat", ADMFLAG_CHAT)))
{
CPrintToChat(ply,"\x07%s[entWatch] \x07%s%N \x07%s \x07%s\x07%s%t \x07%s%s", color_tag, color_name, attacker, color_use, color_use, color_use, "shot", entArray[index][ent_color], entArray[index][ent_name]);
}
}
}
entArray[index][ent_cooldowntime] = entArray[index][ent_cooldown];
}
}
}
}
}
}
}
Sorry I'm terrible at coding and I'm just trying to add something to an existing plugin (ofc without taking any credits as I simply don't even deserve nor want to).