Storing players in Array
Sorry for another newbie question. I'm trying store info in array which will contain id's of all players that *for example* has health below 50. The array size must reflects the numbers of current ids added in it.
Can you show how to do this? Adding/remove info into/from the array and count the array size etc..eg when 2 players have health below 50, add their ids to the array and when their health no long below 50, remove their id from the array.. |
Re: Storing players in Array
#define MAX_CLIENTS 32
new MyArray[ MAX_CLIENTS + 1 ]; |
Re: Storing players in Array
Better description updated
|
Re: Storing players in Array
new Float:array[33] // Yes 33. Ids are from 1 to 32. Yes float because hp are float.
Then to get it. pev(id, pev_health, array[id]) // yes heres id... They are 33 spec in the array. So to get it in another funccion just. new Float:someonehp = array[id] sorry mi english is very bad :P |
Re: Storing players in Array
Something like this
Code:
|
Re: Storing players in Array
PHP Code:
|
Re: Storing players in Array
Yes but the array can be: 1, 0, 0, 1, 1, 1, 0, etc..;
And you have to check if it's 1. |
Re: Storing players in Array
In that case, you have to use dynamic arrays, so the array size will reflect low health players number.
|
Re: Storing players in Array
Quickly made, might be errors.
Code:
|
Re: Storing players in Array
Exolent, thanks..
what is g_player_count there for? |
| All times are GMT -4. The time now is 16:52. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.