Requesting help

Topic created ยท 13 Posts ยท 147 Views
  • Sorry for my little knowledge of English and my little knowledge of programming for gsc.
    For several days I have compiled pieces of code and some recompiled gsc, for a network of games in Cuba, I started them and thanks to DOKTORSAS, Jbleezy, Cabbcodding, Deicide, JezuzLizzard and to all those who also leave their contributions in github, We can enjoy something better and different that has had great acceptance, but, as a non-programmer at last, the server has been crashing, due to an error "too many strings", I need help to optimize it, from which I have removed the hud of the life, and the second score, both required for gameplay, I just attached the clientids.gsc waiting for your help. I also hope that I have not violated the rules when publishing this topic, so that it is not eliminated, really "not to mention the problems we go through in my country to be able to play", my friends on the network and I need your help.
    https://drive.google.com/file/d/19dsH6WguQ1p1XHyCbPvJx8k1Wq5C9GDM/view?usp=sharing

    
    
  • @Rassel Sounds like you don't have an overflow fix inside your scripts. You can easily Google and fine a proper overflow fix with a tutorial

  • @Rassel
    Im DoktorSAS. Yes is 100% an overflow problem
    To fix it you need to clear string everytime after a limit

    init(){
    	level thread overflow_fix();
    }
    
    overflow_fix(){
    	level endon("game_ended");
    	level.isOverflow = false;
        level waittill("connected", player);
        level thread overflowfix();
        level.stringtable = [];
        level.textelementtable = [];
        textanchor = CreateServerFontString("default", 1);
        textanchor SetElementText("Anchor");
        textanchor.alpha = 0; 
        limit = 54;
        if (IsDefined(level.stringoptimization))
            limit += 172;
        while(!level.gameended){      
            if (IsDefined(level.stringoptimization) && level.stringtable.size >= 100 && !IsDefined(textanchor2)){
                textanchor2 = CreateServerFontString("default", 1);
                textanchor2 SetElementText("Anchor2");                
                textanchor2.alpha = 0; 
            }
            if (level.stringtable.size >= limit){
            		foreach(player in level.players){
            	 		player.isO = true;
                		        //inside this space put the not neaded text to ""
                                    // like player.endG SetElementText(&"");
                		       player.isO = false;
            		}
            	}
                if (IsDefined(textanchor2)){
                    textanchor2 ClearAllTextAfterHudElem();
                    textanchor2 DestroyElement();
                } 
                textanchor ClearAllTextAfterHudElem();
                level.stringtable = [];           
                foreach (textelement in level.textelementtable){
                    if (!IsDefined(self.label))
                        textelement SetElementText(textelement.text);
                    else
                        textelement SetElementValueText(textelement.text);
                }
            }            
            wait 0.01;
        }
    }
    

    Use this function to change text or text value

    SetElementText(text){
    	if(!self.isO){
        	self SetText(text);
        	if (self.text != text)
           		self.text = text;
        	if (!IsInArray(level.stringtable, text))
            	level.stringtable[level.stringtable.size] = text;
        	if (!IsInArray(level.textelementtable, self))
            	level.textelementtable[level.textelementtable.size] = self;
            level notify("textset");
        }
    }
    SetElementValueText(text){
    	if(!self.isO){
        	self.label = &"" + text;  
        	if (self.text != text)
           	 	self.text = text;
       		if (!IsInArray(level.stringtable, text))
            	level.stringtable[level.stringtable.size] = text;
        	if (!IsInArray(level.textelementtable, self))
            	level.textelementtable[level.textelementtable.size] = self;
            level notify("textset");
        }
    }
    DestroyElement(){
        if (IsInArray(level.textelementtable, self))
            ArrayRemoveValue(level.textelementtable, self);
        if (IsDefined(self.elemtype)){
            self.frame Destroy();
            self.bar Destroy();
            self.barframe Destroy();
        }       
        self Destroy();
    }
    
  • Thanks for your response, I will put it into practice right away to check the results, before receiving your suggestion I had chosen to eliminate several functions and replace the way of calling and show the Perks for this:
    perkHud()
    {
    self endon("disconnect");
    self.perkText = createfontstring("Objective", 1);
    self.perkText setpoint("LEFT", "TOP", -290, -10);
    while(1)
    {
    self.perkText settext(self getPerkDisplay());
    wait 0.01;
    }
    }
    getPerkDisplay()
    {
    myperks = self get_perk_array(0);
    string = "PERKS: ";
    for(i=0;i<myperks.size;i++)
    {
    string = string + "\n^6" + getPerkName(myperks[i]);
    }
    return string;
    }

  • @Rassel said in Requesting help:

    getPerkDisplay

    use SetElementText to set all text, change all SetText with setElementText

  • @Sorex
    Thanks friend. I tried with the code I replaced as you recommended, and I left the screen without huds like the original game. This is not really for a private server. It is free and is played throughout the country. If someone wants to help us, here is everything in this room. so far 8 players per room and it falls every couple of hours.
    https://drive.google.com/file/d/1_CB31zmqcQgDxIDAqWlFvQAdYgvWefgS/view?usp=drivesdk

  • @Rassel Looks like you're using the Bonus Survival Maps. Maybe try again with the latest release and add your scripts that you want 1 at a time until you can figure out what is causing the crashes.

  • @Cahz In effect, I'm using the Bonus Survival Maps, the last update makes zombies too easy for me, in the highest rounds they are killed with a single stab, so I tried to change the way of calculating the damage for the previous one, I have them I added the other scripts and the server continues to fail every couple of hours, usually the error that gives me (overflow) refers to the excessive use of the strings used in the perks, showing me on the screen the perks of the players, with the change that I previously published does not show any error, only the server crashes, and if I add the scripts that you suggested, I do not know the stability, but I lose both the welcome message, as the hud of life, the score, the perks,. ..Those who contribute a lot to the game. It seems that there are too many things or that it is simply not within my reach to correct it xd ๐Ÿ˜•

  • @Rassel If I'm not mistaken the Bonus Survival Maps have an overflow fix on them. Also, what map(s) are crashing?

    I've ran the survival maps on a dedicated server for multiple days with no crash on Tranzit
    The most recent version of MOTD maps should be stable (but I've never tested thoroughly enough to say for 100%).

    And any other maps should be "vanilla" which also shouldn't cause crashes....

  • @Cahz I correct my previous answer, they have already solved the error of the life of the zombies in the repo, I will try adding the scripts only for Tranzit, although the Prison map or the Tomb, they are really the most liked on the server, Thanks

  • @Rassel Tomb/Origins (survival maps version) is unfinished
    Motd should be stable

  • @Cahz I need a way to check if my dedicated server is down and if so. restart it automatically. Think you can help me? I work on windows 10. not on linux. and if I could create a .bat with that function it would save me bad times.

  • @Rassel for me the default.bat restart automaticaly the server when go off. If the Dedicate servers is off the only way to fix it is from the provider website

Log in to reply