PDA

View Full Version : [L4D] Spawn Minigun


antihacker
03-08-2009, 13:12
[L4D] Spawn Minigun
Version 1.0
Spawn a Minigun where ever you want, seems to work on all maps now!
The command is sm_minigunspawn, so you can easy spawn a minigun by entering /minigunspawnor !minigunspawn in chat.
Only works with realy clients not over rcon, and with the adminflag cheats.
Please Report Bugs:up:
Commands:
sm_minigunspawn: Spawns a minigun and return its position (orgin), and entity ID.
sm_minigunrotate: <Entity ID|-1|-2> <Degree>: Rotate a minigun by a defined Degree with its entity ID, or if -1 the minigun looking at, or if -2 the last minigun created
sm_minigundelete <Entity ID|-1|-2>: Removes a mingun by its entity id, or if -1 the minigun looking at, or if -2 the last minigun created



Installation:
Just copy the spawnminigun.smx in you plugins/ directory.

Cvars:
sm_spawnminigun_version = 1.0 the Spawn Minigun Version

Credits:
Fyren for helping me alot over irc
hlstriker for this code (http://forums.alliedmods.net/showpost.php?p=776296&postcount=4).
Frozenology for his "Direction" Code
ednomerve (http://forums.alliedmods.net/member.php?u=51884) for the bugfix

Changelog:

0.1 Initial Release
0.2
- Renamed sm_spawnminigun to sm_minigunspawn
- Fixed sm_minigunspawn direction bug
- Added sm_minigunlist, sm_minigunrotate, sm_minigundelet
0.3
-Added looking at minigun and last minigun created (-1,-2), as a option of sm_minigunrotate and sm_minigundelet
-Removed sm_minigunlist
1.0
-Hotfix for spawn Origin by ednomerve (http://forums.alliedmods.net/member.php?u=51884)
1.1
-renamed sm_minigundelet to smminigundelete, thx mikeym9 (http://forums.alliedmods.net/member.php?u=48417)

ApocalypseDan
03-08-2009, 14:27
Going to try it out with our tank arena game type now we can add more taknks and miniguns ill let you know how it gose

antihacker
03-08-2009, 14:43
Do this, if you have Problems i will try to answere :)
You can change the radius of the weapon and some thing i will try out what its possible tomorrow.

ApocalypseDan
03-08-2009, 14:57
:cry:
Update:Sorry Could Not Get It Working Tried in chat with server set to sv cheats 1 !spawnminigun and spawnminigun and nothign happened can you shed some light is there something i am missing

server ip 83.142.49.27:28016

The JCS
03-08-2009, 15:32
Nice. I'd started a plugin like this, but i had no time to work on it =/
I'll test this soon

mikercool
03-08-2009, 23:19
What flag is needed for this to work?

This plugin barely works. Spawns only in one direction and spawns in the floor.

AcidTester
03-09-2009, 01:50
make this with combination l4d buildenabler that allows rotate objects.

antihacker
03-09-2009, 08:28
@mikercool:
1)You need the Flag "Cheats".
2)I work on this
@AcidTester:
Thanks, i will look for this plugin.


Can please some help me with the spawn location?
It would be cool if its spawn like ent_spawn, so its drops to ground at the point you aimed.

x13lade
03-09-2009, 15:47
Nice plugin, minigun works. The only problems right now are: Minigun can not be rotated to whatever direction you want, and the minigun is somewhat buried in the ground.
I tried to rotate the minigun with ent_rotate, but it still only let me use it from its default position. Seems like it only rotated the model image thing?.

Jay Dogg
03-09-2009, 19:42
This plug is buggy for sure, The minigun is half in the floor most of the time I spawn it and you cant use it about half the time for some reason anyway. And even if you use the l4d buildenabler to rotate the minigun it still only shoots the way it was pointed when you spawn it. Needs alot of work before I would put this plug back on my server again. But I sure hope antihacker keeps working on this plug cause I have been waiting for this.

{7~11} TROLL
03-10-2009, 16:40
i tryed this and when it spawned it was facing towards the wall but it shot me lol

ApocalypseDan
03-10-2009, 18:19
Yes Direction is set no matter if you rotate it or not it will only fire in the 1 direction also burried. But Still A good plugin Thanks

Frozenology
03-12-2009, 00:23
Thanks for Minigun code.
I solve about the direction, so you have to add these code to set angles


public Action:Command_MiniGun(client, args)
{
decl Float:VecOrigin[3], Float:VecAngles[3], Float:VecDirection[3];
GetClientAbsOrigin(client, VecOrigin);
GetClientEyeAngles(client, VecAngles);
GetAngleVectors(VecAngles, VecDirection, NULL_VECTOR, NULL_VECTOR);
VecOrigin[0] += VecDirection[0] * 32;
VecOrigin[1] += VecDirection[1] * 32;
VecOrigin[2] += VecDirection[2] * 32;
new ent = CreateEntityByName ( "prop_minigun");
DispatchKeyValue(ent, "model", "Minigun_1");
SetEntityModel (ent, "models/w_models/weapons/w_minigun.mdl")
DispatchKeyValueFloat (ent, "MaxPitch", 40.00);
DispatchKeyValueFloat (ent, "MinPitch", -30.00);
DispatchKeyValueFloat (ent, "MaxYaw", 90.00);
VecAngles[0] = 0.0;
VecAngles[2] = 0.0;
DispatchKeyValueVector(ent, "Angles", VecAngles);
DispatchSpawn(ent);
TeleportEntity(ent, VecOrigin, NULL_VECTOR, NULL_VECTOR);
}

antihacker
03-12-2009, 12:00
@Frozenology:
Thanks for the code, i added it to new version.

Look at the first post, version 0.2 released!

Hope you like it more :twisted:

mikercool
03-12-2009, 16:09
Can you make it spawn right in front of you? Not where you look? Where is look is what is messing up and putting the gun in the ground.

ApocalypseDan
03-12-2009, 19:42
Good one ill add it now and test it

Ok tested it and i must say even thought it is a really nice plugin it is complicated to find the id and set it to the degrees no way to make it rotate what you are looking at like in the

l4d build enabler http://forums.alliedmods.net/showthread.php?p=750106 this would make it much more user friendly so you can use it on the fly rather than having to open 3 different menus to get the information nedded to change direction of the gun.Keep up the good work

ku5h
03-15-2009, 18:07
very cool, thx i used to be only able to use spawn a mini gun on NM_05

zxzx1992
03-15-2009, 22:59
Copy the plugin and source to where?

antihacker
03-16-2009, 09:31
@ku5h:
Thanks :)

@zxzx1992:
left4dead/addons/sourcemod/plugins, there you copy the .smx file

Jay Dogg
03-31-2009, 21:50
Hey man great job its working a lot better. The one thing I did find was if you look towards the ground and spawn the minigun and if the minigun is part way in the ground (just needs to be a little bit in the ground) and you start using the minigun it pushies you threw to the area below(if there is an area below) a good example is the starting roof of No Mercy

But really man great plug and thanks for all your hard work.

Jay

ednomerve
04-17-2009, 13:33
vOrigin[2] += vDirection[2] * 1;


i think that makes the minigun not go into the ground

tfphoenix
04-29-2009, 14:26
Works great thanks!

preset
05-08-2009, 18:10
vOrigin[2] += vDirection[2] * 1;
i think that makes the minigun not go into the ground

Where exactly do I change that in the sp? It would be nice not to have the minigun not spawn in the ground. :shock:

Sora3100
05-21-2009, 10:16
Where exactly do I change that in the sp? It would be nice not to have the minigun not spawn in the ground. :shock:


Search for the line: VecOrigin[2] += VecDirection[2] * 32;
Then replace the 32 to 1.
Tested it and works. :D
EDIT: Nice script!

leonil7
05-27-2009, 09:14
yup its working perfectly now. thx's a lot to all u guys. :)

antihacker
05-27-2009, 09:32
Okay thx ednomerve (http://forums.alliedmods.net/member.php?u=51884) for this fix, i have updated the first post.

mikeym9
06-09-2009, 10:31
I am trying to work on it so that, it will be a minigun spawner, in a menu that will be able to spawn: HP Kits, HealthKits, zombies, Pillz, all those goodies, but I can't figure out how to get the minigun into the SM menu. Help?

EDIT: ADDED BELOW!

Errors:
Only works with realy(Change it to Real) clients not over rcon, and with the adminflag cheats.


Change this to 1.2 on next official release.
"sm_spawnminigun_version = 1.0 the Spawn Minigun Version"


Edit #2: Also, Below LEFT 4 DEAD MINIGUN it says the version, Change that to 1.2 on next official release.

Slash The Mighty
06-19-2009, 13:40
I tried this, and all it does is give me the error "You don't have access to this command."

I've tried manually setting the cheat level, and I've even tried using the root level, and neither worked.

bug
07-04-2009, 21:23
I downloaded this a long time ago, and it worked great. But this morning I logged on to l4d, and it wouldent work. It had been working last night, but for some reason it wont anymore. I deleted the old one, and downloaded it again. put it in the sourcemod/plugins place in my l4d folder, still wont work! Can you help?

webname
07-05-2009, 05:56
Has anyone has any success rotating the gun properly once spawned ,it rotates an unexpected no of degrees for me and wont rotate any further. And its only the model
thats sort of rotated it still has to be controlled from the original spawn
angle.
spawn and deleting are working fine and have them added to my admin menu

Zverina
08-10-2009, 14:33
uhhh this is to anyone that wants to know how to point the minigun in the direction u want.. for me actually which every director im facing when i spawn the MG the MG faces i dont see any problems...

webname
08-14-2009, 20:22
To clarify !
Im talking about using sm_minigunrotate which for me fails to rotate the machine gun object properly.

Whosat
08-15-2009, 08:57
Spawning the minigun works for me (and it faces the direction in which I am facing), which is the main part of the plugin, so I don't think it should be unapproved because one (not that very important) function doesn't work.

olj
08-18-2009, 10:03
We have LeftFortDeadBuilder which handle minigun totally correctly. Dont say its bad plugin, i even didnt use it. Just say, that we already have good one for handling minigun with plenty of extra features, and thus separate minigun plugin isnt that much needed. If author want it to be unapproved, let him do it and grab leftfortdead builder instead.

mikeym9
09-26-2009, 02:22
Do you mind If I make a new thread and re-make the coding?

MikesTooLz
11-23-2009, 18:06
This plugin work in L4D2 with no changes needed. And it uses the l4d2 minigun.

antihacker
11-26-2009, 10:20
Cool :)

markbtje
12-10-2009, 09:35
Please help me !
Where do i need to put the plugin into ?
Cuz i dont have the folders addons/sourcemod/plugin

Zverina
12-11-2009, 00:41
Please help me !
Where do i need to put the plugin into ?
Cuz i dont have the folders addons/sourcemod/plugin
do u have sourcemod at all? cuz if u probably didnt install properly(if you do have SM)

antihacker
12-11-2009, 06:57
Installation: Just copy the spawnminigun.smx in you plugins/ directory.

gamemann
12-31-2009, 18:07
Works perfact for me :)

a Muffin
04-04-2010, 13:08
works for l4d2 :D

J.P.
08-29-2010, 14:29
Do this, if you have Problems i will try to answere :)
You can change the radius of the weapon and some thing i will try out what its possible tomorrow.
Where is the plugin folder?

J.P.
08-29-2010, 20:42
Dude it doesnt work 4 me

blablubde
10-15-2010, 11:04
the plugin works great, but can u add both miniguns?
the gatling from l4d1 and the 50.cal from l4d2

maybe with different cmds?
eg:
sm_minigunspawn_l4d1 for the l4d1 gun
and
sm_minigunspawn_l4d2 for the l4d2 gun?

blablubde
11-11-2010, 13:59
no one replied to my request, so i had to try it on my own.
first of all: i never wrote a plugin and i did not read much about coding a plugin. this is my first try and i got it working. (i took the code of antihacker and modified it)


With the original plugin u could spawn only 1 version of the minigun. Depending by the game u got only the L4D1 or the L4D2 version.
Now, with my new version of this plugin, u can spawn both versions of the minigun in both games.
=> u can spawn the 50.cal in L4D1 and the normal gatling minigun.
=> u can spawn the gatling minigun in L4D2 and the normal 50.cal.

BUT: i had to make 2 different plugins (one for each game) because the code is not the same in both games. (and i dont know, how to make a plugin, which can see which game is running and select the fitting code):

To use it u need the CHEAT flag.

So there are now 2 versions of the plugin. One for each game:


L4D1
spawnminigun_l4d1.smx / spawnminigun_l4d1.sp
L4D2
spawnminigun_l4d2.smx / spawnminigun_l4d2.sp

Console Commands:
(they are the same for both plugins)


sm_minigunspawn_l4d1
=> create a L4D1 minigun. (gatling)
sm_minigunspawn_l4d2
=> create a L4D2 minigun. (50.cal)
sm_minigunrotate <Entity ID|-1|-2> <Degree>
=> Rotate a minigun by a defined Degree with its entity ID, or if -1 the minigun looking at, or if -2 the last minigun created. (no matter if it is L4D1 or L4D2 version)
sm_minigundelete <Entity ID|-1|-2>
=> Removes a mingun by its entity id, or if -1 the minigun looking at, or if -2 the last minigun created. (no matter if it is L4D1 or L4D2 version)
sm_spawnminigun_version
=> shows the current version of the plugin.


I set the version to 2.0, because it is a "big change".

(In the "Source - Old Version.zip" file u can find the the latest version 1.0 of antihacker, which only creates one version of the minigun and i also used this version to create my own.)

I hope u enjoy it and it is working for u, too.


Miscellaneous:

The commands for rotating and deleting of the minigun i've never used. The delete command is working, but the rotate command doesn't work correct. (or i am to stupid to get how it works). Well, it rotates the gun, but not in the angle i want.
These 2 commands are inside the plugin, because i don't know if anyone used them or not. (They where in the original plugin, so i didn't delete them).
On the servers i play, there is also the buildenabler, so i dont need these commands for deleting and rotating.
As i wrote above, i dont have much idea how to write a plugin, so i cant provide much support. Of course u can write bugs here, but im not sure if i can help.
I decided to add the modified version of this plugin in this thread and not to create a new one, because it is nearly the same plugin.
In the plugin, there is a different name (not blablubde). In the plugin i've used my normal in-game name "Drakexz".
i apologize for my bad english.

KarnageInk
11-14-2010, 11:54
wow wow wow! nice 1.

Multi_Read
11-23-2010, 02:44
Hello, this is my first post on Allied Mods.

I wanted to show you guys a much MUCH easier way to rotate the objects. I should mention this is for L4D2, I'm uncertain if this works in L4D1.

I created a config (cfg) with these binds, named it proprotate and put it in the ordinary cfg folder.

bind "del" "ent_remove"
bind "leftarrow" "ent_rotate 90"
bind "rightarrow" "ent_rotate 45"
bind "uparrow" "ent_rotate 180"
bind "downarrow" "ent_rotate 270"

In game, I bring down the console and type exec proprotate (or just start typing pro and then hit the down arrow to auto fill).

After you have executed this config, you can spawn your minigun of choice and then just point your laser or crosshair at the minigun (making sure the very center of either one is on a part of the minigun) and press one of the arrows to turn it whatever you want. You can set this to any number between 1 and 360 but obviously only a few are needed or make sense.

To delete a minigun, just do the same thing... point your crosshair or laser at the minigun and press Del (delete key).

Very nice script AntiHacker, I enjoy using it very much :)

And good job blablubde as well!

blablubde
11-23-2010, 15:28
sorry Multi_Read, but this doesnt work.

yes, it will rotate the minigun, but if u try to use it, u will see the problem. it does only rotate the visible part of the gun. the invisible part (dono how to describe it) wont be rotated. => u cant use the gun as intended.


just try it. u will see what i mean.

and another thing: u cant use the ent_rotate command in every server (afaik). u have to enable it fist. (e.g. with the buildenabler)

Multi_Read
11-23-2010, 15:50
Okay, I looked into this some more....

Unfortunately you're correct, although the gun does rotate it still only shoots the radius it spawned as. :(

But ent_rotate works on any server with cheats enabled and sourcemod installed. I'm not sure if sourcemod has to be, but its the only mod we have running so figured I'd add that.

Those binds are still very useful for other prop creations, hopefully someone that read this topic learned about those.

Sorry for the confusion, I thought it worked and excitedly posted... to soon.

KarnageInk
11-24-2010, 04:35
Hi

didnt really understand what u guys were talkign abt rotation but the other say i was playing on a l4d1 server and this server had a menu to buy miniguns!!! and it worked perfectly being able to rotate while shooting. looked thru all the threads in this forum but i couldnt find it. i wished i had the server ip written down...

blablubde
12-03-2010, 09:20
the plugin u where using might be this one:
https://forums.alliedmods.net/showthread.php?t=93716
there are a few plugins which contain the minugun. (dono if all can be used by normal players)

and with rotating we mean something different than u.
we want to rotate it if we are not using it. means, rotate it about 90° and then use it as normal.

example:
u've spawned the minigun facing north.
=> u can shoot everything in the area in front of u. all from left (west) to the right (east)

if u now rotate the gun clockwise about 90°, the minigun would face east.
=> u can shoot everything in the area in front of u. all from left (north) to the right (south)


so u would be able to use the same minigun without rebuilding it.