Results 1 to 3 of 3

Thread: CoD4: !commands

  1. #1
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts

    CoD4: !commands

    I just got player commands working for CoD4.

    Console:
    Code:
    pushing: say
    pushing: abc def
    PLAYER COMMAND! message: say, abc def,
    isPlayer self
    Player: Mitch
    (i didn't use the fixChatArgs function)

    https://github.com/M-itch/libcod/com...57e04082e3f162
    Attached Thumbnails Attached Thumbnails shot0000.jpg  
    Last edited by Mitch; 27th October 2014 at 23:26.

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    To make it fully compatible with code written for cod2 libcod, it should return the args as a bigger array, for example:

    say hello world

    would result in

    args[0] = "say";
    args[1] = "hello";
    args[2] = "world";


    But then again, this can be done manually if needed. Great work
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  3. #3
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by IzNoGoD View Post
    To make it fully compatible with code written for cod2 libcod, it should return the args as a bigger array, for example:
    I turns out that fixChatArgs fixes this issue.

    PHP Code:
    CodeCallback_PlayerCommand(args)
    {
        
    args fixChatArgs(args);

        
    output ""
        for (
    i=0i<args.sizei++) 
            
    output += args[i] + ", "
         
        
    printf("PLAYER COMMAND! message: " output "\n"); 
        
        if(
    isPlayer(self))
        {
            
    printf("isPlayer self\n");
            
    printf("Player: " self.name "\n");
        }
        else
            
    printf("!isPlayer self\n");
        
        
    self iprintlnbold("you wrote: " output);
        
        
    self ClientCommand();

    CoD4 1.7: http://znation.nl/libcod/libcod4_1_7.so
    CoD4 1.7 (query-limit-test): http://znation.nl/libcod/libcod4_1_7_l.so
    Last edited by Mitch; 28th October 2014 at 13:07.

Posting Permissions

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