Lua Script

Hi, I dont know like are the functions of “lua” in gmod, but I want to create a script where messages death are randoms.


**local Msj = { ‘noob’, ‘fag’, ‘LOL’ }

function GM:PlayerDeath( victim, inflictor, attacker )
local text = Msj [ math.random ( 1, #Msj ) ]
if ( victim == attacker ) then
PrintMessage( HUD_PRINTTALK, victim:Name() … text )
PrintMessage( HUD_PRINTTALK, victim:Name() … " killed by " … attacker:Name() … " !")

is understood?

PS: Sorry for my english :stuck_out_tongue:

Please use

 tags for code. Also, if you're not making a game-mode, use hook.Add. Also, don't return a non-nil value in any hook.Add unless you're overriding behavior or you can break functionality of game-modes.

Here you go: Remove .html for .lua.

Please don’t bold your code, use the

 tags, as Acecool said and also help threads go in Developer Discussion, thanks!