Hey guys, I'm in another pickle.
function gameConnection::spawnPlayer(%this, %player)
{
%this.bottomprint("\c2Money:\c6" SPC %this.exp @ "." SPC "\c2Superpower:\c6" SPC %this.power @ ".");
%client = %this;
if(%this.power $= "Sprint")
{
%this.player.setmaxForwardSpeed(20);
talk("Client.Player:" SPC %player);
}
parent::spawnPlayer(%this);
}
This is my code, and basically what I'm trying to do is make it so if a client's superpower is sprint, their player's forward speed is set to 100 every time they spawn. gameConnection::spawnPlayer has the argument for %client. But for some reason, I can't do %client.player. Every time I do, it returns nothing. As seen in the code, I need it to set the maximum forward speed. Any ideas? I'm sure that my system for setting %client.power is correct, and it is indeed set to sprint.
Edit: I'm also wondering how I'd go about making a player faster while in midair-- air control, basically. You'd walk the normal speeds on ground, but really fast in the air. I have no idea how to approach this, and if the answer is really convoluted then just tell me so.
Edit 2: I was working and trying to set up a system so when you hold your light key, your maxForwardSpeed is increased. I couldn't figure out how to do that, since it was a dash between useLight which tells you when it is being pressed and isn't, and servercmdLight which allows you to access the client. So, I thought of the next best thing, schedules. Even through extensive searching, I'm still not quite sure how to format them. Here's my try at it:
function servercmdLight(%client)
{
if(%client.power $= "Sprint")
{
talk("initial");
%client.player.setmaxForwardSpeed(100);
schedule(5000,0,%client);
%client.player.setmaxForwardSpeed(20);
talk("timed");
}
}
Basically, my goal is for the setmaxForwardSpeed(100) to be sent off first, and then five seconds later setmaxForwardSpeed(20); goes off. And yes, I know twenty is higher then usual.
Edit 3: I got the schedules working, here's my code. I'm not sure if it's the most efficient, but hell it works.
//Light ultimates.
function servercmdLight(%client)
{
if(%client.power $= "Sprint")
{
%client.player.setmaxForwardSpeed(100);
schedule(5000, 0, evalSlowDown, %client);
}
}
//Disables speedymode.
function evalSlowDown(%client)
{
%client.player.setmaxForwardSpeed(20);
}
Now to look into cooldowns...