Jump to content

trigger server and client event


Xeonmeister

Recommended Posts

Hi!

First of all, sorry for asking stupid things like this.

I just can't understand how to trigger an event and give parameters.

For example i wanted to try to make a clientside command, where i get the player's coordinates and trigger a server event which puts the coordinates out in the chat. How can i keep the variables?

Edit: Okay i do know now how to trigger a server event. But i'm in trouble trying to trigger a client event for everyone. Can anyone give me an example?

Link to comment

Clinet

function location() 
    local x, y, z = getElementPosition(localPlayer) 
end 
addEvent("area", true) 
addEventHandler("area", localPlayer, location) 

Server

function playerArea(thePlayer, x, y, z, _) 
    triggerClientEvent(root, "area", root, x, y, z) 
    outputChatBox("The Player is on"..x.." "..y.." "..z.., thePlayer, 255, 255, 0) 
end 
addCommandHandler("loc", playerArea) 

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