-
Posts
1,143 -
Joined
-
Last visited
-
Days Won
42
Everything posted by Patrick
-
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)
- 1 reply
-
- 1
-
-
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
-
I think it is not possible, because you can't execute javascript in remote browsers.
-
Its a scripting topic, and not "give me please" section.
-
getPedOccupiedVehicle setElementPosition
-
You need to use onClientGUIChanged event, and check when caposcroll changed. > https://wiki.multitheftauto.com/wiki/OnClientGUIChanged And if you want to change the door state you should use setVehicleDoorOpenRatio instead of setVehicleComponentRotation. > https://wiki.multitheftauto.com/wiki/SetVehicleDoorOpenRatio addEventHandler("onClientGUIChanged", caposcroll, function() local value = guiScrollBarGetScrollPosition(source) -- value: 0-100 -- setVehicleDoorOpenRatio required a ratio between 0-1 instead of 0-100, it need to divide by 100 local vehicle = getPedOccupiedVehicle(localPlayer) setVehicleDoorOpenRatio(vehicle, value / 100) end)
-
I don't understand what you want, but I think select a random spawnpoint in every time. If yes, here is an example: local rows = #spawnLocation -- example, returns 2 if have 2 spawnpoints in the table local randomRowIndex = math.random(1, rows) -- return a number between 1 and length of the table. (what can be 1 or 2, if have 2 spawnpoints in the table) local x, y, z = spawnLocation[randomRowIndex][1], spawnLocation[randomRowIndex][2], spawnLocation[randomRowIndex][3] -- get values like in previous example
-
First of all, check the syntax of spawnPlayer. (https://wiki.multitheftauto.com/wiki/SpawnPlayer) You need x, y and z, not a table. I don't know why you want to use table only for 1 spawn, but then: x, y, z = spawnLocation[1][1], spawnLocation[1][2], spawnLocation[1][3] -- Why? -- spawnLocation => its the table -- [1] => its the first row of the table -- [2] => its the second value in the first row (the Y coord) And here is a Lua tutorial, you should read that, if you want to learn.
-
Take a photo of it. ? But, you can make a "3D Render" with this resource: https://wiki.multitheftauto.com/wiki/Resource:Object_preview
- 1 reply
-
- 1
-
-
You need to use events. OnClientPlayerJoin trigger the attached function when someone join to server, and you need to start the Intro Render only for this client, who is you, localPlayer. addEventHandler("onClientPlayerJoin", root, function -- Wiki note: The `source` of this event is the player that joined the server. if source == localPlayer then -- who join is you, the localPlayer -- start render end end) -- or set the source of the event to localPlayer instead of root, and then you dont need to check it who is the source. Some Lua tutorial
-
Client sided function are affects only for localPlayer, like dxDrawText. Think about it, it runs only on client's PC. But if you start this function on every client's PC, it shows for everyone, ofcourse. But then, the image is not "same", every client render her own image.
-
https://wiki.multitheftauto.com/wiki/IsElementMoving But its not the scripting topic, post questions like this in => https://forum.multitheftauto.com/forum/71-scripting/
-
Check the example of `createBrowser` on wiki, its exactly what you want. > https://wiki.multitheftauto.com/wiki/CreateBrowser And you can find done resources on community, you should check their source code.
-
Ofc, we can do that, but we don't do that instead of you. Some thing what need to do it: https://wiki.multitheftauto.com/wiki/OnClientPedDamage https://wiki.multitheftauto.com/wiki/TriggerServerEvent https://wiki.multitheftauto.com/wiki/KickPlayer Logic: - On client side, check ped hits. - If someone hit the ped, trigger a server sided function (because kickPlayer a server sided function). - And this server sided function kick the player. Some help:
-
You can show it if attach function to the onClientRender Event and hide it if you remove the handler. (like in example) But you can use gui label, its works like other gui elements. => https://wiki.multitheftauto.com/wiki/GuiCreateLabel
-
Dx functions, like dxDrawText shows only once (for 1 frame). You need to use these function in a render function, like onClientRender what call it in every frame. function renderFunction() dxDrawText("MASCULINO", screenW * 0.3602, screenH * 0.3083, screenW * 0.4586, screenH * 0.3431, tocolor(255, 255, 255, 255), 1.00, "default", "center", "top", false, false, false, false, false) dxDrawText("FEMININO", screenW * 0.5406, screenH * 0.3083, screenW * 0.6391, screenH * 0.3431, tocolor(255, 255, 255, 255), 1.00, "default", "center", "top", false, false, false, false, false) end And you can start the render with onClientRender event, attach it to `renderFunction`. addEventHandler("onClientRender", root, renderFunction) -- and stop it with: removeEventHandler("onClientRender", root, renderFunction)
-
-
Hide the default chat and create a custom one, with dxDrawText or CEF
-
You can't change the default chat's font.
-
Wyłączenie auta bindkey
Patrick replied to jason38's topic in Pomoc ze skryptami i programowaniem w Lua
Hi @jason38! This is a english only topic. And read formating guidelines, please: -
Because first time, when you press it down, the function stops in line 6, and leave. Second time, when you release the button, it starts from the beginning, again. (create again the object) But then, it not stop in line 6, and immediately deatach the new object. And old object is still attached to you.