Jump to content

help (triggerServerEvent)


Hugos

Recommended Posts

Posted

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

 

Говорю на русском. Sorry for bad english.
 

  • Moderators
Posted
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.

 

 

 

 

 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
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)

 

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