Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check my code?
#1
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");
}
}
[Image: mca.png]
Add me on steam! otterm
Reply

#2
/Ignore.
Reply

#3
(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.
[Image: mca.png]
Add me on steam! otterm
Reply

#4
(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.
Reply

#5
(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
[Image: mca.png]
Add me on steam! otterm
Reply

#6
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.
Reply

#7
(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? (})
[Image: mca.png]
Add me on steam! otterm
Reply

#8
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");

Reply

#9
(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.
Reply

#10
(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.
[Image: mca.png]
Add me on steam! otterm
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Code color crosshairs koren30 3 4,015 10-02-2013, 19:26
Last Post: koren30
  Help need help?how to make plugins code hXnarutoXone 12 8,543 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 3,311 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 4,130 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 9,677 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 5,636 07-28-2013, 01:52
Last Post: First_Semyon
  Code of vector Bloodfocus 1 2,408 06-23-2013, 11:54
Last Post: Yamato
  How do you guys check for errors when scripting? akillj 6 4,339 06-15-2013, 10:48
Last Post: Yamato
  problem with gsc code CheGuevara 5 5,604 04-20-2013, 15:06
Last Post: Nekochan
  Do you play runescape? :D check this out xD [BTK]Foxy 1 3,025 04-05-2013, 18:16
Last Post: SuperNovaAO

Forum Jump:


Users browsing this thread:
13 Guest(s)

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