IzNoGoD
7th November 2014, 13:50
Here you go:
init()
{
thread waitforconnect();
}
waitforconnect()
{
while(true)
{
level waittill("connecting", player);
player thread waitforspawn();
}
}
waitforspawn()
{
self endon("disconnect");
while(true)
{
self waittill("spawned_player");
self thread onspawn();
}
}
onspawn()
{
self endon("spawned_player");
self endon("disconnect");
wasonground = false;
wasjumpbuttonpressed = false;
boost_frames = 0;
while(true)
{
onground = self isonground();
if(onground)
boost_frames = 0;
if(boost_frames > 1)
{
boost_frames--;
speed = self getvelocity();
speed_2d = (speed[0], speed[1], 0);
if(length(speed_2d) > getcvarint("g_speed") * 0.75)
speed_2d = maps\mp\_utility::vectorscale(vectornormalize(spee d_2d), getcvarint("g_speed") * 0.75);
maxspeed = getcvarint("g_boost_speed");
if(maxspeed <= 0)
maxspeed = 100;
curspeed = speed[2];
boost_percentage = (maxspeed - curspeed) / maxspeed;
if(boost_percentage < 0)
boost_percentage = 0;
if(boost_percentage > 1)
boost_percentage *= 0.9;
newspeed = curspeed + boost_percentage * getcvarint("g_boost_power");
self setvelocity((speed_2d[0], speed_2d[1], newspeed));
}
if(!onground && !wasonground && !boost_frames && self jumpbuttonpressed() && !wasjumpbuttonpressed)
boost_frames = getcvarint("g_boost_frames");
wasjumpbuttonpressed = self jumpbuttonpressed() || wasonground;
wasonground = onground;
wait 0.05;
}
}
Video will be added later, as I'm on a train at the moment.
Cvar values that work well:
g_boost_speed 300
g_boost_power 300
g_boost_frames 7
It's a lot of fun to play this on toujane. Remember to disable killtriggers if you dont wanna die every second
init()
{
thread waitforconnect();
}
waitforconnect()
{
while(true)
{
level waittill("connecting", player);
player thread waitforspawn();
}
}
waitforspawn()
{
self endon("disconnect");
while(true)
{
self waittill("spawned_player");
self thread onspawn();
}
}
onspawn()
{
self endon("spawned_player");
self endon("disconnect");
wasonground = false;
wasjumpbuttonpressed = false;
boost_frames = 0;
while(true)
{
onground = self isonground();
if(onground)
boost_frames = 0;
if(boost_frames > 1)
{
boost_frames--;
speed = self getvelocity();
speed_2d = (speed[0], speed[1], 0);
if(length(speed_2d) > getcvarint("g_speed") * 0.75)
speed_2d = maps\mp\_utility::vectorscale(vectornormalize(spee d_2d), getcvarint("g_speed") * 0.75);
maxspeed = getcvarint("g_boost_speed");
if(maxspeed <= 0)
maxspeed = 100;
curspeed = speed[2];
boost_percentage = (maxspeed - curspeed) / maxspeed;
if(boost_percentage < 0)
boost_percentage = 0;
if(boost_percentage > 1)
boost_percentage *= 0.9;
newspeed = curspeed + boost_percentage * getcvarint("g_boost_power");
self setvelocity((speed_2d[0], speed_2d[1], newspeed));
}
if(!onground && !wasonground && !boost_frames && self jumpbuttonpressed() && !wasjumpbuttonpressed)
boost_frames = getcvarint("g_boost_frames");
wasjumpbuttonpressed = self jumpbuttonpressed() || wasonground;
wasonground = onground;
wait 0.05;
}
}
Video will be added later, as I'm on a train at the moment.
Cvar values that work well:
g_boost_speed 300
g_boost_power 300
g_boost_frames 7
It's a lot of fun to play this on toujane. Remember to disable killtriggers if you dont wanna die every second