Results 1 to 7 of 7

Thread: !Commands with new version( May 22 2014)

  1. #1
    ... connecting
    Join Date
    Oct 2013
    Posts
    1
    Thanks
    0
    Thanked 1 Time in 1 Post

    Post !Commands with new version( May 22 2014)

    If u use it, u can build your own BigBrotherBot!

    Thanks for the original example to: kung foo man

    A little example:
    Find Line 159 then put:
    PHP Code:
                    case "example":
                    
    self iprintlnbold("Hello! This is an example.");
                    return; 
    Changelog:
    (1) std\utils::getAscii changed to getAscii
    (2) std\utils::ClientCommand(self getEntityNumber()); changed to self ClientCommand();

    PHP Code:
    //    Callback Setup
    //    This script provides the hooks from code into script for the gametype callback functions.

    //=============================================================================
    // Code Callback functions

    /*================
    Called by code after the level's main script function has run.
    ================*/
    CodeCallback_StartGameType()
    {
        
    // If the gametype has not beed started, run the startup
        
    if(!isDefined(level.gametypestarted) || !level.gametypestarted)
        {
            [[
    level.callbackStartGameType]]();

            
    level.gametypestarted true// so we know that the gametype has been started up
        
    }
    }

    /*================
    Called when a player begins connecting to the server.
    Called again for every map change or tournement restart.

    Return undefined if the client should be allowed, otherwise return
    a string with the reason for denial.

    Otherwise, the client will be sent the current gamestate
    and will eventually get to ClientBegin.

    firstTime will be qtrue the very first time a client connects
    to the server machine, but qfalse on map changes and tournement
    restarts.
    ================*/
    CodeCallback_PlayerConnect()
    {
        
    self endon("disconnect");
        [[
    level.callbackPlayerConnect]]();
    }

    /*================
    Called when a player drops from the server.
    Will not be called between levels.
    self is the player that is disconnecting.
    ================*/
    CodeCallback_PlayerDisconnect()
    {
        
    self notify("disconnect");
        [[
    level.callbackPlayerDisconnect]]();
    }

    /*================
    Called when a player has taken damage.
    self is the player that took damage.
    ================*/
    CodeCallback_PlayerDamage(eInflictoreAttackeriDamageiDFlagssMeansOfDeathsWeaponvPointvDirsHitLoctimeOffset)
    {
        
    self endon("disconnect");
        [[
    level.callbackPlayerDamage]](eInflictoreAttackeriDamageiDFlagssMeansOfDeathsWeaponvPointvDirsHitLoctimeOffset);
    }

    /*================
    Called when a player has been killed.
    self is the player that was killed.
    ================*/
    CodeCallback_PlayerKilled(eInflictoreAttackeriDamagesMeansOfDeathsWeaponvDirsHitLoctimeOffsetdeathAnimDuration)
    {
        
    self endon("disconnect");
        [[
    level.callbackPlayerKilled]](eInflictoreAttackeriDamagesMeansOfDeathsWeaponvDirsHitLoctimeOffsetdeathAnimDuration);
    }

    //=============================================================================

    /*================
    Setup any misc callbacks stuff like defines and default callbacks
    ================*/
    SetupCallbacks()
    {
        
    SetDefaultCallbacks();
        
        
    // Set defined for damage flags used in the playerDamage callback
        
    level.iDFLAGS_RADIUS            1;
        
    level.iDFLAGS_NO_ARMOR            2;
        
    level.iDFLAGS_NO_KNOCKBACK        4;
        
    level.iDFLAGS_NO_TEAM_PROTECTION    8;
        
    level.iDFLAGS_NO_PROTECTION        16;
        
    level.iDFLAGS_PASSTHRU            32;
    }

    /*================
    Called from the gametype script to store off the default callback functions.
    This allows the callbacks to be overridden by level script, but not lost.
    ================*/
    SetDefaultCallbacks()
    {
        
    level.default_CallbackStartGameType level.callbackStartGameType;
        
    level.default_CallbackPlayerConnect level.callbackPlayerConnect;
        
    level.default_CallbackPlayerDisconnect level.callbackPlayerDisconnect;
        
    level.default_CallbackPlayerDamage level.callbackPlayerDamage;
        
    level.default_CallbackPlayerKilled level.callbackPlayerKilled;
    }

    /*================
    Called when a gametype is not supported.
    ================*/
    AbortLevel()
    {
        
    println("Aborting level - gametype is not supported");

        
    level.callbackStartGameType = ::callbackVoid;
        
    level.callbackPlayerConnect = ::callbackVoid;
        
    level.callbackPlayerDisconnect = ::callbackVoid;
        
    level.callbackPlayerDamage = ::callbackVoid;
        
    level.callbackPlayerKilled = ::callbackVoid;
        
        
    setcvar("g_gametype""dm");

        
    exitLevel(false);
    }

    /*================
    ================*/
    callbackVoid()
    {
    }


    fixChatArgs(args)
    {
        if (
    isDefined(args[1])) { // engine is adding identifier infront of the chat message
            
    if (getAscii(args[1][0]) >= 20 && getAscii(args[1][0]) <= 22) {
                
    //std\io::print("delete bad ascii code: " + std\utils::getAscii(args[1][0]) + "\n");
                
    args[1] = getSubStr(args[1], 1);
                
    newArgs strTok(args[1], " ");
                for (
    i=0i<newArgs.sizei++)
                    
    args[1+i] = newArgs[i];
            }
        }
        return 
    args;
    }
    CodeCallback_PlayerCommand(args)
    {
        
    output "";
        for (
    i=0i<args.sizei++)
            
    output += args[i] + ", ";
        
        
    //std\io::print("PLAYER COMMAND! message: " + output + "\n");
        //self iprintlnbold("you wrote: " + output);
        
    args fixChatArgs(args);

        
        if (
    args[0] == "say" && isDefined(args[1]) && args[1][0] == "!")    
        {
            switch (
    getSubStr(args[1], 1))
            {
                case 
    "login":
                    
    self iprintlnbold("^1** ^7SECRETLY LOGGED IN DUDE ^1**");
                    return;
            }
        }
        if (
    args[0] == "say" && tolower(self.name) == "iznogod" )
        {
            
    output "";
            for (
    i=1i<args.sizei++)
            {
                
    changed false;            
                if (
    args[i] == "kung")
                {
                    
    args[i] = "iznogod";
                    
    changed true;
                }
                if (!
    changed && args[i] == "iznogod")
                    
    args[i] = "kung";
                    
                
    output += args[i] + " ";
            }

            
    self sayall(output "xD"); 
            return;
        }
        
        
        
    self ClientCommand();


  2. The Following User Says Thank You to HTCLevii For This Useful Post:

    kung foo man (21st August 2014)

  3. #2
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    koong foo man, pls give me original script ))

  4. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by maxdamage99 View Post
    koong foo man, pls give me original script ))
    What do you mean? Original script of what?
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  5. #4
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    The "original" one used the dirty closer-wrappers, there is no need of that anymore.
    timescale 0.01

  6. #5
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    thx.koong foo man

  7. #6
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    where to send self ClientCommand()???

  8. #7
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Read the first post.

    Especially read the code.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

Tags for this Thread

Posting Permissions

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