You do not have to do so on Graal, since it's 1. An object oriented language, and 2. There are no defined types in Gs2, unlike Gs3.
To consider an initial value, you can do this.height = 0; but definitely not this.height;
Printable View
You do not have to do so on Graal, since it's 1. An object oriented language, and 2. There are no defined types in Gs2, unlike Gs3.
To consider an initial value, you can do this.height = 0; but definitely not this.height;
I just upgraded the flight script adding more controls and effects such as the bouncing/levitating effect.
PHP Code:
/* Hi, this script was made by Noof. on the TestBed server,
Press the 'O' Button to turn on, use the '+' and '-' to change your altitude.
This script is kind of useless but other than that, enjoy!
*/
//#CLIENTSIDE
function onKeyPressed(code, key) {
if (key == "o") {
if (this.fly == "on") {
player.z -= this.height / 3;
sleep(.2);
player.z -= .3;
sleep(.1);
player.z -= .3;
sleep(.1);
player.z = 0;
this.height = 0;
this.fly = "off";
player.chat = "Flight -Off-";
setTimer(0);
} else {
this.fly = "on";
player.chat = "Flight -On-";
setTimer(0.05);
}
}
if (this.fly == "on") {
if (code == 187) {
if (this.height < 5) {
this.height += .5;
}
player.chat = "Height: " @ this.height;
if (this.height == 5) {
player.chat = "Maximum height reached!";
}
onCreated();
}
if (code == 189) {
player.chat = "Height: " @ this.height;
if (this.height > .1) {
this.height -= .5;
}
if (this.height == 0) {
player.chat = "Can't go lower than this!";
}
onCreated();
}
}
}
function onCreated() {
this.height = 0; //JOHN Happy!?!? lmao
if (this.fly == "on" && this.height < 5 && this.height > 0) {
player.z = this.height;
setTimeout(0.05);
}
}
function onTimeout() {
if (this.fly == "on") {
player.z += .1;
sleep(.1);
player.z += .2;
sleep(.1);
player.z += .3;
sleep(.15);
player.z -= .1;
sleep(.15);
player.z -= .2;
sleep(.1);
player.z -= .3;
sleep(.1);
setTimer(0.05);
}
onCreated();
}
And John, I always looked at
As just creating the variable and setting it later, guess it would not be the same for graal thanks I changed it in the script specifically for you :)PHP Code:
this.height;
But then, since height is 0, it is no longer less than 5 and bigger than 0, so this code cannot be executed =] hahaPHP Code:
this.height = 0; //JOHN Happy!?!? lmao
if (this.fly == "on" && this.height < 5 && this.height > 0) {
player.z = this.height;
setTimeout(0.05);
}
Just remove the whole this.height = 0 line? Not really sure how your code works.
Ooooh you caught me! Never thought of it that way...
Thanks yeah your right logically that would not work I could just change it to
The edit was >= that might not even work because if it equals 0 it will go in the negatives... fine you win,PHP Code:
if (this.fly == "on" && this.height < 5 && this.height >= 0) {
player.z = this.height;
setTimeout(0.05);
}
How was the code besides that? Also clear your damn inbox I wanna show you some cool stuff!