Say the player's position is "Recruit". When the code gets to this line:
NPC Code:
if (pl.clientr.position == "Recruit"){
the result prove true so it continues inside the conditional block and sets the player's position to warrior, your chat tells you it has become warrior and then the script sleeps for a second.
After that is done it comes upon this line:
NPC Code:
if (pl.clientr.position == "Warrior"){
Because you just set pl.clientr.position to Warrior, it is of course, true so the statements inside the conditional block are also read.
You are wondering, why does it read this line too? Well, why wouldn't it? You haven't put anything into the code to stop it from continuing with the following statements.
One solution is to make all the if statements into else if except for the top one (the Recruit one). The else if means that the statement will only be read if the conditional statement before was not true. If it was true, all the following else if statements will be ignored.
Another solution is to use a switch block like:
NPC Code:
switch (pl.clientr.position) {
case "Recruit":
//set the positon to the new one
//and set your chat
break;
case "Warrior":
//set the positon to the new one
//and set your chat
break;
}
Important thing to remember with switchs is that the
break; statement causes you to escape the entire switch once the stuff before it has been carried out. The code will automatically skip to which ever case that the variable in the switch is equal to. If you don't have the break before the next case, the code will do the cases after the one it skipped to even if they aren't true.
And yes, you really don't need those sleeps, though I'm assuming you just had them to figure out the problem with the code.