I'm doing a simple Levitation script just for fun.
For some reason, everything except the timeout works.
Even when I change the name of the timeout to something like "onAir" and use "scheduleEvent(0.05,"Air",null);" or changing the name of the timeout to "Air" and using "sleep(0.05); Air();" it just won't work.
Here's what I've got. Also, I don't care if you use this on your own server, just give me credit.
PHP Code:
//Scripted by Novice
//#CLIENTSIDE
function onCreated() {
this.rep = {"walk","grab","pull","push","sit"};
this.air = 0;
player.z = 0;
setTimer(0.05);
}
function onWeaponFired() {
if (this.air == 0) {
this.air = 1;
for (i=0; i<this.rep.size(); i++)
replaceAni(this.rep[i],"idle");
}
else if (this.air in {1,2}) {
this.air = 0;
for (i=0; i<this.rep.size(); i++)
replaceAni(this.rep[i],this.rep[i]);
}
}
function onTimeOut() {
if (player.z == 2 && this.air != 0)
this.air = 2;
if (player.z == 1 && this.air != 0)
this.air = 1;
if (this.air == 1)
player.z += 0.05;
else if (this.air == 2)
player.z -= 0.05;
else if (this.air == 0 && player.z > 0)
player.z -= 0.05;
setTimer(0.05);
}
Is there anything that looks wrong in there?