client-side script

You don’t seem to understand HUDPaint. HUDPaint is run on every frame. With the code you posted, it will check the NWBool “horror022” every frame, and if it is true, it will randomly pick one of the images every frame, and then draw the picked image every frame. All you have to do to make it go away is NOT draw it. So, if “horror022” became false, it would stop drawing the image every frame, and it would disappear.

Based on your description on when it should appear, it sounds like using LocalPlayer():Alive() instead of that NWBool would be better, since you won’t have to manually set it to true or false. I would also suggest you listen to the advice about not calling ‘Material’ every frame, as it wastes performance with no benefit.

Why did you send me a private message? Not only is it rude to the other participants of the thread, I was monitoring the thread from work while not logged in. I’m not gonna see your private message until I log in again.

Based on the script you sent, you appear to be setting the NWBool to true when the player uses the secondary fire of your SWEP, and the ONLY place that sets the NWBool to false is in the primary fire. Are you purposely keeping the image on the screen until the user presses the primary fire, even if they switch weapons? Personally, I wouldn’t do this, as it reeks of bad design, but if this is what you want, you will need to remove the image either when they die, or when they respawn. These are the hooks you would need:



I think it would be better to have it expire automatically after a few seconds. You seem to know how timer.Simple works, so you can use that.

You should probably also use

SWEP:DrawHUD instead of HUDPaint, as it only gets called while you have the weapon out.

sorry for this but
is it rude for my too to receive this

[editline]17th August 2016[/editline]

well I tested this but I don’t know why no work ;(

if CLIENT then

local function spawn( ply )
    ply:SetNWBool("horror022", false);
hook.Add( "PlayerSpawn", "diehorror022", spawn )
hook.Remove("HUDPaint", "horror022")

You don’t want to hook.Remove the HUDPaint hook. That will stop it from ever rendering. Just set the NWBool to false.

Also, PlayerSpawn is a serverside hook, and serverside network variables can only be set serverside, so don’t do the client check. Do a server check instead

thank you both it works perfectly now :slight_smile:
very very thx :slight_smile:
I kiss you