OnPlayerGiveDamage - Changing "amount" ?
#1

Hello.
I have a little question.
Is this "script" here correct?
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
        switch(weaponid)
        {
                case 0: amount = 5; // Unarmed
                case 1: amount = 5; // Brass Knuckles
                case 2: amount = 5; // Golf
                case 3: amount = 5; // Nite Stick
                case 4: amount = 5; // Knife
                case 5: amount = 5; // BaseBall Bat
                case 6: amount = 5; // Shovel
                case 7: amount = 5; // Pool Cue
                case 8: amount = 5; // Katana
                case 9: amount = 5; // Chainsaw
                case 10: amount = 5; // Purple Dildo
                case 11: amount = 5; // Small White Dildo
                case 12: amount = 5; // Large White Dildo
                case 13: amount = 5; // Silver Vibrator
                case 14: amount = 5; // Flowers
                case 15: amount = 5; // Cane
                case 16: amount = 5; // Grenade
                case 17: amount = 5; // Tear Gas
                case 18: amount = 5; // Molotov
                case 22: amount = 5; // 9mm
                case 23: amount = 5; // Silenced 9mm
                case 24: amount = 5; // Desert Eagle
                case 25: amount = 5; // Shotgun
                case 26: amount = 5; // Sawn-Off
                case 27: amount = 5; // Combat Shotgun
                case 28: amount = 5; // Micro SMG
                case 29: amount = 5; // MP5
                case 30: amount = 5; // AK-47
                case 31: amount = 5; // M4
                case 32: amount = 5; // Tec-9
                case 33: amount = 5; // Country Rifle
                case 34: amount = 5; // Sniper Rifle
                case 38: amount = 5; // Minigun
        }
        return 1;
}
All Weapons makes 5 Damage, is this correct? ^^
Reply
#2

that's mine
PHP код:
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponid)
{
    if(
issuerid != INVALID_PLAYER_ID)
    {
        new 
Float:health;
        
GetPlayerHealth(playeridhealth);
        if(
weaponid == 7)
                        
SetPlayerHealth(playerid,health-12);
        if(
weaponid == 8)
                        
SetPlayerHealth(playerid,health-90);
        if(
weaponid == 4)
                        
SetPlayerHealth(playerid,health-78);
        if(
weaponid == 3)
                        
SetPlayerHealth(playerid,health-11);
        if(
weaponid == 5)
                        
SetPlayerHealth(playerid,health-11);
        if(
weaponid == 23)
                        
SetPlayerHealth(playerid,health-53);
        if(
weaponid == 24)
                        
SetPlayerHealth(playerid,health-90);
        if(
weaponid == 22)
                        
SetPlayerHealth(playerid,health-39);
        if(
weaponid == 25)
                        
SetPlayerHealth(playerid,health-65);
        if(
weaponid == 26)
                        
SetPlayerHealth(playerid,health-48);
        if(
weaponid == 27)
                        
SetPlayerHealth(playerid,health-32);
        if(
weaponid == 28)
                        
SetPlayerHealth(playerid,health-28);
        if(
weaponid == 29)
                        
SetPlayerHealth(playerid,health-31);
        if(
weaponid == 30)
                        
SetPlayerHealth(playerid,health-41);
        if(
weaponid == 31)
                        
SetPlayerHealth(playerid,health-41);
        if(
weaponid == 32)
                        
SetPlayerHealth(playerid,health-27);
        if(
weaponid == 33)
                        
SetPlayerHealth(playerid,health-97);
        if(
weaponid == 34)
                        
SetPlayerHealth(playerid,health-213);
        if(
weaponid == 33)
                        
SetPlayerHealth(playerid,health-97);
        if(
weaponid == 33)
                       
SetPlayerHealth(playerid,health-97);
    }
    return 
1;

Reply
#3

But i heared that it's bugged.^^
Reply
#4

i'll give you an example ONLY:
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
  if(issuerid != INVALID_PLAYER_ID)
  {
       switch(weaponid)
       {
            case 0:
            {
                  new Float:health;
                  GetPlayerHealth(playerid, health);
                  SetPlayerHealth(playerid, health-5);
            }
       }
   }
   return 1;
}
Just an example
Reply
#5

Use this simple code:

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    new Float:HP;
    GetPlayerHealth(playerid, HP);
    if(weaponid == 31) SetPlayerHealth(playerid, HP-30);
    return 1;
}
More about simple damage system look here - https://sampforum.blast.hk/showthread.php?tid=330005
I use this and it's works.
Reply
#6

Yeah, but what's with the armour?
Health != Armor^^
Isn't there any function like "SetPlayerHealthAndArmor(playerid, -120);"?
Now if i have 100 Life and 100 Armor, and use the function i have only 80 life and 0 armor

I need a simple function to set weapon-damage easily!
Like
"SetWeaponDamage(weaponid, damage);" -> SetWeaponDamage(24, 0); -> Deagle = 0 Damage

Thanks.^^
Reply
#7

https://sampforum.blast.hk/showthread.php?tid=348044

pawn Код:
DealPlayerDamage(playerid, damage)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)