Page 5 of 5 FirstFirst ... 3 4 5
Results 41 to 45 of 45

Thread: iMask's Scripts

  1. #41
    Big Cheese Captain
    Join Date
    Jun 2013
    Posts
    1,029
    Reviving this thread!

    EDIT: I got it working. However, I'm unsure how to code a next page...hmm
    PHP Code:
    //Clicked Menu 3 (Friends List)
    function MenuButton3Action() {
      if (
    Friends1.visible == true) {
        for(
    temp.i=0;temp.i=<clientr.friends.size() - 1;temp.i++) {
          (
    "Friends"@i).visible false;
        }
        return;
      }
      if (
    clientr.friends == 0) {
        
    player.chat "I have no friends!";
      } else {
        
    temp.add 0;
        for(
    temp.i=0;temp.i=<clientr.friends.size() - 1;temp.i++) {
          (
    "Friends"@i).visible true;
          
    temp.add += 30;
          new 
    GuiButtonCtrl("Friends"@i) {
            
    profile GuiBlueButtonProfile;
            
    height 20;
            
    width 200;
            
    600;
            
    200 temp.add;
            
    text clientr.friends[i];
            
    thiso.catchevent(name,"onMouseDown","friendsclick");
          }
        }
      }
    }
    function 
    friendsclick(obj) {
      
    temp.friend obj.name.substring(7);
      
    triggerserver("gui","System/Profile","Player",clientr.friends[temp.friend]);

    Last edited by iMask; 05-28-2015 at 03:47 PM.
    iEra Developer / SFX Admin

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

  2. #42
    Big Cheese Captain
    Join Date
    Jun 2013
    Posts
    1,029
    A working hotel script!!!!

    Thanks to The Doctor for helping me with the command
    PHP Code:
    if (temp.var.time <= 0) { 
    Weapon Script:
    PHP Code:
    function onActionServerSide(temp.cmdacctimedays) {
      switch (
    temp.cmd) {
      case 
    "add":
        if (
    clientr.coins 500 days) { 
          
    player.chat "Not enough coins to rent that many days!!";
          return;
        }
        
    this.i++;
        
    temp.var = requestsql("INSERT INTO 'Hotel' (account,time,room) VALUES ('" acc "','" time "','" this."')"true);
        
    PlayerControl.tabEcho("Game"acc " has rented room #" "! Now has " clientr.coins 500 days " coins!");
        
    player.chat "Rented a room! I have the keys to room " this.i;
        
    clientr.coins -= 500 days;
        
    client.room this.i;
        
    client.hotel true;
        break;
      }
    }

    //#CLIENTSIDE
    function onCreated() {
      
    this.0;
    }

    function 
    onPlayerChats() {
      if (
    player.level != "cor_cityhall1.nw") return;
      if (
    player.chat.starts("/rent") && client.hotel == NULL) {
        
    temp.token player.chat.tokenize();
        if (
    temp.token[1] == NULL) {
          
    say2("Correct format: /rent <time>");
          return;
        }
        
    triggerserver("gui"this.name"add"player.accounttemp.token[1] * 86400temp.token[1]);
        return;
      } else if (
    player.chat.starts("/rent") && client.hotel == true) {
        
    say2("Already rented a room!");
      }
      
    //DEBUG
      
    if (player.chat == "reset hotel") {
        
    client.hotel "";
        
    client.room "";
        
    player.chat "Reset client.hotel and client.room!";
      }

    DB Script:
    PHP Code:
    function onCreated() {
      
    onTimeOut();
    }

    function 
    onTimeOut() {
      
    requestsql("UPDATE Hotel SET time = (time - 10)"false);
      
    temp.var = requestsql("SELECT * FROM 'Hotel'"true);
      if (
    temp.var.rows.size() == 0) {
        
    setTimer(10);
        return;
      }
      if (
    temp.var.time <= 0) {
        
    requestsql("DELETE FROM 'Hotel' WHERE account = '" temp.var.account "'",true);
        
    temp.findofflineplayer findplayer(temp.var.account);
        if (
    temp.findofflineplayer == NULL) {
          
    temp.pl = new TServerPlayer(@temp.var.account);
          
    PlayerControl.tabEcho("Game","Offline Player " temp.var.account "'s hotel rent ended!");
          
    temp.pl.client.hotel "";
          
    temp.pl.client.room "";
          
    temp.pl.saveaccount();
          
    temp.pl.destroy();
          
    setTimer(10);
        } else if (
    temp.findofflineplayer != NULL) {
          
    with(findplayer(temp.var.account)) {
            
    client.hotel "";
            
    client.room "";
            
    PlayerControl.tabEcho("Game","Online player " temp.var.account "'s hotel rent ended!");
            
    setTimer(10);
          }
        }
      }
      
    setTimer(10);

    Last edited by iMask; 06-17-2015 at 03:24 AM.
    iEra Developer / SFX Admin

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

  3. #43
    Era Philosopher MikeyUK's Avatar
    Join Date
    Jul 2013
    Location
    United States
    Posts
    2,733
    Quote Originally Posted by iMask View Post
    A working hotel script!!!!

    Thanks to The Doctor for helping me with the command
    PHP Code:
    if (temp.var.time <= 0) { 
    Weapon Script:
    PHP Code:
    function onActionServerSide(temp.cmdacctimedays) {
      switch (
    temp.cmd) {
      case 
    "add":
        if (
    clientr.coins 500 days) { 
          
    player.chat "Not enough coins to rent that many days!!";
          return;
        }
        
    this.i++;
        
    temp.var = requestsql("INSERT INTO 'Hotel' (account,time,room) VALUES ('" acc "','" time "','" this."')"true);
        
    PlayerControl.tabEcho("Game"acc " has rented room #" "! Now has " clientr.coins 500 days " coins!");
        
    player.chat "Rented a room! I have the keys to room " this.i;
        
    clientr.coins -= 500 days;
        
    client.room this.i;
        
    client.hotel true;
        break;
      }
    }

    //#CLIENTSIDE
    function onCreated() {
      
    this.0;
    }

    function 
    onPlayerChats() {
      if (
    player.level != "cor_cityhall1.nw") return;
      if (
    player.chat.starts("/rent") && client.hotel == NULL) {
        
    temp.token player.chat.tokenize();
        if (
    temp.token[1] == NULL) {
          
    say2("Correct format: /rent <time>");
          return;
        }
        
    triggerserver("gui"this.name"add"player.accounttemp.token[1] * 86400temp.token[1]);
        return;
      } else if (
    player.chat.starts("/rent") && client.hotel == true) {
        
    say2("Already rented a room!");
      }
      
    //DEBUG
      
    if (player.chat == "reset hotel") {
        
    client.hotel "";
        
    client.room "";
        
    player.chat "Reset client.hotel and client.room!";
      }

    DB Script:
    PHP Code:
    function onCreated() {
      
    onTimeOut();
    }

    function 
    onTimeOut() {
      
    requestsql("UPDATE Hotel SET time = (time - 10)"false);
      
    temp.var = requestsql("SELECT * FROM 'Hotel'"true);
      if (
    temp.var.rows.size() == 0) {
        
    setTimer(10);
        return;
      }
      if (
    temp.var.time <= 0) {
        
    requestsql("DELETE FROM 'Hotel' WHERE account = '" temp.var.account "'",true);
        
    temp.findofflineplayer findplayer(temp.var.account);
        if (
    temp.findofflineplayer == NULL) {
          
    temp.pl = new TServerPlayer(@temp.var.account);
          
    PlayerControl.tabEcho("Game","Offline Player " temp.var.account "'s hotel rent ended!");
          
    temp.pl.client.hotel "";
          
    temp.pl.client.room "";
          
    temp.pl.saveaccount();
          
    temp.pl.destroy();
          
    setTimer(10);
        } else if (
    temp.findofflineplayer != NULL) {
          
    with(findplayer(temp.var.account)) {
            
    client.hotel "";
            
    client.room "";
            
    PlayerControl.tabEcho("Game","Online player " temp.var.account "'s hotel rent ended!");
            
    setTimer(10);
          }
        }
      }
      
    setTimer(10);



    no prblm m9

    Click the Spoiler to see my fan art!
     Spoiler



    - 2012 iEra Player -
    - 2013 Era-GO Member -
    - iEra Ex-Player Relations -
    - Era-GO Ex-Moderator (Twice) -


  4. #44
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    I've said that on Graalians and I'll say it here, you're improving quite well, you should really compare your old work to the current.

    I think you're heading to the right direction, of course small fixes here and there but so far you can start calling yourself a Developer.

    Good job! Proud.
    -Johnaudi

  5. #45
    Big Cheese Captain
    Join Date
    Jun 2013
    Posts
    1,029
    Quote Originally Posted by John View Post
    I've said that on Graalians and I'll say it here, you're improving quite well, you should really compare your old work to the current.

    I think you're heading to the right direction, of course small fixes here and there but so far you can start calling yourself a Developer.

    Good job! Proud.
    Wow! Thank you John
    iEra Developer / SFX Admin

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

Posting Permissions

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