![]() |
|
Check my code? - Printable Version +- ItsMods (https://www.itsmods.com) +-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html) +--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html) +--- Thread: Check my code? (/Thread-Check-my-code--3041.html) |
Check my code? - GoldenWrapper - 07-11-2011 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");
}
}RE: Check my code? - Madnesslink5 - 07-11-2011 /Ignore. RE: Check my code? - GoldenWrapper - 07-11-2011 (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. RE: Check my code? - iBanana - 07-11-2011 (07-11-2011, 15:40)GoldenWrapper Wrote: Can you check my code? I'm getting an error. 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. RE: Check my code? - GoldenWrapper - 07-11-2011 (07-11-2011, 15:49)GOVNO12 Wrote:(07-11-2011, 15:40)GoldenWrapper Wrote: Can you check my code? I'm getting an error. Thanks, I'm in a programming course right now. I'll try it when I get home.
RE: Check my code? - iBanana - 07-11-2011 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. RE: Check my code? - GoldenWrapper - 07-11-2011 (07-11-2011, 15:52)GOVNO12 Wrote:Thanks again! ![]() (07-11-2011, 16:05)GoldenWrapper Wrote:(07-11-2011, 15:52)GOVNO12 Wrote:Thanks again! Wait... at the end of the code, it has an opening bracket. ({) Shouldnt it be a closing bracket? (}) RE: Check my code? - surtek - 07-11-2011 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");
}
RE: Check my code? - iBanana - 07-11-2011 (07-11-2011, 16:18)surtek Wrote: The code above is wrong, it says: Yeah >.< I do that a lot. RE: Check my code? - GoldenWrapper - 07-11-2011 (07-11-2011, 16:32)GOVNO12 Wrote:So I was right! Achievement unlocked.(07-11-2011, 16:18)surtek Wrote: The code above is wrong, it says: |