Player Kills Player.......

Hey sorry for constantly posting for help, but i think thats the best way to learn is from other coders. Anyway. Im wanting to make a system where if a person kills someone then you can change things like there speed, jumpheight, give more ammo, ect. Ive looked into using "attacker, victim " things but i cant seem to make one that works, or im not using the right thing. Having this will give my gamemode the true meaning of what im going for. But idk how to make a code to where if a player kills another then you can change variables on the player or do things to the HUD. If anyone has any clue on where to look, or if you know and willing to point me in the right direction, i would really appreciate it :). Thanks for all your help :slight_smile:

PlayerDeath hook…

Ik that :P, thats what ive been using for the attacker, victim functions.

No…The best way to learn it’s trying to do something from ourselves, trying to find a solution for our problem…There’s nothing to learn if you ask the solutions to everyone
If you would tried it by yourself, you could learned more about hooks, metatables and HUD
Now you expect to someone to bring their knowledge to solve your problems, it’s okay if you need help, but you aren’t learning…You are cheating

Ive been doing something like this ( key word something )
[lua]
if ( attacker:IsPlayer() && victim:IsPlayer() ) then
–blah blah blah
[/lua]

[editline]31st August 2014[/editline]

Sadly i dont see your logic? I do know ALOT more than i did. I do try my own things before i come here now as a result of knowing more. So i do trail and error quite a bit. And i learn. But im not asking to do it for me, idk why when someone asks for advise or a point in the direction, it instantly means they want to be spoonfed the code. Im not trying to insult you, im just speaking my mind. But i do constantly work with things. If i wasnt, this forum would have >100 threads by me because of many things ive coded so far through trial and error. Again im not trying to start problems just speaking my mind.

Look at the examples the wiki provides, and work you’re way to what you’re trying to accomplish. Posting here 24/7 wont learn you Lua, but just give you finished code others have given for you.



local config = {}
config.RunSpeed = 1500 -- The speed they run at.
config.WalkSpeed = 600 -- The speed they walk at, non sprint.
config.JumpPower = 800 -- The Jump power.

function GiveSpeedJumpEtc( victim, weapon, killer, ply )

if killer:IsPlayer() and victim:IsPlayer() then
killer:SetRunSpeed(config.RunSpeed)
killer:SetWalkSpeed(config.WalkSpeed)
killer:SetJumpPower(config.JumpPower)
end

end
hook.Add("PlayerDeath", "IHateWhyThisDontWorkWithoutThisRandomTextSoHi", GiveSpeedJumpEtc)


*Not Tested.

Tried, my most recent searches is this, this,and this
Im really dumbfounded that as much searching ive done that there isnt really nothing. Dont get me wrong, i learned a little more, and tried to piece things together from searching, but havent has no luck :frowning:

[editline]31st August 2014[/editline]

Ok i will look into it and try and see what i can use :slight_smile: Thanks…

[editline]31st August 2014[/editline]

Ok I had to move a few things and change somestuff, but seems to work :slight_smile: Thanks :). And i noticed what i was doing wrong, its not attacker its killer, wow lol silly me. But thanks :slight_smile: