Jump to content

Patrick

Moderators
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by Patrick

  1. Server side load before client side. You need to wait, until client side load. outputChatBox("Test") -- good addEvent("trig1", true) addEventHandler("trig1", root, function() outputChatBox("trig111") end) addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("onClientSideStarted", resourceRoot) end) addEvent("onClientSideStarted", true) addEventHandler("onClientSideStarted", resourceRoot, function() triggerClientEvent(root, "trig1", root, var1) end)
  2. Maybe, but you need to cancel the event. -- SERVER local pickup = createPickup(...) setElementData(pickup, "unique_id", 1) addEventHandler("onPlayerPickupHit", pickup, function() cancelEvent() -- cancel the event ==> the player can't pickup this "pickup" :D outputChatBox(getElementData(source, "unique_id")) end)
  3. Okay, i see ? In the for loop you define a global marker variable what you overwrite every time until the for loop is running. So, when the loop ends, the marker variable is still alive, whats the last marker's element. In the onMarkerHit event you print the unique_id of this element. You need to replace it to source. function func1() outputChatBox(tostring(getElementData(source, "unique_id"))) end addEventHandler("onMarkerHit", marker, func1, false) btw, nice drawing xd
  4. This part of the code isn't wrong, more info is needed about the script.
  5. I don't quite understand what you want, but: -- CLIENT SIDE -- FIRST RESOURCE function applySetting() setSetting(slcSet, guiGetText(settingsEdit)) triggerEvent("onSettingsChange", localPlayer) -- Trigger the event, whats in a another client sided resource end addEventHandler("onClientGUIClick", apply, applySetting, false) addEventHandler("onClientGUIClick", apply, onApplying, false) -- (?) -- CLIENT SIDE (?) -- SECOND RESOURCE function set() if ( exports.settings:getSetting("setHaze") ) then setHaze( exports.settings:getSetting("setHaze") ) end end addEvent("onSettingsChange", true) -- register our custom event addEventHandler("onSettingsChange", root, set)
  6. https://wiki.multitheftauto.com/wiki/AddEvent
  7. You attached the onPlayerChat event to resourceRoot. A resource can't use chat (like a player ?). You need to change it to root, what contains players. (https://wiki.multitheftauto.com/wiki/Element_tree)
  8. local var1 = "Bobby_Bob" local lengthofvar1 = #var1 -- returns: 9 local positionof_ = var1:find("_") -- returns: 6 local first_part = var1:sub(1, positionof_- 1) -- returns: Bobby local second_part = var1:sub(positionof_ + 1, lengthofvar1) -- returns: Bob
  9. You can't modify it. But the client can for himself in settings.
  10. Replace source of event to root instead of resourceRoot.
  11. The simplest way if you limit the command usage.
  12. Patrick

    help plz

    This "not work" is not a big help dude. - Do you use this code on client side? - Do you test it with Turismo? (id: 451)
  13. Patrick

    help plz

    increase old health with 50 setElementHealth(source, CarHP + 50)
  14. Patrick

    help plz

    The maximum health of the vehicle is 1000, not 100, so: -- CLIENT SIDE function fix() local CarHP = getElementHealth(source) -- use as local variable, because you want to use this variable inside this function only if (getElementModel(source) == 451) then if (CarHP < 900) then setElementHealth(source, 1000) end end end addEventHandler("onClientVehicleDamage", root, fix)
  15. Patrick

    Event

    removeEventHandler("onClientRender", root, ATTACHED_FUNCTION)
  16. Wiki: https://wiki.multitheftauto.com/wiki/Slothman/Slothbot Download: https://community.multitheftauto.com/index.php?p=resources&s=details&id=672
  17. Slothbot is the correct answer. Create a ped with slothbot and set bot mode to follow. Or do your own following algorithm with setPedControlState.
  18. https://wiki.multitheftauto.com/wiki/Slothman/Slothbot
  19. It is possible because the event triggered on button press and release. Trigger event only on button release. addEventHandler("onClientClick", root, function(button, state) if button == "left" then -- if clicked with left button if state == "up" then -- if button released -- trigger end end end)
  20. We can't say exactly because we can't see it. But, you can increase load distance with https://wiki.multitheftauto.com/wiki/EngineSetModelLODDistance Or try to disable occlusion with https://wiki.multitheftauto.com/wiki/SetOcclusionsEnabled
  21. It's just Tiny Encryption Algorithm with base64 encode. You need a 'key' to decode it.
  22. https://wiki.multitheftauto.com/wiki/OnMarkerHit https://wiki.multitheftauto.com/wiki/GetPedOccupiedVehicle https://wiki.multitheftauto.com/wiki/SetElementPosition https://wiki.multitheftauto.com/wiki/SetElementDimension https://wiki.multitheftauto.com/wiki/SetElementInterior
×
×
  • Create New...