View Single Post
  #14  
Old 06-21-2012, 09:25 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by E_Man View Post
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 View Post
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.
Reply With Quote