Quote:
Originally Posted by E_Man
But I am assigning values, it is so that when I use the weapon, it can place the bomb first, then when you use the weapon again, it blows it up
|
Your assigning of variables is correct, it is the comparing of variables within the if conditions which is incorrect, using an assignment causes the if conditions to always be true.
It should be for example:
PHP Code:
if(playertouchsme){
if(this.value == 2){
this.value = 3;
}
}
Doing something like:
PHP Code:
if(this.value = 2){
//stuff
}
is essentially the same as:
PHP Code:
if(true){
//stuff
}
It's probably worth mentioning that the opposite can also be applied for doing 'not equal to', for example:
PHP Code:
if(playertouchsme){
if(this.value != 2){
this.value = 2;
}
}
Quote:
Originally Posted by E_Man
and I can't do "if(created)" because I need it to blow up when I want it to, not on it's own.
|
In that case, you should write and read the 'bomb' variable without using 'this.', so it is a global flag, rather than one tied to the weapon.