#include <a_samp>
new Text:GiveDamage[MAX_PLAYERS];
new Text:TakeDamage[MAX_PLAYERS];
public OnGameModeInit()
{
for(new i; i < MAX_PLAYERS; ++i)
{
GiveDamage[i] = TextDrawCreate(171.000000, 388.000000, " ");
TextDrawAlignment(GiveDamage[i], 2);
TextDrawBackgroundColor(GiveDamage[i], 255);
TextDrawFont(GiveDamage[i], 2);
TextDrawLetterSize(GiveDamage[i], 0.160000, 0.599999);
TextDrawColor(GiveDamage[i], 0x00FF04FF);
TextDrawSetOutline(GiveDamage[i], 1);
TextDrawSetProportional(GiveDamage[i], 1);
}
for(new i; i < MAX_PLAYERS; ++i)
{
TakeDamage[i] = TextDrawCreate(440.000000,388.000000, " ");
TextDrawAlignment(TakeDamage[i], 2);
TextDrawBackgroundColor(TakeDamage[i], 255);
TextDrawFont(TakeDamage[i], 2);
TextDrawLetterSize(TakeDamage[i], 0.160000, 0.599999);
TextDrawColor(TakeDamage[i], 0xE81010FF);
TextDrawSetOutline(TakeDamage[i], 1);
TextDrawSetProportional(TakeDamage[i], 1);
}
return 1;
}
forward OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid);
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
new s[20];
format(s, 20, "+Damage %.0f", amount);
TextDrawSetString(GiveDamage[playerid], s);
TextDrawShowForPlayer(playerid, GiveDamage[playerid]);
PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
SetTimerEx("DestruirTextoDraw", 1000, false, "i", playerid);
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
TextDrawSetString(GiveDamage[issuerid], amount);
TextDrawSetString(TakeDamage[playerid], amount);
}
(10332) : error 035: argument type mismatch (argument 2) |
Use TextDrawSetString to change the string of a textdraw.
pawn Код:
|
new s[10];
format(s, sizeof s, "%f", amount);
TextDrawSetString(GiveDamage[issuerid], s);
new Float:damage[MAX_PLAYERS];
public OnPlayerTakeDamage(...)
{
damage[issuerid] += amount;
new s[20];
format(s, sizeof s, "+ Damage %f", damage[issuerid]);
TextDrawSetString(TakeDamage[playerid], s);
}
You must read it yourself carefuly, the 2nd parameter of TextDrawSetString is a string and not a Float!
pawn Код:
For adding on damage simply use a player var. pawn Код:
|