Jump to content

Kazafka

Members
  • Posts

    143
  • Joined

  • Last visited

Everything posted by Kazafka

  1. So, this will work? CLIENT-SIDE 1: addEventHandler("onClientResourceStart", resourceRoot, function() --Define function rgbOpenPicker() function rgbOpenPicker() --Do some GUI stuff end end) CLIENT-SIDE 2: --Call for defined function, earlier rgbOpenPicker()
  2. So IIYAMA, what can I do here, to make it work in same resource?
  3. I tried exporting client-side function, and calling for it in client-side. Don't work. XML: <export function="rgbOpenPicker" type="client"/> CLIENT-SIDE 1: function rgbOpenPicker() guiSetVisible(window, true) showCursor(true, true) end CLIENT-SIDE 2: exports[getResourceName(getThisResource())]:rgbOpenPicker()
  4. Well, imagine that you want to trigger other resource event, like comunicate within many resources. Is that: triggerEvent(":resource_nameOnEventTriggerred", resourceRoot, [arg1, arg2, arg3]) possible?
  5. Example: You have made a scrollbar and you want to return scrollbar position to some variables by clicking button, I mean, some other scripts' variables. Like exports.... That's what I wanna get to my knowledge
  6. KK, but how can I return data in different function, set by clicking a button? <<< ALL IN CLIENT!!! 'k, but how can I return data by clicking a button? Sorry for multiple questions in one comment, but my final is: How can I return data by clicking a button? CLIENT
  7. Okay, I have now another idea, right? So, how can I make a function, that returns values, that will be set by clicking button? ALL IN CLIENT!!! @stPatrick what do you think 'bout this? /\ /\ /\
  8. So basically, I wanted to make a function in server-side, that returns some stuff, that has been set-up in GUI, but this server-side function depends on, when some button is clicked, etc. Is there any way to do it?
  9. triggerClientEvent() started working :: try #4 now, working on other problem. Sorry
  10. I am done. I've made a function to display text on elements, on server-side, and I wanted to trigger client event, but what? Doesn't triggering. Look: allElems = 0 function dxDrawTextOnElem(element, text, height, distance, r, g, b, alpha, size, font) allElems = allElems + 1 triggerClientEvent("dxDraw", resourceRoot, element, text, height or 0, distance or 20, r or 255, g or 0, b or 0, alpha or 255, size or 1, font or "arial", allElems) end Boom, client-side script: --Ofcourse, I've created all tables + in "onClientRender" I put outputChatBox(), outputs "{}" (because tables are empty) addEvent("dxDraw", true) addEventHandler("dxDraw", resourceRoot, function(element, text, height, distance, r, g, b, alpha, size, font, k) local i = table.find(elements, element) --table.find(pattern, s) if i then elements[i] = element texts[i] = text heights[i] = height distances[i] = distance rs[i] = r gs[i] = g bs[i] = b alphas[i] = alpha sizes[i] = size fonts[i] = font else elements[k] = element texts[k] = text heights[k] = height distances[k] = distance rs[k] = r gs[k] = g bs[k] = b alphas[k] = alpha sizes[k] = size fonts[k] = font end end) addEventHandler("onClientRender", root, function() for i, text in ipairs(texts) do dxDrawTextOnElement(elements[i], text, heights[i], distances[i], rs[i], gs[i], bs[i], alphas[i], sizes[i], fonts[i]) end end) Jesus, I'm done with it. Sorry for asking a similar thing, but it's really difficult for me. For real, I'm like doing it second time, still fails.
  11. Actually that helped me Simple answer, simple result Forgot about magic word: T H A N K S
  12. Bro Idk what are u saying 'bout. Really. I am sooo newbie to programmin' in MTA
  13. Server-side: addEventHandler("onPlayerChat", resourceRoot, function(message, type_) if(type_ == 0) then triggerClientEvent("messageText", resourceRoot, message) setTimer( function() triggerClientEvent("messageText", resourceRoot, "") end, 10000, 1) end end) Client-side: addEvent("messageText", true) addEventHandler("messageText", resourceRoot, function(message) UNITED_MESSAGE = message end) addEventHandler("onClientRender", root, function() dxDrawTextOnElement(localPlayer, UNITED_MESSAGE, 1, 20, 255, 255, 255, 255, 1, "default-bold") end)
  14. I've seen that in tutorial of triggerClientEvent() on MTA Wiki, but OK BTW: Still nothing
  15. I guess here addEventHandler("onPlayerChat", resourceRoot, function(message, type_) if(type_ == 0) then triggerClientEvent("dxDrawMessageText", getRootElement(), message) setTimer( function() triggerClientEvent("dxDrawMessageText", getRootElement(), "") end, 10000, 1) end end) is the problem, with triggerClientEvent(), client: addEvent("dxDrawMessageText", true) addEventHandler("dxDrawMessageText", getLocalPlayer(), function(message) UNITED_MESSAGE = message end) addEventHandler("onClientRender", root, function() dxDrawTextOnElement(localPlayer, UNITED_MESSAGE, 1, 20, 255, 255, 255, 255, 1, "default-bold") end) So, I tried to outputChatBox() inside event handler of dxDrawMessageText, but it keept doing completely nothing. My code for outputChatBox(): --Code from event handler of dxDrawMessageText outputChatBox(UNITED_MESSAGE) --Rest of code from event handler of dxDrawMessageText BTW: dxDrawTextOnElement() exists. Any idea?
  16. Sooo, how can I use (I think for you well known) dxDrawTextOnElement() (client-side function, MTA Wiki site: [click]) in server-side scripts? I tried to export, plus this code: addEventHandler("onPlayerChat", resourceRoot, function(message, type_) if(type_ == 0) then call(resourceRoot, "dxDrawTextOnElement", source, message, 1, 20, 255, 255, 255, 255, 1, "default-bold") end end) (export in meta.xml for proof): <meta> <info author="VaporZ" name="VaporZ's utility [PL]" description="(desc)" type="script" version="1.0.1"/> <script src="cars.Lua" type="server"/> <script src="bank.Lua" type="server"/> <script src="utility.Lua" type="server"/> <script src="utility-c.Lua" type="client"/> <script src="testy.Lua" type="server"/> <file src="bank/accounts.xml"/> <file src="bank/atms.xml"/> <file src="cars/saved.xml"/> <file src="cars/shops.xml"/> <export function="dxDrawTextOnElement" type="client"/> </meta> But this don't work. Any ideas? Okay, I got further, but still it's not good. Look at this one (console error): ERROR: systems\utility.Lua:108: call: failed to call 'systems:dxDrawTextOnElement'
  17. ur right Why imma so dumb to not think about it and dont test it out. PS.: I have 3rd grade from maths, thats why I guess
  18. This, don't work. Idk why. Look: addEventHandler("onClientRender", resourceRoot, function() dxDrawTextOnElement(localPlayer, "P L A Y E R", 1, 20, 0, 0, 255, 255, 1, "pricedown") end) Ofcourse, I have dxDrawTextOnElement() function in my script and script is in type client.
  19. It's like 32nd when I test it out. dxDrawTextOnElement doesn't work. No errors, no results. Nothing. (My) code: --dxDrawTextOnElement is in my script + script is client-side addEventHandler("onClientRender", resourceRoot, function() for _, player in ipairs(getElementsByType("player")) do dxDrawTextOnElement(player, "P L A Y E R", 1, 20, 0, 255, 0, 255, 1, "pricedown") end end) --Idk wut is wrong Some advance?
  20. Alright, thanks bro! Already solved, but thanks for your advance, too!
×
×
  • Create New...