12.02.2018, 11:19
It don't think there is a native function for this, as far as I know, you can create an array, assign all of its slots to -1 or even better INVALID_3DTEXT_ID,
to find out the count, loop through that array, check if the slots do not equal those initial values (-1 or INVALID_3DTEXT_ID), and increase your counting variable by 1.
-Create a global array to store 3D label ID's:
- Store the id's of your 3D labels on that array
-Create these functions:
- Calling the functions:
to find out the count, loop through that array, check if the slots do not equal those initial values (-1 or INVALID_3DTEXT_ID), and increase your counting variable by 1.
-Create a global array to store 3D label ID's:
PHP код:
new glabels[MAX_3DTEXT_GLOBAL] = {INVALID_3DTEXT_ID, ...}; //Global 3D labels
new plabels[MAX_3DTEXT_PLAYER] = {INVALID_3DTEXT_ID, ...}; //Player 3D labels
-Create these functions:
PHP код:
//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;
}
PHP код:
printf("Global 3D labels count: %d", glabelCount());
printf("Player 3D labels count: %d", plabelCount());
printf("All 3D labels count: %d", glabelCount() + plabelCount());