[Tutorial] Worlds shortest tutorial - Display hp loss above player (when hurt)
#1

Top of script:

Код:
new string[16];
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.
Reply
#2

Wow, that's epic lol.. Thanks buddy, I never knew that that could work on the Bubble chat!
Reply
#3

* Glint is affraid of saying bad things because he might get banned.

Seriously i didn't know that too.
Reply
#4

Wow, you can actually do that using SetPlayerChatBubble? o.O
Reply
#5

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.
Reply
#6

Pretty Cool!
Reply
#7

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.
Reply
#8

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.
Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)