What's new

Discussion Any Good Coders wanna Help Me PLZ

  • Thread starter Public Static Void
  • Start date
  • Views 531
P

oO Di2eamZz

Enthusiast
Messages
1,364
Reaction score
245
Points
165
Sin$
0
OK my code looks good and i thought it would work perfectly but I get this error

Server Script Compile Error: Uninitialised Variable 'hud6'

Can Someone with good knowledge look this over please?

This is what I have on player spawned

Code:
self thread doToggleInstruct();

This is my Toggle Thread
Code:
Toggle()
{
while( 1 )
{
wait .5;
if( self UseButtonPressed() && self GetStance() == "stand" )
{
self notify( "Instruct" );
}
}
}
doToggleInstruct()
{ 
self endon ( "disconnect" ); 
self endon ( "death" ); 
for(;;) 
{ 
wait 1; 
self waittill( "Instruct" ); 
{
self thread doInstruct();
self thread doInstructA();
self thread doInstructB();
self thread doInstructC();
self thread doInstructD();
self thread doInstructE();
self thread doInstructF();
self iPrintln("^5INSTRUCTIONS ^2ON"); 
}
wait 3;
self waittill( "Instruct" ); 
{ 
hud6 destroy();
hud7 destroy();
hud8 destroy();
hud9 destroy();
hud10 destroy();
hud11 destroy();
hud12 destroy(); 
self iPrintln("^5INSTRUCTIONS ^1OFF"); 
}   
} 
}

And Here are my huds
Code:
doInstruct()
{
hud6 = newHudElem();
hud6.foreground = true;
hud6.sort = 1;
hud6.hidewheninmenu = false;
hud6.alignX = "right";
hud6.alignY = "top";
hud6.horzAlign = "right";
hud6.vertAlign = "top";
hud6.x = 0; 
hud6.y = 23;
hud6.alpha = 1;
hud6.fontscale = 1.25;
hud6.color = ( 1, 0, 0 );

while(true)
{
hud6 settext( "^2UFO Mode: ^5Crouch and Hold [{+usereload}]" );
wait .5;
}
wait 10;
}

doInstructA()
{
hud7 = newHudElem();
hud7.foreground = true;
hud7.sort = 1;
hud7.hidewheninmenu = false;
hud7.alignX = "right";
hud7.alignY = "top";
hud7.horzAlign = "right";
hud7.vertAlign = "top";
hud7.x = 0; 
hud7.y = 36;
hud7.alpha = 1;
hud7.fontscale = 1.25;
hud7.color = ( 1, 1, 0 );

while(true)
{
hud7 settext( "^1Visions: ^3Crouch and Press [{+frag}]" );
wait .5;
}
wait 10;
}

doInstructB()
{
hud8 = newHudElem();
hud8.foreground = true;
hud8.sort = 1;
hud8.hidewheninmenu = false;
hud8.alignX = "right";
hud8.alignY = "top";
hud8.horzAlign = "right";
hud8.vertAlign = "top";
hud8.x = 0; 
hud8.y = 49;
hud8.alpha = 1;
hud8.fontscale = 1.25;
hud8.color = ( 1, 1, 1 );

while(true)
{
hud8 settext( "^1D^2i^3s^5c^1o ^2Fog: ^5Crouch and Press [{+melee}]" );
wait .5;
}
wait 10;
}

doInstructC()
{
hud9 = newHudElem();
hud9.foreground = true;
hud9.sort = 1;
hud9.hidewheninmenu = false;
hud9.alignX = "right";
hud9.alignY = "top";
hud9.horzAlign = "right";
hud9.vertAlign = "top";
hud9.x = 0; 
hud9.y = 62;
hud9.alpha = 1;
hud9.fontscale = 1.25;
hud9.color = ( 0, 0, 1 );

while(true)
{
hud9 settext( "^3Change Models: ^1Crouch and Press [{weapnext}]" );
wait .5;
}
wait 10;
}

doInstructD()
{
hud10 = newHudElem();
hud10.foreground = true;
hud10.sort = 1;
hud10.hidewheninmenu = false;
hud10.alignX = "right";
hud10.alignY = "top";
hud10.horzAlign = "right";
hud10.vertAlign = "top";
hud10.x = 0; 
hud10.y = 75;
hud10.alpha = 1;
hud10.fontscale = 1.25;
hud10.color = ( 0, 1, 1 );

while(true)
{
hud10 settext( "^5Pick a Prestige: ^2Lie Down and Press [{weapnext}]" );
wait .5;
}
wait 10;
}

doInstructE()
{
hud11 = newHudElem();
hud11.foreground = true;
hud11.sort = 1;
hud11.hidewheninmenu = false;
hud11.alignX = "right";
hud11.alignY = "top";
hud11.horzAlign = "right";
hud11.vertAlign = "top";
hud11.x = 0; 
hud11.y = 88;
hud11.alpha = 1;
hud11.fontscale = 1.25;
hud11.color = ( 0, 1, 0 );

while(true)
{
hud11 settext( "^3Infectable Visions: ^1Lie Down and Press [{+frag}]" );
wait .5;
}
wait 10;
}

doInstructF()
{
hud12 = newHudElem();
hud12.foreground = true;
hud12.sort = 1;
hud12.hidewheninmenu = false;
hud12.alignX = "right";
hud12.alignY = "top";
hud12.horzAlign = "right";
hud12.vertAlign = "top";
hud12.x = 0; 
hud12.y = 101;
hud12.alpha = 1;
hud12.fontscale = 1.25;
hud12.color = ( 1, 0, 1 );

while(true)
{
hud12 settext( "^2100k Points: ^5Lie Down and Press [{+speed_throw}]" );
wait .5;
}
wait 10;
}


I cant see what the problem is... anyone take a guess????
 
M

Mike

Contributor
Forum Addict
Messages
3,475
Reaction score
639
Points
375
Sin$
7
Dont see any errors. Must be in the rest of your coding. Also why so many HUD's?
 
P

oO Di2eamZz

Enthusiast
Messages
1,364
Reaction score
245
Points
165
Sin$
0
i dunno why so many huds does this work?

Code:
TestHud() 
{ 
hud9 = newHudElem(); 
hud9.foreground = true; 
hud9.sort = 1; 
hud9.hidewheninmenu = false; 
hud9.alignX = "right"; 
hud9.alignY = "top"; 
hud9.horzAlign = "right"; 
hud9.vertAlign = "top"; 
hud9.x = 0;  
hud9.y = 15; 
hud9.alpha = 1; 
hud9.fontscale = 1.25; 
hud9.color = ( 0, 0, 1 ); 

while(true) 
{ 
hud9 settext( "" ); 
wait .5;
hud9.y = 30;
hud9 settext( "" ); 
wait .5;
hud9.y = 45;
hud9 settext( "" ); 
wait .5;
} 
wait 10; 
}
 
Andrew74

Andrew74

Enthusiast
Messages
824
Reaction score
219
Points
165
Sin$
7
Code:
self thread doToggleInstruct();
Code:
Toggle()
{
while( 1 )
{
wait .5;
if( self UseButtonPressed() && self GetStance() == "stand" )
{
self notify( "Instruct" );
}
}
}
doToggleInstruct()
{ 
self endon ( "disconnect" ); 
self endon ( "death" ); 
for(;;) 
{ 
self waittill( "Instruct" ); 
self thread doInstruct();
self thread doInstructA();
self thread doInstructB();
self thread doInstructC();
self thread doInstructD();
self thread doInstructE();
self thread doInstructF();
self iPrintln("^5INSTRUCTIONS ^2ON"); 
self waittill( "Instruct" ); 
self notify( "All_Hud_Off" );
}
}
doInstruct()
{
hud6 = newHudElem();
hud6.foreground = true;
hud6.sort = 1;
hud6.hidewheninmenu = false;
hud6.alignX = "right";
hud6.alignY = "top";
hud6.horzAlign = "right";
hud6.vertAlign = "top";
hud6.x = 0; 
hud6.y = 23;
hud6.alpha = 1;
hud6.fontscale = 1.25;
hud6.color = ( 1, 0, 0 );
self thread destroyHud6( hud6 );
while(true)
{
hud6 settext( "^2UFO Mode: ^5Crouch and Hold [{+usereload}]" );
wait .5;
}
wait 10;
}
doInstructA()
{
hud7 = newHudElem();
hud7.foreground = true;
hud7.sort = 1;
hud7.hidewheninmenu = false;
hud7.alignX = "right";
hud7.alignY = "top";
hud7.horzAlign = "right";
hud7.vertAlign = "top";
hud7.x = 0; 
hud7.y = 36;
hud7.alpha = 1;
hud7.fontscale = 1.25;
hud7.color = ( 1, 1, 0 );
self thread destroyHud7( hud7 );
while(true)
{
hud7 settext( "^1Visions: ^3Crouch and Press [{+frag}]" );
wait .5;
}
wait 10;
}

doInstructB()
{
hud8 = newHudElem();
hud8.foreground = true;
hud8.sort = 1;
hud8.hidewheninmenu = false;
hud8.alignX = "right";
hud8.alignY = "top";
hud8.horzAlign = "right";
hud8.vertAlign = "top";
hud8.x = 0; 
hud8.y = 49;
hud8.alpha = 1;
hud8.fontscale = 1.25;
hud8.color = ( 1, 1, 1 );
self thread destroyHud8( hud8 );
while(true)
{
hud8 settext( "^1D^2i^3s^5c^1o ^2Fog: ^5Crouch and Press [{+melee}]" );
wait .5;
}
wait 10;
}

doInstructC()
{
hud9 = newHudElem();
hud9.foreground = true;
hud9.sort = 1;
hud9.hidewheninmenu = false;
hud9.alignX = "right";
hud9.alignY = "top";
hud9.horzAlign = "right";
hud9.vertAlign = "top";
hud9.x = 0; 
hud9.y = 62;
hud9.alpha = 1;
hud9.fontscale = 1.25;
hud9.color = ( 0, 0, 1 );
self thread destroyHud9( hud9 );
while(true)
{
hud9 settext( "^3Change Models: ^1Crouch and Press [{weapnext}]" );
wait .5;
}
wait 10;
}

doInstructD()
{
hud10 = newHudElem();
hud10.foreground = true;
hud10.sort = 1;
hud10.hidewheninmenu = false;
hud10.alignX = "right";
hud10.alignY = "top";
hud10.horzAlign = "right";
hud10.vertAlign = "top";
hud10.x = 0; 
hud10.y = 75;
hud10.alpha = 1;
hud10.fontscale = 1.25;
hud10.color = ( 0, 1, 1 );
self thread destroyHud10( hud10 );
while(true)
{
hud10 settext( "^5Pick a Prestige: ^2Lie Down and Press [{weapnext}]" );
wait .5;
}
wait 10;
}

doInstructE()
{
hud11 = newHudElem();
hud11.foreground = true;
hud11.sort = 1;
hud11.hidewheninmenu = false;
hud11.alignX = "right";
hud11.alignY = "top";
hud11.horzAlign = "right";
hud11.vertAlign = "top";
hud11.x = 0; 
hud11.y = 88;
hud11.alpha = 1;
hud11.fontscale = 1.25;
hud11.color = ( 0, 1, 0 );
self thread destroyHud11( hud11 );
while(true)
{
hud11 settext( "^3Infectable Visions: ^1Lie Down and Press [{+frag}]" );
wait .5;
}
wait 10;
}

doInstructF()
{
hud12 = newHudElem();
hud12.foreground = true;
hud12.sort = 1;
hud12.hidewheninmenu = false;
hud12.alignX = "right";
hud12.alignY = "top";
hud12.horzAlign = "right";
hud12.vertAlign = "top";
hud12.x = 0; 
hud12.y = 101;
hud12.alpha = 1;
hud12.fontscale = 1.25;
hud12.color = ( 1, 0, 1 );
self thread destroyHud12( hud12 );
while(true)
{
hud12 settext( "^2100k Points: ^5Lie Down and Press [{+speed_throw}]" );
wait .5;
}
wait 10;
}
//If your adding these to player spawn then I would make another thread for each hud that deletes on death.
destroyHud6( hud6 )
{
for(;;) { self waittill( "All_Hud_Off" ); hud6 destroy(); }
}
destroyHud7( hud7 )
{
for(;;) { self waittill( "All_Hud_Off" ); hud7 destroy(); }
}
destroyHud8( hud8 )
{
for(;;){ self waittill( "All_Hud_Off" ); hud8 destroy(); }
}
destroyHud9( hud9 )
{
for(;;){ self waittill( "All_Hud_Off" ); hud9 destroy(); }
}
destroyHud10( hud10 )
{
for(;;) { self waittill( "All_Hud_Off" ); hud10 destroy(); }
}
destroyHud11( hud11 )
{
for(;;) { self waittill( "All_Hud_Off" ); hud11 destroy(); }
}
destroyHud12( hud12 )
{
for(;;) { self waittill( "All_Hud_Off" ); hud12 destroy(); }
}
 
C

Crippler

Getting There
Messages
1,942
Reaction score
598
Points
230
Sin$
0
Code:
if( self UseButtonPressed() && self GetStance() == "stand" )
is not necessary

just put
Code:
if( self UseButtonPressed())

and use this for whatever
Code:
if( self UseButtonPressed() && self GetStance() == "crouch" )
Code:
if( self UseButtonPressed() && self GetStance() == "prone" )
 
Top Bottom
Login
Register