07.10.2014, 23:58
(
Последний раз редактировалось Abagail; 12.01.2015 в 23:41.
)
OnPlayerKnifePlayer
Basically, as the title suggests this detects basic knifing between two players. It has one call-back which can be found below.
OnPlayerKnifePlayer
playerid - The player knifing the other player.
i - The player being knifed.
Stops a player from stabbing the targetID given.
Basically this gets called when a player knifes another player. I have not tested if it gets called if the other player is desynced, - how-ever it should work, - note that it won't fix desync problems.
There should be no false detections as there are numerous checks such as which weapon they have, - their animation, - how close they are, etc, how-ever if you do find any false detections please share.
I've also added the option of OnPlayerKnifePlayer being sent multiple times. Basically, - you can use
#define MULTIPLE_KNIFE_SEND for it to be called more than once(depends on how long it takes to knife/if any of the player's are lagging, or not). - Of-course don't define anything, and it will only be called once. This should work 100% with NPC's.
This script is based on WhiteTiger's script which can be found here,
https://sampforum.blast.hk/showthread.php?tid=199636
Downloads:
- Download(- Shows the .inc file in browser) - Click here.
Example code:
NEW UPDATE: Now you can simply stop a player from stabbing someone by returning 0 in OnPlayerKnifePlayer!
Example:
Make sure 1 is returned when you want the stab to occur.
Basically, as the title suggests this detects basic knifing between two players. It has one call-back which can be found below.
OnPlayerKnifePlayer
pawn Код:
forward OnPlayerKnifePlayer(playerid, targetid);
i - The player being knifed.
pawn Код:
StopStab(playerid, targetid);
Basically this gets called when a player knifes another player. I have not tested if it gets called if the other player is desynced, - how-ever it should work, - note that it won't fix desync problems.
There should be no false detections as there are numerous checks such as which weapon they have, - their animation, - how close they are, etc, how-ever if you do find any false detections please share.
I've also added the option of OnPlayerKnifePlayer being sent multiple times. Basically, - you can use
#define MULTIPLE_KNIFE_SEND for it to be called more than once(depends on how long it takes to knife/if any of the player's are lagging, or not). - Of-course don't define anything, and it will only be called once. This should work 100% with NPC's.
This script is based on WhiteTiger's script which can be found here,
https://sampforum.blast.hk/showthread.php?tid=199636
Downloads:
- Download(- Shows the .inc file in browser) - Click here.
Example code:
pawn Код:
#include a_samp
#include opkp
public OnPlayerKnifePlayer(playerid, targetid)
{
SendClientMessage(targetid, -1, "You have been knifed.");
return 1;
}
Example:
pawn Код:
public OnPlayerKnifePlayer(playerid, targetid)
{
if(GetPlayerTeam(playerid) == GetPlayerTeam(targetid))
{
return 0;
}
return 1;
}