Page 2 of 2 FirstFirst 1 2
Results 11 to 17 of 17

Thread: Trav's scripts

  1. #11
    Banned
    Join Date
    Nov 2016
    Location
    :noitacoL
    Posts
    968
    setcharani("sit",null) ? no.
    setcharani("sit",NULL) ? yes

  2. #12
    Big Cheese Sottocapo
    Join Date
    Jul 2016
    Posts
    2,526
    dont understand

  3. #13
    cat supremacist Lieutenant
    Join Date
    Jul 2016
    Location
    Melbourne
    Posts
    907
    Quote Originally Posted by Graal Pro View Post
    setcharani("sit",null) ? no.
    setcharani("sit",NULL) ? yes
    Don't know.
    Scripts are the least of my worries right now.

  4. #14
    Banned
    Join Date
    Nov 2016
    Location
    :noitacoL
    Posts
    968
    Quote Originally Posted by Trav View Post
    Don't know.
    Scripts are the least of my worries right now.
    Do your exams and script more. Graals future is based on you.

  5. #15
    Street Boss Mr LebJoe S's Avatar
    Join Date
    Aug 2014
    Location
    liechtestein
    Posts
    781
    Quote Originally Posted by Graal Pro View Post
    Do your exams and script more. Graals future is based on you.
    Right, chase ^

    - - - Updated - - -

    Quote Originally Posted by Graal Pro View Post
    setcharani("sit",null) ? no.
    setcharani("sit",NULL) ? yes
    Is completely the same.
    NULL and null are completely the same - try testing it Online on a server.
    ineffable.

  6. #16
    Overlord Sottocapo N!chola$'s Avatar
    Join Date
    Jun 2015
    Location
    Canada
    Posts
    4,784
    Quote Originally Posted by Graal Pro View Post
    setcharani("sit",null) ? no.
    setcharani("sit",NULL) ? yes
    That looks like another language 0.o
    Ask me anything and ill try my best to answer

  7. #17
    Ninji™ Notus's Avatar
    Join Date
    Feb 2017
    Location
    Under a bridge.
    Posts
    2
    Hello! Trav you were on the right track, however, you missed something.
    A player could easily just say 2d and it would work (it would multiply), or they could say M1 or 1M (capital m is not checked for).
    The solution is very simple: for the first problem just check each letter of the text one by one in your for loop I'll show you what I mean in a second.
    For the second problem: simply add capital letters to your array. (Not doing this one, too lazy)
    PHP Code:
    function onCreated() {
      
    showcharacter();
      
    this.head "head0.png";
      
    this.colors[0] = "orange";
      
    this.colors[1] = "white";
      
    this.colors[2] = "blue";
      
    this.colors[3] = "red";
      
    this.colors[4] = "black";
      
    this.shield "no-shield.png";
      
    this.dir 2;
      
    this.nick"Kirzey";
      
    this.chat "Tell me the diameter (in centimers) of the circle which it's circumference you want to know?";
      
    setcharani("sit",null);
    }

    function 
    onPlayerChats() {
      
    temp.= {"a""b""c""d""e""f""g""h""i""j","k","l","m","o","p","q","r","s","t","u","v","w","x","y","z","!","@","#","$","%","^","&","*","(",")","{","}","[","]"};
      
    temp.chat player.chat;

      for (
    temp.0temp.<= 26temp.++) {
      
    temp.player.chat.substring(temp.ntemp.n);
        if (
    temp.c in temp.l) { //if a letter is in the chat it will check off as true, therefore not working when someone says 1d or 8943748374m
          
    this.chat "Only numbers!";
          return;
        }
        if (
    temp.chat.pos(temp.l[temp.n])>=0) {
          
    this.chat "Only numbers!";
          return;
        }else{ 
    //Else, if the players chat starts by a number
          
    this.chat player.chat pi//Multiply the players chat by Pi
        
    }
      }

    I added symbols in there for you, but got bored of that so I only put a few.
    I didn't add capital letters to the array, but I'm sure you can figure that out or already know how to do it.
    The magic lies here:
    PHP Code:
    for (temp.0temp.<= 26temp.++) {
      
    temp.player.chat.substring(temp.ntemp.n);
        if (
    temp.c in temp.l) { 
    I assume you know what everything I changed does, but if you don't just ask.
    I'll be more than happy to help!

    With many spelling and grammar mistakes,
    -Zep
    Professional Scripting Ninji™

Posting Permissions

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