Not adding up - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Not adding up (
/showthread.php?tid=499628)
Not adding up -
(_AcE_) - 09.03.2014
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
format(string, sizeof(string), "~b~~h~%i ~w~- ~r~~h~%i", bluescore, redscore);
TextDrawSetString(TS, string);
if(gTeam[i] == TEAM_HOME && iRound[i] == 1)
{
bteamtotal = (GetPlayerHealth(i, health) + GetPlayerArmour(i, armor));
format(string, sizeof(string), "~l~| ~w~Alive: ~b~%i ~l~| ~w~Health: ~b~%.0f", bblue, bteamtotal);
TextDrawSetString(HC, string);
}
else if(gTeam[i] == TEAM_AWAY && iRound[i] == 1)
{
rteamtotal = bteamtotal = (GetPlayerHealth(i, health) + GetPlayerArmour(i, armor));
format(string, sizeof(string), "~w~Alive: ~r~%i ~l~| ~w~Health: ~r~%.0f ~l~|", bred, rteamtotal);
TextDrawSetString(AC, string);
}
}
}
I'm trying to add up the total health of the players in the round on each team. When I do this, I can never get the HP on the textdraw, it never shows any numbers just a blank space where it's suppose to be. Any help or suggestion on how to get the hp of the team?
Re: Not adding up -
jakejohnsonusa - 09.03.2014
How big is the string?
Re: Not adding up -
(_AcE_) - 09.03.2014
It actually says 0 on the textdraw
Re: Not adding up -
r3ct - 09.03.2014
Change this
rteamtotal = bteamtotal =
to this
rteamtotal =
Re: Not adding up -
(_AcE_) - 09.03.2014
That was a typo on copy and pasting while posting the topic that actually isnt in there
Re: Not adding up -
jakejohnsonusa - 10.03.2014
The string says 0?
AW: Not adding up -
Macronix - 10.03.2014
Try float(rteamtotal); and float(bteamtotal);
Re: Not adding up -
r3ct - 10.03.2014
Hide the textdraw
set the string
reshow it to everyone