Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 35

Thread: Quick questions thread

  1. #21
    Private Whiskas's Avatar
    Join Date
    Jan 2015
    Posts
    84
    Thanks
    69
    Thanked 20 Times in 17 Posts
    Is there a way to print/display a structure of an object (self, level etc.) like it is made for example in PHP (vardump()/print_r()) ?

  2. #22
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Quote Originally Posted by Whiskas View Post
    Is there a way to print/display a structure of an object (self, level etc.) like it is made for example in PHP (vardump()/print_r()) ?
    Not directly: https://killtube.org/showthread.php?...5105#post15105

  3. The Following User Says Thank You to serthy For This Useful Post:

    Ni3ls (14th February 2017)

  4. #23
    Private Whiskas's Avatar
    Join Date
    Jan 2015
    Posts
    84
    Thanks
    69
    Thanked 20 Times in 17 Posts
    Quote Originally Posted by serthy View Post
    I believe that you misunderstood my question. For example: I used "magic function" on player object and I would like to get back something like this:
    PHP Code:
    Object (
        [
    name] => "Whiskas"
        
    [pers] => Array
            (
                [
    team] => "spectator"
                
    [weapon] => undefinded
                
    [savedmodel] => undefined
                
    [skipserverinfo] => undefined
            
    )
        [
    score] => 6
        
    [death] => 2
        
    [sessionstate] => "playing"
        
    [maxhealth] => 100
        
    [health] => 100
        
    [friendlydamage] => undefined
        
    [statusicon] => ""

    But with every variable that is "binded" to that structure. I would like to know what variables does level/player have.
    Last edited by Whiskas; 14th February 2017 at 18:35.

  5. #24
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Ahh, got it

    iirc libcod also has GetArrayKeys() implemented, that works like the CoD4 version (see script reference for that) but this would work only for arrays, not objects..)

  6. The Following User Says Thank You to serthy For This Useful Post:

    Whiskas (14th February 2017)

  7. #25
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    How can I print a precached string?

    I have this on Callback_StartGameType()
    Code:
    	game["spawnprotection"] = &"^2Spawn protection ^1OFF^7";
    	precacheString(game["spawnprotection"]);
    And I'm trying to print it like this
    Code:
    self iprintln(game["spawnprotection"]);
    set logfile 2

  8. #26
    Private Lonsofore's Avatar
    Join Date
    Oct 2016
    Posts
    86
    Thanks
    82
    Thanked 38 Times in 25 Posts
    Quote Originally Posted by guiismiti View Post
    How can I print a precached string?
    In iprintln you can use only simple strings (like str="string").
    And as I know, strings with & (don't know a real name of this strings. somebody tell me, please) you can only precache and use for HUDs.

    So, you can:
    1. Make a simple string and use iprintln:
    Code:
    game["spawnprotection"] = "^2Spawn protection ^1OFF^7";
    self iprintln(game["spawnprotection"]);
    2. Make a HUD with your precached string:
    Code:
    game["spawnprotection"] = &"^2Spawn protection ^1OFF^7";
    precacheString(game["spawnprotection"]);
    self.hud = newClientHudElem(self);
    self.hud.x = x;
    self.hud.y = y;
    self.hud.label = game["spawnprotection"];

  9. The Following 2 Users Say Thank You to Lonsofore For This Useful Post:

    guiismiti (23rd March 2017),kung foo man (23rd March 2017)

  10. #27
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    HARDCORE: make anim progress bar for showing status of spawn protection
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  11. #28
    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
    HARDCORE: make anim progress bar for showing status of spawn protection
    Just use scaleovertime(). Be sure to set new size to 1 pixel horizontal size. Setting it to 0 pixels is buggy on cod2, and will result in 10+ pixels.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  12. The Following 3 Users Say Thank You to IzNoGoD For This Useful Post:

    kung foo man (22nd March 2017),Lonsofore (23rd March 2017),Loveboy (22nd March 2017)

  13. #29
    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
    Quote Originally Posted by Lonsofore View Post
    And as I know, strings with & (don't know a real name of this strings. somebody tell me, please) you can only precache and use for HUDs.
    You could refer to them as "configstring strings" or "precached strings" (sic) ^^

    guiismiti:

    Basically you need to track yourself which values your precached strings have. IzNoGoD compiled this post with basically all info's: https://killtube.org/showthread.php?...out-precaching
    timescale 0.01

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

    guiismiti (23rd March 2017)

  15. #30
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    I actually solved my problem.
    All I wanted was to avoid the localized string warning in the console, so I created a localized string (didn't know how to do it, I thought I only needed to precache a string).

    So, for people with the same doubt:
    Create a .str file in folder localizedstrings;
    Write your strings:
    Code:
    REFERENCE           WELCOME_MESSAGE
    LANG_ENGLISH        "^2Welcome to the battlefield"
    LANG_GERMAN         "#same"
    LANG_RUSSIAN        "#same"
    
    REFERENCE           SPAWN_PROTECTION_OFF
    LANG_ENGLISH        "^2Spawn protection ^1OFF^7"
    LANG_GERMAN         "#same"
    LANG_RUSSIAN        "#same"
    
    ENDMARKER
    Print it like this (where FILENAME is the name of the .str file you created):
    Code:
    player iprintln(&"FILENAME_SPAWN_PROTECTION_OFF");
    set logfile 2

  16. The Following User Says Thank You to guiismiti For This Useful Post:

    kung foo man (23rd March 2017)

Posting Permissions

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