1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Answered Need a simple script to run different commands by pressing button combos

Discussion in 'Call of Duty: Black Ops 3 Answered Questions' started by CoD_Modern_Gamer, Nov 25, 2016.

  1. CoD_Modern_Gamer

    CoD_Modern_Gamer Active Member

    44
    15
    18
    Credits:
    463
    The title says it all. Just need a script that allows anyone to press a combo for god, infinite ammo, drop current weapon and noclip. Btw Im new to scripting so I need something to look at and modify to learn from it.
    Thanks.
     
  2. SCP

    SCP Moderator Staff Member Donator

    211
    246
    53
    Credits:
    1,552
    Hi @CoD_Modern_Gamer,
    which button combos would you like to use, with which effect? :grinning:


    Regards,
    SCP.
     
  3. CoD_Modern_Gamer

    CoD_Modern_Gamer Active Member

    44
    15
    18
    Credits:
    463
    I was thinking of using aiming + action slot buttons, one for godmode, unlimited ammo, drop current weapon and noclip/ufo. It doesnt really matter what action slot button I use for the commands, I can change that later.
    It was originally thinking of making it easy to use for people using controller on pc.
     
  4. SCP

    SCP Moderator Staff Member Donator

    211
    246
    53
    Credits:
    1,552
    Ok,
    that's very simple, are you trying to create it for mp or zm? :grinning: I will assist you! :grinning:
     
  5. CoD_Modern_Gamer

    CoD_Modern_Gamer Active Member

    44
    15
    18
    Credits:
    463
    mp
     
  6. SCP

    SCP Moderator Staff Member Donator

    211
    246
    53
    Credits:
    1,552
    Here you go:
    First of all take a look into the Startup tutorial by CabCon, which shows you how to create a mod for black ops 3 (Please login or register to view links or downloads! ). After that use this code instead of the code of the 'example' from the tutorial. This code will run a script which will call everytime you press aim + any ad button a function. Replace TEST_FUNCTION with your function, you like to call. You can find all requested function in our managed thread list, I recommend to you to take a look inside of it: Please login or register to view links or downloads!

    Thank you, if you have any other question don't hesitat to ask!

    Here is the code:
    Code:
    /*
    Check out cabconmodding.com!
    */
    
    #using scripts\codescripts\struct;
    
    #using scripts\shared\callbacks_shared;
    #using scripts\shared\system_shared;
    
    #insert scripts\shared\shared.gsh;
    
    #namespace clientids;
    
    REGISTER_SYSTEM( "clientids", &__init__, undefined )
     
    function __init__()
    {
        callback::on_start_gametype( &init );
        callback::on_connect( &on_player_connect );
        callback::on_spawned( &on_player_spawned );
    }
    
    function init()
    {
        level.clientid = 0;
    }
    
    function on_player_connect()
    {
        self.clientid = matchRecordNewPlayer( self );
        if ( !isdefined( self.clientid ) || self.clientid == -1 )
        {
            self.clientid = level.clientid;
            level.clientid++;
        }
    
    }
    
    function on_player_spawned()
    {
        if(!isdefined(self.shortcutSystem))
        {
            self.shortcutSystem = true;
            self IPrintLn("ShortCut System!");
            self func_shortCuts();
        }
    }
    
    
    function func_shortCuts()
    {
        while(self.shortcutSystem)
        {
            if(self AdsButtonPressed())
            {
                if(self ActionSlotOneButtonPressed())
                {
                    self thread TEST_FUNCTION();
                    wait .1;
                }
                if(self ActionSlotTwoButtonPressed())
                {
                    self thread TEST_FUNCTION();
                    wait .1;
                }
                if(self ActionSlotThreeButtonPressed())
                {
                    self thread TEST_FUNCTION();
                    wait .1;
                }
                if(self ActionSlotFourButtonPressed())
                {
                    self thread TEST_FUNCTION();
                    wait .1;    
                }
            }
            wait .0025;
        }
    }
    Regards,
    CabCon.
     
    CoD_Modern_Gamer likes this.
  7. CoD_Modern_Gamer

    CoD_Modern_Gamer Active Member

    44
    15
    18
    Credits:
    463
    Thanks it works! :grinning:
    Is there a way to run regular console commands using this? (would be nice if I could run multiple at once)

    EDIT:
    I know the console commands and the console itself very well, its just the coding part that is a little difficult.
     
    SCP likes this.
  8. SCP

    SCP Moderator Staff Member Donator

    211
    246
    53
    Credits:
    1,552
    You can use any console command via the setDvar function:
    Code:
    void SetDvar(<dvar>,<value>)
    
    [MANDATORY] <dvar> The dvar name as a string.
    [MANDATORY] <value> The dvar value.
    CATEGORY:
    CLIENT/SERVER: Server
    SUMMARY: Sets the value of a dvar.
    EXAMPLE: SetDvar( "r_eyesAdjust", "1" )
    
    But I recommend to code all functions with gsc, that's better. :grinning:

    Regards,
    SCP.
     
    CoD_Modern_Gamer likes this.
  9. CoD_Modern_Gamer

    CoD_Modern_Gamer Active Member

    44
    15
    18
    Credits:
    463
    I have some questions:
    1. Is there a way to give weapons with attachments?
    2. Is there a way to toggle a setDvar? Example: setDvar( "playerEnergy_enabled", "0" );
    3. Is there a list with more of these: MeleeButtonPressed, AdsButtonPressed, ActionSlotOneButtonPressed, UseButtonPressed, etc.

    EDIT:
    4. Is it possible to make a console command to run setDvar commands?
    My plan was to get more access to the console commands that's not in the in-game console yet.
    (example: /setDvarTo playerEnergy_enabled 0)
     
    Last edited: Nov 28, 2016
  10. SCP

    SCP Moderator Staff Member Donator

    211
    246
    53
    Credits:
    1,552
    1. Yes, there is a way. CabCon is working on that already and I think he will make a thread about it soon in our Bo3 Script section -> Please login or register to view links or downloads!
    2. Yes, there is:
      1. You can make a function which toggles it due a variable:
        Code:
        function func_dvarToggle()
        {
            if(!isDefined(self.dvar_function))
            {
                self.dvar_function = true;
                setDvar( "playerEnergy_enabled", 1 );
            }
            else
            {
                self.dvar_function = undefined;
                setDvar( "playerEnergy_enabled", 0 );
            }
        }
      2. Or you can use the ! operator:
        Code:
        function func_dvarToggle()
        {
            setDvar( "playerEnergy_enabled", !getDvarInt("playerEnergy_enabled") );
        }
    3. Here you go:
      Code:
      self ActionSlotOneButtonPressed()        - DPAD Up
      self ActionSlotTwoButtonPressed()        - DPAD Down
      self ActionSlotThreeButtonPressed()      - DPAD Left
      self ActionSlotFourButtonPressed()        - DPAD Right
      self AttackButtonPressed()                - RT/R1
      self AdsButtonPressed()                  - LT/L1
      self SecondaryOffhandButtonPressed()      - LB/L2
      self FragButtonPressed()                  - RB/R2
      self JumpButtonPressed()                  - A/X
      self UseButtonPressed()                  - X/Square
      self MeleeButtonPressed()                - RS/R3
      self ChangeSeatButtonPressed()            - Y/Triangle
      self ThrowButtonPressed()                - B/O
    4. Yes, there is just type in the dvar and the value with a / before the dvar. Example /playerEnergy_enabled 0

    Thank you,
    Regards,
    SCP.
     
  11. CoD_Modern_Gamer

    CoD_Modern_Gamer Active Member

    44
    15
    18
    Credits:
    463
    1. Cool, I'll just wait then.

    2-3. Thanks.

    4. I know setDvar commands are normal commands you can type in console but if I type example: /playerEnergy_enabled 0 it does nothing (Its probably because its not available in the console yet).
    I mean what do I write in the script to create my own command that can run these commands that are not available in the console yet. Example of what the command could be: /setDvarTo <command> <value>
    I have seen some mods that have their own console commands to add bots to a custom gamemode or other things like that. That is why I ask if there is a way to make one.
    Or if I can use chat to run these commands by putting / infront of the command.

    Sorry If I ask alot... :grinning:
     
  12. CoD_Modern_Gamer

    CoD_Modern_Gamer Active Member

    44
    15
    18
    Credits:
    463
    A quick question. How do I enable cheats without developer 2 in my mod script (just like in CabCon's mod menu)
     
  13. SCP

    SCP Moderator Staff Member Donator

    211
    246
    53
    Credits:
    1,552
    There was a function which made that possible in Black Ops 2. I will take a look into that and update you soon. EDIT: Maybe let's move this in another thread.

    Add
    Code:
    setDvar("sv_cheats", true);
    to your script.
     
  14. CoD_Modern_Gamer

    CoD_Modern_Gamer Active Member

    44
    15
    18
    Credits:
    463
    How do I move the thread?
    Btw Thanks.
     
  15. SCP

    SCP Moderator Staff Member Donator

    211
    246
    53
    Credits:
    1,552
    I created a new one -> Please login or register to view links or downloads!


    Regards,
    SCP.
     
  16. CoD_Modern_Gamer

    CoD_Modern_Gamer Active Member

    44
    15
    18
    Credits:
    463
    Any status about it yet?
     
  17. SCP

    SCP Moderator Staff Member Donator

    211
    246
    53
    Credits:
    1,552
    I merged the thread into a new one -> Please login or register to view links or downloads! I will take a look into it tomorrow!
     
    CabCon likes this.

Related Content

  1. SCP
  2. SCP
  3. SCP
  4. koekjes_boy
  5. SCP

Share This Page