How use KeyBoardAPI?

Discussion in 'Tech Support' started by watsitfts, Dec 29, 2018.

  1. watsitfts
    Offline

    watsitfts Member Member

    Joined:
    Aug 21, 2017
    Messages:
    52
    Likes Received:
    11
    Fougerite Version: 151
    RustBuster Version (If used): 195
    Explain us the problem: Hi everyone. Anybody know how use KeyBoardAPI?? Please... any example?? I can't load using VisualStudio... Thanks.
     
    #1
  2. DreTaX
    Online

    DreTaX Probably knows the answer... Administrator

    Joined:
    Jun 29, 2014
    Messages:
    3,907
    Likes Received:
    684
    Code (C#):
    // Simulate that the key is being pressed down.
    KeyboardAPI.SendKey(KeyboardAPI.DirectXKeyStrokes.DIK_F2, false, KeyboardAPI.InputType.Keyboard);
    // Simulate that the key is not pressed anymore, therefore It was pressed.
    KeyboardAPI.SendKey(KeyboardAPI.DirectXKeyStrokes.DIK_F2, true, KeyboardAPI.InputType.Keyboard);
     
    #2
  3. watsitfts
    Offline

    watsitfts Member Member

    Joined:
    Aug 21, 2017
    Messages:
    52
    Likes Received:
    11
    #3
  4. DreTaX
    Online

    DreTaX Probably knows the answer... Administrator

    Joined:
    Jun 29, 2014
    Messages:
    3,907
    Likes Received:
    684
    Only client side RB.
     
    #4
  5. DreTaX
    Online

    DreTaX Probably knows the answer... Administrator

    Joined:
    Jun 29, 2014
    Messages:
    3,907
    Likes Received:
    684
    Here is the example by @salva , with a small addition:

    Code (C#):
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using UnityEngine;
    using RustBuster2016.API;

    namespace TEEEEESSSSSTTTTT
    {
        public class PluginGUI : MonoBehaviour
        {
            public void OnGUI()
            {
                if (GUI.Button(new Rect(100, 100, 200, 30), "open console"))
                {
                    RustBuster2016.API.KeyboardAPI.SendKey(KeyboardAPI.DirectXKeyStrokes.DIK_F1, false, KeyboardAPI.InputType.Keyboard);
                    //RustBuster2016.API.KeyboardAPI.SendKey(KeyboardAPI.DirectXKeyStrokes.DIK_F1, true, KeyboardAPI.InputType.Keyboard);
                }
    }}}
     
    #5
  6. watsitfts
    Offline

    watsitfts Member Member

    Joined:
    Aug 21, 2017
    Messages:
    52
    Likes Received:
    11
    I already reached good results... tests working. Very thanks.
     
    #6

Share This Page