Jump to content

Patrick

Moderators
  • Posts

    1,143
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by Patrick

  1. I think you try to use this code on client side, but you need to use on server side, because of addCommandHandler. On server side, addCommandHandler pass the following arguments to attached function: PLAYERELEMENT, COMMANDNAME, ... But on client side, its not pass PLAYERELEMENT, because its can be only localPlayer. Looks: COMMANDNAME, ... Wiki: addCommandHandler How to use on client side: -- CLIENT SIDE function PlateText() local Vehicle = getPedOccupiedVehicle(localPlayer) if Vehicle then outputChatBox("Hi") else outputChatBox("bye") end end addCommandHandler("something", PlateText)
  2. ("#ff0000text"):gsub("#%x%x%x%x%x%x", "") -- text
  3. I have a resource for this on community. https://community.multitheftauto.com/index.php?p=resources&s=details&id=18006
  4. Hi! Please first search what you want to ask.
  5. 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.
  6. 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.
  7. 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.
  8. Patrick

    Modloader

    @[email protected] Hi! This is an English section. Please translate your message.
  9. 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
  10. 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.
  11. I think you talking about metatables. https://wiki.multitheftauto.com/wiki/OOP_in_Lua
  12. 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)
  13. for i = 615, 18630 do removeWorldModel(i, 10000, 0, 0, 0) end
  14. Patrick

    Unknow error

    It must work. But 3rd arg of triggerServerEvent is unnecessary. triggerServerEvent ("Skins", getLocalPlayer() )
  15. Set txd and dff to nil too after replace.
  16. 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) -- ...
  17. 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.
  18. 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)
  19. 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)
  20. 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)
×
×
  • Create New...