Jump to content

Patrick

Moderators
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by Patrick

  1. I have a resource for this on community. https://community.multitheftauto.com/index.php?p=resources&s=details&id=18006
  2. Hi! Please first search what you want to ask.
  3. I'm happy to help but you also have to learn. Some Lua tutorial for you: - https://forum.multitheftauto.com/topic/121619-Lua-for-absolute-beginners - https://forum.multitheftauto.com/topic/64228-the-ultimate-Lua-tutorial/ - https://forum.multitheftauto.com/topic/95654-tut-debugging/ - https://forum.multitheftauto.com/topic/114541-tut-events/ local status = false function ghostmode_toggle() status = not status -- toggle status if status then for i,v in pairs(getElementsByType("player")) do --LOOP through all players setElementCollidableWith(v, localPlayer, false) -- Set the collison off with the other players. end outputChatBox("You are now a Ghost") else for i,v in pairs(getElementsByType("player")) do --LOOP through all players setElementCollidableWith(v, localPlayer, true) -- Set the collison on with the other players. end outputChatBox("You aren't a Ghost") end end addCommandHandler("ghostmode", ghostmode_toggle) -- Add the /ghostmode Command.
  4. function ghostmode_on() for i,v in pairs(getElementsByType("player")) do --LOOP through all players setElementCollidableWith(v, localPlayer, false) -- Set the collison off with the other vehicles. end outputChatBox("You are now a Ghost") end addCommandHandler("ghostmode", ghostmode_on) -- Add the /ghostmode Command. Replace vehicle elements with players.
  5. https://wiki.multitheftauto.com/wiki/SetElementCollisionsEnabled Note: Vehicles that are collisionless and have a driver will cause bugs. Note: Enabling a players collisions when they're inside a vehicle will cause bugs. Note: Disabling a peds collisions will cause some problems, such as it being unable to move or wrong rotation after creation. But I think setElementCollidableWith what you want. Check the example on wiki.
  6. Patrick

    Modloader

    @[email protected] Hi! This is an English section. Please translate your message.
  7. local object = createObject(id, x, y, z) moveObject(object, 5000, x, y, z, 0, 0, 360) -- rotate with 360, takes 5 sec setTimer(moveObject, 5000, 0, x, y, z, 0, 0, 360) -- after 5 sec, rotate it again (in every 5th sec) Or rotate it with setElementRotation
  8. How looks like the map file? MTA .map file looks like something like this: <map edf:definitions="editor_main"> <object id="object (Gs_piccies1) (1)" breakable="true" interior="0" collisions="true" alpha="255" model="14462" doublesided="false" scale="1" dimension="0" posX="-1516.5" posY="-2777.3999" posZ="49.2" rotX="0" rotY="0" rotZ="0"></object> <object id="object (Gs_piccies1) (2)" breakable="true" interior="0" collisions="true" alpha="255" model="14462" doublesided="false" scale="1" dimension="0" posX="-1505.5" posY="-2789.8" posZ="49.2" rotX="0" rotY="0" rotZ="0"></object> <object id="object (carlspics) (1)" breakable="true" interior="0" collisions="true" alpha="255" model="14489" doublesided="false" scale="1" dimension="0" posX="-1498.1" posY="-2809.3" posZ="61.1" rotX="0" rotY="0" rotZ="0"></object> <object id="object (cs_oldcarjmp) (1)" breakable="true" interior="0" collisions="true" alpha="255" model="18451" doublesided="false" scale="1" dimension="0" posX="-1523.2" posY="-2786.6001" posZ="48.1" rotX="0" rotY="0" rotZ="15.616"></object> <object id="object (ufo_photos) (1)" breakable="true" interior="0" collisions="true" alpha="255" model="16153" doublesided="false" scale="1" dimension="0" posX="-1551.5" posY="-2773.3" posZ="47" rotX="0" rotY="0" rotZ="0"></object> </map> You need to convert your map somehow. If you paste it here, maybe we could help.
  9. I think you talking about metatables. https://wiki.multitheftauto.com/wiki/OOP_in_Lua
  10. I think the only way if you hide the chat, with showChat Or cancel the keypress event: addEventHandler("onClientKey", root, function(key, state) if key == "t" and state then cancelEvent() end end)
  11. for i = 615, 18630 do removeWorldModel(i, 10000, 0, 0, 0) end
  12. Patrick

    Unknow error

    It must work. But 3rd arg of triggerServerEvent is unnecessary. triggerServerEvent ("Skins", getLocalPlayer() )
  13. Set txd and dff to nil too after replace.
  14. Sadly you can't remove these with mta's map editor. You need to use SAMP Editor. - Start SAMP Editor (download) - Search these bushes, select them and copy following informations about it: model id, x pos, y pos, z pos - Create a new resource, with a client sided script - Remove map objects with removeWorldModel -- CLIENT SIDE EXAMPLE -- removeWorldModel(model id, 1, x pos, y pos, z pos) removeWorldModel(1000, 1, 500, 500, 500) -- ...
  15. Patrick

    Map

    When you save the map in map editor, its generate a folder (with typed in name) in server/mods/deathmatch/resources folder. This folder is a resource, what you can start, like other resources. Just use start <name> in server's console.
  16. I think the only way if you cancel the chat message's event. > onClientChatMessage, cancelEvent local blockedMsg = { "login: You successfully logged in", "login: You are already logged in", } local length = #blockedMsg addEventHandler("onClientChatMessage", root, function(text) for i = 1, length do if blockedMsg[i] == text then return cancelEvent() end end end)
  17. You can use TEA to encode images, but I think you can't protect audio > encodeString Example: https://forum.multitheftauto.com/topic/121753-searching-for-dff-txd-col-compiler/ (It should work with images)
  18. Just an idea: Attach a colshape to the ped, and when somebody hit that colshape, who jumping, do some fall animation. > createColSphere, attachElements, onClientColShapeHit, getPedSimplestTask, triggerServerEvent, setPedAnimation (on server side)
  19. Because `onClientVehicleEnter` triggered if someone entered to a vehicle. (not only localPlayer) If this player is not you (localPlayer), getPedOccupiedVehicle(getLocalPlayer()) returns `false`. (because the event started the render) You need to check, who enter the vehicle is the localPlayer. function entering(player) if player == localPlayer then addEventHandler("onClientRender", root, healthCar) end end function exiting(player) if player == localPlayer then removeEventHandler("onClientRender", root, healthCar) end end addEventHandler("onClientVehicleEnter", root, entering) addEventHandler("onClientVehicleExit", root, exiting)
  20. Ohh.. it's a good idea. ? local apiKey = "censored" -- How to get own: https://www.youtube.com/watch?v=pP4zvduVAqo local browser = createBrowser(500, 500, false) function receiveData(result) local data = fromJSON(result) local isoDuration = data.items[1].contentDetails.duration local min, sec = isoDuration:match("^.-(%d+)M(%d+)S") -- this pattern work only with minimum 1 min, and maximum 1 hour videos setTimer(function() removeEventHandler("onClientRender", root, render) end, (min*60 + sec) * 1000, 1) end function render() dxDrawImage(0, 0, 500, 500, browser) end addEventHandler("onClientBrowserCreated", browser, function() local url = "https://www.youtube.com/watch?v=NLb-gZNKzT8" local id = url:match("%?v=(...........)") -- maybe need a better pattern :'D loadBrowserURL(source, url) addEventHandler("onClientRender", root, render) fetchRemote("https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id="..id.."&key="..apiKey, receiveData) end) @Turbe$Z something like that
×
×
  • Create New...