Is there a way to know how many 3D Text Label's my server haves?
#2

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:
PHP код:
new glabels[MAX_3DTEXT_GLOBAL] = {INVALID_3DTEXT_ID, ...}; //Global 3D labels
new plabels[MAX_3DTEXT_PLAYER] = {INVALID_3DTEXT_ID, ...}; //Player 3D labels 
- Store the id's of your 3D labels on that array

-Create these functions:
PHP код:
//Function that returns the amount of global 3D labels
glabelCount()
{
    new 
count 0;
    for(new 
0i<MAX_3DTEXT_GLOBALi++)
    {
        if(
glabels[i] != INVALID_3DTEXT_ID)
            
count++;
    }
    return 
count;
}
//Function that returns the amount of player 3D labels
plabelCount()
{
    new 
count 0;
    for(new 
0i<MAX_3DTEXT_PLAYERi++)
    {
        if(
plabels[i] != -1)
            
count++;
    }
    return 
count;

- Calling the functions:
PHP код:
printf("Global 3D labels count: %d"glabelCount());
printf("Player 3D labels count: %d"plabelCount());
printf("All 3D labels count: %d"glabelCount() + plabelCount()); 
Reply


Messages In This Thread
Is there a way to know how many 3D Text Label's my server haves? - by Eibison - 12.02.2018, 10:40
Re: Is there a way to know how many 3D Text Label's my server haves? - by Eoussama - 12.02.2018, 11:19
Re: Is there a way to know how many 3D Text Label's my server haves? - by Hrb - 12.02.2018, 11:35
Re: Is there a way to know how many 3D Text Label's my server haves? - by Eoussama - 12.02.2018, 11:54
Re: Is there a way to know how many 3D Text Label's my server haves? - by Hrb - 12.02.2018, 12:01

Forum Jump:


Users browsing this thread: 1 Guest(s)