SA-MP Forums Archive
Weapon damage!! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Weapon damage!! (/showthread.php?tid=239101)



Weapon damage!! - BlackWolf120 - 12.03.2011

hi,

im using the OnPlayerShootPlayer include with this code in my gamemode:

pawn Код:
public OnPlayerShootPlayer(shooter,target,Float:damage)
{
    new Float:H[2];
    GetPlayerHealth(target, H[0]);
    GetPlayerArmour(target,H[1]);
    if(GetPlayerWeapon(shooter) == 34)//this is a sniper
    {
        if(H[1] > 0) return SetPlayerArmour(target,0);
        SetPlayerHealth(target, H[0]-100);
    }
    return 1;
}
I want that u die instantly if hit by a sniper, no matter how much life or armor u got.
This works just perfectly as long as i shoot a player from a low distance.
As soon as a shoot a player from a longer distance it does not work anymore.
Could someone pls help me? PLs tell me what could be the problem.

regards, BlackWolf120.


Re: Weapon damage!! - Tommy_Mandaz - 12.03.2011

Maybe try to make it simple like this:

Код:
if(GetPlayerWeapon(shooter) == 34)
{
SetPlayerHealth(target, 0);
SetPlayerArmour(target, 0);
}
return 1;
}



Re: Weapon damage!! - BlackWolf120 - 13.03.2011

hi,
thx for ur answer.
This would really work?


Re: Weapon damage!! - [WF]Demon - 13.03.2011

The distance for OnPlayerShootPlayer is measured in the include, you need to increase that distance, I'm not sure how to do this as i have no idea what that include looks like.


Re: Weapon damage!! - BlackWolf120 - 13.03.2011

mhh, would be great if someone could tell me how to increase the distance
heres the inlcude on pastebin: http://pastebin.com/tDxSPhqA
would be very happy about an answer