[Include] OnPlayerShootPlayer
#1

EDIT 2013: THIS INCLUDE IS OLD AND OUTDATED! SA-MP HAS DEVELOPED NATIVE FUNCTIONS FOR THIS.


OnPlayerShootPlayer v8


Today I was thinking of making a Real Time damage system. When it was finished, i thought i can make a OnPlayerShootPlayer function of it!
The include is Plug&Play, just include it in your script. No changes needed.

This doesn't call the calback, when you shoot through a wall, or something like that. It checks when a players health goes down, and checks if anyone is aiming at the player.

ChangeLog:
Quote:

Version 1:
-Initial release.

Version 2:
-Cross Product system
-Damage shown in float.

Version 3:
-Checks if the key(KEY_FIRE) is pressed.
-Removed all desync bugs.

Version 4:
-The KEY_FIRE check has been fixed.

Version 5:
-All bugs fixed.
-Shows Health and Armour damage.
-Changed the callback

Version 6:
-Changed the damage checking system.

Version 7:
-Fixed the script for filterscripts.

Version 8:
-Added GetPlayerCameraWeaponVector function(by Nero_3D). All weapons should be detected normaly.
Usage:
Insert this code on top of your game mode after #include <a_samp>
pawn Код:
#include <OPSP>
And place this function anywhere you like:
pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    return 1;
}
An example:
pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    new msg[128],name1[24],name2[24];
    GetPlayerName(Shooter,name1,24);
    GetPlayerName(Target,name2,24);
    format(msg,sizeof(msg)," * %s Shot %s(Dmg: %f HP and %f Armour)!",name1,name2,HealthLost,ArmourLost);
    SendClientMessageToAll(0xFFFFFFFF,msg);
    return 1;
}
Installing:
Download and save to pawn/includes folder!

Credits:
Credits to Double-O-Seven for Cross Product system.
Credits to Nero_3D for GetPlayerCameraWeaponVector function.

Download:
Here you go:
Version 8.4
Version 7.0
Version 6.0
Version 5.0

Feel free to do anything you want with it.
Reply


Messages In This Thread
OnPlayerShootPlayer v8 - by wups - 02.12.2010, 17:15
Respuesta: OnPlayerShootPlayer - by Ari3l - 02.12.2010, 17:18
Re: OnPlayerShootPlayer - by Scenario - 02.12.2010, 17:21
Re: OnPlayerShootPlayer - by wups - 02.12.2010, 17:24
Re: OnPlayerShootPlayer - by Mr L - 02.12.2010, 17:30
Re: OnPlayerShootPlayer - by Bloude - 02.12.2010, 17:31
Re: OnPlayerShootPlayer - by ColdXX - 02.12.2010, 17:33
Re: OnPlayerShootPlayer - by ExSaLiVeR - 02.12.2010, 17:39
Re: OnPlayerShootPlayer - by WillyP - 02.12.2010, 17:41
Re: OnPlayerShootPlayer - by Biesmen - 02.12.2010, 17:49
Re: OnPlayerShootPlayer - by wups - 02.12.2010, 17:55
Re: OnPlayerShootPlayer - by Scenario - 02.12.2010, 17:58
Re: OnPlayerShootPlayer - by NewYorkRP - 02.12.2010, 18:01
Re: OnPlayerShootPlayer - by wups - 02.12.2010, 18:01
Re: OnPlayerShootPlayer - by WillyP - 02.12.2010, 18:02
Re: OnPlayerShootPlayer - by wups - 02.12.2010, 18:04
Re: OnPlayerShootPlayer - by NewYorkRP - 02.12.2010, 18:04
Re: OnPlayerShootPlayer - by Biesmen - 02.12.2010, 18:05
Re: OnPlayerShootPlayer - by wups - 02.12.2010, 18:07
Re: OnPlayerShootPlayer - by Scenario - 02.12.2010, 18:39
Re: OnPlayerShootPlayer - by wups - 02.12.2010, 18:45
Re: OnPlayerShootPlayer - by The_Gangstas - 02.12.2010, 18:49
Re: OnPlayerShootPlayer - by wups - 02.12.2010, 18:57
Re: OnPlayerShootPlayer - by Lynn - 09.12.2010, 01:02
Re: OnPlayerShootPlayer - by Scenario - 11.12.2010, 16:54
Re: OnPlayerShootPlayer - by wups - 11.12.2010, 17:45
Re: OnPlayerShootPlayer - by nuriel8833 - 12.12.2010, 04:31
Re: OnPlayerShootPlayer - by wups - 12.12.2010, 07:49
Re: OnPlayerShootPlayer - by TheStudioSamp - 12.12.2010, 08:20
Re: OnPlayerShootPlayer - by nuriel8833 - 12.12.2010, 11:16
Re: OnPlayerShootPlayer - by olabv - 12.12.2010, 18:06
Re: OnPlayerShootPlayer - by wups - 12.12.2010, 18:07
Re: OnPlayerShootPlayer - by Retardedwolf - 12.12.2010, 19:59
Re: OnPlayerShootPlayer - by wups - 12.12.2010, 20:11
Re: OnPlayerShootPlayer - by cmg4life - 26.12.2010, 11:39
Re: OnPlayerShootPlayer - by wups - 26.12.2010, 11:49
Re: OnPlayerShootPlayer - by Flyfishes - 26.12.2010, 12:14
Re: OnPlayerShootPlayer - by wups - 26.12.2010, 12:47
Re: OnPlayerShootPlayer - by Darnell - 21.08.2011, 16:50
Re: OnPlayerShootPlayer - by wups - 22.08.2011, 06:41
Re: OnPlayerShootPlayer - by MisterTickle - 22.08.2011, 06:42
Re: OnPlayerShootPlayer - by wups - 22.08.2011, 06:43
Re: OnPlayerShootPlayer - by MisterTickle - 22.08.2011, 06:49
Re: OnPlayerShootPlayer - by Swyft™ - 23.08.2011, 01:47
Re: OnPlayerShootPlayer - by Darnell - 23.08.2011, 04:56
Re: OnPlayerShootPlayer - by Sasino97 - 23.08.2011, 08:57
Re: OnPlayerShootPlayer - by Mozz - 23.08.2011, 17:59
Re: OnPlayerShootPlayer - by iansinho - 31.08.2011, 22:29
Re: OnPlayerShootPlayer - by CidadeNovaRP - 10.07.2012, 20:39
Re: OnPlayerShootPlayer - by MP2 - 10.07.2012, 20:41
Re: OnPlayerShootPlayer - by CidadeNovaRP - 10.07.2012, 22:41
Re: OnPlayerShootPlayer - by Mauzen - 18.07.2012, 22:50
Re: OnPlayerShootPlayer - by Plovix - 19.07.2012, 18:01
Respuesta: Re: OnPlayerShootPlayer - by CaptainMactavish - 23.07.2012, 20:34
Re: OnPlayerShootPlayer - by Johnny_Ionut - 05.08.2012, 17:11
Re: OnPlayerShootPlayer - by Delay - 14.08.2012, 03:16
Re: OnPlayerShootPlayer - by xMaGmOtAnEtHx - 18.09.2012, 10:22
Re: OnPlayerShootPlayer - by NoahF - 18.09.2012, 11:06
Re: OnPlayerShootPlayer - by x96664 - 09.11.2012, 19:04
Re: OnPlayerShootPlayer - by LikeNPC - 28.01.2013, 10:18
Re: OnPlayerShootPlayer - by Parallex - 03.06.2014, 04:51
Re: OnPlayerShootPlayer - by Niko_boy - 03.06.2014, 06:16
Re: OnPlayerShootPlayer - by AiRaLoKa - 03.06.2014, 06:33
Re: OnPlayerShootPlayer - by AgusZ - 20.01.2015, 07:19
Re: OnPlayerShootPlayer - by 1proplayer1 - 06.09.2015, 13:38
Re: OnPlayerShootPlayer - by Dayvison_ - 06.09.2015, 13:45

Forum Jump:


Users browsing this thread: 1 Guest(s)