GSC isSprinting() + How To Get Your Speed

Helpful


  • Total voters
    6

God

Skiddy
Messages
337
Reaction score
240
Points
818
Hello CCM :kissingheart:
So just a few minutes ago i needed a check to see if i'm sprinting and I couldn't find one, so I wrote one real quick. If there is a function like this already inside the gsc... well... you can learn something from this lol

Anyway, here it is​
PHP:
isSprinting()
{
    MyVelocity[2] = self GetVelocity(); //since GetVelocity() stores 3 values we have to also
    
    if(MyVelocity[0] > 220 || MyVelocity[0] < -220) //getting the first value (our foward value)
        return true; //true if we are sprinting
    else
        return false;
}

myVelo() //You can use this if you want to find your own values, the above worked for me
{
    self endon("Velo");
    for(;;)
    {
        self iprintln(self GetVelocity());
        wait 1; //Lower this if you want to be more accurate
    }
}

//or you can use something like this if you want to use HUDs instead of iPrintln (didn't test)
DrawMyVelocity(text, font, fontScale, align, relative, x, y, color, alpha, glowColor, glowAlpha, sort)
{

    hud = self createFontString(font, fontScale);
    hud setPoint(align, relative, x, y);
    hud.color = color;
    hud.alpha = alpha;
    hud.glowColor = glowColor;
    hud.glowAlpha = glowAlpha;
    hud.sort = sort;
    hud.alpha = alpha;
    hud setSafeText(self GetVelocity());
    hud.foreground = true;
    hud.hideWhenInMenu = true;
    hud.archived = false;
    return hud;
}
 
S

SeriousHD-

Guest
Hello CCM :kissingheart:
So just a few minutes ago i needed a check to see if i'm sprinting and I couldn't find one, so I wrote one real quick. If there is a function like this already inside the gsc... well... you can learn something from this lol

Anyway, here it is​
PHP:
isSprinting()
{
    MyVelocity[2] = self GetVelocity(); //since GetVelocity() stores 3 values we have to also
   
    if(MyVelocity[0] > 220 || MyVelocity[0] < -220) //getting the first value (our foward value)
        return true; //true if we are sprinting
    else
        return false;
}

myVelo() //You can use this if you want to find your own values, the above worked for me
{
    self endon("Velo");
    for(;;)
    {
        self iprintln(self GetVelocity());
        wait 1; //Lower this if you want to be more accurate
    }
}

//or you can use something like this if you want to use HUDs instead of iPrintln (didn't test)
DrawMyVelocity(text, font, fontScale, align, relative, x, y, color, alpha, glowColor, glowAlpha, sort)
{

    hud = self createFontString(font, fontScale);
    hud setPoint(align, relative, x, y);
    hud.color = color;
    hud.alpha = alpha;
    hud.glowColor = glowColor;
    hud.glowAlpha = glowAlpha;
    hud.sort = sort;
    hud.alpha = alpha;
    hud setSafeText(self GetVelocity());
    hud.foreground = true;
    hud.hideWhenInMenu = true;
    hud.archived = false;
    return hud;
}
There is a built in value for sprinting. And to get speed = GetVelocity().
 
Top