Thread: MouseOver?
View Single Post
  #4  
Old 10-27-2009, 05:26 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
I don't believe findnearestplayer works on the client-side.

temp.p refers to a player object so you can just use..

NPC Code:

for (temp.p: players) {
if (mousex in |temp.p.x, temp.p.x + 3| && mousey in |temp.p.y, temp.p.y + 3|) {
// do whatever
}
}



The in operator has a couple different uses:

NPC Code:

temp.array = {"a", "b", "oranges"};
if ("oranges" in temp.array) {
echo("You have oranges!"); // would output "You have oranges"
}



or it can be used as a shortcut instead of doing..

NPC Code:

temp.i = 2;
if (temp.i >= 1 && temp.i <= 3) {

}

// You can use instead:
if (temp.i in |1,3|) {
echo("rawr"); // would output "rawr"
}

__________________
Quote:
Reply With Quote