Textdraw Help please help me [+REP]
#1

PHP код:
#include <a_samp>
new Text:GiveDamage[MAX_PLAYERS];
new 
Text:TakeDamage[MAX_PLAYERS];
public 
OnGameModeInit()
{
    for(new 
iMAX_PLAYERS; ++i)
    {
    
GiveDamage[i] = TextDrawCreate(171.000000388.000000" ");
    
TextDrawAlignment(GiveDamage[i], 2);
    
TextDrawBackgroundColor(GiveDamage[i], 255);
    
TextDrawFont(GiveDamage[i], 2);
    
TextDrawLetterSize(GiveDamage[i], 0.1600000.599999);
    
TextDrawColor(GiveDamage[i], 0x00FF04FF);
    
TextDrawSetOutline(GiveDamage[i], 1);
    
TextDrawSetProportional(GiveDamage[i], 1);
    }
    for(new 
iMAX_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.1600000.599999);
    
TextDrawColor(TakeDamage[i], 0xE81010FF);
    
TextDrawSetOutline(TakeDamage[i], 1);
    
TextDrawSetProportional(TakeDamage[i], 1);
    }
    return 
1;
}
forward OnPlayerGiveDamage(playeriddamagedidFloatamountweaponid);
public 
OnPlayerGiveDamage(playeriddamagedidFloatamountweaponid)
{
    new 
s[20];
    
format(s20"+Damage %.0f"amount);
    
TextDrawSetString(GiveDamage[playerid], s);
    
TextDrawShowForPlayer(playeridGiveDamage[playerid]);
    
PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
    
SetTimerEx("DestruirTextoDraw"1000false"i"playerid);
    return 
1;

what should i have to that it calculate damage for example like i shoot with him deagle it hit 46 and then 2nd it show 46 not + it , what should i do that it show 92 and so on ? please help rep + who help me
Reply
#2

Use TextDrawSetString to change the string of a textdraw.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
    TextDrawSetString(GiveDamage[issuerid], amount);
    TextDrawSetString(TakeDamage[playerid], amount);
}
Reply
#3

getting errors

TextDrawSetString(GiveDamage[issuerid], amount);

when i add this i got that error

Quote:

(10332) : error 035: argument type mismatch (argument 2)

Reply
#4

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
Use TextDrawSetString to change the string of a textdraw.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
    TextDrawSetString(GiveDamage[issuerid], amount);
    TextDrawSetString(TakeDamage[playerid], amount);
}
You must read it yourself carefuly, the 2nd parameter of TextDrawSetString is a string and not a Float!

pawn Код:
new s[10];
format(s, sizeof s, "%f", amount);
TextDrawSetString(GiveDamage[issuerid], s);
EDIT:
For adding on damage simply use a player var.
pawn Код:
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);
}
Dont forget to reset the var damage on player's spawn.
Reply
#5

Quote:
Originally Posted by Gammix
Посмотреть сообщение
You must read it yourself carefuly, the 2nd parameter of TextDrawSetString is a string and not a Float!

pawn Код:
new s[10];
format(s, sizeof s, "%f", amount);
TextDrawSetString(GiveDamage[issuerid], s);
EDIT:
For adding on damage simply use a player var.
pawn Код:
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);
}
Dont forget to reset the var damage on player's spawn.
Thanks For help <3 +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)