-
Posts
1,141 -
Joined
-
Last visited
-
Days Won
42
Everything posted by Patrick
-
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)
-
How can I add unique element data for object from table?
Patrick replied to NoviceWithManyProblems's topic in Scripting
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) -
How can I add unique element data for object from table?
Patrick replied to NoviceWithManyProblems's topic in Scripting
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 -
How can I add unique element data for object from table?
Patrick replied to NoviceWithManyProblems's topic in Scripting
I think the problem is similar to a previous one -
How can I add unique element data for object from table?
Patrick replied to NoviceWithManyProblems's topic in Scripting
This part of the code isn't wrong, more info is needed about the script. -
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)
-
https://wiki.multitheftauto.com/wiki/AddEvent
-
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)
-
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
-
You can't modify it. But the client can for himself in settings.
-
The simplest way if you limit the command usage.
-
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)
-
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)
-
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
-
It's just Tiny Encryption Algorithm with base64 encode. You need a 'key' to decode it.
-
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
-
Paste the full code.