SA-MP Forums Archive
How to fix damage weapons - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to fix damage weapons (/showthread.php?tid=647645)



How to fix damage weapons - ducmcmca1 - 08.01.2018

Cant you tell me how to fix damage weapons??
E.g: I want fix damage weapons deagle 46 down 23
Please tell me the principle of their operation


Re: How to fix damage weapons - Abagail - 08.01.2018

There are many ways to implement custom damage, which is what you'd be doing. Search "SA-MP custom damage" and you can find many different results on potential options. One way is setting all players to the same team and manually giving damage for all weapons (note some things are still a hard-coded death; vehicle explosion and some others).


Re: How to fix damage weapons - Lirbo - 08.01.2018

PHP код:
#define deagle_damage 23
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID && weaponid == 24)
    {
        new 
Float:hpFloat:apFloat:damageleft;
        
GetPlayerArmour(playeridap);
        
GetPlayerHealth(playeridhp);
        if(
ap deagle_damage)
        {
            
damageleft deagle_damage ap;
            
SetPlayerArmour(playerid0);
            
SetPlayerHealth(playeridhp-damageleft);
            return 
1;
        }
        
SetPlayerHealth(playeridhp+amount);
        
SetPlayerHealth(playeridhp-deagle_damage);
    }
    return 
1;

I believe it could cause bugs, I'd recommend you in this case to just create server-sided HP