Results 1 to 8 of 8

Thread: Basic kick script.

  1. #1
    aaaaaaaaaaaaaaaaaaaaaaaaa Grief Hero's Avatar
    Join Date
    Jun 2013
    Location
    n/a
    Posts
    1,327

    Basic kick script.

    Here's a basic kick script if you don't want a specific player going into your levels. Feel free to use it.
    PHP Code:
    function onPlayerEnters() {
      
    temp.pl findplayer("Graal1008419"); //The account name can be changed. 
      
    if (temp.pl.level == "era_grief-test.nw") {  //The level you don't want them to be in.
        
    temp.pl.setlevel2("era_present_00-00.nw",30,39);  //the level you want them to warp to.
      
    }

    Last edited by Grief Hero; 11-09-2013 at 12:16 AM.

  2. #2
    Veteran eden's Avatar
    Join Date
    Oct 2013
    Location
    Sweden
    Posts
    295
    Nice.
     Spoiler

  3. #3
    It's nice to see you've learned how to script grief! Good luck!

  4. #4
    El Bacon Hombre Police Commissioner
    Join Date
    Jun 2013
    Location
    United States
    Posts
    247
    My personal criticism:

    First off, let's look at what you did well. It's good to see that you used server side to evaluate the whole script rather than wasting a trigger to send information to the server. Secondly, the direction it looks like you were headed with onPlayerEnters() looks good.

    Now, some improvements. What you are making the server do right now is wait for someone to enter a level that this NPC was placed in, find the specified player, then check if that player is in some other level. This is quite ineffective and should be changed. The flow should go a little more like this: A player enters the level, check if their account is the specified account to kick, kick them if they are the specified account.
    So, let's make some changes, shall we?
    PHP Code:
    function onPlayerEnters() {
        if (
    player.account == "accountNameHere") { //Once the player enters the level, are they the account we're looking for?
            
    player.setlevel2("era_present_00-00.nw",30,39);  //If they are that player, we don't even need to check their level.
        
    }

    On another note, when you want to reference the player's level, reference player.level.name. Player.level itself is an object containing several children variables. This means that when you want the level name, you have to refer player.level.name.

    Keep trying and keep up the good work! =)
    Last edited by BboyEatsbacon; 11-10-2013 at 06:21 PM. Reason: Fixed syntax error; thanks to John for pointing it out.
    [email protected]
    *Stefan: You steal my cookies?

  5. #5
    What ze fu/ck?

  6. #6
    Quote Originally Posted by Dora View Post
    What ze fu/ck?

    It basically removes a player from a room lol.

  7. #7
    aaaaaaaaaaaaaaaaaaaaaaaaa Grief Hero's Avatar
    Join Date
    Jun 2013
    Location
    n/a
    Posts
    1,327
    Quote Originally Posted by BboyEatsbacon View Post
    My personal criticism:

    First off, let's look at what you did well. It's good to see that you used server side to evaluate the whole script rather than wasting a trigger to send information to the server. Secondly, the direction it looks like you were headed with onPlayerEnters() looks good.

    Now, some improvements. What you are making the server do right now is wait for someone to enter a level that this NPC was placed in, find the specified player, then check if that player is in some other level. This is quite ineffective and should be changed. The flow should go a little more like this: A player enters the level, check if their account is the specified account to kick, kick them if they are the specified account.
    So, let's make some changes, shall we?
    PHP Code:
    function onPlayerEnters() {
        if (
    player.account == "accountNameHere") { //Once the player enters the level, are they the account we're looking for?
            
    temp.pl.setlevel2("era_present_00-00.nw",30,39);  //If they are that player, we don't even need to check their level.
        
    }

    On another note, when you want to reference the player's level, reference player.level.name. Player.level itself is an object containing several children variables. This means that when you want the level name, you have to refer player.level.name.

    Keep trying and keep up the good work! =)
    Thanks, I never actually thought formatting it the way you did. It looks much cleaner, and it's easier to read.

  8. #8
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    Quote Originally Posted by BboyEatsbacon View Post
    My personal criticism:

    First off, let's look at what you did well. It's good to see that you used server side to evaluate the whole script rather than wasting a trigger to send information to the server. Secondly, the direction it looks like you were headed with onPlayerEnters() looks good.

    Now, some improvements. What you are making the server do right now is wait for someone to enter a level that this NPC was placed in, find the specified player, then check if that player is in some other level. This is quite ineffective and should be changed. The flow should go a little more like this: A player enters the level, check if their account is the specified account to kick, kick them if they are the specified account.
    So, let's make some changes, shall we?
    function onPlayerEnters() {
    if (player.account == "accountNameHere") { //Once the player enters the level, are they the account we're looking for?
    temp.pl.setlevel2("era_present_00-00.nw",30,39); //If they are that player, we don't even need to check their level.
    }
    }

    On another note, when you want to reference the player's level, reference player.level.name. Player.level itself is an object containing several children variables. This means that when you want the level name, you have to refer player.level.name.

    Keep trying and keep up the good work! =)
    Psst, small typo: player.setlevel2(...) not temp.pl.setlevel2(...)


    Also BB PM me as soon as you're online with some information of where I can live-chat you.
    -Johnaudi

Posting Permissions

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