Raised This Month: $ Target: $400
 0% 

Help with convars


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 06-01-2016 , 07:44   Help with convars
Reply With Quote #1

Hey,
Is there any way to do that convar will be at diffrent value on only 1 player I mean if I have the convar(example only)plugin_useplugincommands so I can do it 1 for player that I am choosing and 0 to the other.
is that possible?
thx.
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests

Last edited by asherkin; 10-25-2018 at 17:23. Reason: Restore to previous version.
BraveFox is offline
TheUnderTaker
Senior Member
Join Date: Dec 2013
Location: Israel
Old 06-01-2016 , 08:17   Re: Help with convars
Reply With Quote #2

It would be easier to make a command that effect on only 1 player,
you can try convar and make a loop to check the players in the servers.
__________________
SourcePawn, C# and C++ Programmer.

My plugin list
TheUnderTaker is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 06-01-2016 , 08:33   Re: Help with convars
Reply With Quote #3

This was asked and answered 2 days ago.

https://forums.alliedmods.net/showpo...60&postcount=2
__________________
Chaosxk is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 06-01-2016 , 08:33   Re: Help with convars
Reply With Quote #4

Quote:
Originally Posted by TheUnderTaker View Post
It would be easier to make a command that effect on only 1 player,
you can try convar and make a loop to check the players in the servers.
I want that when there are(example) 3 players from red team alive my convar will be "1" for 1 player only that I choose
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 06-01-2016 , 09:22   Re: Help with convars
Reply With Quote #5

Quote:
Originally Posted by Chaosxk View Post
This was asked and answered 2 days ago.

https://forums.alliedmods.net/showpo...60&postcount=2
Bro,
I want a convar from my plugin
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 06-01-2016 , 12:53   Re: Help with convars
Reply With Quote #6

Did you bother to even click the link? If you bothered then you would know to use ReplicateToClient() on your convar handle.
__________________
Chaosxk is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 06-02-2016 , 16:45   Re: Help with convars
Reply With Quote #7

Quote:
Originally Posted by Chaosxk View Post
Did you bother to even click the link? If you bothered then you would know to use ReplicateToClient() on your convar handle.
I tried to use it and it worked but that what I got in my console:
ConVarRef convar_use doesn't point to an existing ConVar
SetConVar: No such cvar ( convar_use set to 1), skipping
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 06-02-2016 , 17:18   Re: Help with convars
Reply With Quote #8

Quote:
Originally Posted by Chaosxk View Post
Did you bother to even click the link? If you bothered then you would know to use ReplicateToClient() on your convar handle.
That is very incorrect. You cannot replicate convars to clients if those convars do not exist on the client.


BraveFox, you're thinking about this all wrong. You can't set a server-side, plugin-created convar to be different from one player to the other. There is only 1 instance of the convar, which is on the server.

You need to rewrite your code to ignore the setting of the convar for certain players.
__________________

Last edited by ddhoward; 06-02-2016 at 17:30.
ddhoward is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 06-03-2016 , 02:34   Re: Help with convars
Reply With Quote #9

Quote:
Originally Posted by ddhoward View Post
That is very incorrect. You cannot replicate convars to clients if those convars do not exist on the client.


BraveFox, you're thinking about this all wrong. You can't set a server-side, plugin-created convar to be different from one player to the other. There is only 1 instance of the convar, which is on the server.

You need to rewrite your code to ignore the setting of the convar for certain players.
How?
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 06-03-2016 , 04:19   Re: Help with convars
Reply With Quote #10

IDK, it's your code. Something like

PHP Code:
if (client == someClientThatWeWantADifferentValueFor) {
    
//do something involving a different value
}
else {
    
//do something else involving the convar's value

Are you even sure that a convar is something that you should be using here?
__________________

Last edited by ddhoward; 06-03-2016 at 04:21.
ddhoward 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 15:35.


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