[Support] Zombie Counter info

Topic created · 7 Posts · 108 Views
  • I am setting up a simple dedicated zombies server to play with my friends on. Everything so far is fine, however I want there to be

    1. unlimited perks
      and
    2. a "zombies left" counter

    I have found a script that allows me to get the unlimited perks; I even know it works becuase every time I load up the server the confirmation message comes up.

    However, for the zombies counter, I have looked everywhere for a good script but I am not sure what I am doing wrong. So far I have just copied the script from here:
    https://cabconmodding.com/threads/zombies-counter-display.149/
    and pasted the code into my .gsc and added the correct import statement. (and also changed the "setSafeText" into "setText")
    The server still loads up, no problem, but the counter simply does not show up at all. I don't know what I am doing wrong. Any help appreciated!

  • You need to compile the GSC using GSC studio. Check the tutorials on this forum.

  • @SaintAodhan Here's a modified version of the zombies counter.

    just call this inside of init()

    level thread drawZombiesCounter();
    

    Source

    drawZombiesCounter()
    {
        level.zombiesCounter = createServerFontString("hudsmall" , 1.9);
        level.zombiesCounter setPoint("CENTER", "CENTER", "CENTER", 190);
        level thread updateZombiesCounter();
    }
    updateZombiesCounter()
    {
        oldZombiesCount = get_current_zombie_count();
        while(true)
        {
            newZombiesCount = get_current_zombie_count();
            wait 0.05;
            if(oldZombiesCount != newZombiesCount)
            {
                level thread updateZombiesCounter();
                return;
            }
            else
            {
            	if(newZombiesCount != 0)
            		level.zombiesCounter.label = &"Zombies: ^1";
            	else
            		level.zombiesCounter.label = &"Zombies: ^6";
            	level.zombiesCounter setValue(newZombiesCount);
            }
        }
    }
    

    This method uses setValue instead of setText to avoid any sort of overflow errors.

  • @Cahz
    Thanks a bunch, finally worked. Really appreciate it

  • @Cahz hey im trying to create a gsc with the code u posted for the zombie cunter but i dont know where to put it it gives me errors everytime i try something different and never works. could i get a little help on how to create the script for the zombie counter?

  • @Cahz said in [Support] Zombie Counter info:

    @SaintAodhan Here's a modified version of the zombies counter.

    just call this inside of init()

    level thread drawZombiesCounter();
    

    Source

    drawZombiesCounter()
    {
        level.zombiesCounter = createServerFontString("hudsmall" , 1.9);
        level.zombiesCounter setPoint("CENTER", "CENTER", "CENTER", 190);
        level thread updateZombiesCounter();
    }
    updateZombiesCounter()
    {
        oldZombiesCount = get_current_zombie_count();
        while(true)
        {
            newZombiesCount = get_current_zombie_count();
            wait 0.05;
            if(oldZombiesCount != newZombiesCount)
            {
                level thread updateZombiesCounter();
                return;
            }
            else
            {
            	if(newZombiesCount != 0)
            		level.zombiesCounter.label = &"Zombies: ^1";
            	else
            		level.zombiesCounter.label = &"Zombies: ^6";
            	level.zombiesCounter setValue(newZombiesCount);
            }
        }
    }
    

    Follow the directions

  • @Mr-Android Isn't the official method using the provided compiler on the forum post? Pretty sure GSC Studio is / was heavily discouraged for compiling. I don't know if the program just isn't liked, or if it compiles differently than the provided compiler

Log in to reply