add a if statement
Code:if (c.playerrights !=4) c.sendMessage("only donators can enter this portal");
|
i added a portal and want it to be donators only what i do
Any did you make a case in actionhandler.java?
Just add a restriction on its case in ActionHandler like
Code:if (!c.isDonator = 1) c.sendMessage("You need to be a donator to enter this portal."); else <tele method here>
Like this:
Code:if (!c.isDonator = 1) { c.sendMessage("You need to be a donator to enter this portal."); return; } else { c.getPA().startTeleport(xcoord, ycoord, height, "modern"); // Teleports him. c.sendMessage("Welcome to donator zone!"); // I don't know the name of your place, so I just named it Donator zone. Yea. }
should i do it like this?
case....
if (!c.isDonator = 1) {
c.sendMessage("You need to be a donator to enter this portal.");
return;
} else {
c.getPA().startTeleport(xcoord, ycoord, height, "modern"); // Teleports him.
c.sendMessage("Welcome to donator zone!"); // I don't know the name of your place, so I just named it Donator zone. Yea.
}
were in their do i write the case
2 Things:
1) Learn to use conventions please
2) You don't need the return statment if you are doing an if else.
Code:case ####: if (c.isDonator < 1) { c.sendMessage("You need to be a donator to enter this portal."); } else { c.getPA().startTeleport(xcoord, ycoord, height, "modern"); c.sendMessage("Welcome to donator zone!"); } break;
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |