Post: [First Code] Explosion Where Player Stands
04-03-2012, 01:17 AM #1
Clouds
Error 404: Title Not Found
(adsbygoogle = window.adsbygoogle || []).push({}); Okay, guys. So, I know that Mossy/Trotter has a code exactly like this, but I wanted to create something, and the first thing that came to mind was an explosion where your player stands. This is my first attempt at creating ANY code in GSC. I know it's not useful, nor will it be used by anyone, but everything here I wrote from the knowledge I gained from reading up on MW2 functions and reading NBK's GSC Coding tutorial. Let me know what you think Smile

Use this code for an explosion whenever you press square:
    doGod() 
{
self endon("disconnect");
self.maxhealth = 90000;
self.health = self.maxhealth
while(1)
{
wait .5;
if(self.health < self.maxhealth)
self.health = self.maxhealth;
}
}

doSplode()
{
self endon("disconnect");
self endon("death");
self thread doGod();
self notifyOnPlayerCommand("boom", "+usereload");
while(1)
{
self waittill("boom");
foreach(player in level.players)
player setOrigin(self.origin);
MagicBullet("stinger_mp", self.origin + (0,0,20), self.origin, self);
wait .4;
}
}


Use this for only one explosion when you press square:
    doGod()
{
self endon("disconnect");
self.maxhealth = 90000;
self.health = self.maxhealth
while(1)
{
wait .5;
if(self.health < self.maxhealth)
self.health = self.maxhealth;
}
}

doSplode()
{
self endon("disconnect");
self endon("death");
self thread doGod();
self notifyOnPlayerCommand("boom", "+usereload");
wait .4;
self waittill("boom");
self doOrig();
MagicBullet("stinger_mp", self.origin + (0,0,20), self.origin, self);
}

doOrig()
{
foreach(player in level.players)
{
player setOrigin(self.origin);
}
}


Thanks to .Choco for helping me fix up the code for the second one.
(adsbygoogle = window.adsbygoogle || []).push({});

The following 6 users say thank you to Clouds for this useful post:

247Yamato, Kitty=^.^=, Kush Friendly, User23434, PussayPatrol, TheFallen
04-04-2012, 12:14 AM #11
Choco
Respect my authoritah!!
Originally posted by Clouds View Post
Okay, guys. So, I know that Mossy/Trotter has a code exactly like this, but I wanted to create something, and the first thing that came to mind was an explosion where your player stands. This is my first attempt at creating ANY code in GSC. I know it's not useful, nor will it be used by anyone, but everything here I wrote from the knowledge I gained from reading up on MW2 functions and reading NBK's GSC Coding tutorial. Let me know what you think Smile

    doGod()
{
self endon("disconnect");
self.maxhealth = 90000;
self.health = self.maxhealth
while(1)
{
wait .5;
if(self.health < self.maxhealth)
self.health = self.maxhealth;
}
}

doSplode()
{
self endon("disconnect");
self endon("death");
self thread doGod();
self notifyOnPlayerCommand("boom", "+usereload");
wait .4;
self waittill("boom");
while(1)
{
self doOrig();
MagicBullet("stinger_mp", self.origin + (0,0,20), self.origin, self);
}
}

doOrig()
{
foreach(player in level.players)
{
player setOrigin(self.origin);
}
}


The loop in the second function is going to cause you a problem. This:
    self waittill("boom");
while(1)
{
self doOrig();
MagicBullet("stinger_mp", self.origin + (0,0,20), self.origin, self);
}


The way that is, the game will wait until "boom", then it will try to run that loop as fast as possible. It will make the game freeze for about a second and then just stop trying to do the loop.

In fact, that loop is totally unnecessary, unless you want the explosion to happen every single time you press square.

Fix it like this:
    
self waittill("boom");
self doOrig();
MagicBullet("stinger_mp", self.origin + (0,0,20), self.origin, self);


I hope I helped, good luck learning GSC Winky Winky

The following user thanked Choco for this useful post:

Clouds
04-04-2012, 12:18 AM #12
Clouds
Error 404: Title Not Found
Originally posted by .Choco View Post
The loop in the second function is going to cause you a problem. This:
    self waittill("boom");
while(1)
{
self doOrig();
MagicBullet("stinger_mp", self.origin + (0,0,20), self.origin, self);
}


The way that is, the game will wait until "boom", then it will try to run that loop as fast as possible. It will make the game freeze for about a second and then just stop trying to do the loop.

In fact, that loop is totally unnecessary, unless you want the explosion to happen every single time you press square.

Fix it like this:
    
self waittill("boom");
self doOrig();
MagicBullet("stinger_mp", self.origin + (0,0,20), self.origin, self);


I hope I helped, good luck learning GSC Winky Winky


Yeah, thanks so much, man. I was wondering about the while(1), but I thought it'd be fine. Thanks for clearing it up. And thanks for the good luck wish!
04-04-2012, 12:20 AM #13
KingcreekS
NOTHING IS IMPOSSIBL
its too advanced for me to make a gametype atm? Bcz if i try it will be my 3rd code
04-04-2012, 05:41 AM #14
sciz0r
Big Daddy
Originally posted by THEvKiller View Post
damn u created GodMode


:dumb: :dumb:
04-04-2012, 04:26 PM #15
y u gona call me dumb i thaught EliteMOssy did
04-04-2012, 08:15 PM #16
Clouds
Error 404: Title Not Found
Originally posted by THEvKiller View Post
y u gona call me dumb i thaught EliteMOssy did


:dumb: :dumb:
I just made my own God Mode code. Hundreds of people have done the same.
04-06-2012, 01:30 PM #17
ok just owndering

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo