Page 3 of 5 FirstFirst 1 2 3 4 5 LastLast
Results 21 to 30 of 45

Thread: iMask's Scripts

  1. #21
    I think Grief means something like the following:

    PHP Code:
    //MADE BY IMASK
    //REVISED BY NOOF*
    //#CLIENTSIDE    //TIP ALWAYS CHECK THIS TO MAKE SURE IT IS SPELLED CORRECTLY!!

    function onCreated() {
      
    this.image "door.png";
      
    this.open false//make sure this starts false when the script runs
    }

    function 
    onPlayerChats() {
      if (
    player.chat == "/open" && clientr.staff == 1) {
        
    this.open true;
        
    onCheck();
      } else if (
    player.chat == "/close" && clientr.staff == 1) {
        
    this.open false;
        
    onCheck();
      }
    }

    function 
    onCheck() {
      if (
    this.open == true) {
        
    this.image.show();
      } else if (
    this.open == false) {
        
    this.image.hide();
      }

    Check out the booleans (the = true and = false), and practice them they are important in the future.

    Also as Grief mentioned the
    PHP Code:
    if(..) {

    } else if(...) {


    Is always your friend, reason being it looks cleaner and what can go wrong using less amount of code?

    Hope this helps and Good luck your doing great!
    Noof was here.

  2. #22
    Big Cheese Captain
    Join Date
    Jun 2013
    Posts
    1,029
    Thanks Noof!!

    Staff Block image script
    PHP Code:
    //#CLIENTSIDE
    function onPlayerChats () {
       if (
    clientr.staff == && player.chat == "/showblock") {
       
    setimg (300"block.png"player.0.5player.0.5);
       
    with ("300");
          
    mode 1;
          
    red 0;
          
    green 0;
          
    blue 1;
          
    alpha 0.4;
          
    this.message "Hi, I'm iMask";
       }

    Last edited by iMask; 01-10-2015 at 01:51 AM.
    iEra Developer / SFX Admin

    Need help? Contact me:
    Email: [email protected]

  3. #23
    PHP Code:
    //#CLIENTSIDE 
    Do not forget the client side my friend, and the code looks good besides that, can't complain.

    Good Work.
    Noof was here.

  4. #24
    Big Cheese Captain
    Join Date
    Jun 2013
    Posts
    1,029
    Quote Originally Posted by Noofboy12 View Post
    PHP Code:
    //#CLIENTSIDE 
    Do not forget the client side my friend, and the code looks good besides that, can't complain.

    Good Work.
    Ahh, forgot it lolol! Thanksss
    iEra Developer / SFX Admin

    Need help? Contact me:
    Email: [email protected]

  5. #25
    Hi, I found a few errors in you're last script.

    Error 1: setimg (300, "block.png", player.x + 0.5, player.y + 0.5); You have a space between setimg and (300...) that will cause the script not to run.
    Error 2: When ever you are adding something like player.x + 0.5, player.y + 0.5 make sure you are using the += either or -= in the code I will provide you with you will see the adjusments I made and I even stored it in a seperate variable for you!

    Error 3: with ("300"); is wrong check out the code below of what should work.

    PHP Code:
    //#CLIENTSIDE
    function onCreated() {
      
    temp.plx player.+= 0.5//Added this
      
    temp.ply player.+= 0.5//Added this
      
    if (this.block == "on") {
        
    with(findimg(300)) { //the findimg should be used in this format :)
          
    mode 1;
          
    red 0//Why have it if it is just setting to 0? :0
          
    green 0;
          
    blue 1;
          
    alpha 0.4;
          
    this.message "Hi, I'm iMask";
        }
      }
    }

    function 
    onPlayerChats() {
      if (
    clientr.staff == && player.chat == "/showblock") {
        
    setimg(300"block.png"player.plxplayer.ply);
        
    this.block == "on";
        
    onCreated();
      }

    Keep practicing and do NOT forget the clientside again

    -Noof
    Noof was here.

  6. #26
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    Quote Originally Posted by Noofboy12 View Post
    Hi, I found a few errors in you're last script.

    Error 1: setimg (300, "block.png", player.x + 0.5, player.y + 0.5); You have a space between setimg and (300...) that will cause the script not to run.
    Why wouldn't it?
    ** Small note:
    you can name your functions and variables (I'll talk about that) whatever you want.
    spaces do not matter, it's just for a nice coding style, so having:
    PHP Code:
    function onCreated()         {
    echo   (
    "HIII");
                                                                      echo(
    "ELLO");






    Is the same as having :

    PHP Code:
    function onCreated(){echo("HIII");echo("ELLO");} 
    end of small note**
    Error 2: When ever you are adding something like player.x + 0.5, player.y + 0.5 make sure you are using the += either or -= in the code I will provide you with you will see the adjusments I made and I even stored it in a seperate variable for you!
    Nope, player.x += 0.5 is adding 5 to player.x, and then assigning the value to player.x and temp.plx, this is not what we want, we need to add 0.5 to player.x and assign it to temp.plx only. That would be temp.plx = player.x + 0.5; Same goes for y.

    Error 3: with ("300"); is wrong check out the code below of what should work.

    PHP Code:
    //#CLIENTSIDE
    function onCreated() {
      
    temp.plx player.0.5//Added this
      
    temp.ply player.0.5//Added this
      
    if (this.block == "on") {
        
    with(findimg(300)) { //the findimg should be used in this format :)
          
    mode 1;
          
    red 0//Why have it if it is just setting to 0? :0 // it's better if he keeps it here, trust me.
          
    green 0;
          
    blue 1;
          
    alpha 0.4;
          
    this.message "Hi, I'm iMask";
        }
      }
    }

    function 
    onPlayerChats() {
      if (
    clientr.staff == && player.chat == "/showblock") {
        
    setimg(300"block.png"player.plxplayer.ply);
        
    this.block "on"// This is supposed to be = "on"; and better to use true/false
        
    onCreated();
      }

    Keep practicing and do NOT forget the clientside again

    -Noof
    -Johnaudi

  7. #27
    Big Cheese Captain
    Join Date
    Jun 2013
    Posts
    1,029
    Thanks guys!

    I'm trying to create something where if you say /open (number here), the door would open for that many seconds.

    PHP Code:
    function onCreated () {
      
    setimg("door.png");
      
    setshape (1,32,32);
    }
    //#CLIENTSIDE
      
    function onPlayerChats () {
        if (
    player.chat.starts == "/open" && clientr.staff == 1) {
          
    this.time.open player.chat.substring(6).trim();
            
    this.show();
            
    sleep(???); //see below
            
    this.hide();
        }
      } 
    If anyone could tell me what to put inside the sleep function and tell me if I'm doing it right, that would be great!
    iEra Developer / SFX Admin

    Need help? Contact me:
    Email: [email protected]

  8. #28
    aaaaaaaaaaaaaaaaaaaaaaaaa Grief Hero's Avatar
    Join Date
    Jun 2013
    Location
    n/a
    Posts
    1,327
    Quote Originally Posted by iMask View Post
    Thanks guys!

    I'm trying to create something where if you say /open (number here), the door would open for that many seconds.

    PHP Code:
    function onCreated () {
      
    setimg("door.png");
      
    setshape (1,32,32);
    }
    //#CLIENTSIDE
      
    function onPlayerChats () {
        if (
    player.chat.starts == "/open" && clientr.staff == 1) {
          
    this.time.open player.chat.substring(6).trim();
            
    this.show();
            
    sleep(???); //see below
            
    this.hide();
        }
      } 
    If anyone could tell me what to put inside the sleep function and tell me if I'm doing it right, that would be great!
    What's the point of making a variable if you're not going to use it?
    PHP Code:
    //Put the " this.time.open" inside the sleep function.
    function onCreated () {
      
    setimg("door.png");
      
    setshape (1,32,32);
    }
    //#CLIENTSIDE
      
    function onPlayerChats () {
        if (
    player.chat.starts == "/open" && clientr.staff == 1) {
          
    this.timeOpen player.chat.substring(6).trim();
            
    this.show();
            
    sleep(this.timeOpen); //see below
            
    this.hide();
        }
      } 


    I saw. I conquered. I came.


  9. #29
    Big Cheese Captain
    Join Date
    Jun 2013
    Posts
    1,029
    Quote Originally Posted by Grief Hero View Post
    What's the point of making a variable if you're not going to use it?
    I was going to put the variable in the sleep function
    iEra Developer / SFX Admin

    Need help? Contact me:
    Email: [email protected]

  10. #30
    aaaaaaaaaaaaaaaaaaaaaaaaa Grief Hero's Avatar
    Join Date
    Jun 2013
    Location
    n/a
    Posts
    1,327
    Quote Originally Posted by iMask View Post
    I was going to put the variable in the sleep function
    Could have done then tested it out.


    I saw. I conquered. I came.


Posting Permissions

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