Thursday, October 18, 2012

OnPlayerShootPlayer v8


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>
Code:
#include <OPSP>
And place this function anywhere you like:
Code:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    return 1;
}
An example:
Code:
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.

No comments:

Post a Comment