• Content Count

  • Joined

  • Last visited

  • Days Won


The_GTA last won the day on April 3

The_GTA had the most liked content!

Community Reputation

126 Excellent


About The_GTA

  • Rank

Recent Profile Visitors

1,565 profile views
  1. Please note that there exists another MTA bug: the camera matrix is sometimes wronly returned. See this Github issue for further details. I noticed that there was a tiny bug in the get_screen_coordinates function if the world coordinate was directly on the middle vertical line of the screen. Then the screen-y coordinate would be returned as inverted. Even though that issue would be virtually never encountered I decided to give you this following script which has the issue fixed: local function get_screen_coordinates(wx, wy, wz) local camMatArray = getElementMatrix(getCamera()); local camMat_right = camMatArray[1]; local camMat_forward = camMatArray[2]; local camMat_up = camMatArray[3]; local camMat_pos = camMatArray[4]; local camMat = Matrix(); local sW, sH = guiGetScreenSize(); local s_ratio = sH / sW; local _,_,_,_,_,_,_,fov = getCameraMatrix(); local fovRad = math.rad(fov/2); local tanfov = math.tan(fovRad); local farclip = getFarClipDistance(); camMat:setForward(Vector3(camMat_forward[1], camMat_forward[2], camMat_forward[3])); camMat:setRight(Vector3(camMat_right[1] * tanfov, camMat_right[2] * tanfov, camMat_right[3] * tanfov)); camMat:setUp(Vector3(camMat_up[1] * tanfov * s_ratio, camMat_up[2] * tanfov * s_ratio, camMat_up[3] * tanfov * s_ratio)); camMat:setPosition(Vector3(camMat_pos[1], camMat_pos[2], camMat_pos[3])); local invCamMat = camMat:inverse(); local invVec = invCamMat:transformPosition(wx, wy, wz); local function to_real_coord(val) return ( val / 2 ) + 1/2; end local ratWidth, depthDist, ratHeight = invVec.x, invVec.y, invVec.z; -- Screen top is -1 but should be 1 to match the up vector perception. ratHeight = -ratHeight; if (depthDist > 0) then ratWidth = ratWidth / depthDist; ratHeight = ratHeight / depthDist; if (math.abs(ratWidth) <= 1) and (math.abs(ratHeight) <= 1) then return to_real_coord(ratWidth), to_real_coord(ratHeight), true; end end if (ratWidth == 0) and (ratHeight == 0) then return 1/2, 1/2; elseif (ratWidth == 0) then return 1/2, to_real_coord(1 / ratHeight); elseif (ratHeight == 0) then return to_real_coord(1 / ratWidth), 1/2; end local dist_to_width = math.abs(1 / ratWidth); local dist_to_height = math.abs(1 / ratHeight); local scale_dist = math.min(dist_to_width, dist_to_height); ratWidth = ratWidth * scale_dist; ratHeight = ratHeight * scale_dist; return to_real_coord(ratWidth), to_real_coord(ratHeight), false; end
  2. Hello SryMan, welcome to the MTA scripting forums! Did you try searching for information on the MTA wiki? There is a helpful search bar in the left navigation pane and I typed "scoreboard" into it to find the following interesting article: At the bottom of the article is an example on how to add your very own column to the dxscoreboard resource! Please take a look at it and post any questions that you may have. - Martin
  3. Hello OrbTanT, your script seems to use external map data that is not provided in your post. But you mention the map of a potential MTA resource. Could you please try to find the map lines in question that show the erratic behavior in connection with your script? We would like to have data that we can test instead of combing through potentially an entire map file.
  4. The_GTA

    Bot spawn

    Hello unkwn, I think the issue is simple code structure. The problem is that you are creating a ped while you do not know what skin it should have at first. You should first determine the array of available skins and then create the ped: addEvent( "onZombieSpawn", true ) function RanSpawn_Z ( gx, gy, gz, rot, zombieType, row ) local safezone = 0 local allradars = getElementsByType("radararea") for theKey,theradar in ipairs(allradars) do if getElementData(theradar, "zombieProof") == true then if isInsideRadarArea ( theradar, gx, gy ) then safezone = 1 end end end if safezone == 0 then if table.getn ( everyZombie ) < newZombieLimit then if not rot then rot = math.random (1,359) end local ZombiePedSkins = false; if (zombieType == 1) or (zombieType == 2) then ZombiePedSkins = {10} elseif (zombieType == 3) then ZombiePedSkins = {11} end if (ZombiePedSkins) then local randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) ) local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), gx, gy, gz ) if (zomb ~= false) then setElementData( zomb, "zombie:type", zombieType ) if zombieType == 1 then setElementData( zomb, "head:n", 1) setElementData( zomb, "head:now", 0 ) elseif zombieType == 2 then exports.extra_health:setElementExtraHealth ( zomb, 400 ) setElementData( zomb, "head:n", 3 ) setElementData( zomb, "head:now", 0 ) elseif zombieType == 3 then setElementData( zomb, "respawn:zombie", row ) exports.extra_health:setElementExtraHealth ( zomb, 800 ) end setElementData ( zomb, "zombie", true ) table.insert( everyZombie, zomb ) setTimer ( function (zomb, rot) if ( isElement ( zomb ) ) then setPedRotation ( zomb, rot ) end end, 500, 1, zomb, rot ) local chaseanim, checkspeed = getZombieType ( zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setPedAnimation ( zomb, "ped", chaseanim, -1, true, true, true ) end end, 1000, 1, zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "status", "idle" ) end end, 2000, 1, zomb ) triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) end end end end end end addEventHandler( "onZombieSpawn", getRootElement(), RanSpawn_Z ) Hope this helps! - Martin
  5. You mean the TXD that you replaced on your server, if you connect to another server the same textures are visible even though that server does not have your resource? That could be a MTA bug if you mean that...
  6. Thank you for posting about this bug. I think you can fix this by, instead of setting the indicator intensity to 0, set the indicator light intensity to a 0.2 or something close to that. Then you also have to add fog effect as well as ambient lighting of GTA:SA so that the texture looks as if it were rendered by GTA:SA. I will look into it tomorrow.
  7. The_GTA

    [HELP] HTML.

    Hello iwalidza, I was hesistant to respond because I have no experience in the MTA implementation of web services but I think you want to read this wiki article: It contains helpful examples on how to create a Lua-based HTML interface.
  8. Hello PeeQ, do you know about the difference between server-side and client-side scripts? It looks like your first script is a server-side script because you are using the server-side "onMarkerHit" event. Is it intentional that you want to create server-side peds and markers? I am going to assume that it is, so let's fix your script! What iwalidza tried to do is put both code onto the client-side. But that user forgot to use the client-side onClientMarkerHit event instead of the server-side onMarkerHit. Please test your code next time, iwalidza. In order to synchronize data between server and client you have to use MTA event functions. We want to create a remote client-side event called "onClientShowGUI" and put our GUI code into an event handler of that event. Then inside of the server-side onMarkerHit event... addEventHandler("onMarkerHit", binco1b, function(hitElement) if (getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "onClientShowGUI", root); end end ); I recommend you to read up on MTA events to catch up on good MTA Lua scripting
  9. I see that it is the same problem many times so let's look at one examplein line 29: if (info.indicator_left_on == true) then Do you know about Lua tables? You don't have any "info" variable inside of this function. I think you meant to call the getVehicleIndicatorLights function with the vehicle of the local player as argument and then store the result into a local "info" variable. Try doing that at the top of that function. Then there are many followup errors because you try to look at invalid variables like "shader_left". You forgot to create those shaders inside of the info table between like 18 and 19. And then you have to use those variable from inside the vehicle indicator light info of any vehicle table. I recommend you to try using Lua tables! Lua tables are essential for good Lua scripters.
  10. Glad to hear that your issue has been resolved.
  11. I think the message is confusing. The timer just waits 2 seconds and not 5 minutes. I doubt that you are typing "/rp" two times faster than 2 seconds. But the script above does prevent ... "rapid" enabling. And then there is this weirdness about a timer inside of a timer. Maybe try increasing some timers?
  12. Hello NewMemberScript and welcome to our MTA scripting forums, could you please format your Lua code properly using the "<>" button in the richtext editor? Also please post in English because I cannot really understand your problem...
  13. There is no "error" in your script. But could there be any other resource that forces "vehicle_name" to be shown?
  14. Hint: you can calculate 1/2 plus the half of cosinus of a time-fraction multiplied by 2PI to get a wave-function between 0 and 1; by setting this value to the intensity shader variable you will get a "smooth" animation.
  15. Hint: we need to move the code from the key "up" handler into the key "down" handler somehow.