Results 1 to 6 of 6

Thread: Script i made for Cobyri (very simple)

  1. #1

    Script i made for Cobyri (very simple)

    Hi i just finished up a very easy script for a new server name Cobyri
    http://pastebin.com/a0C9rJJQ
    Tell me what you think please tell me how i could improve and yes this is a very simple script.waiting for johns pro tutorial to come out
    Noof was here.

  2. #2
    Big Cheese
    Join Date
    Aug 2013
    Location
    America
    Posts
    1,411
    You still work for Xadis?

  3. #3
    Quote Originally Posted by CHAMPGRAAL View Post
    You still work for Xadis?
    Yes i do.
    Noof was here.

  4. #4
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    Well, it won't work in general...
    Here's your script:
    PHP Code:
    //#CLIENTSIDE
    function onPlayerChats() {
      if(
    player.chat == "/hug"){
      
    setani("grab"null);
      }
        if(
    player.chat == "/Dance") {
        
    player.dir 2;
      
    setani("dance",null);
      }
    }
        if(
    player.chat == "/sit") {
        
    setani("sit",null);
      }
        if(
    player.chat == "/run") {
        
    setani("walk",null);
      }
        if(
    player.chat == "/jump") {
        
    setani("jump",null);
      }
        if(
    player.chat == "/omg") {
        
    setani("omg",null);
      } 
    As you can see, the if statements are outside the function, so it's supposed to be:
    PHP Code:
    //#CLIENTSIDE
    function onPlayerChats() {
      if(
    player.chat == "/hug"){
        
    setani("grab"null);
      }
      if(
    player.chat == "/Dance") {
        
    player.dir 2;
        
    setani("dance",null);
      }
      if(
    player.chat == "/sit") {
        
    setani("sit",null);
      }
      if(
    player.chat == "/run") {
        
    setani("walk",null);
      }
      if(
    player.chat == "/jump") {
        
    setani("jump",null);
      }
      if(
    player.chat == "/omg") {
        
    setani("omg",null);
      }

    But also, it's way too many if statements, using switch()case() is better:

    PHP Code:
    //#CLIENTSIDE
    function onPlayerChats() {
      switch(
    player.chat) {
        case 
    "hug"
          
    setani("grab"null);
        break;
        case 
    "/dance":
          
    player.dir 2;
          
    setani("dance",null);
        break;
        case 
    "/sit":
          
    setani("sit",null);
        break;
        case 
    "/run":
          
    setani("walk",null);
        break;
        case 
    "/jump":
          
    setani("jump",null);
        break;
        case 
    "/omg":
          
    setani("omg",null);
        break;
      }

    -Johnaudi

  5. #5
    Quote Originally Posted by John View Post
    Well, it won't work in general...
    Here's your script:
    PHP Code:
    //#CLIENTSIDE
    function onPlayerChats() {
      if(
    player.chat == "/hug"){
      
    setani("grab"null);
      }
        if(
    player.chat == "/Dance") {
        
    player.dir 2;
      
    setani("dance",null);
      }
    }
        if(
    player.chat == "/sit") {
        
    setani("sit",null);
      }
        if(
    player.chat == "/run") {
        
    setani("walk",null);
      }
        if(
    player.chat == "/jump") {
        
    setani("jump",null);
      }
        if(
    player.chat == "/omg") {
        
    setani("omg",null);
      } 
    As you can see, the if statements are outside the function, so it's supposed to be:
    PHP Code:
    //#CLIENTSIDE
    function onPlayerChats() {
      if(
    player.chat == "/hug"){
        
    setani("grab"null);
      }
      if(
    player.chat == "/Dance") {
        
    player.dir 2;
        
    setani("dance",null);
      }
      if(
    player.chat == "/sit") {
        
    setani("sit",null);
      }
      if(
    player.chat == "/run") {
        
    setani("walk",null);
      }
      if(
    player.chat == "/jump") {
        
    setani("jump",null);
      }
      if(
    player.chat == "/omg") {
        
    setani("omg",null);
      }

    But also, it's way too many if statements, using switch()case() is better:

    PHP Code:
    //#CLIENTSIDE
    function onPlayerChats() {
      switch(
    player.chat) {
        case 
    "hug"
          
    setani("grab"null);
        break;
        case 
    "/dance":
          
    player.dir 2;
          
    setani("dance",null);
        break;
        case 
    "/sit":
          
    setani("sit",null);
        break;
        case 
    "/run":
          
    setani("walk",null);
        break;
        case 
    "/jump":
          
    setani("jump",null);
        break;
        case 
    "/omg":
          
    setani("omg",null);
        break;
      }

    Can you explain what you did from here
    //#CLIENTSIDE
    function onPlayerChats() {
    if(player.chat == "/hug"){
    setani("grab", null);
    }
    if(player.chat == "/Dance") {
    player.dir = 2;
    setani("dance",null);
    }
    }
    if(player.chat == "/sit") {
    setani("sit",null);
    }
    if(player.chat == "/run") {
    setani("walk",null);
    }
    if(player.chat == "/jump") {
    setani("jump",null);
    }
    if(player.chat == "/omg") {
    setani("omg",null);
    }
    to
    //#CLIENTSIDE
    function onPlayerChats() {
    if(player.chat == "/hug"){
    setani("grab", null);
    }
    if(player.chat == "/Dance") {
    player.dir = 2;
    setani("dance",null);
    }
    if(player.chat == "/sit") {
    setani("sit",null);
    }
    if(player.chat == "/run") {
    setani("walk",null);
    }
    if(player.chat == "/jump") {
    setani("jump",null);
    }
    if(player.chat == "/omg") {
    setani("omg",null);
    }
    }
    and how do you make it a php code? thanks
    Noof was here.

  6. #6
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    Use the PHP quotes:
    HTML Code:
    [PHP] script here [/PHP]
    -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
  •