Jump to content

Search the Community

Showing results for tags 'function'.

  • 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





  1. So the problem is that there is a function called "animate" https://wiki.multitheftauto.com/wiki/Animate and with this function we can animate the GUI etc ... but there is one problem, because I would like to stop this function at some point and stop animating at some point, there is a way to do that ?
  2. I started scripting with GUI / dxDraw and would like to do some panning or alpha animation. And the question is how this animate works, I know it is shown on the MTA wiki, but I don't quite understand how, If someone would explain it to me, I would be grateful. By the way, I am sending the function I am talking about ... https://wiki.multitheftauto.com/wiki/Animate
  3. Hello dear community. I'm doing a Error Tooltip Resource, I created an Error Client File for all the Errors from my Main Register Resource, and I tried to call that resource by Functions on the same resource, How can I call a Function from the same resource and get The Object File that I want?... This is my code - Error File (InitTooltipMessage.lua) ---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•---•--- ---| |--- ---| Script by "Kyonax - Pilar Perfeccionista" Syn
  4. redditing


    Is there a function similar to ToogleControl but with Binds? I mean, there is such a function attached to BindKey (under the "k" key), and I would like to press the "k" function just like in ToggleControl, where we clicked eg left mouse button to shoot
  5. Alguém consegue me responder pq a function finish n é chamada? function markerb1() if CurrentMarker >= 2 then destroyElement(marker) destroyElement(blip) end if CurrentMarker == 2 then --42 = ultima outputChatBox("Você terminou, entre na auto-escola para ver sua avaliação.", getRootElement(), 0, 255, 0) health = getElementHealth(car) fnh = createMarker(-2026.83, -114.85, 1034, "cylinder", 1.0, _,_,_,_, getRootElement()) setElementInterior(fnh, 3) destroyElement(car) addEventHandler("onMarkerHit", fnh, finish
  6. I made this: -- All other functions and GUI creation. -- [...] -- Created button called "fbumper". local function setFBumper() local theVeh7 = getPedOccupiedVehicle(localPlayer) if theVeh7 then setVehicleComponentVisible(theVeh7, "bump_front_dummy", false) end end addEventHandler("onClientGUIClick", fbumper, setFBumper, false) -- Everything else... It works. Then I wanted to have the button switch between true to false when clicked. Something like: local function setFBumper() local theVeh7 = getPedOccupiedVehicle(localPlayer) if theVeh7 then setVehicleComponentVi
  7. I decided to dive into the world of rotations. I know this might be incomplete and even incorrect: function openCapo() local theVeh = getPedOccupiedVehicle(localPlayer) local value1 = guiScrollBarGetScrollPosition(caposcroll) if theVeh and value1 then setVehicleComponentRotation (theVeh, bonnet_dummy, value1, rY, rZ) end end I've a GUI already created, and the visibility key bound. The first scrollbar (caposcroll) should affect the bonnet_dummy. This was made with absolute basic thinking process: "if I want doors to open, I need to get the position of the scrollbar". However,
  8. I have this: -- 2 points on each city. local spawnCoords = { {1125, -2036, 69.89, -90}, {2504, -1686, 13.55, 45}, {-1972, 643, 46.57, -45}, {-2720, -317, 7.85, 45}, {2023, 1008, 10.83, -90}, {1298, 2084, 12.83, -90}, } -- all skins. local validSkins = {0, 1, 2, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 9
  9. 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"
  10. Today, I've made a event, for checking if player have mooved. At first, after success of detecting players' moovement, it was displaying a message for player, who have mooved.Then, I tried to trigger the event, and the problems started. Any idea? Code's here: ----------------------------------------- ---------------VaporZ (c)---------------- ----------------------------------------- toggleOnPlayerMove = true addEventHandler("onResourceStart", root, function() if(toggleOnPlayerMove == true) then addEvent("onPlayerMove", true) setTimer( function() for _, player in ipairs(getEle
  11. This function is for creating idle animations, on player's afk/idle. Aaand, u need to probably put this one in "onResourceStart" event, remember, to make it work. Here it comes: setTimer( function() for _, player in ipairs(getElementsByType("player")) do if(getPlayerIdleTime(player) > 10000) then local veh = getPedOccupiedVehicle(player) if veh then setPedAnimation(player, "car", "Sit_relaxed", -1, false, false, true, true, 250, false) else local anim = math.random(1, 5) if(anim == 1) then setPedAnimation(player, "playidles", "stretch", -1, false,
  12. CALL FUNCTION DOESN'T WORK I tried to use "handbrake" command from Vehicle System resource (link: https://github.com/FlyingSpoon/vehicle-system). Of course, I've called to function, that I had to create either, because there were only command handlers, but the error kept showing up in console: failed to call 'vsys:handbrakeA'. IMPORTANT: I've added mark to meta file of Vehicle System that I want to export a function, even, I set one .Lua file to <shared>. (Server-side) function: function garage(player) local veh = getPedOccupiedVehicle(player) local x, y, z = ge
  13. Identical panels, only with different functions, giving interference, how to fix? the panels are separated by acl, but when I press the bind key, it opens the two, but it is not allowed to access the resources, but it gets in the way, because all corporation panels are the same, changing only the function and the acl group script: function SetCorpFT(player) if player and not isGuestAccount(getPlayerAccount(player)) then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("BOPECMD")) then
  14. MTA-Communication-Enchantment This is an enchantment that allows you to communicate between clientside and serverside a bit easier. If you know how to work with events, then you probably do not need this, but it has some nice features which allows you to sit back and write less code + achieve some nice results. Note: It is important to keep in mind that this is an enchantment. Which means it is just an layer on top of the basic functionalities of MTA. And most enchantments come with a cost, in this case that is bit of performance. I will keep the information of topic to th
  15. Atualmente estou fazendo um script de trabalho ilegal de metanfetamina, gostaria de uma explicação ou um exemplo de como posso fazer o player carregar um objeto na mão quando ele passar por um marker. E quando ele passar em um outro marker o objeto vai sumir da mão dele. Obrigado!
  16. Client.lua: function processLockUnlock(vehicle) if vehicle then local vehicleID = tonumber(getElementData(vehicle, "veh:id")) or -1 local vehFaction = tonumber(getElementData(vehicle, "veh:faction")) or 0 local vehOwner = tonumber(getElementData(vehicle, "veh:owner")) or -1 local vehJobID = tonumber(getElementData(vehicle, "veh:jobvehID")) or -1 local locked = isVehicleLocked(vehicle) local vehID = getElementModel(vehicle) local vehName = getVehicleRealName(vehID) if isPedInVehicle(localPlayer) then playSounds("lockin") else playSounds("lockout")
  17. function asdasdsas() playSound("http://www.convertmp3.io/fetch/?video=https://www.youtube.com/watch?v=iq7q82Cd6RI") end addCommandHandler("test",asdasdsas) what wrong? the API working fine, but the playSound not.. how to fix?
  18. I have this: function Salir() if isElement(tableVehicles[source]) then destroyElement(tableVehicles[source]) end end addEventHandler("onPlayerVehicleExit",getRootElement(),Salir) This function destroys the vehicle when the player leaves, I want this to happen after a second and not immediately, i need to use "Set timer", but I do not know how to use it, I tried different ways but none of them
  19. Hello ! when there's an event handler like below, function vehicleEnter(vehicle,seat) if seat == 0 then outputChatBox("You have entered a "..getVehicleName(vehicle),source,255,255,0) end end addEventHandler("onPlayerVehicleEnter",root,vehicleEnter) we can remove it from one line code like below, removeEventHandler("onPlayerVehicleEnter",root,vehicleEnter) So that's all. BUT !, when there's an event handler like below, addEventHandler("onPlayerVehicleEnter",root, function (vehicle,seat) if seat == 0 then outputChatBox("You have entered a "..
  20. Hello forums! I've been working on a project of mine, and I'm in need of a function which is similar to getPositionFromElementOffset (scroll down to examples). I can't wrap my head around matrices at all, and I would love to have a similar function, but with rotations instead (getting a rotation offset from an element). Would someone be able to help me out? I'd be very thankful!
  21. 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
  22. It's because of the onClientResourceStart event, but i dont know why its triggering it twice. Thanks function create() triggerServerEvent ( "create_s", resourceRoot) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), create) and the server function create_s() outputChatBox("lol") end addEvent("create_s", true) addEventHandler("create_s", resourceRoot, create_s)
  23. This is the code: And i get this warnings: bad argument @ 'stopSound' [expected sound at argument 1, got nil] and bad argument @ 'detachElement' [expected element at argument 1, got nil] .. -.- how to fix this?
  24. This is the code: addEvent ( "aPlayer", true ) addEventHandler ( "aPlayer", _root, function ( player, action, data, additional, additional2, kickedname ) if checkClient( "command."..action, source, 'aPlayer', action ) then return end if not isElement( player ) then return -- Ignore if player is no longer valid end if ( hasObjectPermissionTo ( source, "command."..action ) ) then local admin = source local mdata = "" local more = "" if ( action == "kick" ) then local reason = data or "" mdata = reason~="" and ( "(" .. reason .. ")" ) or "" setTimer ( kickPlayer, 100, 1
  25. Hi, i have a trouble with my fuction . It's simply trigerred by hiting marker but the clue is that i want it to be trigerred ONLY ONCE like "onceTrigerredonMarkerHit". My code as an example : marker2=createMarker(3399.2,-1899.2,30.1,"corona",2,0,0,255,0) tr1=createVehicle(584,3357.5,-1956.8,31.29,0,0,90) tr2=createVehicle(515,3347.2,-1957,31.29,0,0,90) function open_smashb() ... function m() ... blowVehicle(tr) blowVehicle(tr2) end setTimer(m,2000,1) end addEventHandler("onMarkerHit", marker2, open_smashb)
  • Create New...