Jump to content

help (triggerServerEvent)


Hugos

Recommended Posts

I have a function where I get text from "guiCreateEdit," as well as "triggerServerEvent," I need to move my text to the server part. How do I do that?

function go(button)
    if button == "left" then
    	guiGetText(pin)
    	triggerServerEvent("check", resourceRoot)
    end
end

 

Link to comment
  • Moderators
1 hour ago, Hugos said:
  Hide contents

@IIYAMA help me please)

 

Ha @Hugos

 

I am currently a bit busy with stuff, I will reply when I have time. (~1.5 day)

 

If you do not want to wait for help, there are two tutorials you can follow:

The first one is about events:

(which also includes triggerServerEvent's)

 

And the second one is about some code that can help you making communication easier between serverside and clientside.

 

 

 

 

 

  • Thanks 1
Link to comment
  • Scripting Moderators
16 hours ago, Hugos said:

I have a function where I get text from "guiCreateEdit," as well as "triggerServerEvent," I need to move my text to the server part. How do I do that?


function go(button)
    if button == "left" then
    	guiGetText(pin)
    	triggerServerEvent("check", resourceRoot)
    end
end

 

-- Client-side

local guiText = guiGetText(pin)
triggerServerEvent("check", resourceRoot, guiText) -- pass data

-- Server-side

function checkEvent(text)
	outputChatBox(text)
end
addEvent("check", true)
addEventHandler("check", resourceRoot, checkEvent)

 

  • Thanks 2
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...