Results 1 to 10 of 13

Thread: [COD2] Random string hud

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts
    Alright, if you use libcod you can use use new makelocalizedstring function:
    PHP Code:
    // Find free localized string index
    index findFreeConfigStringIndex(1310256);

    // Set configstring
    setConfigString(indexlevel.mapcandidate[0]["mapname"]);

    // Your Hud Stuff
    level.votemap0 setText(makeLocalizedString(level.mapcandidate[0]["mapname"]));

    findFreeConfigStringIndex(startend)
    {
        for (
    start 1start endi++)
        {
            
    configstring getConfigString(i);
            if (!
    isDefined(configstring))
                return 
    i;
        }

        return 
    undefined;

    Just tested it, works quite nicely.

    Or you can use the old fashioned way and replace strings on a client (iznogod's settext wrapper)
    Last edited by voron00; 27th March 2017 at 16:14.
    sudo apt-get rekt

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

    kung foo man (27th March 2017)

  3. #2
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts
    Thank you for your involvement

    But i have this error:

    Code:
    ******* script compile error *******
    unknown function: (file 'maps/mp/gametypes/_mapvote.gsc', line 328)
    configstring = getConfigString(i);
    *
    ************************************
    Sys_Error: Error during initialization:
    script compile error
    (see console for details)

  4. #3
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts
    Quote Originally Posted by Moczulak View Post
    Thank you for your involvement
    But i have this error:
    Quote Originally Posted by voron00 View Post
    Alright, if you use libcod you can use use new makelocalizedstring function:
    10 char. bla-bla
    sudo apt-get rekt

  5. #4
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by voron00 View Post
    Alright, if you use libcod you can use use new makelocalizedstring function:
    PHP Code:
    // Find free localized string index
    index findFreeConfigStringIndex(1310256);

    // Set configstring
    setConfigString(indexlevel.mapcandidate[0]["mapname"]);

    // Your Hud Stuff
    level.votemap0 setText(makeLocalizedString(level.mapcandidate[0]["mapname"]));

    findFreeConfigStringIndex(startend)
    {
        for (
    start 1start endi++)
        {
            
    configstring getConfigString(i);
            if (!
    isDefined(configstring))
                return 
    i;
        }

        return 
    undefined;

    Just tested it, works quite nicely.

    Or you can use the old fashioned way and replace strings on a client (iznogod's settext wrapper)
    Dont forget to check if index is a proper index. Might be undefined if the configstrings are all used up.

    Default cod configstring functions can take care of this for you, including a "is it already duplicated somewhere else" check.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

Posting Permissions

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