Weapon Spawner

Posts 1–11 of 11 · Page 1 of 1
Weapon Spawner
Hi,
Yesterday i searched a code for "Spawn a Weapon".
Didn't find what i wanted..
------------------------------------------
So in this thread, I'll show you how to make weapon Pickup (Spawn) in GSC.
Acually it's very Simple
Code:
doSpawnGold()
{
	self notifyOnPlayerCommand("[{+actionslot 2}]", "+actionslot 2"); // When player Press [+actionslot 2] (default - 5)
	while( 1 )
	{
		self waittill("[{+actionslot 2}]"); // Wait untill he press it
                OrginalW = getCurrentWeapon(); // Gets his Weapon
                SpawnW = "deserteaglegold_mp"; // Set the Weapon to spawn (Change it to whatever weapon you want)
                self giveWeapon(SpawnW, 0); // 
		self GiveMaxAmmo(SpawnW);
                self switchToWeapon(SpawnW);
                wait 0.1
                self DropItem( SpawnW );
                wait 0.1
                self giveWeapon(OrginalW, 0);
		self GiveMaxAmmo(OrginalW);
                self switchToWeapon(OrginalW);
	}
}
Have fun!
Quote Originally Posted by InferNus` View Post
Code:
doSpawnGold(SpawnW)
{
	self notifyOnPlayerCommand("[{+actionslot 2}]", "+actionslot 2"); // When player Press [+actionslot 2] (default - 5)
	while( 1 )
	{
		self waittill("[{+actionslot 2}]"); // Wait untill he press it
                self giveWeapon(SpawnW, 0);
		self GiveMaxAmmo(SpawnW);
                wait 0.1 //Scripts takes 0.05 seconds, but alright.
                self DropItem( SpawnW );
	}
}
Removed some unnecessary things
unnecessary? So the player Will have no Weapons?
Quote Originally Posted by InferNus` View Post
unnecessary? So the player Will have no Weapons?
The player will drop the weapon yes.

So the weapon will be on the ground.
That means the player will have the secondary weapon.
But drops the primary on the ground and need to pick it back up.
Quote Originally Posted by InferNus` View Post
unnecessary? So the player Will have no Weapons?
The player will get the weapon and will drop it, so the player wont really see anything
Code:
weapontospawn = spawn("weapon",position);
Quote Originally Posted by Yamato View Post
Code:
weapontospawn = spawn("weapon",position);
aha so "weapon" did exist?
Code:
doSpawnGold()
{
	self notifyOnPlayerCommand("[{+actionslot 2}]", "+actionslot 2");
	while( 1 )
	{
		self waittill("[{+actionslot 2}]");
                OrginalW = getCurrentWeapon(); // GETS THE CURRENT WEAPON
                SpawnW = "deserteaglegold_mp";
                self giveWeapon(SpawnW, 0); // 
		self GiveMaxAmmo(SpawnW);
                self switchToWeapon(SpawnW);
                wait 0.1
                self DropItem( SpawnW );
                wait 0.1
                self giveWeapon(OrginalW, 0); // GIVES BACK THE CURRENT WEAPON!!
		self GiveMaxAmmo(OrginalW);
                self switchToWeapon(OrginalW);
	}
}
Quote Originally Posted by EpicPlayer View Post
aha so "weapon" did exist?
Where I put weapon you must put the weapon name.
Quote Originally Posted by Yamato View Post
Where I put weapon you must put the weapon name.
I mean, I know how you can spawn weapons through the .ents files, but I didn't knew there was a script function like this :P
Quote Originally Posted by EpicPlayer View Post
I mean, I know how you can spawn weapons through the .ents files, but I didn't knew there was a script function like this :P
Dont question his theroys! Yamato is 1337 hax0r
Posts 1–11 of 11 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?