Is there anyway that i could make the draw deathnotice only for admins?
[code]
if ( pl:IsAdmin() or pl:IsSuperAdmin() ) then
return true
else
return false
end
[/code]
Thank you
[editline]08:27AM[/editline]
ugh... when i put that in i get this
ERROR: GAMEMODE:'HUDPaint' Failed: DarkRP\gamemode\cl_init.lua:59: attempt to index global 'ply' (a nil value)
Try LocalPlayer() instead of ply!
I don't know whats up with it is their anything else that will tell only admins who is killing who?
[LUA]
if( LocalPlayer():IsAdmin() or LocalPlayer():IsSuperAdmin()) then
LocalPlayer():ChatPrint(killer:GetName().." killed you")
end
[/LUA]
You want to do this in init.lua:
[lua]function GM:DrawDeathNotice( ply )
if ply:IsPlayer() && ply:IsAdmin() then
return true
else
return false
end
[/lua]
or
[lua]function DeathNotice(ply)
if ply:IsPlayer() && ply:IsAdmin() then
return true
else
return false
end
hook.Add("DrawDeathNotice", "DeathNotice", DeathNotice)
[/lua]
Well, it depends if it's clientside or not. I'm not sure what library the hook belongs to. If clientside, use LocalPlayer():, if serverside, use pl:, but you need to make sure to add ( ply ) as the arguments.
Untested.
[lua]
local function DeathNotice(x, y, death, hud_deathnotice_time)
local ply = LocalPlayer()
if !ply:IsPlayer() || !ply:IsAdmin() then return false end
end
hook.Add("DrawDeathNotice", "DeathNotice", DeathNotice)
[/lua]
The sanity checks are probably not necessary.
I would just set hooks up in the Init.lua instead of having a massive cl_init file.
Sorry, you need to Log In to post a reply to this thread.