[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
#2

Very good!!
Reply
#3

Finally, it's about time somebody released something like this! I'm going to go check the accuracy of this in an hour or so.
Reply
#4

Thanks, I appreciate that guys.
Reply
#5

nice job bro.
Reply
#6

Woot! Nice job. I will test it.
Reply
#7

Lovely! Really usefull! Ur being so kind releasing it!
Would be really usefull for Sniper Minigames!
Reply
#8

Very good! Now I can to fix the team fuction.
Reply
#9

Thanks a FUCKLOAD for this. =D
Reply
#10

Thanks for this, seriously. I have been looking for this, great job.
Next mission; Create an include which will decide how many HP(damage) the one will lose when you shoot!
Reply
#11

Eh.. It isn't so hard.

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
Thanks for this, seriously. I have been looking for this, great job.
Next mission; Create an include which will decide how many HP(damage) the one will lose when you shoot!
I didn't quite catch that.
Reply
#12

Quote:
Originally Posted by wups
Посмотреть сообщение
Eh.. It isn't so hard.



I didn't quite catch that.
I think he means for you to create an include which will make a player loose a certain amount of health per weapon.
Reply
#13

Waddafak?

pawn Код:
pawno\include\OPSP.inc(8) : fatal error 100: cannot read from file: "foreach"
Reply
#14

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
I think he means for you to create an include which will make a player loose a certain amount of health per weapon.
That's stupid.
Reply
#15

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
I think he means for you to create an include which will make a player loose a certain amount of health per weapon.
That's really not hard to do. I don't know why he asked. :S
Reply
#16

Quote:
Originally Posted by NewYorkRP
Посмотреть сообщение
Waddafak?

pawn Код:
pawno\include\OPSP.inc(8) : fatal error 100: cannot read from file: "foreach"
obs.. my bad. Reuploading..
I made #include instead of #tryinclude

By the way, you should use foreach!
Reply
#17

Tell me when you have reuploaded it. .
Reply
#18

Quote:
Originally Posted by [FU]Victious
Посмотреть сообщение
That's really not hard to do. I don't know why he asked. :S
Because it was a joke. Apperently it didn't sound as a joke, sorry for that.
Reply
#19

Lets not go to much offtopic!
Reply
#20

Actually, you could use this include to do such a thing. It may not be as accurate as possible, but it's better then nothing.

@Wups; Sorry for going off topic.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)