Drakath Posted October 27, 2014 Posted October 27, 2014 If I want to call a client exported function from server-side script, do I always have to make a new server script which does triggerClientEvent in the exported function's resource? Isn't there a simpler way?
MTA Team botder Posted October 27, 2014 MTA Team Posted October 27, 2014 Make a resource (e.g. client-api), which has an exported function, which would triggerClientEvent it to the player and then call it (still from that client-api resource). The "client-api" needs 3 parameters: string targetResource, string exportedFunction, table parameters
Drakath Posted October 27, 2014 Author Posted October 27, 2014 Now I have another problem. I have called a function with a text argument. In that function I addEventHandler for another function but I also need to pass this text to that function. addEventHandler does not allow custom arguments. How can I work around it?
MTA Team botder Posted October 27, 2014 MTA Team Posted October 27, 2014 Make that addEventHandler in your addEventHandler function (function in function) and the text will be available.
Drakath Posted October 27, 2014 Author Posted October 27, 2014 Not sure what you mean. Here's the script: addEvent("myEvent", true) function asdf(text) addEventHandler ( "onClientRender", root, draw ) end addEventHandler("myEvent", root, asdf) function draw (text) blablabla... How can I pass text to function draw? Function asdf receives text from server-side script.
Anubhav Posted October 27, 2014 Posted October 27, 2014 texts = {} addEvent("myEvent", true) function asdf(text) texts["draw"] = text addEventHandler ( "onClientRender", root, draw ) end addEventHandler("myEvent", root, asdf) function draw () dxDrawText(texts['draw'], .......)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now