Raised This Month: $32 Target: $400
 8% 

Solved Menu item will change cvar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 12-02-2017 , 15:53   Menu item will change cvar
Reply With Quote #1

Hey coders,

i need help with making menu item, and that item will change cvar on 1 and other item will change it on 0.. like:

Turn on - this item will make cvar on 1
Turn off - this item will make cvar on 0

If you know how to make it, i will be happy if you help me with this..

Javierko.. thanks..

Last edited by Javierko; 12-03-2017 at 07:21. Reason: solved
Javierko is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 12-02-2017 , 17:39   Re: Menu item will change cvar
Reply With Quote #2

you can use this
PHP Code:
ConVar cBuffer FindConVar("my_convar_bool");
cBuffer.BoolValue true//set true

cBuffer FindConVar("my_convar_int");
cBuffer.IntValue 5//set 5

cBuffer FindConVar("my_convar_float");
cBuffer.FloatValue 5.0// set 5.0

cBuffer FindConVar("my_convar_string");
cBuffer.SetString("new value"falsefalse)); // https://sm.alliedmods.net/new-api/convars/ConVar/SetString 
best you check the convar class to fully understand this. https://sm.alliedmods.net/new-api/convars

Otherwise you can use my old stocks for such things.
https://github.com/shanapu/MyJailbre....inc#L154-L193
Will look like:
PHP Code:
SetCvar("my_convar_bool"1);
SetCvar("my_convar_int"5);
SetCvarFloat("my_convar_float"5.0);
SetCvarString("my_convar_string""new value"); 
__________________
coding & free software
shanapu is offline
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 12-03-2017 , 07:15   Re: Menu item will change cvar
Reply With Quote #3

I used this old version, but in compile it say to me its undefined symbols...

Do you know why?
Javierko is offline
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 12-03-2017 , 07:21   Re: Menu item will change cvar
Reply With Quote #4

Oh i fixed it...

Solved

Thanks for help shanapu
Javierko 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 02:19.


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