Solved Binding a key with Lua?

Discussion in 'Rust Development' started by isuelt, Feb 19, 2016.

  1. how can I do this in LUA?
    Code:
    ConsoleSystem.SendClientCommand(player.net.connection, "  7 +slot7;inventory.toggle");
     
  2. Wulf

    Wulf Community Admin

    There's no way to send multiple commands are one or whatever 7 +slot7 is. You can however send a console command like below:
    Code:
    rust.RunClientCommand(player, "inventory.toggle")
     
  3. I know I've seen some LUA code that binded a specific key - but maybe not the multiple commands.
     
  4. Wulf

    Wulf Community Admin

    Just run the client command to bind the key.
    Code:
    rust.RunClientCommand(player, "bind H inventory.toggle")
     
  5. Code:
     C# PLZ!
     
  6. Wulf

    Wulf Community Admin

    Code:
    rust.RunClientCommand(player,"bind H inventory.toggle");
     
  7. Code:
                if (BasePlayer.activePlayerList.Count > 0)
                {
                    foreach (BasePlayer player in BasePlayer.activePlayerList)
                    {
                        startupList.Add(player.userID);
                        rust.RunClientCommand(player,"bind Q kill");
                        //player.Command("bind q \"kill");
                        //ConsoleSystem.SendClientCommand(player.net.connection, "bind q \"kill\"");
                    }
                }
    this is right ??
     
  8. Wulf

    Wulf Community Admin

    Looks okay be, test and see I guess. Make sure you aren't mixing Rust Legacy with Rust code too.
     
  9. if (BasePlayer.activePlayerList.Count > 0)
    {
    foreach (BasePlayer player in BasePlayer.activePlayerList)
    {
    startupList.Add(player.userID);
    rust.RunClientCommand(player, "bind Q \"say test"\"");
    }
    }

    is not working...

    api so hard..
     
  10. Wulf

    Wulf Community Admin

    The majority of that isn't from Oxide's API, the only part is the RunClientCommand helper. If you can post your errors and full plugin, I'm sure someone can help you figure out the issues with your code.
     
  11. LustyMap Plugin (M) clicking show map...
    why my button is not working ..T^T
     
  12. ConsoleSystem.SendClientCommand(player.net.connection, "bind q \"LustyMap map\"");
    I think you need to call the LustyMap via LustyMap?.Call(args) - You replace args with something else: Here is a example of calling a kit:
    Kits?.Call("GiveKit", player, kitname);