Get_players stock
Hello!
I am trying to figure out how to make a get_players stock which can be used like so PHP Code:
tho as i test it, it sets the hp to 20 on random T players, not on all of them. I would appreciate if somebody could lay some wisdom. |
Re: Get_players stock
You will have to give health to each player in the loop, they way you are trying is not possible.
|
Re: Get_players stock
Oh really? Didn't know that
So in general it is not possible to store the iPlayers[33] from get_players into a global variable? |
Re: Get_players stock
Code:
stock get_and_set(szFlags[] = "", szTeam[] = "", iHealth) Code:
get_and_set("ae", "TERRORIST", 250); |
Re: Get_players stock
Quote:
Also, your "players" global variable is a scalar so it will only contain a single value ever. In the for loop, you're simply overwriting that variable many times without having done anything with it and will have only the last player index in it when get_them_players() finishes executing. So, when you eventually call set_user_health() you are doing so on only that last player. So here, based on just your code alone, the stock is unnecessary, simply put the get_players() and the loop in your main function and set the user's health for each player in that loop. Quote:
|
Re: Get_players stock
Quote:
Let's take an example: instead of putting 250 as health (stock parameter) we also can use get_pcvar_num to take the value from a cvar. if the cvar is zero just break the loop, this is what i wanted when i checked for !iHealth |
Re: Get_players stock
Nonsense.
There is no need for a get_players stock thats nonsense use get_players as it supposed to be used. |
Re: Get_players stock
Quote:
|
All times are GMT -4. The time now is 10:20. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.