Jump to content

[HELP] Script


Skraund

Recommended Posts

Posted

Hello, I created a function that changes the color of the square from white to black on command. But I had a problem, the color should change only for the player who entered it, and it changes for all players on the server, how can I fix it?
Event handler:

addEventHandler( "onClientHUDRender", getRootElement(), d ) 

  • 2 weeks later...
Posted
addCommandHandler("commandname", 
    function(player, cmd)
        --trigger some event to client with player variable
    end
)

You can get the player who entered it by using this

Posted

You're probably running the event for all clients, make sure you only forward the client that issues the command using the example provided above.

Posted

I think you trigger events with getRootElement() server-side. If you use triggerServerEvent("someEvent",root,args) your local player here is source. BUT if you trigger client use this: triggerClientEvent("some_client_event", root, args). If you use getRootElement() instead of root , it will trigger for ALL player. Make sure u read wiki properly ^_^

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...