AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ehm... i dunno, just a simple question. (https://forums.alliedmods.net/showthread.php?t=24972)

[ --<-@ ] Black Rose 03-05-2006 11:56

ehm... i dunno, just a simple question.
 
i just wondered would this start with client_print(0,... or client_print(1,...?
Code:
for ( new a = 0 ; a < get_playersnum() ; a++ )     client_print(i, print_chat, "msg")

PM 03-05-2006 12:06

It would start with 0.
client_print(0, whatever) prints to all clients (IIRC).

Player indices are 1-32. Also, note that if there are 5 players on the server, it doesn't mean that they will have the indices 1, 2, 3, 4, and 5. If there are 6 players with 1,2,3,4,5,6 and then the one with 3 leaves, there are 5 players with 1,2,4,5,6 now... You get the idea.

to get the indices of all players, use get_players.

[ --<-@ ] Black Rose 03-05-2006 12:11

thank you PM

Edit: this would work, right?
Code:
new Player[32] new playerCount get_players(Player, playerCount, "c") for (new i = 0; i < playerCount; i++ )     client_print(Player[i], print_chat, "lol")

PM 03-05-2006 12:28

Quote:

Originally Posted by [ --<-@
Black Rose]thank you PM

Edit: this would work, right?
Code:
new Player[32] new playerCount get_players(Player, playerCount, "c") for (new i = 0; i < playerCount; i++ )     client_print(Player[i], print_chat, "lol")

I guess it would, yes :) well, testing it is the best way to find out.

Xanimos 03-05-2006 12:30

why not just do
Code:
client_print(0 , print_chat, "lol")

[ --<-@ ] Black Rose 03-05-2006 12:42

im not using it for client_cmd

and what i meant with the post was is this gonna show to all players first and then continue to player 1 player 2.......?
for (new i = 0; i < playerCount; i++ )

Des12 03-05-2006 13:29

Yes, i is incremented after the first loop run


All times are GMT -4. The time now is 20:22.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.