18.08.2014, 19:00
(
Last edited by ThePhenix; 19/08/2014 at 02:59 AM.
)
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:
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;
}