How can i make this ony work for headshot? - 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: How can i make this ony work for headshot? (
/showthread.php?tid=424291)
How can i make this ony work for headshot? -
Don_Cage - 21.03.2013
Like the tite say, this is what i got
pawn Код:
stock IsPlayerAiming(playerid, aimid)
{
new Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2;
GetPlayerPos(playerid, X1, Y1, Z1);
GetPlayerPos(aimid, X2, Y2, Z2);
new Float:Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
if(Distance < 100)
{
new Float:A;
GetPlayerFacingAngle(playerid, A);
X1 += (Distance * floatsin(-A, degrees));
Y1 += (Distance * floatcos(-A, degrees));
Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
if(Distance < 0.5)
{
return true;
}
}
return false;
}
pawn Код:
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i) && playerid != i && !IsPlayerNPC(i))
{
if(IsPlayerAiming(playerid, i))
{
if (newkeys & KEY_FIRE && newkeys & 128)
{
if(GetPlayerWeapon(playerid) == 34)
{
if(IsPlayerInAnyVehicle(i) || IsPlayerInAnyVehicle(i))
{
return 0;
}
SetPlayerHealth(i, 0);
return 1;
}
}
}
}
}
}
Also how can i make it so if the target is on admin duty nothing will happen?
Re: How can i make this ony work for headshot? -
Scenario - 21.03.2013
You can use this to detect which bodypart someone is aiming at:
http://forum.sa-mp.com/showthread.ph...light=headshot
And in order to stop a player from shooting an admin (only if they aim at the admin, will this work) you can use this:
https://sampwiki.blast.hk/wiki/ClearAnimations
Re: How can i make this ony work for headshot? -
Don_Cage - 21.03.2013
I have tried that headshot include and it didnt work
Re: How can i make this ony work for headshot? -
RajatPawar - 21.03.2013
Quote:
Originally Posted by Don_Cage
I have tried that headshot include and it didnt work
|
How come it does for hundreds of people, but doesn't, for you? (Really, I am curious)
Anyways, if you do want to do this on your own, it's quite difficult and mostly quite inaccurate considering lag between players.
Re: How can i make this ony work for headshot? -
Don_Cage - 21.03.2013
Quote:
Originally Posted by Rajat_Pawar
How come it does for hundreds of people, but doesn't, for you? (Really, I am curious)
Anyways, if you do want to do this on your own, it's quite difficult and mostly quite inaccurate considering lag between players.
|
I got help with it too and they couldnt get it to work either so idk, hm ok well thanks anyway