new glabels[MAX_3DTEXT_GLOBAL] = {INVALID_3DTEXT_ID, ...}; //Global 3D labels
new plabels[MAX_3DTEXT_PLAYER] = {INVALID_3DTEXT_ID, ...}; //Player 3D labels
//Function that returns the amount of global 3D labels
glabelCount()
{
new count = 0;
for(new i = 0; i<MAX_3DTEXT_GLOBAL; i++)
{
if(glabels[i] != INVALID_3DTEXT_ID)
count++;
}
return count;
}
//Function that returns the amount of player 3D labels
plabelCount()
{
new count = 0;
for(new i = 0; i<MAX_3DTEXT_PLAYER; i++)
{
if(plabels[i] != -1)
count++;
}
return count;
}
printf("Global 3D labels count: %d", glabelCount());
printf("Player 3D labels count: %d", plabelCount());
printf("All 3D labels count: %d", glabelCount() + plabelCount());
new TextLabels = 0; // on the top of your script // somewhere in your script Text3D:Create3DTextLabelEx(text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, VirtualW, testLOS = 0) { TextLabels += 1; return Create3DTextLabel(text, color, X, Y, Z, DrawDistance, VirtualW, testLOS); } Delete3DTextLabelEx(Text3D:id) { TextLabels -=1; return Delete3DTextLabel(Text3D:id); } How to use: Use "Create3DTextLabelEx" instead of "Create3DTextLabel" and "Delete3DTextLabelEx" instead of "Delete3DTextLabel" printf("%d", TextLabels); // print number of created labels
Yeah, that's definitely better, but you can't start a variable name with numbers.
|