How to boost the value of a bullet
#1

Hi guys,
does anyone know how to boost the value of a bullet,for example i want to get a single shot takes off 60 hp.
Sorry for my bad english,i think i explained well.
Reply
#2

You can use wups include called OnPlayerShootPlayer. You need put the include in your /pawn/includes folder!

Then you need to add this on the top of your script after include <a_samp>.

pawn Код:
#include <OPSP>
Then you can use the following callback.

pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    new Float:health;
    if(GetPlayerWeapon(Shooter) == 24)//Lets say u wanted to increase damage of Deagle which is ID 24.
    {
         GetPlayerHealth(Target,health);//Get the remaining health after getting shot.
         SetPlayerHealth(Target, health-5);//Deduct more 5 health from the Victim. You can increase this number for more health.
         return 1;
    }
}

EDIT:

I just realized that i forgot about the new callbacks introduced by SAMP Team.

Thanks to iZN and Chasm.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    new Float:Health;
    GetPlayerHealth(playerid, Health);
    if(weaponid == 24) SetPlayerHealth(playerid, Health-5);
    return 1;
}
Reply
#3

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
You can use wups include called OnPlayerShootPlayer. You need put the include in your /pawn/includes folder!

Then you need to add this on the top of your script after include <a_samp>.

pawn Код:
#include <OPSP>
Then you can use the following callback.

pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    new Float:health;
    if(GetPlayerWeapon(Shooter) == 24)//Lets say u wanted to increase damage of Deagle which is ID 24.
    {
         GetPlayerHealth(Target,health);//Get the remaining health after getting shot.
         SetPlayerHealth(Target, health-5);//Deduct more 5 health from the Victim. You can increase this number for more health.
         return 1;
    }
}
That's outdated mate. SA-MP has made a callback 'OnPlayerTakeDamage'

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    // Check if the issuer (attacker) exist and using a deagle (weapon id 24)
    if(issuerid != INVALID_PLAYER_ID && weaponid == 24)
    {
         // The 'amount' is combined health + armour.
         SetPlayerHealth(playerid, amount - 5); // You have deducted -5 amount from the player (victim).
         return true;
    }
}
Reply
#4

OnPlayerTakeDamage, OnPlayerGiveDamage.
Reply
#5

...

This is the easiest way, probaly.

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    new Float:Health;
    GetPlayerHealth(playerid, Health);
    if(weaponid == 24) SetPlayerHealth(playerid, Health-46);
    return 1;
}
Damage stacks, Deagle normally does 46 damage. Now it does 92 damage.
Reply
#6

Thank you all man.I did what Chasm told me. REP+ for you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)