Results 1 to 5 of 5

Thread: Problem with UFO script

  1. #1
    Private
    Join Date
    May 2017
    Posts
    17
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Problem with UFO script

    Hi, I use the codjumper mod on a paid server and I'v added a (ufo) script and it works very well for at least one day and as admin I use the admin menu and I noticed that when I use it the server lags.
    I asked this on the cod4x forum 2 weeks ago and one of them told me this: "for(;; ) - linker never gets deleted. Memory leak."
    Pros: maintaining r pressed you move wherever you want and stop it with space.
    Cons: admin menu does not work a day after the server is up.

    Code:
    _Noclip()
    {
        self endon("disconnect");
        self endon("killed_player");
        linker = spawn("script_origin", self.origin);
        for(;;)
        {
            if(self reloadbuttonpressed()) 
            {
            self linkto(linker);
            m=380;
            o=anglestoforward(self getplayerangles());
            linker moveto((linker.origin+(o[0]*m,o[1]*m,o[2]*m)),0.05);
            wait 0.05;    
            }else if(self jumpButtonPressed()){
            self unlink();
            wait 0.05;
        }
        wait 0.05;
        }   
        linker delete();
        wait 2;
    }
    PD: If you have time, help please.

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Possibly that, or possibly that you're trying to linkto() an entity that's already linkto()'d, which might produce an error message.

    Linker gets deleted properly, except in the case that a player dies or disconnects. Shouldn't be too much of an issue unless you have tons of players and never change the map.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

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

    genez_x (19th May 2017)

  4. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Just looked at the script again. Why are you moving the linker 380 units per serverframe? Do you really need your clients to be racing through the map with noclip at 7600 units/sec?
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  5. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Lonsofore (19th May 2017)

  6. #4
    Private
    Join Date
    May 2017
    Posts
    17
    Thanks
    2
    Thanked 2 Times in 2 Posts
    First of all, thanks for the answers IzNoGoD, I forgot to write that function only works for vip and admin, then there should be fewer problems because less people get to use that function?
    PS: (380) can cause any problems?
    If so what number should be safe.
    PS2:mod codjumperv3_12b.
    PS3:A couple minutes ago I looked the server log and saw that there's no evidence of script failure from _noclip() but a ton of script failure from the admin control script that I think it appears when we use the admin menu.
    PS4:A couple hours from I will post the errors.

  7. #5
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Try reducing m to something sensible, like 20, and remove the additional wait 0.05's. Only keep the one right before linker delete();
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

Tags for this Thread

Posting Permissions

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