SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 02/12/2010, 06:15 PM   #1
wups
High-roller
 
wups's Avatar
 
Join Date: Apr 2010
Location: Lithuania
Posts: 1,368
Reputation: 132
Thumbs up OnPlayerShootPlayer v8

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

Last edited by wups; 25/03/2013 at 08:36 PM.
wups is offline   Reply With Quote
Old 02/12/2010, 06:18 PM   #2
Ari3l
Huge Clucker
 
Join Date: Aug 2010
Location: Puerto Madryn
Posts: 244
Reputation: 3
Default Respuesta: OnPlayerShootPlayer

Very good!!
Ari3l is offline   Reply With Quote
Old 02/12/2010, 06:21 PM   #3
RealCop228
Godfather
 
Join Date: Feb 2010
Location: Springboro, OH
Posts: 8,265
Reputation: 670
Default Re: OnPlayerShootPlayer

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.
__________________
Putting [URGENT] in the thread title stops me from opening the thread. Nobody else's problem on this forum is more important that another person's. Try not to be self-centered!
RealCop228 is offline   Reply With Quote
Old 02/12/2010, 06:24 PM   #4
wups
High-roller
 
wups's Avatar
 
Join Date: Apr 2010
Location: Lithuania
Posts: 1,368
Reputation: 132
Default Re: OnPlayerShootPlayer

Thanks, I appreciate that guys.
wups is offline   Reply With Quote
Old 02/12/2010, 06:31 PM   #5
Bloude
Little Clucker
 
Join Date: Jul 2010
Posts: 13
Reputation: 0
Thumbs up Re: OnPlayerShootPlayer

Woot! Nice job. I will test it.
Bloude is offline   Reply With Quote
Old 02/12/2010, 06:30 PM   #6
Mr L
Huge Clucker
 
Mr L's Avatar
 
Join Date: Jan 2010
Posts: 326
Reputation: 7
Default Re: OnPlayerShootPlayer

nice job bro.
Mr L is offline   Reply With Quote
Old 02/12/2010, 06:33 PM   #7
ColdXX
Banned
 
Join Date: Jan 2010
Location: Everywhere
Posts: 694
Reputation: 0
Default Re: OnPlayerShootPlayer

Lovely! Really usefull! Ur being so kind releasing it!
Would be really usefull for Sniper Minigames!
ColdXX is offline   Reply With Quote
Old 02/12/2010, 06:39 PM   #8
ExSaLiVeR
Little Clucker
 
Join Date: Nov 2010
Posts: 7
Reputation: 0
Default Re: OnPlayerShootPlayer

Very good! Now I can to fix the team fuction.
ExSaLiVeR is offline   Reply With Quote
Old 02/12/2010, 06:41 PM   #9
WillyP
High-roller
 
WillyP's Avatar
 
Join Date: Jul 2010
Location: Durham, England
Posts: 2,232
Reputation: 63
Default Re: OnPlayerShootPlayer

Thanks a FUCKLOAD for this. =D
WillyP is offline   Reply With Quote
Old 02/12/2010, 06:49 PM   #10
Biesmen
High-roller
 
Biesmen's Avatar
 
Join Date: May 2009
Posts: 1,625
Reputation: 637
Default Re: OnPlayerShootPlayer

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!
Biesmen is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 06:19 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.