How do you remove the knife's assassination ability please? - 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 do you remove the knife's assassination ability please? (
/showthread.php?tid=427931)
How do you remove the knife's assassination ability please? -
EiresJason - 03.04.2013
Hi, i have been looking around the forums but never found a way to remove the ability of the 'assassination' that the knife has automatically. Is there even a way? I'm sure i have watched videos where people have done it but i can't figure it out.
Thanks alot
Re : How do you remove the knife's assassination ability please? -
DaRk_RaiN - 03.04.2013
Well i can't tell for sure but try to search for the animation, use OnPlayerUpdate (or a timer) to check if the player is knifing some one and then ClearAnimations, or slap him.
Re: How do you remove the knife's assassination ability please? -
EiresJason - 03.04.2013
Ooh nice
I'll try that, thanks.
Re: How do you remove the knife's assassination ability please? -
MP2 - 03.04.2013
Won't work. Once it's started you can't stop it.
Re: How do you remove the knife's assassination ability please? -
Scenario - 03.04.2013
What about this?
pawn Код:
#if !defined KEY_AIM
#define KEY_AIM KEY_HANDBRAKE
#endif
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(GetPlayerWeapon(playerid) == 4)
if(newkeys & KEY_AIM) ClearAnimations(playerid);
return 1;
}
EDIT:
You could make it so it only stops the aiming animation if the player is near someone else...
pawn Код:
#if !defined KEY_AIM
#define KEY_AIM KEY_HANDBRAKE
#endif
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(GetPlayerWeapon(playerid) == 4)
if(newkeys & KEY_AIM && IsAnyoneNearPlayer(playerid)) ClearAnimations(playerid);
return 1;
}
stock IsAnyoneNearPlayer(playerid)
{
new
Float:fPos[3]
;
GetPlayerPos(playerid, fPos[0], fPos[1], fPos[2]);
foreach(new i : Player)
{
if(i == playerid) continue;
if(IsPlayerInRangeOfPoint(i, 7.0, fPos[0], fPos[1], fPos[2]))
{
return true;
}
}
return false;
}