0

Hi, I'm trying to fix something on my site so that a user can only kill when a certain rank. I currently have this code

if ($rank < "Boss, Supreme Boss, Kingpin, Don, Godfather"){ echo "You have to be ranked atleast Boss to kill";
}

It does return the correct "You have to be. . . " But also carries on through the page and continues to try and kill? So aswell as getting "You have to be. . " I get"You dont have enough bullets. . . or you have to wait to shoot again"

Thanksinadvance

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Coder99
0

It sounds like you have:

if ($rank < "Boss, Supreme Boss, Kingpin, Don, Godfather"){ 
  echo "You have to be ranked atleast Boss to kill";
}
//code that "kills" follows here
...

You need to wrap the code that kills in an else clause:

if ($rank < "Boss, Supreme Boss, Kingpin, Don, Godfather"){ 
  echo "You have to be ranked atleast Boss to kill";
}
else
{
  //code that "kills" follows here
  ...
}

OR simply exit the script immediately from the if clause:

if ($rank < "Boss, Supreme Boss, Kingpin, Don, Godfather"){ 
  echo "You have to be ranked atleast Boss to kill";
  exit;
}
0

Last one worked perfect. Don't know why I didn't do that in the first place!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.