OnPlayerShootPlayer v8 -
wups - 02.12.2010
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>
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.
Respuesta: OnPlayerShootPlayer -
Ari3l - 02.12.2010
Very good!!
Re: OnPlayerShootPlayer -
Scenario - 02.12.2010
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.
Re: OnPlayerShootPlayer -
wups - 02.12.2010
Thanks, I appreciate that guys.
Re: OnPlayerShootPlayer -
Mr L - 02.12.2010
nice job bro.
Re: OnPlayerShootPlayer -
Bloude - 02.12.2010
Woot! Nice job. I will test it.
Re: OnPlayerShootPlayer -
ColdXX - 02.12.2010
Lovely! Really usefull! Ur being so kind releasing it!
Would be really usefull for Sniper Minigames!
Re: OnPlayerShootPlayer -
ExSaLiVeR - 02.12.2010
Very good! Now I can to fix the team fuction.
Re: OnPlayerShootPlayer -
WillyP - 02.12.2010
Thanks a FUCKLOAD for this. =D
Re: OnPlayerShootPlayer -
Biesmen - 02.12.2010
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!
Re: OnPlayerShootPlayer -
wups - 02.12.2010
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.
Re: OnPlayerShootPlayer -
Scenario - 02.12.2010
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.
Re: OnPlayerShootPlayer -
NewYorkRP - 02.12.2010
Waddafak?
pawn Код:
pawno\include\OPSP.inc(8) : fatal error 100: cannot read from file: "foreach"
Re: OnPlayerShootPlayer -
wups - 02.12.2010
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.
Re: OnPlayerShootPlayer -
WillyP - 02.12.2010
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
Re: OnPlayerShootPlayer -
wups - 02.12.2010
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!
Re: OnPlayerShootPlayer -
NewYorkRP - 02.12.2010
Tell me when you have reuploaded it.
.
Re: OnPlayerShootPlayer -
Biesmen - 02.12.2010
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.
Re: OnPlayerShootPlayer -
wups - 02.12.2010
Lets not go to much offtopic!
Re: OnPlayerShootPlayer -
Scenario - 02.12.2010
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.