Jump to content

Fabioxps

Members
  • Posts

    229
  • Joined

  • Last visited

Everything posted by Fabioxps

  1. I have not tested yet but thanks
  2. race, winner how can I do, can someone help me addCommandHandler ( "a", function() local ped = createPed(0, 138.70454406738, 2491.1267089844, 16.484375) local pVeh = createVehicle(411, -73.699996948242, 2506.3999023438, 16.299999237061,0,0,270) warpPedIntoVehicle ( ped,pVeh ,0 ) triggerClientEvent("onCameraStart",root, ped,pVeh) triggerClientEvent("stunts",getRootElement(),stunts) outputChatBox("test") end) local peds = { } stunt = nil function stunts(tag) stunt = tag end addEvent("stunts",true) addEventHandler("stunts",getRootElement(),stunts) function camera ( ) for ped,veh in pairs(peds)do local x, y, z = getElementPosition(veh) setCameraMatrix(x+12, y+11, z+4, x, y, z) end end function cameraStarts(ped) setPedControlState(ped,"accelerate",true) setTimer(function() setPedControlState(ped,"accelerate",false) end,800,1) pVeh = getPedOccupiedVehicle(ped) if not peds[ped] then peds[ped] = pVeh end addEventHandler("onClientRender",root,camera) addEventHandler("onClientRender",getRootElement(),stunt) end addEvent( "onCameraStart", true ) addEventHandler( "onCameraStart",root, cameraStarts ) function stunt ( ) local x, y = guiGetScreenSize ( ) for _, veh in pairs ( peds ) do if ( veh ) then local x, y, z = getElementPosition ( veh ) local px, py, pz = x + 5, y + 10, z + 2 local distance = getDistanceBetweenPoints3D ( x, y, z, px, py, pz ) if ( distance <= 150 ) then local sx, sy = getScreenFromWorldPosition ( x, y, z + 0.55, 0.06 ) if ( sx ) then if stunt ~= nil then local scale = 1 / ( 0.3 * ( distance / 150 ) ) dxDrawImage ( sx - 100, sy - 105, 200, 70,"img.png",0,0,0,tocolor(255,255,255,255)) dxDrawText ( stunt, sx, sy - 70, sx, sy - 60, tocolor ( 255, 255, 255, 255 ), math.min ( 0.4 * ( 20 / distance ) * 1.4, 4 ), "default-bold", "center", "bottom", false, false, false, true ) end end end end end end here no more errors as I do that?
  3. thank you very much Castillho
  4. "local pVeh = createVehicle(411, -73.699996948242, 2506.3999023438, 16.299999237061,0,0,270)" addCommandHandler ( "a",function() local ped = createPed(0, 138.70454406738, 2491.1267089844, 16.484375) local pVeh = createVehicle(411, -73.699996948242, 2506.3999023438, 16.299999237061,0,0,270) warpPedIntoVehicle ( ped,pVeh ,0 ) triggerClientEvent("onCameraStart",root, ped,pVeh) outputChatBox("test") end)
  5. this script is for a map when the player arrives on site to create a exploasao
  6. function fakeBomb(x,y,z,d) if d then --Check the players Dimension if getElementDimension(getLocalPlayer()) == d then --If the players Dimension is the current dimension --Then people on other dimensions cant see this explosion createExplosion(x, y, z, 0, true, -1.0, false) end else createExplosion(x,y,z,0,true,-1.0,false) end end addEvent("fakeBomb",true) addEventHandler("fakeBomb",getRootElement(),fakeBomb) local zone = createColSphere( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) function shapeHit(hitPlayer, matchingDimension) local pX, pY, pZ = getElementPosition ( source ) createExplosion ( pX, pY, pZ, 6, hitPlayer, true, true, false ) triggerClientEvent ( "fakeBomb", getRootElement(), x, y, z, 0 ) end addEventHandler( 'onColShapeHit', zone, shapeHit )
  7. how can I cause an explosion that will not harm the player local zone = createColSphere( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) function shapeHit(hitPlayer, matchingDimension) local pX, pY, pZ = getElementPosition ( source ) createExplosion ( pX, pY, pZ, 6, hitPlayer ) end addEventHandler( 'onColShapeHit', zone, shapeHit )
  8. I want the rectangle appears in the vehicle created test the code on your server to see you
  9. but not the vehicle created
  10. I do not know how I can explain can follow me on my server?
  11. I want the rectangle to stay in the vehicle created
  12. I want the rectangle to stay in the vehicle created but this on top of my vehicle
  13. is to stay on top of the vehicle this in my car
  14. I want to create a rectangle on top of the vehicle with my name more giving this error WARNING: "getElemetPosition" ERROR: local 'x' (a bolean value)
  15. what do this wrong here local peds = {} function camera() for ped,veh in pairs(peds)do local x, y, z = getElementPosition(veh) setCameraMatrix(x+8, y+10, z+4, x, y, z) end end function cameraStarts(ped) setPedControlState(ped,"accelerate",true) setTimer(function() setPedControlState(ped,"accelerate",false) end,600,1) pVeh = getPedOccupiedVehicle(ped) if not peds[ped] then peds[ped] = pVeh end addEventHandler("onClientRender",root,camera) addEventHandler("onClientRender",getRootElement(),stunt) end addEvent( "onCameraStart", true ) addEventHandler( "onCameraStart",root, cameraStarts ) function stunt() local x, y = guiGetScreenSize() if pVeh ~= nil then local x,y,z = getElementPosition(veh) local px,py,pz = x+5, y+10, z+2 local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if distance <= 150 then local sx,sy = getScreenFromWorldPosition ( x, y, z+0.55, 0.06 ) if not sx then return end local scale = 1/(0.3 * (distance / 150)) dxDrawRectangle ( sx - 100, sy - 105, 200, 70, tocolor ( 0, 0, 0, 200 ) ) dxDrawColoredText ( "#000000Fabioxps", sx, sy - 70, sx, sy-30, tocolor(255,255,255,255), math.min ( 0.4*(20/distance)*1.4,4), "default-bold", "center", "bottom", false, false, false ) end end end local screen_width, screen_height = guiGetScreenSize() function dxDrawColoredText(text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) right = right or screen_width bottom = bottom or screen_height while(left < 0) do left = screen_width - math.abs(left) end while(top < 0) do top = screen_height - math.abs(top) end while(right < 0) do right = screen_width - math.abs(right) end while(bottom < 0) do bottom = screen_height - math.abs(bottom) end if(right > screen_width)then right = screen_width end if(bottom > screen_height)then bottom = screen_height end color = color or tocolor(255, 255, 255, 200) scale = scale or 1 font = font or "default" alignX = alignX or "left" alignY = alignY or "top" clip = clip or false wordBreak = wordBreak or false postGUI = postGUI or true local alpha = intToAlpha(color) local text_width = 0 local offset = 0 local text_height = dxGetFontHeight(scale, font) local TEXT_WIDTH = dxGetTextWidth(text:gsub("#%x%x%x%x%x%x", ""), scale, font) local off = -TEXT_WIDTH local width = 0 local height = 0 if(alignX == "center")then left = left + width/2 - TEXT_WIDTH/2 end if(alignX == "right")then left = left + width - TEXT_WIDTH end if(alignY == "center")then top = top + height/2 - text_height/2 end if(alignY == "bottom")then top = top + height - text_height end alignX = "left" alignY = "top" -- 0 index ? local col1, col2 = string.find(text, "#%x%x%x%x%x%x") if col1 ~= nil then col1 = col1-1 end -- draw text with the color we sent until we find hexadecimal code. for i = 1, col1 or string.len(text) do text_width = dxGetTextWidth(string.sub(text, i, i), scale, font) dxDrawText(string.sub(text, i, i), left + offset, top, right-off+offset, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) offset = offset + text_width end while(string.find(text, "#%x%x%x%x%x%x", i))do local hex1, hex2 = string.find(text, "#%x%x%x%x%x%x") local r, g, b, a = getColorFromString(string.sub(text, hex1, hex2)) text = string.sub(text, hex2 + 1) hex1, hex2 = string.find(text, "#%x%x%x%x%x%x") if hex1 ~= nil then hex1 = hex1-1 end for i = 1, hex1 or string.len(text) do text_width = dxGetTextWidth(string.sub(text, i, i), scale, font) dxDrawText(string.sub(text, i, i), left + offset, top, right-off+offset, bottom, tocolor(r, g, b, alpha), scale, font, alignX, alignY, clip, wordBreak, postGUI) offset = offset + text_width end end end function intToAlpha(color) local a = 16777216 local red, green, blue, alpha = 0, 0, 0, 0 local ap = 1 if(color < 0)then color = 2147483648 + (-color) alpha = 383 ap = -ap end while(color >= a)do alpha = alpha + ap color = color - a end return alpha end
  16. longer works because the car shakes? thanks for the help
  17. yes but the camera follow vehicle
  18. thanks for replying, but still not working the camera does not follow the car
×
×
  • Create New...