Worlds shortest tutorial - Display hp loss above player (when hurt) -
kaisersouse - 14.09.2012
Top of script:
Then:
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
format(string,sizeof(string),"-%.0f hp",amount);
SetPlayerChatBubble(playerid,string,0x660000AA,150.0,2500);
return 1;
}
This will display how much health/armor the player lost when hit in a chat bubble above the player's head (for 2.5 seconds).
Note: this is a good way to spot cheaters, because I've noticed people using health/armor hacks do NOT call OnPlayerTakeDamage...so if you shoot a player and never see the chat bubble, they are likely cheating. Food for thought.
Re: Worlds shortest tutorial - Display hp loss above player (when hurt) -
Guitar - 15.09.2012
Wow, that's epic lol.. Thanks buddy, I never knew that that could work on the Bubble chat!
Re: Worlds shortest tutorial - Display hp loss above player (when hurt) - Glint - 15.09.2012
* Glint is affraid of saying bad things because he might get banned.
Seriously i didn't know that too.
Re: Worlds shortest tutorial - Display hp loss above player (when hurt) -
newbienoob - 15.09.2012
Wow, you can actually do that using SetPlayerChatBubble? o.O
Re: Worlds shortest tutorial - Display hp loss above player (when hurt) -
JaKe Elite - 16.09.2012
Newbienoob yes.
SetPlayerChatBubble works like 3D Text Label.
The difference is. SetPlayerChatBubble has time when it will disappear.
And its already attach to player without using Attach3DTextLabel.
Re: Worlds shortest tutorial - Display hp loss above player (when hurt) -
Faisal_khan - 16.09.2012
Pretty Cool!
Re: Worlds shortest tutorial - Display hp loss above player (when hurt) -
[-Vibr@tion-] - 16.09.2012
You Made it alot easier for me instead of writing a full anti cheat from the start O_o i never though of that thanks.
Re: Worlds shortest tutorial - Display hp loss above player (when hurt) -
Lordzy - 16.09.2012
Nice idea.
Good work.
But you could explain bit more because there are a lot of beginners.
Like this:
pawn Код:
new string[16]; //Creating a string to output the loss of HP.
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid) //Using OnPlayerTakeDamage callback to get lost hp.
{ //Opening brackets to write the function below.
format(string,sizeof(string),"-%.0f hp",amount); //Creating a format of our string to display lost hp.
//Here amount refers to the loss of player's health.
SetPlayerChatBubble(playerid,string,0x660000AA,150.0,2500); // Adding our string and Creating Chat Bubble to display above player's head.
return 1; //Returning the functions.
} //Closing the brackets which we've opened.
Re: Worlds shortest tutorial - Display hp loss above player (when hurt) - Glint - 16.09.2012
Quote:
Originally Posted by [xB]Lordz
Nice idea.
Good work.
But you could explain bit more because there are a lot of beginners.
Like this:
pawn Код:
new string[16]; //Creating a string to output the loss of HP. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid) //Using OnPlayerTakeDamage callback to get lost hp. { //Opening brackets to write the function below. format(string,sizeof(string),"-%.0f hp",amount); //Creating a format of our string to display lost hp. //Here amount refers to the loss of player's health. SetPlayerChatBubble(playerid,string,0x660000AA,150.0,2500); // Adding our string and Creating Chat Bubble to display above player's head. return 1; //Returning the functions. } //Closing the brackets which we've opened.
|
No need because they are in plain English everyone can understand it.
Re: Worlds shortest tutorial - Display hp loss above player (when hurt) -
Lordzy - 16.09.2012
Quote:
Originally Posted by Lexi'
No need because they are in plain English everyone can understand it.
|
You're right but I just posted that because my cousin is a newbie and didnt understand it.