One shot one kill by sniper. - 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: One shot one kill by sniper. (
/showthread.php?tid=560681)
One shot one kill by sniper. -
PrinceOfPersia - 29.01.2015
So yea, I wanted to make the sniper kills someone from 1 shot.
Can anyone help me?
Re: One shot one kill by sniper. -
StreetGT - 29.01.2015
have you ever tried to read wiki from sa-mp?
Re: One shot one kill by sniper. -
Schneider - 29.01.2015
Here you go, but you could have easily figured this out yourself If you would have searched..
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(weaponid == 34)
{
SetPlayerHealth(playerid, 0.0);
}
return 1;
}
Re: One shot one kill by sniper. -
PrinceOfPersia - 29.01.2015
Thank you guys.
Re: One shot one kill by sniper. -
Abagail - 30.01.2015
Quote:
Originally Posted by Schneider
Here you go, but you could have easily figured this out yourself If you would have searched..
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) { if(weaponid == 34) { SetPlayerHealth(playerid, 0.0); } return 1; }
|
I'd recommend peforming IsPlayerConnected checks, aswell as making sure playerid, and issuerid are different. Some SA:MP functions crash if a bad player ID is given, which can cause a server crash, thus causing an exploit within your server. Just a FYI thing, though, SetPlayerHealth shouldn't crash to my knowledge if an invalid player ID is passed through.