02.06.2014, 17:54
(
Last edited by Kyance; 02/06/2014 at 05:57 PM.
Reason: fixed
)
pawn Code:
CMD:hits(playerid, params[])
{
new string[256];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && HasHit[i] == 1)
{
format(string, sizeof(string), "%s~n~%s(%d)~n~", string, GetName(i), i);
TextDrawSetString(List[playerid], string);
TextDrawShowForPlayer(playerid, List[playerid]);
}
}
return 1;
}
EDIT: You can use "HasHit[i]" instead of "HasHit[i] == 1".
+, if that doesn't still work, try using the "TextDrawShowForPlayer" OUTSIDE THE LOOP.
Example:
pawn Code:
CMD:hits(playerid, params[])
{
new string[256];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && HasHit[i] == 1)
{
format(string, sizeof(string), "%s~n~%s(%d)~n~", string, GetName(i), i);
TextDrawSetString(List[playerid], string);
}
}
TextDrawShowForPlayer(playerid, List[playerid]); //outside loop!
return 1;
}