General > Developers Corner

Help with modding Murder gamemode..

(1/5) > >>

VonTreece:
Well, I tried posting this on the Facepunch forums, but didn't get much help.
I don't know why, but i'm not a huge fan of the Facepunch community. They're not very welcoming to noobs.. /rant

Anyway, on point..

So I own a Murder server and it's relatively basic as far as addons and whatnot.

My goal is to make it so that whenever a Bystander kills another Bystander, they are instantly ignited via the ULX command "ulx ignite <player>" as punishment for killing an innocent.

Is this possible? If so, how might I go about it?

Please know that although I get the basic structuring of LUA, it is still very new territory for me. (Be gentle..)

IceMod from Facepunch reccomended I try something along these lines:

--- Code: ---function IgniteBystander(victim,inflictor,attacker)

if victim:IsBystander() and attacker:IsBystander() then
attacker:Ignite()
end
end
hook.Add("PlayerDeath", "BystanderPunishment", IgniteBystander)
--- End code ---

Would this work? Where exactly would this be added?

Decicus:
First of all, you need to modify Ignite. You need to specify the amount of seconds (read more about Entity/Ignite here: http://wiki.garrysmod.com/page/Entity/Ignite).
In this case it would pretty much only need this:

--- Code: ---attacker:Ignite( 30 )
--- End code ---
.
Replace 30 with whatever amount of seconds you want.

Note that "Ignite" also uses a second parameter. In this case, I don't think it's necessary (if you only want to ignite the player and nothing around him), but you can read more about that on te wiki link.

Finally, save as "IgniteBystander.lua" (name before ".lua" can be anything, really) and put it inside <Garry's Mod server directory>/lua/autorun/server.

VonTreece:
Wouldn't that also affect the Murderer when he kills bystanders as well as the Bystander when they kill the murderer?

I only want it to affect the bystander who killed another innocent bystander.

Correct me if i'm wrong. (which I probably am) I just don't see any code that specifies anything other than just igniting anyone that kills another person.

But thank you for the reply! I appreciate any help.

EDIT: Just realised you were talking about adding that to the code shown on my original post.. Derp.. Sorry.. haha

Alright, so I just throw this into my server's lua autorun?


--- Code: ---function IgniteBystander(victim,inflictor,attacker)

if victim:IsBystander() and attacker:IsBystander() then
attacker:Ignite(30)
end
end
hook.Add("PlayerDeath", "BystanderPunishment", IgniteBystander)

--- End code ---

I'll give it a go and post results.. Thanks!


UPDATE:

Didn't work! I tried killing another bystander as a bystander and nothing happened. Any other ideas?

Decicus:
Is "IsBystander" even part of the Murder gamemode, is the question? If you're checking for a function that doesn't exist, that is a problem.
I have no experience with "Murder", so I really can't help with gamemode-specific things in this matter.

VonTreece:
So although it didn't work, it DID do something..

Now every time a Bystander kills an innocent, they keep the gun and the kill isn't broadcast.

I'm not sure if it's IsBystander or not, any idea where that information might be stored?

EDIT: Removed the script and things went back to normal, so it is for sure that script.

Navigation

[0] Message Index

[#] Next page

Go to full version