[Tutorial] Blood in screen and damage amount when shot by a player - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (
https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Blood in screen and damage amount when shot by a player (
/showthread.php?tid=532526)
Blood in screen and damage amount when shot by a player -
ThePhenix - 18.08.2014
Hi, this is a pretty simple tutorial, but I've seen some people that doesn't know how to display blood in the screen of a player when that player gets shot by someone and how to display the damage amount on screen.
You don't need to create a red textdraw to show blood in the screen when a player receives a shot, you just have to do:
pawn Code:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)//This callback is called when a player gives damage to another player.
{
new st[16];//We create a string
format(st, sizeof(st), "~r~-%.0f", amount);//we give a format to the string created above basedo on the damage amount given with a red color ~r~
GameTextForPlayer(damagedid, st, 2000, 5);//we show a game text showing the damage to the damagedid for 2 seconds.
new Float:Pos[3];//We create 3 variables to store the player position X, Y, Z
GetPlayerPos(damagedid, Pos[0], Pos[1], Pos[2]);//We store the player position in the variables created above
CreatePlayerObject(damagedid, 18668, Pos[0], Pos[1], Pos[2]-0.4, 0.0, 0.0, 96.0);//We show the object 18668(blood_heli) to the player who received the shot
return 1;
}
Re : Blood in screen and damage amount when shot by a player -
www - 18.08.2014
Great ! Thanks (repped)
Re: Blood in screen and damage amount when shot by a player -
Awide - 18.08.2014
Can the others see this?
Re: Blood in screen and damage amount when shot by a player -
ThePhenix - 18.08.2014
Quote:
Originally Posted by Awide
Can the others see this?
|
They are not supposed to, it means that if someone fires at you, that blood object will come up in your screen, making you know that you were shot for example?, the same thing with the damage amount.
Re: Blood in screen and damage amount when shot by a player -
Pottus - 19.08.2014
There is an issue with this just because OnPlayerWeaponShot() is called does not mean the player was actually shot on their screen (with stock damage system). You would need to actually implement a skinhit system for this to be effective just use OnPlayerTakeDamage() instead.
Re: Blood in screen and damage amount when shot by a player -
Awide - 20.08.2014
Quote:
Originally Posted by ThePhenix
They are not supposed to, it means that if someone fires at you, that blood object will come up in your screen, making you know that you were shot for example?, the same thing with the damage amount.
|
Ah I didn't realize it's a player object. Good idea! ^^