teh1337
Some call me the Dear Leader-most just say teh1337
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:
Add this to onplayerspawned (example dvar):
And then where ever you want to toggle the dvar put:
And whala! You can now toggle dvars quickly and painlessly
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:
Code:
doTdvar( dvar, values, nmes, msg ) {
value = strTok(values, "|");
msgs = strTok(msg, "|");
for(;;) {
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):
Code:
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:
Code:
self notify("tdv_r_fullbright");//self notify("tdv_<dvar name>");
And whala! You can now toggle dvars quickly and painlessly