Help please! System of a damage
#1

Hello, I had very important question on a damaga. It is possible to clean somehow standard damage completely? My functions not correctly work. Tazer, shouldn't cause a loss in general, but at first the standard loss from the weapon is taken away, and then quickly restores value health. Sometimes, isn't in time. And if at the player about 10 health, he in general kills him. Question: how to disconnect a standard loss? That only my functions worked, whether there is any way? I want to make approximate function of a loss as on the LS-RP project. Thanks!

PHP код:
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart)
{
    if(
== weaponid && PlayerInfo[issuerid][pStrength] != 0)
    {
        new 
strength PlayerInfo[issuerid][pStrength]*2;
        
GivePlayerHealth(playerid, -strength);
    }
    else if(
== weaponid && PlayerInfo[issuerid][pStrength] != 0)
    {
        new 
strength PlayerInfo[issuerid][pStrength]*3;
        
GivePlayerHealth(playerid, -strength);
    }
    else if((
>= weaponid <= 15) && PlayerInfo[issuerid][pStrength] != 0)
    {
        new 
strength PlayerInfo[issuerid][pStrength]*4;
        
GivePlayerHealth(playerid, -strength);
    }
    if((
<= weaponid <= 46) || weaponid == 53)
    {
        
PlayerInfo[playerid][pHits] ++;
        if(
BODY_PART_TORSOd <= bodypart <= BODY_PART_HEADdDamage[playerid][(bodypart 3)][weaponid]++;
        if(
bodypart == BODY_PART_LEFT_LEG || bodypart == BODY_PART_RIGHT_LEGStartPlayerInjury(playerid);
        
    }
    if(
PlayerIsWounded(playerid))
    {
        
SetPlayerHealth(playerid25.0);
    }
    return 
1;

OnPlayerShootPlayer
PHP код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    new 
Float:armour;
    
GetPlayerArmour(Targetarmour);
    new 
weapon GetWeaponHolding(Shooter);
    if(
PlayerHoldingWeapon(Shooter23) && TazerActive{Shooter})
    {
        if(!
Tazed{Target})
        {
            
GivePlayerHealth(TargetHealthLost);
            
SetPlayerArmour(Targetarmour+ArmourLost);
            
FreezePlayer(Target);
            
OnPlayAnim(Target"PARACHUTE""FALL_skyDive_DIE"4.000010);
            
Tazed{Target} = true;
            
SetTimerEx("SetUnTazed"15000false"i"Target);
        }
        else
        {
            
GivePlayerHealth(TargetHealthLost);
            
SetPlayerArmour(Targetarmour+ArmourLost);
        }
    }
    else if(
PlayerHoldingWeapon(Shooter25) && RubberActive{Shooter})
    {
        if(!
Tazed{Target})
        {
            
GivePlayerHealth(TargetHealthLost);
            
SetPlayerArmour(Targetarmour+ArmourLost);
            
FreezePlayer(Target);
            
OnPlayAnim(Target"SWEET""Sweet_injuredloop"4.010010);
            
Tazed{Target} = true;
            
SetTimerEx("SetUnTazed"30000false"i"Target);
        }
        else
        {
            
GivePlayerHealth(TargetHealthLost);
            
SetPlayerArmour(Targetarmour+ArmourLost);
        }
    }
    else if(
PlayerHoldingWeapon(Shooter41) && CopDuty{Shooter})
    {
        
GivePlayerHealth(TargetHealthLost+0.5);
        if(
armour 0)
        {
            
SetPlayerArmour(Targetarmour+ArmourLost+1.0);
        }
    }
    else if(
weapon == 24 || weapon == 30 || weapon == 31 || weapon == 34 || weapon == 25 || weapon == 29 || weapon == 28 || weapon == 32 || weapon == 33 || weapon == 34)
    {
        if(
GetWorld(Shooter) == GetWorld(Target))
        {
            if(
IsPlayerAimingTargetBodyPart(ShooterTarget1)) // BODY_PART_HEAD
            
{
                
DoDamage(Target1GetPlayerWeapon(Shooter));
            }
            else if(
IsPlayerAimingTargetBodyPart(ShooterTarget2)) // BODY_PART_TORSO
            
{
                
DoDamage(Target2GetPlayerWeapon(Shooter));
            }
            else if(
IsPlayerAimingTargetBodyPart(ShooterTarget3)) // BODY_PART_LEGS
            
{
                
DoDamage(Target3GetPlayerWeapon(Shooter));
            }
        }
    }
    return 
1;

Reply
#2

help, up
Reply
#3

Try something like this --

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 3)
    {
        new Float:phealth;
        GetPlayerHealth(playerid, phealth);
        SetPlayerHealth(playerid, phealth-50);
        SendClientMessage(issuerid, COLOR_ORANGERED, "HIT: Torso (-50)");
    }
}
Reply
#4

Consider using OnPlayerWeaponShoot instead
https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot
and disable native weapon damage between players.
Reply
#5

Quote:
Originally Posted by Shoulen
Посмотреть сообщение
Consider using OnPlayerWeaponShoot instead
https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot
and disable native weapon damage between players.
excuse, but you won't prompt as to disconnect a standard loss? At me many variables which aren't present in onplayerweaponshot are used in onplayershootplayer.
Reply
#6

Quote:
Originally Posted by Wist
Посмотреть сообщение
excuse, but you won't prompt as to disconnect a standard loss? At me many variables which aren't present in onplayerweaponshot are used in onplayershootplayer.
Well you can say OnPlayerShootPlayer is the same as OnPlayerTakeDamage because it gets only called after the player got shoot / took the damage, also OnPlayerShootPlayer is inaccurate

Like said above with OnPlayerWeaponShot you can prevent the weapon damage complete if you return 0
Also there is a great weapon damage system already released -> weapon-config.inc
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)