30.07.2011, 00:04
You would need a health timer for the health but I'm sure you already have a timer that you can just add to. Here is how you would do kills and deaths.
EDIT:
There is a few errors in your code there
1. GetPlayerHealth is a float %f not a integer.
2. GetPlayerHealth has mutliple params
3. You need a textdraw for each player.
pawn Код:
new Text:Textdraw5[MAX_PLAYERS];
new Text:Textdraw6[MAX_PLAYERS];
new deaths[MAX_PLAYERS];
new kills[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
Textdraw5[playerid] = TextDrawCreate(472.000000, 172.000000, "Kills:");
TextDrawBackgroundColor(Textdraw5[playerid], 65535);
TextDrawFont(Textdraw5[playerid], 1);
TextDrawLetterSize(Textdraw5[playerid], 0.629998, 2.200000);
TextDrawColor(Textdraw5[playerid], 16777215);
TextDrawSetOutline(Textdraw5[playerid], 1);
TextDrawSetProportional(Textdraw5[playerid], 1);
Textdraw6[playerid] = TextDrawCreate(472.000000, 197.000000, "Deaths:");
TextDrawBackgroundColor(Textdraw6[playerid], 65535);
TextDrawFont(Textdraw6[playerid], 1);
TextDrawLetterSize(Textdraw6[playerid], 0.479999, 2.299998);
TextDrawColor(Textdraw6[playerid], 16777215);
TextDrawSetOutline(Textdraw6[playerid], 1);
TextDrawSetProportional(Textdraw6[playerid], 1);
TextDrawShowForPlayer(playerid, Textdraw5[playerid]);
TextDrawShowForPlayer(playerid, Textdraw6[playerid]);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID) kills[killerid]++;
deaths[playerid] ++;
new str[40];
format(str, sizeof(str), "Kills: %d", kills[killerid]);
TextDrawSetString(Textdraw5[killerid], str);
format(str, sizeof(str), "Deaths: %d", deaths[playerid]);
TextDrawSetString(Textdraw6[playerid], str);
return 1;
}
Quote:
Example for health:
Код:
new string[64]; format(string,sizeof(string),"Health: %i",GetPlayerHealth(playerid)); TextDrawSetString(Textdraw7,string); |
1. GetPlayerHealth is a float %f not a integer.
2. GetPlayerHealth has mutliple params
pawn Код:
new Float:Health;
GetPlayerHealth(playerid, Health);