Thread: Need help with some commands, and other things! Please look!

Results 1 to 5 of 5
  1. #1 Need help with some commands, and other things! Please look! 
    pillowfight
    Guest
    Well my new server is going great! Were having alot of people starting to join. Now i need some help with some command and bugs i have. And if you help i can make you donator if you want.
    __________________________________________________ _________________

    Ok ,first the commands. Im making buy and sell commands, like yell but in different colors, blue and green.

    Code:
    if (command.startsWith("sell") && command.length() > 5 && !muted)
    	{
    String text = command.substring(5);
    yell("  " + playerName + ": " + Character.toUpperCase(text.charAt(0)) + text.substring(1));
    }
    if (command.startsWith("buy") && command.length() > 5 && !muted)
    	{
    String text = command.substring(5);
    yell("  " + playerName + " - " + Character.toUpperCase(text.charAt(0)) + text.substring(1));
    }
    I want the sell to be blue, and the buy to be green. I have tried putting @gre@ and @blu@ in so many different places and get errors, where do i put them for the whole thing to be green or blue?


    Now, some more commands un-ban, un-mute, and un-jail:

    Code:
                if (command.startsWith("mute") && playerRights > 0) {
                    try {
                        String otherPName = command.substring(5);
                        int otherPIndex = PlayerHandler.getPlayerID(otherPName);
    
                        if (otherPIndex != -1) {
                            client p = (client) server.playerHandler.players[otherPIndex];
    
                            p.muted = true;
    yell(" "+playerName+" has Muted "+p.playerName+" ");
    			writeLog(p.playerName, "mutes");
    			sM("You have muted "+p.playerName+"!");
                        } else { 
                           sM("The name doesnt exist."); 
                        }
                    } catch (Exception e) { 
                        sM("Try entering a name you want to mute..");
                    }
                }
    How would i make an un-mute command out of this. I know if has to be deleted instead of written, so how would i make it deleteLog instead of writeLog?

    My unjail command:
    Code:
                if (command.startsWith("unjail") && playerRights >= 1) {
                    try {
                        String otherPName = command.substring(5);
                        int otherPIndex = PlayerHandler.getPlayerID(otherPName);
    
                        if (otherPIndex != -1) {
                            client p = (client) server.playerHandler.players[otherPIndex];
                            p.toX = 3093;
    			p.toY = 3490;
    			p.action = 0;
                            p.sM(
                                    "You have been un-jailed by " + playerName);
    yell(" "+playerName+" has jailed "+p.playerName+" ");
    			sM("You have jailed "+p.playerName+".");
                        } else { 
                           sM("The name doesnt exist."); 
                        }
                    } catch (Exception e) { 
                        sM("Try entering a name you want to jail..");
                    }
                }
    But whenever i use this one i get "The name doesnt exist." Whats wrong?

    My ban command:
    Code:
                if (command.startsWith("ban") && playerRights > 1) {
                    try {
                        String otherPName = command.substring(8);
                        int otherPIndex = PlayerHandler.getPlayerID(otherPName);
    
                        if (otherPIndex != -1) {
                            client p = (client) server.playerHandler.players[otherPIndex];
    
    			writeLog(p.playerName, "bans");
    			p.disconnected = true;
    yell(" "+playerName+" has banned "+p.playerName+" ");
    			sM("You have banned "+p.playerName+"!");
    
                        } else { 
                           sM("The name doesnt exist."); 
                        }
                    } catch (Exception e) { 
                        sM("Try entering a name you want to ban..");
                    }
                }
    Now i know this unban would work the same was as un-mute but once again how to i make it deleteLog instead of writeLog?

    __________________________________________________ _______________

    Now onto some glitches:

    On my server there is a "Buy X" cap, originally 100 (Well 101 in java) so i decided to experiment. Well it seems that whenever you buy something over 100 it glitches and gives you a ridiculous amount of runes/arrows/etc....I decided to move to to 2000 but it still does it. Any ideas?

    Also some minor help please, my portal code:
    Code:
    if(objectID == 2492){ //Staff tele
    if (playerRights >= 1);
    sM("Welcome to the Staff Area.");
    toX = 2121;
    toY = 4918;
    triggerTele2(2121, 4918, 0);
    }
    For some reason regular players are allowed to go in, why?
    Reply With Quote  
     

  2. #2  
    Registered Member Yodoxin's Avatar
    Join Date
    Sep 2008
    Age
    33
    Posts
    190
    Thanks given
    0
    Thanks received
    10
    Rep Power
    54
    In your unjail command change
    Code:
    String otherPName = command.substring(5);
    the 5 to a 7.
    *Ahem* I will not be doing that again...
    Reply With Quote  
     

  3. #3  
    pillowfight
    Guest
    Thanks alot! Now any help with the others?
    Reply With Quote  
     

  4. #4  
    Registered Member Yodoxin's Avatar
    Join Date
    Sep 2008
    Age
    33
    Posts
    190
    Thanks given
    0
    Thanks received
    10
    Rep Power
    54
    This:
    Code:
    if(objectID == 2492){ //Staff tele
    if (playerRights >= 1);
    sM("Welcome to the Staff Area.");
    toX = 2121;
    toY = 4918;
    triggerTele2(2121, 4918, 0);
    }
    If the if function is fulfilled it'll only execute the line under it exclusivley but the rest will trigger no matter what, so do this:

    Code:
    if(objectID == 2492){ //Staff tele
    if (playerRights >= 1){
    sM("Welcome to the Staff Area.");
    triggerTele2(2121, 4918, 0);
    }else{
    sM("Sorry, staff only.");
    }
    }
    (You don't need the toX and toY if you're using triggertele too.)

    In your coloured commands have you tried:
    Code:
    String text = command.substring(5);
    yell("  " + playerName + ": @red@" + Character.toUpperCase(text.charAt(0)) + text.substring(1));
    }
    (Or before the colon, whatever you want)

    Also, can you post your code for your Buy X so we can get a look at it?
    *Ahem* I will not be doing that again...
    Reply With Quote  
     

  5. #5  
    pillowfight
    Guest
    Thanks! But the colored commands still don't work. I replaced them with what you said and i get what i did before.

    When i use the command i get "Owner Noah: @red@ Test"

    Ill try ti find my "Buy X", here's the limit thing:

    Code:
    					if (EnteredAmount < 2001)
    						buyItem(XremoveID, XremoveSlot, EnteredAmount);
    					else
    						sM("You cannot buy more than 2k items at a time.");
    				}
    And where would my Buy X be?
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •