• Content Count

  • Joined

  • Last visited

Community Reputation

90 Popular


About MrTasty

  • Rank
    Road Dawg


  • Location
    United Kingdom
  • Occupation
    Scripting Guru

Recent Profile Visitors

1,930 profile views
  1. MrTasty

    play sound when sending top bar messages

    function sendClientMessage(msg, r, g, b, img, checkImgPath) -- line 49 if (checkImgPath == nil) then checkImgPath = true end if (img and sourceResource and checkImgPath) then img = ":"..tostring(getResourceName(sourceResource)).."/"..img end local sound = playSound("notif.wav") setSoundVolume(sound, 0.8) return _sendClientMessage(msg, r, g, b, img) end Make sure you added notif.wav in meta.xml in a <file> tag. Also please remove function message (messagesound) -- line 230 local sound = playSound("notif.wav") setSoundVolume(sound, 0.8) end addEventHandler("onClientRender", localPlayer, message) Trying to play a sound every frame? That is, up to 60 times a second? By the way, source for onClientRender is always root, so attaching it to localPlayer will not work.
  2. MrTasty

    I want to encode script

    If you're talking abot compiling with encryption (extra obfuscation), you can use
  3. MrTasty

    Replacing CJ hair .dff files on server

    I believe he's concerned about DFFs, not textures. I dont think its possible use engineReplaceModel for clothes. Seems like only engineImportTXD allows IDs that high (or clothes names strings).
  4. MrTasty

    [HELP] Map bug

    Try setOcclusionsEnabled
  5. MrTasty

    Group name over head.

    addEventHandler("onClientRender", getRootElement(), function () for k,v in ipairs(getElementsByType("player")) do local group = getElementData(v,"Group") if group and v ~= localPlayer then dxDrawTextOnElement(v,group,1,20,0,0,255,255,1,"arial") end end end ) group = getElementData(v,"Group") on line 2 was the problem, v wasn't defined at that point.
  6. MrTasty

    Help in script

    Just some points from the top. First, please note it's called a gridlist, not grindlist. Secondly, your indenting is inconsistent (sometimes you use spaces, other times tabs — just stick to one of them, otherwise it gets ugly when shared on the forum) Now, let's get to some rudimentary debugging. Add debug messages in the code so you can trace the flow of execution (which blocks of code were executed and which weren't), and inspect variables or return values of functions. By the way, in Lua, brackets after if and before then are optional. addEventHandler ("onClientGUIClick", getRootElement(), function (button, state, absoluteX, absoluteY) outputDebugString("onClientGUIClick called.") -- if this is appears in debugscript, that means the event was triggered and this function handled it local me = not guiGetVisible (WinMission) if (source == accepted) then outputDebugString("guiGridListGetSelectedItem(ListMissions): "..guiGridListGetSelectedItem(ListMissions)) -- if this appears in debugscript, that means (source == accepted) is true. if (guiGridListGetSelectedItem(ListMissions) == 1) then outputDebugString("1 was selected") elseif (guiGridListGetSelectedItem(ListMissions) == 2) then outputDebugString("2 was selected") elseif (guiGridListGetSelectedItem(ListMissions) == 3) then outputDebugString("3 was selected") elseif (guiGridListGetSelectedItem(ListMissions) == 4) then outputDebugString("4 was selected") end end end ) Try the code above and report back what you get in /debugscript 3.
  7. MrTasty

    animation does not see anyone

    local animTable = { ifp = {}, anims = { -- ... } } addEventHandler("onClientResourceStart", resourceRoot, function() animTable.ifp["block"] = "ped" animTable.ifp["ifp"] = engineLoadIFP("ped.ifp", animTable.ifp["block"]) for _, v in ipairs(animTable.anims) do engineReplaceAnimation(localPlayer, "ped", v, animTable.ifp["block"], v) -- replace the animations on localPlayer end end ) addEventHandler("onClientElementStreamIn", root, function() if getElementType(source) == "player" or getElementType(source) == "ped" and source ~= localPlayer then for _, v in ipairs(animTable.anims) do engineReplaceAnimation(source, "ped", v, animTable.ifp["block"], v) -- replace the animations on streamed in ped end end end ) addEventHandler("onClientElementStreamOut", root, function() if getElementType(source) == "player" or getElementType(source) == "ped" and source ~= localPlayer then engineRestoreAnimation(source, "ped") -- restore the animations on streamed out ped end end ) engineReplaceAnimation replaces anims only on the screen of the client that executed the function, and only on the ped that was passed in that function. If you want yourself and others to see everyone else with the anims, you need to execute this function for every ped (that streams in, in this example) on each client.
  8. MrTasty

    MTA Progress Bar

    Then you'll need to monitor getTimerDetails every now and then (perhaps even by render event but it's overkill - you do not need to do this every frame). local duration = --[[ define a duration in ms ]] local timeLeft = getTimerDetails(--[[ the timer ]]) local timeDone = duration - timeLeft local percent = timeDone / duration guiProgressBarSetProgress(--[[ progressbar element ]], percent)
  9. MrTasty

    Help GrindList

    I'm sorry but I can't understand what help you need. If you're not good with English, I'd suggest trying in your native language section.
  10. MrTasty

    0905: toggle_door/set_door opcode in LUA?

    If I recall correctly, setElementFrozen will immediately reset the door's rotation to closed position so you don't have to worry about it freezing in the wrong rotation.
  11. MrTasty

    Warp player into vehicles

    How us the relevant part of the code. It's most likely that you're calling the function with a variable of nil value, or an expired userdata reference such as a player who has already quit or something.
  12. MrTasty

    MySQL save at server stop.

    The issue most likely arises because mysql resource stops before your core resource stops. You could try executing when (technically just before, since onResourceStop is triggered before the resource stops) mysql stops rather than when core stops. -- this bind directly onto the 'mysql' resource (not sure if it will work after 'mysql' is restarted or when this handler binds before 'mysql' is started, so if it doesn't work 100% of the time, try the other version addEventHandler("onResourceStop", getResourceRootElement(getResourceFromName("mysql")), function() for id, v in pairs(vehicles) do dbExec(db,"UPDATE vehicles SET x=?, y=?, z=? WHERE id=?", v.x, v.y, v.z, id) end end) -- this binds to root so it might be less efficient addEventHandler("onResourceStop", root, function(stoppedRes) if getResourceName(stoppedRes) == "mysql" then for id, v in pairs(vehicles) do dbExec(db,"UPDATE vehicles SET x=?, y=?, z=? WHERE id=?", v.x, v.y, v.z, id) end end end)
  13. MrTasty


    Its been broken for a long time now. Firstly, the backend is provided by OpenLayers and map images by (presumably operated by eAi, the creator of the script) but the CGI script serving images is broken (e.g. And secondly, webmap's script.js attempts to use jQuery selectors but jQuery isn't present. Due to the image provider being broken, I don't think there is any easy workaround other than creating your own webmap script. The relevant Github issue is multitheftauto/mtasa-resources#130.
  14. MrTasty


    Is this an error or a bug? That is, is there an actual error message that you could provide us, or does this code simply not do what you intended it to do? If its the latter, I'd point towards this line engineReplaceAnimation( localPlayer, "ped", "ped", customBlockName, "ped" ) -- ^block ^animation name (doesn't exist) and the fact that there isn't an animation named "ped" in the ped block.
  15. MrTasty

    [HELP] Rotating the image of the minimap.

    You could do this via a rendertarget (draw the rotated image on the RT and draw the render target unrotated) (RTs aren't designed for this purpose, however. RTs are slower than drawing the contents individually unless you write to them less often than every frame), or via a shader