Jump to content

Search the Community

Showing results for tags 'element'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



About Me






    Map files

    Map files Table of contents: Introduction How to read a map file? Broken map file, what to do? Editor bugged, what to do? Modify your maps outside of MTA Extra links Introduction A map-file! What is that? The name already gives away the definition. It is a file which contains a MTA map. The format makes maps portable, so that you can send them over to your friends. You can recognize map-files by the extension: .map Here is an example of a map: Syntax highlight When you open a map file in your te
  2. I would like to know how I could get ElementData from server to client and vice versa -- server side marker = createMarker(0, 0, 1.5, "cylinder", 2, 255, 0, 0) setElementData(marker, "Item", 5) addEvent("GetItem", true) addEventHandler("GetItem", root, function() ClientMarker = marker ItemOfClientMarker = getElementData(marker, "Item") end) addEventHandler("onMarkerHit", marker, function(hp) triggerClientEvent("Element", resourceRoot) setElementData(hp, "ItemTwo", ElementVariable+getElementData(marker, "Item")) end) -- client side function dxDrawText
  3. -- server side cylinder = createMarker(-712.09100, 967.01917, 12.33547-1, "cylinder", 1.5, 255, 50, 0, 255) setElementData(cylinder, "BoxWithPoints", 0) function TIMER() if getElementData(cylinder, "BoxWithPoints") >= 8 then setElementData(cylinder, "BoxWithPoints", 8) else setElementData(cylinder, "BoxWithPoints", getElementData(cylinder, "BoxWithPoints")+1) end if isElementWithinMarker(source, cylinder) then triggerServerEvent("givePointsToServer", root) PointsServer = getElementData(source, "points") BoxPoints = getElementData(cylinder, "BoxWithPoints") setEl
  4. I would like to know something about ElementData, the most about these two commands {getElementData, setElementData}, could someone help me understand these two things. For example, write a guide that would help me a lot and give me a heart
  5. Hi, I want to get list of visible elements (in my case pickups) to player in client-side code so I can loop through these elements. By visible, I mean literally player can "see" with their own eyes. You can also think it as loaded/rendered elements within given range. eg. element list of in 400.0 meters radius with player in center. I couldn't find proper function for it. Thank you for your further helps. Edit: these pickups are created server-side
  6. 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"
  7. 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?
  8. Hello I'm just asking for function or way to get the local player in the Server-Side in the mod Please explain me all the possible ways to get the local player in the Server-Side in Easy , Clear and detailed way Thank you !
  9. This is the code: local now = getTickCount() local x,y = interpolateBetween(one, one1, 0, two, two1, 0, (now - start) / ((start + 2500) - start), "Linear") local now2 = getTickCount() local x2,y2 = interpolateBetween(asd, asd1, 0, fgh, fgh1, 0, (now2 - start2) / ((start2 +2500) - start2), "Linear") if right == false then dxDrawRectangle(x, (sy_/2-20) * ym, 3* xm, 40 * ym,tocolor(255,255,255,255)) else dxDrawRectangle(x2, (sy_/2-20) * ym, 3* xm, 40 * ym,tocolor(255,255,255,255)) end -- if x >= 1063 and x <= 1073 and right == false then
  10. I want to render a rectangle to the cursor, but the rectangle too far from the cursor.. How to fix this in my code? code: local sx_, sy_ = 1920, 1080 local sx__, sy__ = guiGetScreenSize() local xm, ym = sx__/sx_, sy__/sy_ function render() local screenx, screeny = getCursorPosition() dxDrawRectangle((sx_-687) * xm * screenx, (sy_/2+70) * ym * screeny, 170 * xm, 25 * ym,tocolor(255,181,64,80)) end addEventHandler("onClientRender",root,render) the problem:
  11. Olá Pessoal, como fazer para clicar em um veículo e receber no chat uma localização da roda dele? Já tenho a ideia de como usar o getVehicleComponentPosition (algo do lado do cliente), mas como identificar ou veicular o que estou tentando ver no OnElementClicked é do lado Server? function rodadireita (source) local vehicle = --Queria por aqui o veiculo que estou clicando x, y, z = getVehicleComponentPosition ( vehicle , "wheel_rf_dummy", "world") outputChatBox ( "Cordenadas:"..x..", "..y..", "..z, 255, 255, 255, true ) end
  12. Quando utilizo: function aoSair(player) outputChatBox("| AVISO | você tem 30 segundos para voltar ao veículo.", player, 255,255,255, true) setTimer (function ( ) destroyElement(source) end, 30000, 1) end addEventHandler("onVehicleExit", getRootElement(), aoSair) o veículo não se destrói. Erro: Expected element at argument 1, got nil. Imagino que o erro aconteça porquê depois do jogador sair, source não é mais veículo, mas não sei como resolver. Outra coisa, estou usando esse método de destruir porque não consigo achar outra opção (sou novato em script). Que
  13. local vehicleElements = {} allVeh = {510} local pickupTable = { {1086.1798095703,-1801.6898193359,13.601690292358}, } function createPickupOnServerStart () for i, cor in ipairs (pickupTable) do local pickup = createPickup(cor[1], cor[2], cor[3], 3, 1274, 0) setElementData(pickup, "pickupArenda", true) end end addEventHandler("onResourceStart", getResourceRootElement( getThisResource() ), createPickupOnServerStart) function onResourceStop (veh) if isTimer(vehicleElements[veh]) then killTimer(vehicleElements[veh]) end --vehicleElements[veh] = destroyElement(ve
  14. This is in 1440x900 (in my resolution): This is in 1920x1080: I calculate the dx elements position with this: local sx_, sy_ = guiGetScreenSize() local sx, sy = sx_/1440, sy_/900 And i draw dx elements like this: dxDrawRectangle(sx / 2 + 290, sy / 2 +240,850,65,tocolor(0,0,0,200)) What wrong??? How can i fix this problem??
  15. Events tutorial The reason why I created this topic, is that a lot of people are struckeling with them. In this tutorial I will only discus the very basic of them. If you want more, then there is a list of links at the end with more information. If I made any mistakes in the code, please let me know because I am not going to test every part. What are events? (basic description) Events are something custom added by MTA to make it easier to bring scripting(Lua) closer to our game. If we do not have events, then the only thing we can do is give instructions to our game. But our code
  16. Hi! My problem is that on the client side the object is seen by only one person who has tried it out and I want everyone to see the object on the server. Client Side: local rx,ry,rz = getElementPosition(getElementData(localPlayer,"cage")) local cx,cy,cz = getVehicleComponentPosition(getElementData(localPlayer,"cage"),"static_p01") local x,y,z = rx + cx, ry + cy+3, 0.8 local a,b = getScreenFromWorldPosition(x,y,z) local magnet = createObject(1301, rx-0.6, ry-5, rz+4, 0, 0, 0) setObjectScale(magnet, 0.3) setElementCollisionsEnabled(magnet, false) moveObject(magnet,
  17. Hello. Is there any difference between using the entity's name instead of a custom name in a variable? local vehicle = createVehicle (...) or local theVehicle = createVehicle (...) Why does the Wiki always avoid using the entity's name as variable? If I use the entity's name instead of a custom name, is this a bad programming method? PS: I am not using OOP.
  18. is it possible to get an element from a table by type , for example when i get attached elements to my car , i attached a sound element to my car. but get attached elements returns all the attached elements in to a table ( as i know) , is there a way to get the sound element from the table ???
  19. I want create a bank-system. But i don't know, how to begin the script. Can i make it possible this with setElementData, and getElementDatas? sorry for my bad english
  20. I don't understand this Error = [Expected bool at argument 2, got none]... how to use function clientSide setElementFrozen ? --client side script function FPlayer () setElementFrozen (this, true) --This is how this method? end
  21. I created "RepairMarkers" and when player hits any of them, their car's health must to increase. But I don't know, how to check every marker here: if isElementWithinMarker( getLocalPlayer(), RepairMarker[1] ) then Instead of "RepairMarker[1]" I want to check every marker Source: function CreateMarkers( thePlayer, seat ) if thePlayer == getLocalPlayer() and seat == 0 then BaysideRM = createMarker( -2259.027, 2386.142, 3.897, "cylinder", 3, 233, 96, 21, 100 ) Area69SkyRM = createMarker( 307.876, 2051.747, 16.587, "cylinder", 5, 233, 96, 21, 100 ) Repai
  22. function test() setElementPosition ( mark, pos.x,pos.y,pos.z ) end addEventHandler("onMarkerHit", mark, test) this is the code. if i hit the marker, the element position change for all players.. how to fix this? sorry for my bad english.
  23. hello all i have scripted a command for warehouse but the problem is i want a teleport button for knife arena in my exist guiwindow! client.lua : addCommandHandler( "knife", function( player ) setElementInterior( player, 1, 1401.3, -15, 1000.8 ) -- teleport player to the centre of SA end ) for gui code i dont want to paste here come pm for cilent code of guiwindow,button why i dont want to paste here is members can easy clown my scripts by using my cilentcode!! please help me guys screenshoot ; https://imgur.com/WgJR2Qi
  24. http://imgur.com/a/og3e5 this is the problem, how to fix this? code: local screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", root, function() local x, y, z = getElementPosition(localPlayer) local location = getZoneName ( x, y, z ) dxDrawImage(screenW * 0.0076, screenH * 0.7300, screenW * 0.2194, screenH * 0.2422, "mapbg.png", 360, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText(location, screenW * 0.0965, screenH * 0.7370, screenW * 0.2250, screenH * 0.7567, tocolor(118, 224, 90, 255), 1.00, "default-bold", "left", "center",
  25. I have this script: dxDrawRectangle(screenW * 0.7549, screenH * 0.6933 - 1 - (33*k), screenW * 0.2347, screenH * 0.0211, tocolor(0, 0, 0, 145), false) dxDrawText(v.text, screenW * 0.7535, screenH * 0.6933 - 1 - (66*k), screenW * 0.9896, screenH * 0.7144, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, true, false) and different resolutions the distance grow, or lessen. Picture: How to fix this problem? I want, that all resulotions distance the same. Thanks the help! And sorry for my very bad english!
  • Create New...