Thread: Some questions
View Single Post
  #9  
Old 05-01-2011, 11:14 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
Nothing wrong with it that I can see, except that you'll want to do the checks serverside.

PHP Code:
function onActionServerSide(tokens){
    if (
tokens[0] == "/kill") {
        if (
player.clientr.stafflvl 1) {
          
temp.pl findPlayerByCommunityName(tokens[1]);
          
temp.pl.hearts 0;
          
temp.pl.chat player.account SPC "killed you!";
          
player.chat "You killed" SPC temp.pl SPC "!";
        } else {
          
player.chat "Not authorized!";
        }
    }
}

//#CLIENTSIDE
function onPlayerChats() {
    if(
tokens[0] == "/kill") {
        
temp.tokens player.chat.tokenize();
        
triggerServer("gui"this.nametokens);
    }

Also, there's no reason to do (player.clientr.stafflvl)—just player.clientr.stafflvl works fine.

The reason I inserted another if statement was so you could use the else clause properly. If you'd used && instead, then the else would also apply if the command wasn't "/kill".

Also, be sure to work on your styling. Two spaces is an indent.
__________________
Reply With Quote