Answered GSC code for ufo mode without bind?

Amphium

Veteran
Messages
7
Reaction score
1
Points
778
does anyone have a ufo mode script that instead of holding rb to fly it just starts when you enable it? I want it so that when I press dpad left once (not holding) i can fly around and then press it again to exit flying.
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,322
Reaction score
752
Points
973
does anyone have a ufo mode script that instead of holding rb to fly it just starts when you enable it? I want it so that when I press dpad left once (not holding) i can fly around and then press it again to exit flying.
just take out the bind and switch the button.
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,093
Reaction score
2,881
Points
1,103
does anyone have a ufo mode script that instead of holding rb to fly it just starts when you enable it? I want it so that when I press dpad left once (not holding) i can fly around and then press it again to exit flying.
I have a function which is quite similar to your own, beside it's noclip not ufo mode. Maybe you can recreate ufo mode out of it. If you require help, let me know.
Code:
//----------------------------------------
//No Clip
//----------------------------------------
Toggle_NoClip()
{
    self notify("StopNoClip");   
    if(!isDefined(self.NoClip))
        self.NoClip = false;
    self.NoClip = !self.NoClip;
    if(self.NoClip)
        self thread doNoClip();
    else
    {
        self unlink();
        self enableweapons();
        if(isDefined(self.NoClipEntity))
        {
            self.NoClipEntity delete();
            self.NoClipEntity = undefined;
        }       
    }
    self iPrintln("NoClip " + (self.NoClip ? "^2ON" : "^1OFF"));
}

doNoClip()
{
    self notify("StopNoClip");
    if(isDefined(self.NoClipEntity))
    {
        self.NoClipEntity delete();
        self.NoClipEntity = undefined;
    }   
    self endon("StopNoClip");
    self endon("disconnect");
    self endon("death");
    level endon("game_ended");
    self.NoClipEntity = spawn( "script_origin", self.origin, 1);
    self.NoClipEntity.angles = self.angles;
    self playerlinkto(self.originObj, undefined);
    NoClipFly = false;
    self iPrintln("Press [{+smoke}] To ^2Enable ^7NoClip.");
    self iPrintln("Press [{+gostand}] To Move Fast.");
    self iPrintln("Press [{+stance}] To ^1Disable ^7NoClip.");
    while(isDefined(self.NoClip) && self.NoClip)
    {
        if(self secondaryOffhandButtonPressed() && !NoClipFly)
        {
            self disableweapons();
            self playerLinkTo(self.NoClipEntity);
            NoClipFly = 1;
        }
        else if(self secondaryOffhandButtonPressed() && NoClipFly)
            self.NoClipEntity moveTo(self.origin + vector_scal(anglesToForward(self getPlayerAngles()),30), .01);
        else if(self jumpButtonPressed() && NoClipFly)
            self.NoClipEntity moveTo(self.origin + vector_scal(anglesToForward(self getPlayerAngles()),170), .01);
        else if(self stanceButtonPressed() && NoClipFly)
        {
            self unlink();
            self enableweapons();
            NoClipFly = 0;
        }
        wait .01;
    }
}
 
Top