-
Posts
6,089 -
Joined
-
Last visited
-
Days Won
216
Everything posted by IIYAMA
-
local lastGear addEventHandler("onClientRender", root, function() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then local gear = getVehicleCurrentGear(vehicle) if gear ~= lastGear then iprint("gear isn't the same as last gear") triggerEvent("onClientVehicleGearChange", vehicle, gear) lastGear = gear local x,y,z if getVehicleComponents(vehicle).exhaust_ok then x,y,z = getVehicleComponentPosition ( vehicle, "exhaust_ok", "world" ) iprint("found exhaust_ok component on vehicle")-- debug else x,y,z = getElementPosition(vehicle) iprint("can't find exhaust_ok component on vehicle")-- debug end fxAddGunshot(x, y+0.5, z+1, -10, 0, 0, true) fxAddSparks(x, y+0.5, z+1, -10, 0, 0) fxAddBulletImpact(x, y+0.5, z+1, -10, 0, 0, 2, 15, 5) fxAddTankFire(x, y, z, -10, 0, 0) local sound = playSound3D("untitled.mp3", x, y, z, true) setSoundVolume(sound, 1) setSoundMaxDistance(sound, 100) end end end) -- prevent the trigger to activate after entering a vehicle. addEventHandler("onClientPlayerVehicleEnter", localPlayer, function (vehicle) lastGear = getVehicleCurrentGear(vehicle) end) Untested, if it doesn't work, please debug properly. You could have guessed it... As it is just a language like English, with different rules.
-
hmm local x,y,z if getVehicleComponents(vehicle).exhaust_ok then x,y,z = getVehicleComponentPosition ( vehicle, "exhaust_ok", "world" ) iprint("found exhaust_ok component on vehicle")-- debug else x,y,z = getElementPosition(vehicle) iprint("can't find exhaust_ok component on vehicle")-- debug end OR (get the back of the vehicle) --local x,y,z = getElementPosition(vehicle) local x0, y0, z0, x1, y1, z1 = getElementBoundingBox ( vehicle ) -- test which one is ~ correct. x,y,z = getPositionFromElementOffset(vehicle, (x0 + x1) / 2, y0, z0) -- or x,y,z = getPositionFromElementOffset(vehicle, (x0 + x1) / 2, y1, z1) -- or x,y,z = getPositionFromElementOffset(vehicle, x0, (y0 + y1) / 2, z0) -- or x,y,z = getPositionFromElementOffset(vehicle, x1, (y0 + y1) / 2, z1) function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end
-
@swag_k_dog Why creating a new topic for only this? And you didn't even say thank you for my help, are you that inhuman or what? local lastGear addEventHandler("onClientRender", root, function() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then local gear = getVehicleCurrentGear(vehicle) if gear ~= lastGear then triggerEvent("onClientVehicleGearChange", vehicle, gear) lastGear = gear local x,y,z = getElementPosition(vehicle) local sound = playSound3D("untitled.mp3", x, y, z, true) setSoundVolume(sound, 1) setSoundMaxDistance(sound, 100) outputChatBox("test") end end end) -- prevent the trigger to activate after entering a vehicle. addEventHandler("onClientPlayerVehicleEnter", localPlayer, function (vehicle) lastGear = getVehicleCurrentGear(vehicle) end)
-
local lastGear addEventHandler("onClientRender", root, function() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then local gear = getVehicleCurrentGear(vehicle) if gear ~= lastGear then triggerEvent("onClientVehicleGearChange", vehicle, gear) lastGear = gear end end end) -- prevent the trigger to activate after entering a vehicle. addEventHandler("onClientPlayerVehicleEnter", localPlayer, function (vehicle) lastGear = getVehicleCurrentGear(vehicle) end) You could try this. (clientside)
- 1 reply
-
- 1
-
-
Please. Add more debug lines. Do a hard refresh. (/refreshall) Because if an export goes wrong, there is NO WAY you get no error/warning. Unless the export code hasn't been executed OR it has been executed but the code that should show this indication doesn't work.
-
Can you script or not? Because this the scripting section. If you make a small attempt with the light element, then I will help you further.
-
Did you add the export child/tag in your meta.xml as well? (from the resource that contains that function) https://wiki.multitheftauto.com/wiki/Call <export function="createWindow" type="server"/>
-
You could also try this: https://wiki.multitheftauto.com/wiki/CreateLight Skygraphy. (z.j.). From the Idea to the Finished Product [Foto]. Geraadpleegd van http://www.skygraphy.com/cp-lifecycle Not sure if it works.
-
You didn't check the whitelist, pfff local screenWidth, screenHeight = guiGetScreenSize() function webBrowserRender() dxDrawImage(0, 0, screenWidth, screenHeight, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true) end requestBrowserDomains({ "www.facebook.com" }, false) local facebookWasAccepted local webBrowser = createBrowser(screenWidth, screenHeight, false, false) addEventHandler('onClientBrowserCreated',webBrowser, webBrowserCreated) addEventHandler("onClientBrowserWhitelistChange", root, function (newDomains) if not facebookWasAccepted then for i=1, #newDomains do if newDomains[i] == "www.facebook.com" then facebookWasAccepted = true break end end if facebookWasAccepted then loadBrowserURL(webBrowser,'https://www.facebook.com/iulian.macovei.904/videos/1932180010376910/') end end end) function webBrowserCreated () addEventHandler('onClientRender',root,webBrowserRender) if not isBrowserDomainBlocked("www.facebook.com") then loadBrowserURL(webBrowser,'https://www.facebook.com/iulian.macovei.904/videos/1932180010376910/') facebookWasAccepted = true end end
-
Did you check if this video is available without being logged in? Afaik, you shouldn't be able to view Facebook video's if you aren't.
-
Then you post your code, as simple as that...
-
You can render it as well, see example: 'Local example' https://wiki.multitheftauto.com/wiki/CreateBrowser
-
setServerPassword("") nil should be working too. Try to give the resource admin rights.
-
You could use this: https://wiki.multitheftauto.com/wiki/IsChatBoxInputActive
-
for i = 1, #Blips do local blip = Blips[i] if isElement(blip) then destroyElement(blip) end end Please also take a look at: (which can come in handy if you want to destroy multiple elements in once) If you destroy a parent element, all child elements will also be destroyed.
-
Only one wheel is returned with getVehicleComponents
IIYAMA replied to Dzsozi (h03)'s topic in Scripting
the effectDestroyTimer Is global. (not sure if that is the problem, but will have influence.) How does the script know that it has to create the effect? Because that sounds more like your problem. (the trigger itself) -
Only one wheel is returned with getVehicleComponents
IIYAMA replied to Dzsozi (h03)'s topic in Scripting
You can't figure out why you used the same variable name? You got to be kidding me. Just remove the second loop and debug your code. -
Only one wheel is returned with getVehicleComponents
IIYAMA replied to Dzsozi (h03)'s topic in Scripting
You use the same key word for all the components as for only one component, and you do not index the components table. -
If you are a beginner. (which I do not know if you are) Then use downloadFile. https://wiki.multitheftauto.com/wiki/DownloadFile (there is an example in it, which shows you how to download a test.xml file)
-
Always a solution: Reduce elementdata updates. Every time you call setElementData(without disabling synchronization), it will send data. (even if the value is the same) I often see people do this: (clientside) addEventHandler("onClientRender", root, function () local data = "random data" setElementData(localPlayer, "key", data) end) He, Frame 1: please update (16 ms later) Frame 2: please update (16 ms later) Frame 3: please update (16 ms later) Etc. Not even a second has past and you almost requested 62 UPDATES! (not sure if there is elementdata reduction clientside, but I don't think so) Which is IDIOTIC! (for the ones who do this, please go in your microwave) Which should/could be done like this: addEventHandler("onClientRender", root, function () local data = "random data" if data ~= getElementData(localPlayer, "key") then setElementData(localPlayer, "key", data) end end) Or this: (serverside) -- element could be a team for key, data in ipairs(example) do setElementData(element, "score", getElementData(element, "score") + 1) end Updating the score to 20? = Tell all clients/players 20x > "I have grown 1 more!" Which is stupid. Should/could be done like this. local score = getElementData(element, "score") or 0 for key, data in ipairs(example) do score = score + 1 end setElementData(element, "score", score)
-
Because you have to adjust the max value for that. You could try something like this: local maxAmmoTable = {} -- function -- ... local weapon = getPedWeapon(localPlayer) local maxAmmo = maxAmmoTable[weapon] or 1 if AllAmmo > maxAmmo then maxAmmoTable[weapon] = AllAmmo end -- ... -- end -- reset addEventHandler("onClientPlayerWasted", localPlayer, function () maxAmmoTable = {} end)
-
-- clear those once you stop the timer it. local lastCheckTime local newStartTime -- -- function () -- ... if isVehicleOnGround(vehicle) then if getVehicleSpeed(vehicle) >= 10 then local currentTime if lastCheckTime then currentTime = lastCheckTime if not newStartTime then newStartTime = getTickCount() else currentTime = currentTime + (getTickCount() - newStartTime) end else currentTime = getTickCount() end if currentTime - lastTimeAdded[vehicle] >= 5000 then if someVariable < #someTable then someVariable = someVariable+1 lastTimeAdded[vehicle] = getTickCount() else someVariable = #someTable end end else lastCheckTime = getTickCount() end end -- ... -- end function
-
Try this. local maxAmmo = 1000 dxDrawRectangle (1701/x*jx, 65/y*jy, (math.min(AllAmmo, maxAmmo) / maxAmmo * 100)/x*jx, 8/y*jy, tocolor(227, 160, 93, 255)) -- this is useless unless you know what you are doing: local FullAmmoBar = The bar length is based on the value 100? Else you have to change the value 100 to the correct value.