Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!
Moderator: Core Staff
-
Lethal323
Post
by Lethal323 » October 15th, 2007, 8:51 am
I run my mod that I am working on and here is the section of the mod I added before I was having crashing problems...
Added:
Code: Select all
spec()
{
self endon("boot");
setcvar("scr_allow_spectator", "");
while(1)
{
if(getcvar("scr_allow_spectator") == "1")
{
if(self.pers["team"] == "spectator")
{
level.hudright = newHudElem();
level.hudright.x = 0;
level.hudright.y = 0;
level.hudright.alignX = "center";
level.hudright.alignY = "center";
level.hudright.sort = 0;
level.hudright setShader("textures/spec/hud@spec.dds", 1280, 1024);
level.hudright.alpha = 1;
}
}
}
}
I ran cod in developer mod and got nothing. Game still freezes and then crashes. Dont get an error or anything(does same to my server(s))
Any help?
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » October 15th, 2007, 12:49 pm
your script is looping continuously.
Add a wait command before the "}" of the while function...
while(1)
{
if(something)
{
do something
}
wait 1;
}
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
Lethal323
Post
by Lethal323 » October 15th, 2007, 8:15 pm
like this?
Code: Select all
spec()
{
self endon("boot");
setcvar("scr_allow_spectator", "");
while(1)
{
if(getcvar("scr_allow_spectator") == "1")
{
if(self.pers["team"] == "spectator")
{
level.hudright = newHudElem();
level.hudright.x = 0;
level.hudright.y = 0;
level.hudright.alignX = "center";
level.hudright.alignY = "center";
level.hudright.sort = 0;
level.hudright setShader("textures/spec/hud@spec.dds", 1280, 1024);
level.hudright.alpha = 1;
}
wait(1);
}
}
}
-
Nightmare
- Core Staff
- Posts: 2688
- Joined: January 12th, 2006, 10:09 pm
-
Contact:
Post
by Nightmare » October 15th, 2007, 8:43 pm
The lowest wait time you can have without getting a script runtime error is 0.05.
The reason it crashes is because the script loops so much that the game gets "flooded" and can't take any more info.
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » October 16th, 2007, 9:15 am
Lethal323 wrote:like this?
Code: Select all
spec()
{
self endon("boot");
setcvar("scr_allow_spectator", "");
while(1)
{
if(getcvar("scr_allow_spectator") == "1")
{
if(self.pers["team"] == "spectator")
{
level.hudright = newHudElem();
level.hudright.x = 0;
level.hudright.y = 0;
level.hudright.alignX = "center";
level.hudright.alignY = "center";
level.hudright.sort = 0;
level.hudright setShader("textures/spec/hud@spec.dds", 1280, 1024);
level.hudright.alpha = 1;
}
wait(1);
}
}
}
The wait must be OUTSIDE the IF statement.
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
YaNo
- CJ Worshipper
- Posts: 460
- Joined: May 5th, 2005, 9:34 pm
- Location: Azeroth
-
Contact:
Post
by YaNo » October 22nd, 2007, 5:02 pm
thats pretty dumb eh
question when reading over the code as a smart person : so if IF is not true? it will not wait... and crashes
-
Nightmare
- Core Staff
- Posts: 2688
- Joined: January 12th, 2006, 10:09 pm
-
Contact:
Post
by Nightmare » October 22nd, 2007, 8:19 pm
Basically. The script would overload the server and there would be a script runtime error.
What you would want to do is this:
Code: Select all
while(1)
{
if
wait 1;
wait 0.05;
}
-
Lethal323
Post
by Lethal323 » October 23rd, 2007, 10:31 pm
well it didnt over load the whole server but it didnt even work so I just said fuck it...
Users browsing this forum: No registered users and 36 guests