-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
Well this will do it, without rendering with setCameraMatrix. But aiming with the gun is kinda impossible. local cam = getCamera() setElementPosition( cam, 0,0,0 ) attachElements( cam, localPlayer, 0.2,-2,0.8, 0,0,0 )
-
You could try to attach an army door to it and set the alpha to 0.
-
Check out this example on wiki: https://wiki.multitheftauto.com/wiki/GetCamera I haven't tried it myself, but it might do what you want(if you edit it ofcourse).
-
or: https://wiki.multitheftauto.com/wiki/On ... bjectBreak addEventHandler("onClientObjectBreak", root, function(attacker) if getElementModel( source ) == 3851 then cancelEvent() end end ) This code will stay working when you start another map with the same objects etc. This is a solid solution, without bugs. It only uses a little bit more memory, but you won't notice it. Enjoy.
-
Depends, you can render your peds as the image you showed me. A far as I can see, that is what you want to do. Or do you mean something else by 3D object image ? And about what kind of files/formats are you talking about?
-
If you understand shader code (.fx), you might be able to do it the hardcore mode. But that will be a lot to learn next to lua. But for now: https://wiki.multitheftauto.com/wiki/Dx ... reenSource
-
There are 3D dx functions...
-
setControlState Add that function with the same arguments as toggleControl. So one is for toggling and one for change the state. Also put between line 11 and 12 another else, for disabling the control.
-
Ok, let me know if something comes up!
-
1: How many times does this function gets called? 2: What is the position after the reset? 3: And what is the position before you affect any of the components? 4: Does the function getVehicleComponentPosition moves the component down? Or the result is, moved down? Debug the results. After what you told me, I would say resetVehicleComponentPosition doesn't reset everything well. But if that is the case, make sure you backup the original position. (or save it) local modelComponentPosition = {} local model = getElementModel(source) local bufferModelComponentData = modelComponentPosition[model] if not bufferModelComponentData then modelComponentPosition[model]= {} end for k in pairs ( getVehicleComponents ( source ) ) do if ( k ~= "exhaust_ok" ) then local x, y, z = bufferModelComponentData and table.unpack(bufferModelComponentData[k]) or getVehicleComponentPosition ( source, k ) setVehicleComponentPosition ( source, k, x, y, z) if not bufferModelComponentData then modelComponentPosition[model][k] = {x, y, z} end end end But maybe you can better generate a xml document with original positions, then you won't have trouble with bugs.
-
Well, combine the code from a both and you have it. But make sure you have a table with valid players you can loop through, so the variable "player" can be defined.
-
local x,y,z = getElementPosition(chair) local sx,sy,sz,_,_,_ = getCameraMatrix(player) if not sx then sx,sy,sz = getElementPosition(player) end setCameraMatrix(player,sx,sy,sz,x,y,z) I don't know what you want, explain better with less nonsense. local lastPosition = {} setTimer(function () if not lastPosition then local x,y,z = getElementPosition(chair) if getDistanceBetweenPoints3D(x,y,z,lastPosition[1],lastPosition[2],lastPosition[3]) > 0.1 then outputChatBox("chair moved!") lastPosition = {x,y,z} end else lastPosition = {getElementPosition(chair)} end end,100,0)
-
Another way of requesting images from other resources: (not tested but should be working) <export function="requestImage" type="client"/> local requestDatabase = {} function requestImage (filePath,buffer) if requestDatabase[filePath] then return requestDatabase[filePath]["texture"] elseif fileExists (filePath) then local texture = dxCreateTexture(filePath) if texture then if buffer then requestDatabase[filePath] = {["texture"]= texture,["creationTime"]=getRealTime().timestamp} end return texture end end return false end local image = call ( getResourceFromName ( "**********" ), "requestImage",filePath,true)
-
This is not a place for requests. You know what and how to fix your code, now do it! Move that lazy ass of yours.
-
That will dissable all damage, if he wants it that way then yes. But what I am trying to tell you is that you never know when the damage is caused by the fire.
-
Damage from fire is most of the time not bounded to an attacker or the attacker weapon is unknown. Cancel using cancelEvent() would be hard under those conditions. The result will be in the end the same, it doesn't matter who owns the fire you simply die... So setTeamFriendlyFire would give the most performance. If you don't want fire in your server: addEventHandler("onClientPreRender",root, function () if isPedOnFire(localPlayer) then setPedOnFire(localPlayer,false) end end)
-
Ey horse guy, are you even listening to me?
-
@Derpy why are you changing your tabs while scrolling? Afaik your scroll is vertical(for the items) and not horizontal(for the tabs). local tabTextSize = 0 for i=1,#tab do local tabTitle = tab[i] dxDrawText(tabTitle,x,y+tabTextSize-5,sw,sh,tocolor(255,255,255),scaleX,font) -- THERE IS NO ,scaleY !!!!!! tabTextSize = tabTextSize+dxGetTextWidth(tabTitle,scaleX,font)+10 --tab tab tab tab ...
-
It is: getElementType getElementModel outputChatBox and not: getElemntType isElementModel OutPutChatBox And don't tell me you don't see any warnings of that, because that would a lie. Unless your meta is incorrect...
-
I recommend this: function delayedKill (player,command) -- player = you, command = "test1" setTimer (function () if isElement(player) then -- Players can leave during the timer, which will give you warning if this happens. killPed(player) end end,1500, 1) end addCommandHandler ("test1", delayedKill) As scripter you don't want warnings during execute your code. Warnings = lagg and fill up your server logs.
-
Well it would be nice to keep the camera static. Like this: local playerCameraTarget = {0,0,0} local extendLine2D = function ( x,y,x2,y2,length ) local vx = x2 - x local vy = y2 - y local ratio = length/(getDistanceBetweenPoints2D ( x,y,x2,y2 )) vx = vx*ratio vy = vy*ratio return (x + vx),(y + vy) end addEventHandler("onClientPreRender",root, function () local playerX,playerY,playerZ = getElementPosition(localPlayer) local cameraTargetX,cameraTargetY,cameraTargetZ = playerCameraTarget[1],playerCameraTarget[2],playerCameraTarget[3] local distance2DFromCameraTarget = getDistanceBetweenPoints2D(cameraTargetX,cameraTargetY,playerX,playerY) local cameraStartX,cameraStartY = extendLine2D(cameraTargetX,cameraTargetY,playerX,playerY,distance2DFromCameraTarget+6) local cameraEndX,cameraEndY = extendLine2D(cameraTargetX,cameraTargetY,playerX,playerY,distance2DFromCameraTarget-10) setCameraMatrix ( cameraStartX,cameraStartY,playerZ+1, cameraEndX,cameraEndY,playerZ, 0, 0, 70 ) end)
-
Also thank you Novo and Anubhav for other explanations, examples and websites! Storing and loading, it is all working now!
-
ah yea, mist that one. Yet not critical, since false can never be 0. thx
-
Huh? Why would you define a table under the name query? And at line 7 you check if: it isn't a table or the variable query isn't empty or variable query. Should be: if type(result) == "table" and #result~= 0 then Yet I didn't notice any real mistakes in it, just extra checks. Thx for that.
