07-25-2011, 20:30
add to init
add to on spawned
Add this anywhere in ur on spawned file
Is this the right code to activate slow motion? or did i something wrong?
Code:
//set the variable so it doesnt error when we want to use it.
setDvar("timescale",0.5);
add to on spawned
Code:
//start the thread
self thread timescale();
//print the keybind we are using
self iPrintLn("^8Press ^7 [{+actionslot 3}] ^8 to toggle slow motion!");
Add this anywhere in ur on spawned file
Code:
ThirdPerson()
{
self endon ( "death" );
//begin loop til you die
while( true )
{
//wait a while so it doesnt freeze up as an endless loop
wait 0.08;
//designate a key to be pushed
if( self ActionSlotThreeButtonPressed() )
{
//setting dvars that dont matter no matter what we toggle
setDvar("timescale",0.5);
// check iff the dvar is off or on - first time round it will be 0 and skip this.
ifset(Dvar("timescale",0.5);== "off")
{
//our first option in the toggle..
setDvar("timescale",0.5);
setDvar("timescale",0.5);= "on";
}
// set variable to off so next time around it toggles the above option
else
{
//our second option in the toggle..
setDvar("timescale",0.5);
setDvar("timescale",0.5);= "off";
}
}
}
}
Is this the right code to activate slow motion? or did i something wrong?