SA-MP Forums Archive
[Include] OnPlayerKnifePlayer - OPKP.inc - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] OnPlayerKnifePlayer - OPKP.inc (/showthread.php?tid=540880)

Pages: 1 2


Re: OnPlayerKnifePlayer - OPKP.inc - Abagail - 20.11.2014

Thanks for the clarification. How-ever, I believe it'd be an easier spoof since it's called when damage is given, which now-a-days can be spoofed easily whereas animations, etc isn't so easy.


Re: OnPlayerKnifePlayer - OPKP.inc - Whitetiger - 20.11.2014

Checking the animation can cause false negatives too. Consider this:

A = killer
B = player getting knifed

if A knives B, and only B sees the throat slitting animation. on A's screen he's not knifing. B dies. In this case your include would fail where with OnPlayerGiveDamage it would get picked up.

I don't know if it's harder to spoof animation, though it's definitely less mainstream. Obviously you can do whatever you want, it's your include, and I hope I don't seem pushy to you to change your include.


Re: OnPlayerKnifePlayer - OPKP.inc - Abagail - 20.11.2014

Quote:
Originally Posted by Whitetiger
Посмотреть сообщение
Checking the animation can cause false negatives too. Consider this:

A = killer
B = player getting knifed

if A knives B, and only B sees the throat slitting animation. on A's screen he's not knifing. B dies. In this case your include would fail where with OnPlayerGiveDamage it would get picked up.

I don't know if it's harder to spoof animation, though it's definitely less mainstream. Obviously you can do whatever you want, it's your include, and I hope I don't seem pushy to you to change your include.
I will probably end up making a version with the option of which method to use. If I do make that sort-of update it will most likely be released tomorrow or later.


Re: OnPlayerKnifePlayer - OPKP.inc - Abagail - 13.12.2014

Updated.


Re: OnPlayerKnifePlayer - OPKP.inc - TRTDM - 14.12.2014

Simple yet useful, good job +rep


Re: OnPlayerKnifePlayer - OPKP.inc - Abagail - 14.12.2014

Thank you. If you have any suggestions; or (CONSTRUCTIVE) criticism it'd be much appreciated.


Re: OnPlayerKnifePlayer - OPKP.inc - Onfroi - 29.12.2014

Would this work?
pawn Код:
public OnPlayerKnifePlayer(playerid, targetid)
{
    if(GetPlayerTeam(playerid) == GetPlayerTeam(targetid))
    {
        return GameTextForPlayer(playerid, "~r~Don't back-stab team mates!", 5000, 3);
    }
    return 1;
}
or will it kill the player either way?


Re: OnPlayerKnifePlayer - OPKP.inc - Abagail - 29.12.2014

OnPlayerKnifePlayer is called before the damage is called; so I imagine by doing something like this, the worst it would do is cause the slide bug.

pawn Код:
public OnPlayerKnifePlayer(playerid, targetid)
{
    if(GetPlayerTeam(playerid) == GetPlayerTeam(targetid))
    {
           GameTextForPlayer(playerid, "~r~Don't back-stab team mates!", 5000, 3);
           new Float: pos[3];
           GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
           SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
           ClearAnimations(playerid);
           return ClearAnimations(targetid);
    }
    return 1;
}
I will look into being able to return 0 or something to stop the stab.


Re: OnPlayerKnifePlayer - OPKP.inc - Puppy - 30.12.2014

Using ClearAnimations should prevent it from happening(if you clear animations of both the playerid, and targetid). I will test this soon.


Re: OnPlayerKnifePlayer - OPKP.inc - Abagail - 30.12.2014

Yes; that does work. While testing, I encountered a small bug, which I believe should be fixed now. The new version can be found here.

I have also added a simple "StopStab" function to stop the player from stabbing the targetID. Simply place it with the according parameters in the OnPlayerKnifePlayer callback to stop a player from stabbing them.


Re: OnPlayerKnifePlayer - OPKP.inc - Pottus - 09.11.2015

Just going to say that Slices damage include covers all knife issues and all lagcomp issues this is not the way to go.


Re: OnPlayerKnifePlayer - OPKP.inc - Abagail - 10.11.2015

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Just going to say that Slices damage include covers all knife issues and all lagcomp issues this is not the way to go.
This was made previous to the release of his include for reference. I also believe Kar that I am currently hooking OnPlayerUpdate though I haven't looked at the code in a while.


Re: OnPlayerKnifePlayer - OPKP.inc - Pottus - 10.11.2015

I understand was just point out it's old and there is better methods that cover this issue and a wide ranger of others.