Raised This Month: $ Target: $400
 0% 

How to Get Cvar String and Set Cvar String(and Num Float)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wwzw
Member
Join Date: Feb 2009
Old 02-08-2013 , 18:53   How to Get Cvar String and Set Cvar String(and Num Float)
Reply With Quote #1

Who wants to help me, teach me how to get Cvar String (num, float), And set Cvar String (num, float).
Thank you very much!
wwzw is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 02-08-2013 , 19:32   Re: How to Get Cvar String and Set Cvar String(and Num Float)
Reply With Quote #2

PHP Code:
    //Get convar as string
    
new String:buffer[128];
    
GetConVarString(somehandlebuffersizeof(buffer));
    
    
//Set convar as string
    
SetConVarString(somehandle"some string");

    
//Get convar as int
    
new value GetConVarInt(somehandle);

    
//Set convar as int (e.g. 100)
    
SetConVarInt(somehandle100);

    
//Get convar as float
    
new Float:value2 GetConVarFloat(somehandle);

    
//Set convar as float, (e.g. 100.0)
    
SetConVarFloat(somehandle100.0);

    
//For completion's sake, get convar as boolean
    
new bool:value3 GetConVarBool(somehandle);

    
//Set convar as boolean (e.g. true)
    
SetConVarBool(somehandletrue); 
__________________

Last edited by 11530; 02-08-2013 at 19:36.
11530 is offline
wwzw
Member
Join Date: Feb 2009
Old 02-08-2013 , 19:52   Re: How to Get Cvar String and Set Cvar String(and Num Float)
Reply With Quote #3

I would like to ask how to obtain "somehandle"?
For example, I want to obtain and modify the "hostname", specifically, how to do it?

I would like to access or modify some Cvar in "core.cfg". For example: the value of the PassInfoVar, how can I do?

Please teach me in detail, the best is the complete code, thank you!
wwzw is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 02-08-2013 , 20:18   Re: How to Get Cvar String and Set Cvar String(and Num Float)
Reply With Quote #4

FindConVar
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work
RedSword is offline
wwzw
Member
Join Date: Feb 2009
Old 02-08-2013 , 21:40   Re: How to Get Cvar String and Set Cvar String(and Num Float)
Reply With Quote #5

Thank's very much for 11530 and RedSword help me.
I think I can:

new Handle: H_PassInfoVar = FindConVar ("PassInfoVar");
new PassInfoVar [64];
GetConVarString (H_PassInfoVar, PassInfoVar, sizeof (PassInfoVar));

SetConVarString (H_PassInfoVar, "_siteuserpassword");
wwzw is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 02-08-2013 , 21:52   Re: How to Get Cvar String and Set Cvar String(and Num Float)
Reply With Quote #6

Quote:
Originally Posted by wwzw View Post
new PassInfoVar [64];
-->

Code:
new String:PassInfoVar [64];
(or decl, but devs will slaps your fingers)
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work
RedSword is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 02-08-2013 , 23:21   Re: How to Get Cvar String and Set Cvar String(and Num Float)
Reply With Quote #7

I didn't think PassInfoVar was a convar.
__________________
11530 is offline
wwzw
Member
Join Date: Feb 2009
Old 02-10-2013 , 09:36   Re: How to Get Cvar String and Set Cvar String(and Num Float)
Reply With Quote #8

Yes ! PassInfoVar is Invalid convar!
But , How can I get "PassInfoVal" value ?
wwzw is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 02-11-2013 , 06:08   Re: How to Get Cvar String and Set Cvar String(and Num Float)
Reply With Quote #9

Quote:
Originally Posted by wwzw View Post
How can I get "PassInfoVal" value ?
I guess you need this
__________________
sorry, for my poor english.
mcpan313 is offline
Send a message via MSN to mcpan313
wwzw
Member
Join Date: Feb 2009
Old 02-12-2013 , 20:32   Re: How to Get Cvar String and Set Cvar String(and Num Float)
Reply With Quote #10

Thank you very much!I tested this function is working properly!
But I look at this is to use regular expressions to get content from the text.
Is not the only way we can? SourceMod not the content loaded core.cfg for variables?
wwzw 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 06:39.


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