Jump to content

How to show DX Image to only local player


Mvrat

Recommended Posts

  • Moderators

Client sided function are affects only for localPlayer, like dxDrawText.

Think about it, it runs only on client's PC.

But if you start this function on every client's PC, it shows for everyone, ofcourse. But then, the image is not "same", every client render her own image.

Edited by Patrick
Link to comment
  • Moderators
11 minutes ago, Lukas said:

I am trying to make an intro script, image fades in on player join the server. But image fading in my and my friends client.

You need to use events.

OnClientPlayerJoin trigger the attached function when someone join to server, and you need to start the Intro Render only for this client, who is you, localPlayer.

addEventHandler("onClientPlayerJoin", root, function
	-- Wiki note: The `source` of this event is the player that joined the server.
    if source == localPlayer then  -- who join is you, the localPlayer
    	-- start render
    end
end)

-- or set the source of the event to localPlayer instead of root, and then you dont need to check it who is the source.

 

Some Lua tutorial

 

Edited by Patrick
  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...