Posts: 122
Threads: 24
Joined: Jul 2011
Reputation:
0
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");
}
}
Add me on steam! otterm
Posts: 184
Threads: 11
Joined: May 2011
Reputation:
1
07-11-2011, 15:44
(This post was last modified: 07-11-2011, 16:14 by Madnesslink5.)
/Ignore.
Posts: 122
Threads: 24
Joined: Jul 2011
Reputation:
0
(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.
Add me on steam! otterm
Posts: 317
Threads: 24
Joined: Mar 2011
Reputation:
10
07-11-2011, 15:49
(This post was last modified: 07-11-2011, 15:49 by iBanana.)
(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.
Posts: 122
Threads: 24
Joined: Jul 2011
Reputation:
0
(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.
Add me on steam! otterm
Posts: 317
Threads: 24
Joined: Mar 2011
Reputation:
10
07-11-2011, 15:52
(This post was last modified: 07-11-2011, 15:56 by iBanana.)
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.
Posts: 122
Threads: 24
Joined: Jul 2011
Reputation:
0
07-11-2011, 16:05
(This post was last modified: 07-11-2011, 16:18 by GoldenWrapper.)
(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!
(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!
Wait... at the end of the code, it has an opening bracket. ({) Shouldnt it be a closing bracket? (})
Add me on steam! otterm
Posts: 2,509
Threads: 96
Joined: Nov 2010
Reputation:
38
07-11-2011, 16:18
(This post was last modified: 07-11-2011, 16:20 by surtek.)
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"); }
Posts: 317
Threads: 24
Joined: Mar 2011
Reputation:
10
07-11-2011, 16:32
(This post was last modified: 07-11-2011, 16:33 by iBanana.)
(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.
Posts: 122
Threads: 24
Joined: Jul 2011
Reputation:
0
(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.
Add me on steam! otterm
|