Castillo Posted March 17, 2013 Posted March 17, 2013 But the script already does that, it renders it over the vehicle.
Fabioxps Posted March 18, 2013 Author Posted March 18, 2013 But the script already does that, it renders it over the vehicle. but not the vehicle created
Fabioxps Posted March 18, 2013 Author Posted March 18, 2013 I want the rectangle appears in the vehicle created test the code on your server to see you
Castillo Posted March 18, 2013 Posted March 18, 2013 You want it to appear on a specific vehicle and not in the local player's vehicle?
Fabioxps Posted March 18, 2013 Author Posted March 18, 2013 "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)
Castillo Posted March 18, 2013 Posted March 18, 2013 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 ( ) 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 local scale = 1 / ( 0.3 * ( distance / 150 ) ) dxDrawRectangle ( sx - 100, sy - 105, 200, 70, tocolor ( 0, 0, 0, 200 ) ) dxDrawText ( "#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, true ) end end end end end
Fabioxps Posted March 19, 2013 Author Posted March 19, 2013 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?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now