General > Developers Corner
Lua n00b questions
krooks:
@Magiddo Sorry I didn't notice your post, using csay solved the problem without having to go the SendLua route!
Completed code:
--- Code: ---function ShowKiller(victim,inflictor,killer)
if killer:IsPlayer() then
ULib.csay(victim, "You were been killed by "..killer:Nick()..". A "..killer:GetRoleString().."!")
elseif not killer:IsPlayer() then
ULib.csay(victim, "CLUMSY!")
end
end
hook.Add("PlayerDeath","killer name and roll",ShowKiller)
--- End code ---
This will now tell a player who killed them, and what their role was in a TTT game!
I haven't done any intense testing yet, but the bug mentioned above seems to have been solved.
Thanks everyone, learned a lot on this first simple project, I'll keep all my noob questions in this thread when they come up, anyone else is welcome to use this thread, too.
krooks:
Is it possible to target a game function, remove it, then replace it with your own edited version added as an addon in the addon's folder?
I took a look at the sui_scoreboard and it looks to be doing something like this, but I don't fully understand it. I think its a lot more in-depth because that is a complete scoreboard overhaul, when I'm looking to modify just one part of it.
Basically, what I've done is I edited one part of the default scoreboard by adding a new row to player_row.lua. After some trial and error I got it working nicely, but I would rather not have to re-edit the game file every time I update gmod.
An Error Has Occurred!
array_keys(): Argument #1 ($array) must be of type array, null given
[0] Board index
Go to full version