View Single Post
  #3  
Old 06-21-2012, 09:38 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by ffcmike View Post
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;
  }



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.
I don't get why I need to compare variables, also would client.variable work for global flags? Though it probably is the comparing variables because I can place the bomb but it blows up on it's own.
Reply With Quote