Jump to content

Overkillz

Members
  • Posts

    545
  • Joined

  • Last visited

  • Days Won

    2

Overkillz last won the day on April 10 2023

Overkillz had the most liked content!

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Overkillz's Achievements

Playa Partner

Playa Partner (27/54)

43

Reputation

  1. Thats probably because server-side is running before client side, so, in this case, you should make a trigger from the client to the server and send the response back to the client again. Not sure if there is a better option for it cuz using a timer is not a good idea aswell ... So here goes my solution: -- ## CLIENT-SIDE local myCountry = "" addEvent("onPlayerCountryReceived", true) addEventHandler("onPlayerCountryReceived", root, function(country) outputChatBox(country) myCountry = country end) addEventHandler("onClientResourceStart", resourceRoot, function () triggerServerEvent("onRequestPlayerCountry", resourceRoot) end) -- ## SERVER-SIDE addEvent("onRequestPlayerCountry", true) addEventHandler("onRequestPlayerCountry", resourceRoot, function() local country = exports.admin:getPlayerCountry(client) triggerClientEvent(client, "onPlayerCountryReceived", resourceRoot, country) end)
  2. The source element of the event onResourceStart is not a player, so, you are triying to get the country of a Resource, obyously this is not going to work. What you should do ? You need to loop the whole player list by using getElementsyType("player") and inside that loop ask for player country and do the trigger aswell. Best regards.
  3. Many of the times we don't need to use MTA SDK. Otherwise, he is trying to build an api, so, it useless to use MTA SQL connector in this case aswell .. -------------------------------------------------------- Well, I have done some researches about the issue its in php file. You are not receiveing a JSON, so, the decoding function won't never work. If you directly output the content, you probably are going to get something un-parsed which is related with 'WebKitFormBoundary' or similar. There are methods made by people to parse it and try to get a json content, but, it doesn't support weird content. Regards.
  4. Overkillz

    setTimer

    Not sure if this can be even better. Try this one: addEventHandler("onVehicleExplode", root, function() setTimer(destroyElement(),3000,1,source) end)
  5. No, you are not using the right event. Checkout onClientMarkerHit event. The source parameter is the event, so, you just need to compare such element with you variable infoMarker and do whatever you want. Best regards.
  6. Well, I've just realized about few things that I wasn't aware about them. First of all, If you store your exported resource which containts your exported functions in a variable, you can't call those functions with: myVariable(dot)functionName -- This doesn't work util.isEmptyString("FIRST_PARAMETER", "SECOND_PARAMENTER") --## RESULT: SECOND_PARAMENTER -- Right way to read parameters util:isEmptyString("FIRST_PARAMETER", "SECOND_PARAMENTER") --## RESULT: FIRST_PARAMETER Thats all, thanks for reading.
  7. I'm having an issue while using exported functions with receive some parameters Im trying to read the first parameter, but it doesn't work at all, it reads the second one. What do I mean ? -- CLIENT local util = exports["SHI_Util"] function whatever() util.isEmptyString("FIRST_PARAMETER", "SECOND_PARAMENTER") end -- SHARED CLASS function isEmptyString(s) outputChatBox("Recived string: " ..s) end -- RESULT --> Recived string: SECOND_PARAMENTER -- META.XML <meta> <export function="isEmptyString" type="shared"/> </meta> Something similar happens with server side exported functions. I hope you can bring me a hand with this. Thanks in advice, best regards.
  8. Nonsense ? For other resolutions will be the default one "x1". On the other hand, there is something called elseif (Not sure if you heard about it) which allows you to set a multiplier for other resolutions ...
  9. You could use a variable that increase the size value of fonts, dx sizes ...etc local sX,sY = guiGetScreenSize() local multiplier = 1 if sY >= 2160 then multiplier = 2 end function yourOtherFunctions() dxDrawRectangle(0,0,250*multiplier, 100*multiplier) end
  10. Hello dear community, I'm back in development scene and I have some doubts about performing my current scritps that I made like 4 years ago. Well, the first question is Passing an element with multiple datas decrease is not a good way to a proper performance ? In fact, I have this doubt with a data which store players in a specific arena. Imagine that there are 32 players in that arena, well, im storing them in a table which is a data of the element. My question is, passing the whole element pass only the pointer address or pass the elements, therefore, the performance could be decreased ? I leave you a picture of the element. The other question is, what about if I trigger from a client to the server side an element which containts some datas, but before the element arrives to the server, some of the data changes his values. Which values arrives ? The updated one or the old one ? Best regards.
  11. Might you should check the following doc engineRequestModel It has an example that might could make you achieve your goal
  12. Did u add it to your meta file ? If you can, show is your meta file
  13. Are you sure that the file "states/fenyjelzo_szabad.txd" is loaded correctly ? Might you could add a condition with "fileExists" function to confirm that it exists. Regards.
  14. Not tested addEventHandler("onClientRender", root, function() local a = string.format("FPS: %d PING: %d", 51, getPlayerPing(localPlayer)) local c_version = "MTA:SA"..getVersion().mta.."*" dxDrawText(a, 0, 0, sx-dxGetTextWidth(c_version), sy, tocolor(255, 255, 255, 255), 1, "default", "right", "bottom", false, false, false, false, false) end )
  15. Whats exactly do you want to do ? It is doing what you have coded.
×
×
  • Create New...