Jump to content

The_GTA

Distinguished Members
  • Posts

    461
  • Joined

  • Last visited

  • Days Won

    44

Everything posted by The_GTA

  1. The_GTA

    Script issues

    I know that it is a bad move to voice-out about bugs without evidence, but a similar-sounding spurious issue has occured to me on a LAN server with low ping where we played with three people but one person had the race gamemode fail to load. The result was that the person spawned outside of the car but still had GTA SA vehicle radio play on-foot. I wonder if this is due to the fact that UDP is a terrible networking protocol for a reliable game experience or that there are hidden game-up-to-date issues.
  2. I personally appreciate your passion for the GTA franchise related to multiplayer gaming. People like you are big examples of engineering your ideas into reality. Without testing your promoted game installation, just by judging the download size I see that you are packing a lot of content! We as a community surely love people who put their time and passion into creating new content. I am not sure how your content lays out and how much of it is of sensitive nature. But I sure hope that you have taken the necessary protections and in turn act as a good example for the russian GTA modding communities. Sometimes you guys surely have a funny way of treating other people's contents!
  3. You're welcome! Working with the GPU is very complicated because it is a piece of hardware that has been incrementally created. A lot of things that seem intuitive will lead you to annoying & strong drawbacks, most likely due to aging & limited API design (Direct3D9). That is why it is important to get support on our forums whenever your drawing code does not work how you imagine it.
  4. I have received your resource files for full evaluation and have detected an alpha-based image configuration combined with append-layer based shader attachment. Based on the provided files, here is my defect report: By creating and attaching multiple shaders onto the same "head_diff_000_a_whi" texture of the player model you are inducing depth-fighting between the bart and the face textures. It looks like a coding error in your script due to COPY & PASTE. In order to focus your eyes for critical reading, take a look at line 348 of example.lua: engineApplyShaderToWorldTexture(shader,clothes_ID[7]["face"][1],thePlayer, true) In this line you are using the "face" texture. Are you meaning to use the "beard" texture instead? If you are, then you can fix easily fix this issue by chaging the string and making sure that each shader points to only one texture. In case you are not, there is a fundamental flaw in your design that is caused by misunderstanding how the GPU works and how MTA is utilizing it. By using append-layers and enabling depth-testing, the GPU is attempting to redraw the beard onto the original model BUT this is not stable because of mathematical inprecision. Your textures will start to flicker or one will hide another. So how to fix this defect? Instead of creating two shaders that draw onto one texture, I recommend you to off-screen combine the textures and then apply them to a shader. You can use the dxCreateRenderTarget, dxSetRenderTarget, dxCreateTexture and dxDrawImage functions to create a drawing surface (render target), layer the face + beard onto each other and then use the resulting render-target as texture in your shader. Do not forget to enable alpha for the render-target! Here is how a combine-stage of two textures might look like: local function renderCombinedTexture(tex1, tex2) local tex1w, tex1h = dxGetMaterialSize(tex1) local tex2w, tex2h = dxGetMaterialSize(tex2) local cw, ch = math.max(tex1w, tex2w), math.max(tex1h, tex2h) local rt = dxCreateRenderTarget(cw, ch, true) dxSetRenderTarget(rt) dxDrawImage(0, 0, tex1w, tex1h, tex1) dxDrawImage(0, 0, tex2w, tex2h, tex2) dxSetRenderTarget() return rt end You should use renderCombinedTexture in the onClientRender event handler to adhere to MTA's recommendations. If you have combined the textures and the combined texture does replace a predefined texture fully of the GTA SA DFF file, then I recommend you to set appendLayers to false instead. I was unsure how your system worked in my previous reply so I spearheaded a guess. But now with my actual analysis I recommend you to NOT use the appendLayers functionality. IMO it is a feature of MTA with very limited applicability. You seem to use weird global variables across your script. Take a look at the following line which repeats itself but seems to imply a contradiction: hat[thePlayer] = shader The global table is called "hat" but the function it is used in is called addFace or addBart. Could this be a variable misuse? I am looking forward to hearing back from you!
  5. Hello ju4nnnnnnn, have you modified your acl.xml file? This error message sounds like you are using a non-standard access permission configuration. Inside of the acl.xml file you should find the following relevant entries: <group name="Admin"> <acl name="Moderator"></acl> <acl name="SuperModerator"></acl> <acl name="Admin"></acl> <acl name="RPC"></acl> <object name="resource.admin"></object> <object name="resource.webadmin"></object> <object name="resource.acpanel"></object> </group> ... <acl name="Moderator"> ... <right name="function.startResource" access="true"></right> ... </acl> By default, the resources of the admin ACL group do have the Moderator ACL rights list assigned to them and it gives them access to the startResource function. Please check if your ACL.xml file has changed and try to revert the configuration to the last known good state.
  6. Hello SkyDow, welcome to our forums! In this Scripting section we like to help you solve your Lua programming related questions so that you get to spawn your vehicles by either writing the Lua code yourself or making use of existing resources. It sounds like you have made a map using the MTA map editor and are trying to use it inside of your own server. I think that by starting the map on your server then you can at least make the vehicles be placed on your server. If you want to add respawning rules then I recommend you to script it yourself using the toggleVehicleRespawn, setVehicleRespawnPosition and setVehicleRespawnDelay functions. You could loop through the map elements using the getElementsByType function in combination with the "vehicle" element type.
  7. Cool job! I think your work shows how creative you are.
  8. Sorry but I do not work on the next version of scene2res at the moment.
  9. Este é um texto traduzido. Recomendo que você use scene2res para conversão de mapa GTA para MTA. Ele otimiza automaticamente os arquivos TXD para você. Converter e carregar mapas GTA sem aprovação dos criadores de conteúdo está errado. scene2res Project Top Page - OSDN
  10. Parts of it, like drawing text on elements, have to be done clientside. You might have to tell clients the text string using an event and when it should stop displaying (I recommend a timer).
  11. Is one of the files missing that is inside the meta.xml? It is because of unexpected data loss? (hard drive starting to fail, unexpected delete operation inside server folder, etc) You can solve load failures by fixing the meta.xml problems and then executing a "refresh" command inside of your MTA server executable.
  12. Hello Mario222, since you have asked in your title about "how to create" such a system, I want to give you basic hints about useful functions of MTA and Lua in general. You can use the table.sort Lua table library function to put table entries into a point-based order. This function can receive a table of tables as input and then sort based on an item key, for example the points of a player. The wiki documentation for the MTA:SA race resource is the go-to location for details about the events and functions when creating add-ons for it. I think that the "onPlayerFinish" event is of interest to you. By using its rank parameter you can design a mathmatical point-distribution function based on finish-positions. I recommend you to use a fixed table of points for a each player finish-position. When you are more advanced in mathematics you wouldn't be asking this question, right? But you could give it an exponential decrease based on a higher first-position score depending on the player count. This detail is up to you, in other words I won't be providing you with the advanced solution for nothing.
  13. Thank you very much. I am trying my hardest to help you and everyone else who is genuinely in the need of it. You're welcome!
  14. Sure. Here is my example. -- We assume that there is only one warehouse on the map/server. -- We assume that being inside the warehouse means being inside the colshape. local warehouse_timer = false; local warehouse_col = false; -- TODO. local function warehouseEnter(shape, matching_dimm) if (shape == warehouse_col) and (matching_dimm) then -- If we previously had a warehouse_timer, then we should clean it up here regardless. if (warehouse_timer) then killTimer(warehouse_timer); warehouse_timer = false; end warehouse_timer = setTimer( function() -- TODO -- If the timer has finished, then we should clean it up. warehouse_timer = false; end, 1000, 1 -- TODO ); end end addEventHandler("onClientElementColShapeHit", root, warehouseEnter); local function warehouseLeave(shape, matching_dimm) if (shape == warehouse_col) and (matching_dimm) then -- If we have previously entered the warehouse clientside, then we should -- have the warehouse_timer variable set to not false. We assume that -- the warehouseEnter function has been properly implemented. if (warehouse_timer) then killTimer(warehouse_timer); warehouse_timer = false; end end end addEventHandler("onClientElementColShapeLeave", root, warehouseLeave); Good luck with your project. I like that you phrased your idea in a serious way.
  15. You're not even giving a full description what your script is supposed to do! Besides that, your script has flaws. But the flaws of your kind of scripts do not allow general support. Instead of doing too much, I want to give you hints: function warehoueEnter() if (getElementType(source) == "ped") or (getElementType(source) == "marker") then return end --thought maybe this would work if isElementWithinColShape(localPlayer, WarehouseCol1) == true then setElementData(localPlayer, "timer", 60) :O = setTimer(warehoueTimer, 1000, 61) else killTimer(:O) end end addEventHandler("onClientElementColShapeLeave", localPlayer, warehoueEnter) addEventHandler("onClientElementColShapeHit", localPlayer, warehoueEnter) you fire this event for all colshapes; is this really what you want to do? for what colshapes do you want warehoueEnter to really trigger? if you asked this question in a straightforward way, maybe people could help you much easier. If you want to limit triggering events to certain elements such as WarehouseCol1, use the addEventHandler function with propagate set to false and comparing the first argument of the event handler callback to WarehouseCol1. Look at the wiki page of onClientElementColShapeHit for an example! you triggering this event handler for both leaving and entering the col shapes makes no sense. could you please decide on what is important here: entering the warehoue if you enter the col shape (onClientElementColShapeHit) or when you leave it (onClientElementColShapeLeave)? There seldom exist MTA scripters that seek support on our forums and I like to see you here. If you want to listen to my advice, then please learn from the code structures and examples from the wiki. Format your code exactly like on the wiki pages. Get used to best-practice coding rules.
  16. Which functions do you mean in particular? I don't understand.
  17. Yes. I do not like to start support requests through private messaging but continuing there is fine.
  18. Do your textures have alpha enabled? This looks like a hack-job to me and I am not convinced that you truly know how HLSL shaders work. If the beard is an alpha texture then you might have to set relevant alpha-enabling render-states. What you have to set depends on the asset structure themselves and unless you share the textures I cannot give you a recommendation.
  19. There is a fundamental logic issue in your script. The element type of the root element is "root". Thus the following check will always fail: if (getElementType(getRootElement()) == "ped") then return end --thought maybe this would work Do you know about predefined event handler global variables? They are set based on the situation of each issued event. Look them up here. I suggest you to use the source event handler global variable like this: if (getElementType(source) == "ped") then return end The following is kind of weird, so please split up the event handler code: --Leaving the warehouse function warehouseLeave() if (getElementType(getRootElement()) == "ped") then return end --thought maybe this would work if isElementWithinColShape(localPlayer, WarehouseCol1) == true then timertxt = getElementData(localPlayer, "timer") Wtimer = dxDrawTextOnElement(localPlayer, "Defend Warehouse: "..timertxt, 1, 20, 255, 0, 255, 255, 5, "arial") elseif Wtimer == nil then return else destroyElement(Wtimer) end end addEventHandler("onClientRender", getRootElement(), warehouseLeave) -- OK. because of dxDrawTextOnElement addEventHandler("onClientElementColShapeLeave", getRootElement(), warehouseLeave) -- Why??? Good luck with your scripting!
  20. Could you name the Antivirus please? This way users who face the same problem will know about it. MTA does not recommend disabling your antivirus. If you are facing such problems it is a good idea to look for an alternative. If you are using Windows 10 or higher then, based on my experience, the protection that is built into the OS itself is pretty good.
  21. Please take a look at the engineApplyShaderToWorldTexture wiki documentation. Are you properly setting the appendLayers parameter to true or leaving it out? It might help to support you if we had insight into your shaders themselves. They could be designed in a way that does not allow layering. Could you share them with us?
  22. Understandable. I am hoping for a modding API a'la plugin-sdk in the new GTA SA version. In some rumors there was talk of a comparison to high fidelity mods in the community. To not confuse the public I have, cautiously in advance, edited the Wiki page on how to buy GTA SA that the new game version on digital markets will not be compatible with MTA. This might of course change but it is unlikely to happen fast. I sure hope so! As vague as our participation in the upcoming game release is, as vague is also the modding capability of it. Due to the recent crossfire between GTA modding community and R* Games/Take-Two especially. But I am hoping for a more stable and capable engine that would not require those ugly assembly hacks anymore to get the game to multiplayer fruition.
  23. It looks like you forgot to adjust the second parameter to outputChatBox which should be the element to send the message to. Did you know that you can simply use the item variable? The reason is that it points to each eligible player exactly one time. If you pass the nearbyPlayers variable which is a list of players then it sends the message in the color 255, 255, 0 to the nearbyPlayers multiplied by (#nearbyPlayers - 1). Do this instead: -- This way the player who sent the message is guarranteed to always receive it independent of any math. outputChatBox ( getPlayerName(source).." says: "..message, source, 255, 255, 255, true ) -- Send to all other nearby players now. for key, item in pairs (nearbyPlayers) do if not (item == source) then outputChatBox ( getPlayerName(source).." says: "..message, item, 255, 255, 0, true ) end end Those small errors happen to the best of us.
  24. Maybe something like this? local is_mode_running = false; local kill_last_timer = false; addEventHandler("onGamemodeMapStart", root, function(startedMap) -- Clean up from previous runtime. if (kill_last_timer) then killTimer(kill_last_timer); kill_last_timer = false; end is_mode_running = true; outputChatBox("started mode!"); end ); local function on_mode_end() outputChatBox("end of mode!"); end local function on_last_survivor(survivor) kill_last_timer = setTimer( function() killPed( survivor ); kill_last_timer = false; end, 2000, 1 ); end addEventHandler("onPlayerWasted", root, function() local alivePlayers = getAlivePlayers(); if (is_mode_running) and (#alivePlayers <= 1) then is_mode_running = false; on_mode_end(); if (#alivePlayers == 1) then on_last_survivor(alivePlayers[1]); end end end );
×
×
  • Create New...