Jump to content

MIKI785

Members
  • Posts

    1,131
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by MIKI785

  1. Not true in this case as Lua is case sensitive. But you're right, in this case it actually doesn't make much sense to create a new function to call just one other function, just use 'anonymous' function by putting it straight into addEventHandler. addEventHandler("event", element, function () otherFunction(arg) end)
  2. MIKI785

    Crosshair

    screenX? Don't you mean screenX1? I guess that's because getScreenFromWorldPosition failed and returned false. Try this: function crosshair() local hitX,hitY,hitZ = getPedTargetEnd ( getLocalPlayer() ); local screenX1, screenY1 = getScreenFromWorldPosition ( hitX,hitY,hitZ ); if screenX1 then dxDrawImage(screenX1-(32/2), screenY1-(32/2), 32, 32, "files/crosshair.png") end end It might not draw it sometimes but maybe that's gonna happen for just a couple of frames and you might not see it, just try and see.
  3. The code is a mess but I guess the problem is that you're not updating stat8. Just move local stat8 = getPlayerStat (getLocalPlayer(),77) into the event handler before guiProgressBarSetProgress.
  4. You can create GUI in HTML using CEF, that is createBrowser/guiCreateBrowser. What do you mean by bind? You can interact with Lua part of your resource using javascript in the HTML page as explained here.
  5. You don't need a shader unless you want to draw the GUI on an element in the GTA world. If you just want it to float around then dxDrawMaterialLine3D is good enough. The material you would draw would be a render target created using dxCreateRenderTarget. Once you create the render target you can use that as a second screen (dxSetRenderTarget) to draw dx stuff on, after that's done you change it back to the actual screen using dxSetRenderTarget again. Do you understand or do you need an example? There are some examples on the wiki but I could write one as well if needed. The only thing is that I'm not sure how would the player interact with such GUI, I'm sure it's possible but it would require a lot of calculations and I don't think I would be able to do that.
  6. MIKI785

    ScreenShot

    Even that won't work, https://wiki.multitheftauto.com/wiki/Game_Processing_Order. As you can see GUI (incl. chat) gets drawn near the end of the frame and there is no event being called after that happens.
  7. What do you mean? Is that a custom (created by mta) object? If so then the vehicle's lights wont reflect on it, if thats the problem. You'd have to use some shader for that to work.
  8. Just to make it clear, that wouldn't work, you're mixing server/client functions. You'd have to ask the server to kick you using triggerServerEvent, also if the player had a resolution of 640x480 (yes, small resolution like that is possible), it wouldn't work. Also, you mixed up your Xs and Ys, argh.. that code is just completely wrong
  9. How did you change the acl? Did you actually edit the file itself? if so, you have to use aclReload afterwards.
  10. Which one is line 313? Where is source and msg defined? Also use code tag next time.
  11. Read this: https://wiki.multitheftauto.com/wiki/SetElementCallPropagationEnabled
  12. Yes it is, https://wiki.multitheftauto.com/wiki/TeaEncode.
  13. Why would it be a risk? removeWorldModel has a radius argument, so it will just affect LV if done properly, won't it? I never tried anything like this myself, but maybe you just forgot about that radius thingy.
  14. That's very strange, i use dimensions myself and i've never had this issue. It looks like it gets set on the server but the client still thinks that you are in the same dimension (but then why does the nametag disappear?). Try running getElementDimension() on you and the other player after you set the dimension using that command. Or just: addEventHandler("onClientRender", root, function () dxDrawText("localPlayer: " .. getElementDimension(localPlayer) .. "\nremotePlayer: " .. getElementDimension(getPlayerFromName("teszt1")), 200, 200) end) I know, i know it's an awful code, but it's just for debug.
  15. I'm sure there is a way but wouldn't it be easier to just replace the texture with an empty texture? Like 1x1 transparent .png file?
  16. Try this: TbPlEmp = {} function StartJobEmpilhadeiraForPlayer() --> verifica se não há uma tabela e cria uma no nome do player ! if not(TbPlEmp[source]) then TbPlEmp[source] = {} end --> Verifica se o player tem um veículo e destroy se houver ! if TbPlEmp[source]["veh"] then destroyElement(TbPlEmp[source]["veh"]) TbPlEmp[source]["veh"] = nil end TbPlEmp[source]["veh"] = createVehicle(530,2799,-2401,13,0,0,93) warpPedIntoVehicle(source,TbPlEmp[source]["veh"]) TbPlEmp[source]["box"] = createObject(1558,2779.2048,-2485.4523,13.1577,0,0,0,false) TbPlEmp[source]["marker"] = createMarker(2724,-2398,12,"cylinder",3,0,255,150,255,source) setElementPosition(TbPlEmp[source]["box"], 1558,2779.2048,-2485.4523) end addEvent("GiveItensForJobEmpilhadeira",true) addEventHandler("GiveItensForJobEmpilhadeira",root,StartJobEmpilhadeiraForPlayer) function PlayerHitInMarkerLeaveBox(hitElement) if (isElement(hitElement) and getElementType(hitElement) == "player") then if TbPlEmp[hitElement] and source == TbPlEmp[hitElement]["marker"] then if TbPlEmp[hitElement]["box"] and isElement(TbPlEmp[hitElement]["box"]) and isElementWithinMarker(TbPlEmp[hitElement]["box"],source) then outputChatBox("#FFAA00||#00FF00 ✔ #FFAA00||#00FF00 ok !",hitElement,255,255,255,true) else outputChatBox("#FFAA00||#FF0000 ✘ #FFAA00||#FF0000 error !",hitElement,255,255,255,true) end end end end addEventHandler("onMarkerHit",root,PlayerHitInMarkerLeaveBox) All I did was set the box's position to the same position, you might think that it makes no sense but it should work.
  17. It would be useful. But in the meantime you could use this simple shell script (if running linux): for name in *.png #will go through all pngs, use * for all files. do echo "<file src=\"/images/$name\" type=\"client\" />" #$name will get replaced with file names done Just put it in the same directory as the files and then run simply like: ./test.sh > list.txt Then just copy it from list.txt to meta.xml. Hopefully someone can find it useful if they're not familiar with shell scripting.
  18. I really doubt that that's possible. The only way I could think of would be using setElementParent but on its wiki page it explicitly says: "This function does not change when an element will be destroyed - Elements are always destroyed when the resource that created them is stopped." So I don't think so.
  19. MIKI785

    CCTV

    Try putting this anywhere in your code: addEventHandler("onResourceStart", resourceRoot, function () executeSQLCreateTable("cctvterminals", "name TEXT, loc TEXT, interior INTEGER, restricted INTEGER, access TEXT, options TEXT") executeSQLCreateTable("cctvcameras", "name TEXT, type INTEGER, terminal TEXT, loc TEXT, interior INTEGER, target TEXT, color TEXT, scan TEXT, zoom BOOL, motor BOOL, options TEXT") end) executeSQLCreateTable uses CREATE TABLE IF NOT EXISTS so it doesn't matter if it runs every time the resource starts.
  20. What do you mean by "directly load from vps" ? You can't possibly load a model without downloading it first because the client needs all the model data (the full file) in order to load it. It's not like a sound or video that can be streamed, because in that case you don't need the full file to play it. So no, it's not possible. And it's also not possible to compress the files, sadly we don't have the ability to compress/uncompress (like put it into .zip) files in mta. Although this module https://wiki.multitheftauto.com/wiki/Modules/FileSystem might be able to do that, but i never used it myself so I can't say.
  21. I'm no expert at this but maybe you're trying to run 64bit mta server on a 32bit machine or the other way around, are you sure you're using the correct version? Btw. wrong section.
  22. What value does WEAPON_SHOVEL have?
  23. That's intentional, but you're able to change the maximum transfer rate using the bandwidth argument. So if your server has a good connection you can increase it.
  24. Ok then. But just a bit of advice, dont use triggerClientEvent to transfer large amount of data as it could stall the server. Use triggerLatentClientEvent instead.
×
×
  • Create New...