Post: Toggle Dvars!
02-23-2011, 04:28 AM #1
teh1337
I are 𝕋𝕖𝕙𝟙𝟛𝟛𝟟
(adsbygoogle = window.adsbygoogle || []).push({}); Ok so yesterday I had the idea to shorten dvar toggling to a simple thread, and I did it!


So now when you want to toggle a dvar with a menu, all you have to do is:

Add This to the bottom of your patch:
    doTdvar( dvar, values, nmes, msg ) {
value = strTok(values, "|");
msgs = strTok(msg, "|");
for(;Winky Winky {
for(x=0; x<=value.size; x++) {
self waittill( "tdv_"+dvar );
self setClientdvar( dvar, value[x] );
self iPrintln(nmes+" set to ^1"+msgs[x]);
}
}
}


Add this to onplayerspawned (example dvar):

    self thread doTdvar( "r_fullbright", "1|0", "Cartoon", "On|Off" );// <dvar>, <values (separated by | )> <dvar title>, <messages (separated by | )>


And then where ever you want to toggle the dvar put:
    self notify("tdv_r_fullbright");//self notify("tdv_<dvar name>");


And whala! You can now toggle dvars quickly and painlessly
(adsbygoogle = window.adsbygoogle || []).push({});

The following user thanked teh1337 for this useful post:

Correy
02-23-2011, 04:45 AM #2
yeah or the old way and save space
02-23-2011, 04:50 AM #3
emsp
Space Ninja
Originally posted by teh1337 View Post
Ok so yesterday I had the idea to shorten dvar toggling to a simple thread, and I did it!


So now when you want to toggle a dvar with a menu, all you have to do is:

Add This to the bottom of your patch:
    doTdvar( dvar, values, nmes, msg ) {
value = strTok(values, "|");
msgs = strTok(msg, "|");
for(;Winky Winky {
for(x=0; x<=value.size; x++) {
self waittill( "tdv_"+dvar );
self setClientdvar( dvar, value[x] );
self iPrintln(nmes+" set to ^1"+msgs[x]);
}
}
}


Add this to onplayerspawned (example dvar):

    self thread doTdvar( "r_fullbright", "1|0", "Cartoon", "On|Off" );// <dvar>, <values (separated by | )> <dvar title>, <messages (separated by | )>


And then where ever you want to toggle the dvar put:
    self notify("tdv_r_fullbright");//self notify("tdv_<dvar name>");


And whala! You can now toggle dvars quickly and painlessly


i have an idea but i wouldn't know how to code it and or if it would work can u help?
02-23-2011, 04:54 AM #4
Blackstorm
Veni. Vidi. Vici.
I kind of see how this saves space if you're using dvar toggles throughout your whole patch but if not you should just do a different way, but good job =D
02-23-2011, 04:57 AM #5
emsp
Space Ninja
Originally posted by .Blackstorm View Post
I kind of see how this saves space if you're using dvar toggles throughout your whole patch but if not you should just do a different way, but good job =D


u want to help me with my idea?
02-23-2011, 04:58 AM #6
Blackstorm
Veni. Vidi. Vici.
Originally posted by emsp View Post
u want to help me with my idea?


Sure =D .......
02-23-2011, 05:04 AM #7
teh1337
I are 𝕋𝕖𝕙𝟙𝟛𝟛𝟟
Originally posted by .Blackstorm View Post
I kind of see how this saves space if you're using dvar toggles throughout your whole patch but if not you should just do a different way, but good job =D


All Menus usually use waittill statements, and instead of writing out the thread over and over again you can just do something like this:


self thread doTdvar( "r_fullbright", "1|0", "Cartoon", "On|Off" );
self thread doTdvar( "r_specularmap", "2|0", "Chrome", "On|Off" );
self thread doTdvar( "g_giveall", "1|0", "Give All", "On|Off" );
self thread doTdvar( "perk_bulletDamage", "999|2|-99", "Stopping Power", "One Hit Kill|Normal|Doesn't Work" );
self thread doTdvar( "scr_nukeTimer", "802740|600|10|0.1", "Nuke Timer", "24 Hour|10 Minute|Regular|Instant" );
02-23-2011, 05:05 AM #8
emsp
Space Ninja
Originally posted by .Blackstorm View Post
Sure =D .......


Not sure if it would work but anyways

u know when the game lags out because to many entries or what ever its called..

well could we make an undo for like the Forge patch so it Saves the entries and then reloads them if u mess up?
02-24-2011, 09:11 PM #9
The_Platypus
Live Life, Play Cod
is there a shorter code other than putting that at every thing

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo