View Single Post
  #16  
Old 07-10-2011, 01:52 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Gunderak View Post
so somthing like the first bit then
if player.rupees <=1000;
triggerserver blah blah blah;
}
else {
player.chat = "I Dont Have Enough Money!";
return;

would that do it?
No, it wouldn't. Please use PHP tags when posting code in the future.

PHP Code:
if player.rupees <=1000;
triggerserver blah blah blah;
} else {
player.chat = "I Dont Have Enough Money!";
return; 
The first line is of an if-statement does not need a semicolon as it is not a command, it's a condition.

If you'd read the guide linked to you, you'd see that the proper syntax for an if-else statement is:

PHP Code:
if (condition) {
  
// do something
} else {
  
// do something else
} 
Your condition was backwards.

player.rupees <= 1000 would be true if they had less than or equal to 1000, so change it to player.rupees >= 1000 and plug that in:

PHP Code:
if (player.rupees >= 1000) {
  
// do something
} else {
  
// do something else
} 
Now all you have to do is either add the weapon or set the player's chat.

PHP Code:
if (player.rupees >= 1000) {
  
player.addWeapon("Hats/Dino Hat");
} else {
  
player.chat = "You don't have enough money!";
} 
You don't need a trigger as you should be doing this serverside.
__________________
Reply With Quote