Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Emission code, everyone times out?
#1
doEmission(); is executed somewhere on the code. level.emissionincoming = false; is put under init();

Code:
doEmission()
{
    level endon("emission_cancel");
    level endon("emission_end");
    if(level.emissionincoming) return 0;
    level.emissionIncoming = true;

    level thread emissionEarthquake();

    currentEmissionClock = 0;
    emissionTimer = spawn("script_origin", (0,0,0));
    emissionTimer hide();
    while(currentEmissionClock != 10)
    {
        currentEmissionClock += 1;
        emissionTimer playSound("ui_mp_nukebomb_timer");
        if(currentEmissionClock <= 5) wait(5);
        else wait(1);
    }

    level.emissionIncoming = false;
    level.emissionInProgress = true;
    earthquake(0.25, 12, (0, -2500, 0), 100000);
    emissionTimer playSound("nuke_wave");
    //setDvar("r_todoverride","2 1.3 0.8");
    wait 2;
    foreach(player in level.players)
    {
        player thread radiationEffect();
    }
    wait 6;
    level.emissionInProgress = false;
    wait 2;
    level notify("radiation_stop");
    level notify("emission_end");
    emissionTimer destroy();
}

emissionEarthquake()
{
    level endon("emission_cancel");
    level endon("emission_end");
    while(level.emissionIncoming)
    {
        wait randomint(10);
        duration = (randomint(9) + 1);
        intensity = (randomint(5)/20);
        emissionEnt = getEntArray("mp_global_intermission", "classname");
        earthquake(intensity, duration, emissionEnt[0].origin, 100000);
        wait duration;
    }
}

radiationEffect()
{
    self.poison = 0;
    
    while(1)
    {
        if(self.issafe) continue;
        if(!isAlive(self)) continue;
        if(!level.emissioninprogress) continue;
        self.radiation ++;
        if(self.radiation == 1) {
            self ViewKick(1, self.origin);
        } else if(self.radiation == 3) {
            self shellshock("mp_radiation_low", 4);
            self ViewKick(3, self.origin);
            self doRadiationDamage(15);
        } else if(self.radiation == 4) {
            self shellshock("mp_radiation_med", 5);
            self ViewKick(15, self.origin);
            self doRadiationDamage(25);
        } else if(self.radiation == 5) {
            self shellshock("mp_radiation_high", 5);
            self ViewKick(75, self.origin);
            self doRadiationDamage(45);
        } else if(self.radiation == 6) {
            self shellshock("mp_radiation_high", 5);
            self ViewKick(127, self.origin);
            self doRadiationDamage(175);
        }
        wait(1);
    }
    wait(5);
}

doRadiationdamage(iDamage)
{
    self thread [[ level.callbackPlayerDamage ]](self,self,iDamage,0,"MOD_SUICIDE","claymore_mp",self.origin,(0,0,0) - self.origin,"none",0);
}

When the large earthquake and the sound are due to start, everyone times out except for me. This is a dedicated server.

Please only post the part of this code which needs to be fixed, and not the entire code.

thanks
Reply

#2
lol spammer??
Reply

#3
(01-06-2012, 17:03)alvarogt95 Wrote: lol spammer??

yes you are a spammer. please don't reply unless you got something useful Smile
Reply

#4
I dont know the reason, but you should destroy the loop you make on here(after some time): radiationEffect()
Reply

#5
(01-07-2012, 11:56)Yamato Wrote: I dont know the reason, but you should destroy the loop you make on here(after some time): radiationEffect()

I found the problem. It was not in that function, but it was the continue;. Continue does not stop the while, it simply tells it to go to the top and that is why it was crashing.

thanks
Reply

#6
(01-07-2012, 14:58)xplosiff Wrote:
(01-07-2012, 11:56)Yamato Wrote: I dont know the reason, but you should destroy the loop you make on here(after some time): radiationEffect()

I found the problem. It was not in that function, but it was the continue;. Continue does not stop the while, it simply tells it to go to the top and that is why it was crashing.

thanks

To stop the loop: break;

Continue works similar to a return.
Reply

#7
Code:
function(derp)
{
    for(i=0;i<20;i++)
    {
        doStuff1();
        if(i==5) { continue; } //This will skip the rest of the loop and increase I by 1. (So when i=5 stuff2 and stuff3 don't happen, but with every other number it does
        doStuff2();

        doStuff3();
    }
    //Using a break; in the loop will end up here (it exits the loop)
    doEvenMoreStuff();
    //using a return; in the loop will end up here (end of function, it exits the function)
}
[Image: MaEIQ.png]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Code color crosshairs koren30 3 4,037 10-02-2013, 19:26
Last Post: koren30
  Help need help?how to make plugins code hXnarutoXone 12 8,629 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 3,334 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 4,170 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 9,762 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 5,683 07-28-2013, 01:52
Last Post: First_Semyon
  Code of vector Bloodfocus 1 2,427 06-23-2013, 11:54
Last Post: Yamato
  problem with gsc code CheGuevara 5 5,652 04-20-2013, 15:06
Last Post: Nekochan
Tongue [Request] read if you have a cs:go code:) rawr-saours 5 4,089 04-05-2013, 18:15
Last Post: SuperNovaAO
Smile Help Help me with a code (who knows) NyZzE 2 2,558 04-05-2013, 01:47
Last Post: NyZzE

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.