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

Solved [CS:GO]Bool for clients


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 12-19-2016 , 07:43   [CS:GO]Bool for clients
Reply With Quote #1

Hi,
How can I toggle a bool (or any variable that can do this) not globaly but only for the client that did the command like:

Code:
Player A do : sm_command
Server answer: X
Player B do: sm_command
Server answer: X
Player B do: sm_command
Server answer: Y ; not X
EDIT: Solved by searching in the tutorial sections: https://forums.alliedmods.net/showth...highlight=bool
Sorry for the (I think)not useful post.
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!

Last edited by Papero; 12-19-2016 at 08:09.
Papero is offline
Kolapsicle
Senior Member
Join Date: Oct 2014
Old 12-19-2016 , 08:19   Re: [CS:GO]Bool for clients
Reply With Quote #2

I don't know why you can't use a global two dimensional boolean, but you could probably use a static boolean.

Last edited by Kolapsicle; 12-19-2016 at 08:19.
Kolapsicle is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 12-19-2016 , 08:32   Re: [CS:GO]Bool for clients
Reply With Quote #3

Quote:
Originally Posted by Kolapsicle View Post
I don't know why you can't use a global two dimensional boolean, but you could probably use a static boolean.
Sawing that tutorial I saw that I can use
PHP Code:
bool Comm;

Comm[client] = true/false
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 12-19-2016 , 23:26   Re: [CS:GO]Bool for clients
Reply With Quote #4

Quote:
Originally Posted by Papero View Post
Sawing that tutorial I saw that I can use
PHP Code:
bool Comm;

Comm[client] = true/false
That can't happen
headline is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 12-20-2016 , 03:18   Re: [CS:GO]Bool for clients
Reply With Quote #5

bool Comm[MaxClients + 1];

Comm[client] = !Comm[client];
__________________
ddhoward is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 12-20-2016 , 21:32   Re: [CS:GO]Bool for clients
Reply With Quote #6

Quote:
Originally Posted by ddhoward View Post
bool Comm[MaxClients + 1];

Comm[client] = !Comm[client];
The declaration for the array is incorrect as it'll eval to 1 at compile time, or error
__________________
WildCard65 is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 12-20-2016 , 23:50   Re: [CS:GO]Bool for clients
Reply With Quote #7

derp

bool Comm[MAXPLAYERS + 1];

bool Comm[] = new bool[MaxClients + 1];

One of those, depending on where it's declared and/or initialized, right? Source Engine games are making my machine BSOD, so I've been getting rusty.
__________________
ddhoward is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 12-21-2016 , 20:22   Re: [CS:GO]Bool for clients
Reply With Quote #8

Quote:
Originally Posted by ddhoward View Post
derp

bool Comm[MAXPLAYERS + 1];

bool Comm[] = new bool[MaxClients + 1];

One of those, depending on where it's declared and/or initialized, right? Source Engine games are making my machine BSOD, so I've been getting rusty.
2nd varient requires static keyword.
__________________
WildCard65 is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 12-22-2016 , 00:34   Re: [CS:GO]Bool for clients
Reply With Quote #9

The code has to look like this though
PHP Code:
bool[] Comm = new bool[MaxClients 1]; 
__________________

Last edited by Impact123; 12-23-2016 at 00:50.
Impact123 is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 12-22-2016 , 00:37   Re: [CS:GO]Bool for clients
Reply With Quote #10

Quote:
Originally Posted by WildCard65 View Post
2nd varient requires static keyword.
how so?

Code:
// global
bool[] boolean1 = new bool[MaxClients + 1];

public void OnPluginStart()
{
	// local
	bool[] boolean2 = new bool[MaxClients + 1];
}
compiles just fine!
__________________
retired
shavit 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 11:09.


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