Raised This Month: $12 Target: $400
 3% 

Variables getallclients help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shadowdragon
Senior Member
Join Date: Dec 2012
Old 12-17-2014 , 02:28   Variables getallclients help
Reply With Quote #1

Hey all alliedmodders i know this may be a stupid question to ask but is it possible to change a variable for all clients at the same time for example

PHP Code:
new test[MAXPLAYERS+1]

public 
OnClientPutInServer(client)
{
     
test[GetAllPlayers] = 5;

it would be really great if someone can help me with this.
__________________
Sorry for my poor English!
________________________________
I can do CSS/CSGO plugin request for little money!
shadowdragon is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 12-17-2014 , 02:35   Re: Variables getallclients help
Reply With Quote #2

for(new i = 0; i < sizeof(test); i++) { test[i] = 5; }

or

for(new i = 1; i <= MaxClients; i++) { test[i] = 5; }
__________________

Last edited by Chdata; 12-17-2014 at 22:01.
Chdata is offline
shadowdragon
Senior Member
Join Date: Dec 2012
Old 12-17-2014 , 03:17   Re: Variables getallclients help
Reply With Quote #3

Quote:
Originally Posted by Chdata View Post
for(new i = 0; i < sizeof(test); i++) { test[i] = 5; }

or

for(new i = 1; i < MaxClients; i++) { test[i] = 5; }
Thank you so much this worked.
__________________
Sorry for my poor English!
________________________________
I can do CSS/CSGO plugin request for little money!
shadowdragon is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 12-17-2014 , 12:09   Re: Variables getallclients help
Reply With Quote #4

second one is recommended
__________________
Chdata is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 12-17-2014 , 17:44   Re: Variables getallclients help
Reply With Quote #5

Should also be <=, not <.
bl4nk is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 12-17-2014 , 22:01   Re: Variables getallclients help
Reply With Quote #6

fixed typo
__________________
Chdata is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:31.


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