Jump to content

cheez3d

Members
  • Posts

    290
  • Joined

  • Last visited

Everything posted by cheez3d

  1. local hospitals = { {2036.1735839844,-1413.0563964844,16.9921875,0}, {-2656.12,631.01,14.45,0}, {1607.07,1825.3,10.83,0} } addEventHandler("onPlayerWasted",root,function() local x,y = getElementPosition(source) local nearest = {} for k,position in ipairs(hospitals) do nearest[k] = {["distance"] = getDistanceBetweenPoints2D(x,y,position[1],position[2]),["position"] = position} end table.sort(nearest,function(a,b) return a["distance"]<b["distance"] end) setTimer(spawnPlayer,1000,1,source,nearest[1]["position"][1],nearest[1]["position"][2],nearest[1]["position"][3],0,getPedSkin(source),nearest[1]["position"][4],0,getPlayerTeam(source)) setTimer (setCameraTarget,1250,1,source,source) end) Not tested.
  2. You can create a table with the original San Andreas color codes: local colors = { [0] = {0,0,0}, [1] = {245,245,245}, [2] = {42,119,161} -- and so on until 126 } I suggest Instant Eyedropper for finding out the RGB color codes of those colors fast as I did with these three colors above. http://instant-eyedropper.com/
  3. cheez3d

    dxDraw Help

    Use something like this to calculate the position relative to the screen size: _dxDrawText = dxDrawText -- keep original function as we'll need it; function dxDrawText(text,left,top,relative,right,bottom,color,scale,font,alignX,alignY,clip,wordBreak,postGUI,colorCoded,subPixelPositioning,fRotation,fRotationCenterX,fRotationCenterY) local sx,sy = guiGetScreenSize() local left = relative and left*sx or left local top = relative and top*sy or top local right = relative and right and right*sx or not relative and right or left local bottom = relative and bottom and bottom*sy or not relative and bottom or top local color = color or tocolor(255,255,255) local scale = scale or 1 local font = font or "default" local alignX = alignX or "left" local alignY = alignY or "top" local clip = clip or false local wordBreak = wordBreak or false local postGUI = postGUI or false local colorCoded = colorCoded or false local subPixelPositioning = subPixelPositioning or false local fRotation = fRotation or 0 local fRotationCenterX = fRotationCenterX or 0 local fRotationCenterY = fRotationCenterY or 0 return _dxDrawText(text,left,top,right,bottom,color,scale,font,alignX,alignY,clip,wordBreak,postGUI,colorCoded,subPixelPositioning,fRotation,fRotationCenterX,fRotationCenterY) end The new function. bool dxDrawText ( string text, float left, float top, bool relative [, float right=left, float bottom=top, int color=white, float scale=1, mixed font="default", string alignX="left", string alignY="top", bool clip=false, bool wordBreak=false, bool postGUI=false, bool colorCoded=false, bool subPixelPositioning=false, float fRotation=0, float fRotationCenterX=0, float fRotationCenterY=0 ] ) And now you can just use dxDrawText with the relative argument just like in GUI functions.
  4. There are at least 3 more topics about this. Use the search button.
  5. local convert = function(bytes) return bytes*(9.53674316*10^-7) end
  6. fileDelete if it is an SQLite file or DbExec(connection,"DROP `database`") if it is a MySQL database.
  7. Try /svp. Make sure you are an admin.
  8. addEventHandler("onVehicleDamage",root,function(loss) --local player = getVehicleOccupant(source,0) //no need to use this local _,_,vz = getElementVelocity(source) if vz>0 and not isVehicleOnGround(source) and loss >=350 then blowVehicle(source) end end)
  9. The event "onVehicleDamage" has the loss parameter. https://wiki.multitheftauto.com/wiki/OnVehicleDamage
  10. Add this client-side and use /dump to dump the camera coordinates. They will be copied to your clipboard so you just use CTRL+V somewhere. addCommandHandler("dump",function() local x,y,z,lx,ly,lz = getCameraMatrix() setClipboard(tostring(x)..","..tostring(y)..","..tostring(z)..","..tostring(lx)..","..tostring(ly)..","..tostring(lz)) end)
  11. "onClientCursorMove" "onClientKey"
  12. local x,y,z,amount = --[[x coordinate of marker]],--[[y coordinate of marker]],--[[z coordinate of marker]],--[[amount of money to give]] addEventHandler("onMarkerHit",createMarker(x,y,z),function(element,dimension) if getElementType(element) == "player" and dimension then givePlayerMoney(element,amount) end end)
  13. Maybe the resource uses a client -> server -> client path for changing settings. Example: you click on a button to change a value of a setting -> the client sends your data to the server and then if successful triggers a callback client event that will output in the chatbox that message (as it is only visible to you if it is used clientside).
  14. You must modify the weather file.
  15. local seconds = 6 setTimer(function() seconds = seconds-1 exports["TopBarChat"]:sendClientMessage(string.format("#FF0000You will die in #00FF00%d#FF0000 seconds",seconds),255,255,255,true) if seconds<=0 then -- kill the ped end end,1000,seconds)
  16. I guess you'll have to deal with some DirectX functions.
  17. Firstly, you must have the source code. Secondly, you must understand the code to modify it.
  18. addEventHandler("onPlayerDamage",root,function(attacker,weapon,part) if attacker and getElementType(attacker) == "player" and attacker ~= source then if weapon == 8 and part == 9 then setPedHeadless(source,true) killPed(source,attacker,weapon,part) end end end)
  19. guiCreateStaticImage() guiStaticImageLoadImage() "onClientMouseEnter" "onClientMouseLeave" "onClientGUIClick"
  20. local mine_pos = { {271.94140625, 1350.1923828125, 10.5859375}, {275.94140625, 1350.1923828125, 10.5859375} } local n = math.random(1,#mine_pos) local mineplace = createMarker(mine_pos[n][1],mine_pos[n][2],mine_pos[n][3])
  21. I put the px,py,sx,sy variables outside onClientRender, otherwise you declare those variables every frame and the position of the picture will be different everytime. I tought you declared px and py as the start position of the animation.
  22. setWorldSoundEnabled() -- disable default engine sound playSound3D() -- play your own sound attachElements() -- attach it to the vehicle getElementVelocity() -- adjut sound properties depending on speed createColSphere() -- for playing the engine sound for all the other players that are near the car
  23. local px,py = guiGetPosition(pic,false) local sx,sy = guiGetScreenSize() local function render_handler() local nx,ny = interpolateBetween(px,py,0,px,(py)/3+475,0,getProgress(7500),"OutElastic",2,2,2) guiSetPosition(pic,nx,ny,false) end addEventHandler("onClientRender",root,render_handler)
  24. addCommandHandler("handbrake",function() local x,y,z = getElementPosition(localPlayer) local sound = playSound3D("handbrake.mp3",0,0,0,false) setSoundMaxDistance(sound,50) setSoundVolume(sound,1) local vehicle = getPedOccupiedVehicle(localPlayer) attachElements(sound,vehicle) end)
  25. for _,label in ipairs(getElementsByType("gui-label",resourceRoot)) do -- your code end This function also has a startat parameter. It defaults to the root element so it changes all the resources' fonts but you can specify resourceRoot to change only the resource's labels.
×
×
  • Create New...