• Running a Clientsided Hook on a Player in a Server Sided Function
    1 replies, posted
Hey, I know I just asked for some help, but I need more! I had asked earlier for HUD text to appear and disappear for EXP gaining. The code is flawless, but I am not sure how to run the hook for the hud text on a player in this case: function ENT:OnTakeDamage(dmg) local woodcuttingskill = dmg:GetAttacker():getChar():getData("Skill_Woodcutting") if !IsValid(dmg:GetAttacker()) or !dmg:GetAttacker():IsPlayer() then return end --if woodcuttingskill <= 24  then  dmg:GetAttacker():notify ("You need atleast have level 25 woodcutting to chop this!") return end     if table.HasValue(SWM_CUTTING_TOOLS, dmg:GetInflictor():GetClass()) or table.HasValue(SWM_CUTTING_TOOLS, dmg:GetAttacker():GetActiveWeapon():GetClass()) then          if CLIENT then hook.Run("HUDPaint", "draw_xp_gain", XP.drawGainNotification) end end Below is the HUD EXP gain function that I have in my HUD file (which is client side only ofcourse!): local XP = {} XP.alpha = 0 XP.GainNotification = function(gain)     XP.alpha = 600     XP.gain = gain     hook.Add("HUDPaint", "draw_xp_gain", XP.drawGainNotification) end XP.drawGainNotification = function() if not (XP.alpha > 0) then hook.Remove("HUDPaint", "draw_xp_gain") return end     draw.SimpleText("+ 500000 EXPERIENCE!@!@#!@#!#!@", "ChatFont", 20, 20, Color(230, 230, 230, XP.alpha))     XP.alpha = XP.alpha - 15 * FrameTime() * 10 end
Use Net library to send a message to the client server which will replace the usage of hook.Run This link Net Library Usage gives you a tutorial on how to use the net library to send a message from the server to the client
Sorry, you need to Log In to post a reply to this thread.