Results 1 to 2 of 2

Thread: Cmd_ExecuteString - execute /tell /say etc. from gsc

  1. #1
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts

    Cmd_ExecuteString - execute /tell /say etc. from gsc

    Ok, first post in this new forum, here we can collect the infos for new updates:

    Code:
    [21:01] Selbie:         case 1204:
            {
                void (*Cmd_ExecuteString)(const char *text);
                (*(int *)&Cmd_ExecuteString) = 0x080609D4;
    
                char *msg;
                int helper = 0;
                helper += stackGetParamString(1, &msg); // todo: is string?
                if (helper < 1)
                {
                    printf_hide("scriptengine> wrongs args for: say(): at least 1 arg\n");
                    return stackReturnInt(0);
                }
                Cmd_ExecuteString(msg);
                return stackPushInt(1);
            }
            
            closer(1204, "say hello");
            closer(1204, "tell 0 hello");
            closer(1204, "status");
            
    [21:01] kung foo man: nice
    [21:01] kung foo man: you can read the return value also?
    [21:01] kung foo man: like /status in a string
    [21:02] Selbie: I haven't tried that. could work. I have tested it to get tell and say working. but more things are looking possible now. it'sfor 1.2 
    [21:02] kung foo man: ah nice
    [21:03] Selbie: just lookup the addr for 'Cmd_ExecuteString' and it should work for 1.3 & 1.7 to
    [21:04] kung foo man: thats like saying "you find the apple tree somewhere" for explaining where it is
    [21:04] Selbie: oh, well
    [21:05] kung foo man: gonna make a forum for libcod
    [21:05] Selbie: I looked into rcon system from q3, went down the same path. I am not quite good with IDa.
    [21:05] kung foo man: then we can collect all infos there
    [21:05] Selbie: good
    [21:05] kung foo man: ah k
    [21:08] kung foo man: ok added
    [21:09] Selbie: ;)
    [21:09] Selbie: 1.2 only, not sure about 1.3 etc
    [21:09] kung foo man: yea mitch or so will search
    [21:13] Selbie: didn't tested it, but 0x08609CC should be the 1.3 value
    timescale 0.01

  2. The Following User Says Thank You to kung foo man For This Useful Post:

    Mitch (9th September 2013)

  3. #2
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    This functions works with CoD2 1.0, 1.2, 1.3 and CoD4 1.7.

    std\utils.gsc
    PHP Code:
    executeString(str) { closer(1204str); }
    sayConsole(str) { executeString("say " str); } 
    std\player.gsc
    PHP Code:
    tellMessage(str)
    {
        
    std\utils::executeString("tell " self GetEntityNumber() + " " str);

    Note: the cod4 version is a bit different inside libcod, but it isn't a problem within gsc.
    PHP Code:
    #if COD_VERSION == COD4_1_7
        
    void (*Cmd_ExecuteString)(int a1int a2, const char *text);
    #else
        
    void (*Cmd_ExecuteString)(const char *text);
    #endif
    ...
    #if COD_VERSION == COD4_1_7
        
    Cmd_ExecuteString(00msg); // idk what first 2 numbers do
    #else
        
    Cmd_ExecuteString(msg);
    #endif 
    Last edited by Mitch; 15th January 2014 at 22:46.

Posting Permissions

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