So, in the same script i’d just need to add a function basically doing what I need, then calling it with hook?
[editline]17th August 2017[/editline]
I’ve revised it a little bit and think im close:
hook.Add("holsterscript", "EntityTakeDamage", function()
local function GM:EntityTakeDamage( target, dmginfo )
if ( target:IsPlayer() and dmginfo:IsBulletDamage() ) then
LocalPlayer():ConCommand("say /holster")
end
end
Edit: I get this error:
[ERROR] lua/holsterscript.lua:3: '(' expected near ':'
1. unknown - lua/holsterscript.lua:0
EDIT Again: I’ve gotten to a point with 0 errors, i don’t think its working however.
hook.Add("EntityTakeDamage", "holsterscript", HolsterScript)
local function HolsterScript( target, dmginfo )
if ( target:IsPlayer() and dmginfo:IsBulletDamage() ) then
LocalPlayer():ConCommand("say /holster")
end
end
Although there arent any errors, it doesnt even say “test” instead of /holster
Edit 3: Ive changed it yet again, no errors, but no print
hook.Add("EntityTakeDamage", "holsterscript", HolsterScript)
local function HolsterScript( target, dmginfo )
if ( target:IsPlayer() and dmginfo:IsBulletDamage() ) then
Player:PrintMessage( HUD_PRINTTALK, "Im testing code." )
end
end
Lost at this point. Any help would be nice.