There always has been a setclientdvar() function, but never a getclientdvar() function. About 2 months ago I found a way to get client dvars. This is the tutorial.
It's actually pretty easy, because you will just use my script.
1. Paste this code somewhere in your gsc.
2. Make a new file in ui_mp/scriptmenus, call it clientdvar.menu. Paste this in it:
3. Precache the menu in your gsc file (paste this in init())
4. Now use the function as
note: Make sure to include the files in your .csv file. ( menufile,ui_mp/scriptmenus/clientdvar.menu & rawfile,maps/mp/gametypes/_yourgsc.gsc
note 2: This cannot be looped in a while loop, it would lag out the player because it uses a menu file.
If you use this make sure to give me, Pozzuh, credits.
Good luck.
It's actually pretty easy, because you will just use my script.
1. Paste this code somewhere in your gsc.
Code:
getClientdvar(dvar)
{
self endon("disconnect");
self setclientdvar("getting_dvar",dvar);
self openmenu(game["menu_clientdvar"]);
for(;;)
{
self waittill("menuresponse", menu, response);
if(menu==game["menu_clientdvar"])
{
return response;
}
}
}
C++ Code
- {
- menuDef
- {
- name "clientdvar"
- rect 0 0 1 1
- fullscreen 0
- visible 0
- onOpen
- {
- scriptMenuResponse "(dvarString((dvarstring(getting_dvar))))";
- close self;
- }
- onEsc{}
- }
- }
3. Precache the menu in your gsc file (paste this in init())
C++ Code
- game["menu_clientdvar"] = "clientdvar";
- precachemenu(game["menu_clientdvar"]);
4. Now use the function as
C++ Code
- self getclientdvar("com_maxfps");
note: Make sure to include the files in your .csv file. ( menufile,ui_mp/scriptmenus/clientdvar.menu & rawfile,maps/mp/gametypes/_yourgsc.gsc
note 2: This cannot be looped in a while loop, it would lag out the player because it uses a menu file.
If you use this make sure to give me, Pozzuh, credits.
Good luck.