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

Issues with selecting all players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unreal1
AlliedModders Donor
Join Date: Dec 2010
Old 02-09-2012 , 19:51   Issues with selecting all players
Reply With Quote #1

Ok so I have read through the tuturiols, but I'm having issues with being able to target all players on a server including dead,spectating,and alive players. I want to target everybody on the server.

So if I have something like this:

Code:
public Action: Activatecommand();

{
CreateTimer(0.1, Dosomething, /* Somehow target all users*/);
}
public Action: Dosomething((Handle:timer, /*Recieve all players*/));
{
//Run a command that targets all players. 
//I have read everything about prossessing stings but I just don't get how they work
}
How do I make it so when I run Activatecommand, it passes all the users into DoSomething which then does something with all the users.
Unreal1 is offline
necavi
Veteran Member
Join Date: Sep 2010
Old 02-09-2012 , 20:00   Re: Issues with selecting all players
Reply With Quote #2

Code:
for(new i=1;i<MAXPLAYERS;i++)
{
//Do something on each client
}
necavi is offline
Unreal1
AlliedModders Donor
Join Date: Dec 2010
Old 02-09-2012 , 20:11   Re: Issues with selecting all players
Reply With Quote #3

Ok and how to I make a ProccessSting that targets all players not only dead or only alive. But all players that are on the server.

Last edited by Unreal1; 02-09-2012 at 20:11.
Unreal1 is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 02-09-2012 , 20:46   Re: Issues with selecting all players
Reply With Quote #4

Read the introduction.

Yours sincerely
Impact
__________________
Impact123 is offline
Tylerst
Veteran Member
Join Date: Oct 2010
Old 02-09-2012 , 22:46   Re: Issues with selecting all players
Reply With Quote #5

Just for reference, these are the possible target filters for ProcessTargetString

Code:
#define COMMAND_FILTER_ALIVE		(1<<0)	/**< Only allow alive players */
#define COMMAND_FILTER_DEAD		(1<<1)	/**< Only filter dead players */
#define COMMAND_FILTER_CONNECTED	(1<<2)	/**< Allow players not fully in-game */
#define COMMAND_FILTER_NO_IMMUNITY	(1<<3)	/**< Ignore immunity rules */
#define COMMAND_FILTER_NO_MULTI		(1<<4)	/**< Do not allow multiple target patterns */
#define COMMAND_FILTER_NO_BOTS		(1<<5)	/**< Do not allow bots to be targetted */
If you want to do stuff to everyone whether dead or alive, just use COMMAND_FILTER_CONNECTED

Note: That is if you're talking about the @all command targetting specifically. If you just want to run something on all players from the plugin, use a for loop like earlier. Although I would use <=MaxClients instead of <MAXPLAYERS

Last edited by Tylerst; 02-09-2012 at 22:54.
Tylerst is offline
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 02-10-2012 , 01:26   Re: Issues with selecting all players
Reply With Quote #6

Quote:
Originally Posted by Tylerst View Post
Although I would use <=MaxClients instead of <MAXPLAYERS
+1
Quote:
Originally Posted by clients.inc
* MAXPLAYERS is not the same as MaxClients.
* MAXPLAYERS is a hardcoded value as an upper limit. MaxClients changes based on the server.
* Both GetMaxClients() and MaxClients are only available once the map is loaded, and should
* not be used in OnPluginStart().
__________________

Last edited by napalm00; 02-10-2012 at 01:30.
napalm00 is offline
Reply



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 14:20.


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