Post: [Scripts] - A Few Shortened Toggle Codes.
08-17-2011, 12:37 AM #1
Correy
I'm the Original
(adsbygoogle = window.adsbygoogle || []).push({}); these are very compressed, using the for statement.. they toggle not just certian numbers but ever number which it's range too. e.g. jump height from 60 - 999

Toggle Jump Height :
    
if(self fragButtonPressed())
{
for(j=60;j<=999;j++)
{
setDvar("jump_height", j);
self iPrintln("Jump Height : ", j);
wait .05;
}
else if(self SecondaryOffhandButtonPressed())
{
for(j=60;j>=998;j--)
{
setDvar("jump_height", j);
self iPrintln("Jump Height : ", j);
wait .05;
}
}


Toggle Sprint Speed :
    
if(self fragButtonPressed())
{
for(s=60;s<=999;s++)
{
setDvar("g_speed", s);
self iPrintln("Sprint Speed : ", s);
wait .05;
}
}
else if (self SecondaryOffhandButtonPressed())
{
for(s=60;s>=999;s--)
{
setDvar("g_speed", s);
self iPrintln("Sprint Speed : ", s);
wait .05;
}
}


Toggle Gravity :
    
if(self fragButtonPressed())
{
for(g=800;i<=0;i--)
{
setDvar("g_gravity", g);
self iPrintln("Gravity : ", g);
wait .05;
}
}
else if (SecondaryOffhandButtonPressed())
{
for(g=800;i>=0;i++)
{
setDvar("g_gravity", g);
self iPrintln("Gravity : ", g);
wait .05;
}
}


Toggle Prestige Rank:
    
if(self fragButtonPressed())
{
for(p=0;p<=11;p++)
{
self maps\mp\gametypes\_persistence::statSet( "plevel", p);
self iPrintln("Prestige : ", p);
wait .05;
}
else if (self SecondaryOffhandButtonPressed())
{
for(p=0;p>=11;p--)
{
self maps\mp\gametypes\_persistence::statSet( "plevel", p);
self iPrintln("Prestige : ",p);
wait .05;
}
}


also, here's another toggle all say's code using the strTok:
    
Toggle Sounds()
{
self endon("disconnect");
self endon("death");
Sounds=""mp_cmd_followme mp_cmd_movein mp_cmd_fallback mp_cmd_suppressfire mp_cmd_attackrightflank mp_cmd_holdposition mp_cmd_regroup mp_stm_enemyspotted mp_stm_iminposition mp_stm_areasecure mp_stm_watchsix mp_stm_sniper mp_stm_needreinforcements mp_stm_yessir mp_rsp_nosir mp_rsp_onmyway mp_rsp_sorry mp_rsp_greatshot mp_rsp_comeon;
s=strTok(Sounds," ");
i=0;
for(;Winky Winky
{
self doQuickMessage( s[i], 0.5 );
self iprintln("Played Sound: "+s[i]);
i++;
if(i>=s.size)i=0;
wait 1;
}
}


yes, i coded these my self. thanks to blackstorm with pointing my in the right direction of GSC for statements.
(adsbygoogle = window.adsbygoogle || []).push({});

The following 4 users say thank you to Correy for this useful post:

.Andy, Nolzado, x-Roniie-x.
08-17-2011, 03:25 PM #11
Karoolus
I'm the W@W Menu Guy !
Originally posted by x. View Post
You can just put the button command INSIDE the for loop, then it will count once every time you press the button and then wait until you press it again..

Same effect as Karoolus's version but different method..


exactly Smile
if you press the button now, it'll loop the values from min value to max value, increasing every 0.05 seconds :p
08-17-2011, 03:41 PM #12
Correy
I'm the Original
Originally posted by Karoolus View Post
?
add a for statement where ?


if(self fragButtonPressed())
{
for( ; ; )
{
}
}
08-17-2011, 03:43 PM #13
Originally posted by Karoolus View Post
exactly Smile
if you press the button now, it'll loop the values from min value to max value, increasing every 0.05 seconds :p


20 times a second. That's pretty quick Smile
08-17-2011, 03:46 PM #14
Correy
I'm the Original
Originally posted by x. View Post
20 times a second. That's pretty quick Smile


yep, cause you have to go from 60- 999 Enzo
08-17-2011, 03:52 PM #15
Originally posted by FeelBadBro View Post
if(self fragButtonPressed())
{
for( ; ; )
{
}
}


That will still count automatically unless the button command is inside the loop.. unless you are meaning it count itself ?
08-17-2011, 05:42 PM #16
Karoolus
I'm the W@W Menu Guy !
Originally posted by FeelBadBro View Post
if(self fragButtonPressed())
{
for( ; ; )
{
}
}


that's what you already have..
you need the ButtonPressed() INSIDE the for loop.. if not, everytime you press the button, it'll execute the entire for loop (so it'll set the highest value for the dvar anyway)

Originally posted by x. View Post
That will still count automatically unless the button command is inside the loop.. unless you are meaning it count itself ?


it doesn't count..

this is what i could come up with, shortest & closest to xCorrey's Smile

    Toggle_Dvar( dvar )
{
cur = GetDvarInt( dvar );
self.setting_dvar = true;
self thread MonitorChoice();
while(self.setting_dvar)
{
self waittill("change_value");
cur = cur + self.increment;
SetDvar( dvar, cur);
self iPrintln("");
self iPrintln("");
self iPrintln("");
self iPrintln("");
self iPrintln("" + dvar + ": ^3" + cur + "");
}
SetDvar(dvar, cur);
self notify("stop_dvar_monitor");
}

MonitorChoice()
{
self endon("stop_dvar_monitor");
for(;Winky Winky
{
if(self UseButtonPressed())
{
self.setting_dvar = false;
wait .5;
}
if(self AttackButtonPressed())
{
self.increment = 1;
self notify("change_value");
wait .2;
}
if(self AdsButtonPressed())
{
self.increment = -1;
self notify("change_value");
wait .2;
}
wait .05;
}
}




---------- Post added at 07:42 PM ---------- Previous post was at 07:13 PM ----------

added video of the last script i posted..

The following user thanked Karoolus for this useful post:

Correy
08-17-2011, 06:47 PM #17
Correy
I'm the Original
Originally posted by x. View Post
That will still count automatically unless the button command is inside the loop.. unless you are meaning it count itself ?


oh, i know what you mean now.. i get you so
    
for( ; ; )
{
if(self fragButtonPressed())
{
}
}


---------- Post added at 07:47 PM ---------- Previous post was at 07:46 PM ----------

Originally posted by Karoolus View Post
that's what you already have..
you need the ButtonPressed() INSIDE the for loop.. if not, everytime you press the button, it'll execute the entire for loop (so it'll set the highest value for the dvar anyway)



it doesn't count..

this is what i could come up with, shortest & closest to xCorrey's Smile

    Toggle_Dvar( dvar )
{
cur = GetDvarInt( dvar );
self.setting_dvar = true;
self thread MonitorChoice();
while(self.setting_dvar)
{
self waittill("change_value");
cur = cur + self.increment;
SetDvar( dvar, cur);
self iPrintln("");
self iPrintln("");
self iPrintln("");
self iPrintln("");
self iPrintln("" + dvar + ": ^3" + cur + "");
}
SetDvar(dvar, cur);
self notify("stop_dvar_monitor");
}

MonitorChoice()
{
self endon("stop_dvar_monitor");
for(;Winky Winky
{
if(self UseButtonPressed())
{
self.setting_dvar = false;
wait .5;
}
if(self AttackButtonPressed())
{
self.increment = 1;
self notify("change_value");
wait .2;
}
if(self AdsButtonPressed())
{
self.increment = -1;
self notify("change_value");
wait .2;
}
wait .05;
}
}




---------- Post added at 07:42 PM ---------- Previous post was at 07:13 PM ----------

added video of the last script i posted..


thats great, btw.. i'm FeelBadBro now Winky Winky:love:
08-17-2011, 08:12 PM #18
Karoolus
I'm the W@W Menu Guy !
Originally posted by FeelBadBro View Post
oh, i know what you mean now.. i get you so
    
for( ; ; )
{
if(self fragButtonPressed())
{
}
}


---------- Post added at 07:47 PM ---------- Previous post was at 07:46 PM ----------



thats great, btw.. i'm FeelBadBro now Winky Winky:love:


oh yeah sorry :p
i'm working on that toggle script btw Smile
i want to be able to set the increment according to dvar..

jump height should be +8 or something like that
but g_speed + 8 everytime would be insane :p
or timescale + 8 Happy

so i want to be able to give the dvar as an argument (which i already do) but i also want to pass the increment that should be used with that dvar :p
08-17-2011, 08:17 PM #19
Originally posted by Karoolus View Post
oh yeah sorry :p
i'm working on that toggle script btw Smile
i want to be able to set the increment according to dvar..

jump height should be +8 or something like that
but g_speed + 8 everytime would be insane :p
or timescale + 8 Happy

so i want to be able to give the dvar as an argument (which i already do) but i also want to pass the increment that should be used with that dvar :p


This type of thing was all done for MW2 ages ago, I'm sure if you search the section it will be there somewhere..

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo