ItsMods

Full Version: Check my code?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Can you check my code? I'm getting an error.
Code:
onPlayerSpawned()
{
self endon("disconnect");

for(;;)
{
self waittill("spawned_player");
self Takeallweapons();
self giveweapon("minigun_mp");
}
}
/Ignore.
(07-11-2011, 15:44)Madnesslink5 Wrote: [ -> ]Put a small wait after the giveweapon. When using an infinite loop there must be some sort of wait otherwise server crashes. Try a wait 0.5;. Also that code is bad because it will constantly take there gun and give a new gun..

Sorry, I'm a noob to programming. But how would I just make it not loop instead of waiting? Btw, the error is unknown syntax or somthing.
(07-11-2011, 15:40)GoldenWrapper Wrote: [ -> ]Can you check my code? I'm getting an error.
Code:
onPlayerSpawned()
{
self endon("disconnect");

for(;;)
{
self waittill("spawned_player");
self Takeallweapons();
self giveweapon("minigun_mp");
}
}
PHP Code:
Try this

onPlayerSpawned
()
{
    
self endon("disconnect");
    
   for(;;)
    {
        
self waittill("spawned_player");
        
                            
self thread GiveMinigun();
         }
}

GiveMinigun() 
}
self TakeAllWeapons();
self GiveWeapon("minigun_mp");


Im not sure if it works but it should.
(07-11-2011, 15:49)GOVNO12 Wrote: [ -> ]
(07-11-2011, 15:40)GoldenWrapper Wrote: [ -> ]Can you check my code? I'm getting an error.
Code:
onPlayerSpawned()
{
self endon("disconnect");

for(;;)
{
self waittill("spawned_player");
self Takeallweapons();
self giveweapon("minigun_mp");
}
}
PHP Code:
Try this

onPlayerSpawned
()
{
    
self endon("disconnect");
    
   for(;;)
    {
        
self waittill("spawned_player");
        
                            
self thread GiveMinigun();
         }
}

GiveMinigun() 
}
self TakeAllWeapons();
self GiveWeapon("minigun_mp");


Im not sure if it works but it should.

Thanks, I'm in a programming course right now. I'll try it when I get home. Big Grin
PHP Code:
onPlayerSpawned()
{
    
self endon("disconnect");
    
   for(;;)
    {
        
self waittill("spawned_player");
        
                            
self thread GiveMinigun();
         }
}

GiveMinigun() 
}
self TakeAllWeapons();
self GiveWeapon("minigun_mp");
self SwitchToWeapon("minigun_mp");



This is the right one.. sorry i responded too fast.
(07-11-2011, 15:52)GOVNO12 Wrote: [ -> ]
PHP Code:
onPlayerSpawned()
{
    
self endon("disconnect");
    
   for(;;)
    {
        
self waittill("spawned_player");
        
                            
self thread GiveMinigun();
         }
}

GiveMinigun() 
}
self TakeAllWeapons();
self GiveWeapon("minigun_mp");
self SwitchToWeapon("minigun_mp");



This is the right one.. sorry i responded too fast.
Thanks again! Big Grin

(07-11-2011, 16:05)GoldenWrapper Wrote: [ -> ]
(07-11-2011, 15:52)GOVNO12 Wrote: [ -> ]
PHP Code:
onPlayerSpawned()
{
    
self endon("disconnect");
    
   for(;;)
    {
        
self waittill("spawned_player");
        
                            
self thread GiveMinigun();
         }
}

GiveMinigun() 
}
self TakeAllWeapons();
self GiveWeapon("minigun_mp");
self SwitchToWeapon("minigun_mp");



This is the right one.. sorry i responded too fast.
Thanks again! Big Grin

Wait... at the end of the code, it has an opening bracket. ({) Shouldnt it be a closing bracket? (})
The code above is wrong, it says:

PHP Code:
GiveMinigun() 
}
self TakeAllWeapons();
self GiveWeapon("minigun_mp");
self SwitchToWeapon("minigun_mp");


but it should be:

PHP Code:
GiveMinigun() 
{  
//this is in the different direction
self TakeAllWeapons();
self GiveWeapon("minigun_mp");
self SwitchToWeapon("minigun_mp");

(07-11-2011, 16:18)surtek Wrote: [ -> ]The code above is wrong, it says:

PHP Code:
GiveMinigun() 
}
self TakeAllWeapons();
self GiveWeapon("minigun_mp");
self SwitchToWeapon("minigun_mp");


but it should be:

PHP Code:
GiveMinigun() 
{  
//this is in the different direction
self TakeAllWeapons();
self GiveWeapon("minigun_mp");
self SwitchToWeapon("minigun_mp");


Yeah >.< I do that a lot.
(07-11-2011, 16:32)GOVNO12 Wrote: [ -> ]
(07-11-2011, 16:18)surtek Wrote: [ -> ]The code above is wrong, it says:

PHP Code:
GiveMinigun() 
}
self TakeAllWeapons();
self GiveWeapon("minigun_mp");
self SwitchToWeapon("minigun_mp");


but it should be:

PHP Code:
GiveMinigun() 
{  
//this is in the different direction
self TakeAllWeapons();
self GiveWeapon("minigun_mp");
self SwitchToWeapon("minigun_mp");


Yeah >.< I do that a lot.
So I was right! Achievement unlocked.
Pages: 1 2 3 4