AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Custom weapon damage (https://forums.alliedmods.net/showthread.php?t=322951)

Gold Fish 04-08-2020 15:09

Custom weapon damage
 
Hello, I put the hook on the damage from the weapon through
HTML Code:

SDKHook(entity, SDKHook_OnTakeDamage, OnTakeDamage);,
I change the damage, but then I check it after injuring the infected ones and I find that the damage additionally increases or decreases depending on the hit box, how will the damage change me so that it does not change at all and is exactly the same as I configured in the plugin?

sorry for my English

game L4D2

Bacardi 04-08-2020 15:14

Re: Custom weapon damage
 
Show your code... please.

Gold Fish 04-08-2020 16:11

Re: Custom weapon damage
 
Quote:

Originally Posted by Bacardi (Post 2691785)
Show your code... please.

HTML Code:


public void OnClientPutInServer(int client)
{
        SDKHook(client, SDKHook_TraceAttack, OnTakeDamage);
}
public void  OnClientDisconnect(int client)
{
        SDKUnhook(client, SDKHook_TraceAttack, OnTakeDamage);
}

public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &ammotype, int hitbox, int hitgroup)
{

        if (damage <= 0.0 || victim < 1 || victim > 2048 || attacker < 1 || attacker > MaxClients)
                return Plugin_Continue;

        damage = 100.0;
        return Plugin_Changed;
}


This is the simplest example, even after such a change in damage, when hit in the leg, less than 100 will be taken away, and when hit in the head twice as much


All times are GMT -4. The time now is 23:13.

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