GsSchulzZ Posted April 22, 2020 Share Posted April 22, 2020 (edited) estou tentando por um vídeo em vez de uma imagem (Exemplo o "Se Fodeu") quando o player morre, mas não esta indo, alguém ajuda ae? Edited April 22, 2020 by GsSchulzZ Link to comment
Other Languages Moderators Lord Henry Posted April 22, 2020 Other Languages Moderators Share Posted April 22, 2020 Mostre o que você já tentou fazer. Utilize o botão <> do fórum para postar o código. Link to comment
GsSchulzZ Posted April 22, 2020 Author Share Posted April 22, 2020 local crosses = {} local crossesEnabled = true local crossTimeoutTime = 30000 local crossViewDistance = 30 local crossTextFont = "bankgothic" local crossTextScale = 1 function wasted () local x, y, z = getElementPosition ( source ) local playername = getPlayerName ( source ):gsub("#%x%x%x%x%x%x","") local r,g,b = getPlayerNametagColor ( source ) local tick = getTickCount() table.insert(crosses,{x=x,y=y,z=z,name=playername,r=r,g=g,b=b,tick=tick}) end addEventHandler("onClientPlayerWasted",getRootElement(),wasted) function riplabel() -- Get the camera position. We use the camera position to measure distance to the crosses local camX,camY,camZ = getCameraMatrix() -- Get the current CPU time (in ms) to compare with the cross times -- In this way, we can see how long the cross exists, and delete it if necessary local tick = getTickCount() -- Loop through all crosses for index,cross in ipairs(crosses) do -- Check if the cross has had its time if tick - cross.tick <= crossTimeoutTime then -- Get the cross position local posX, posY, posZ = cross.x, cross.y, cross.z -- See if the camera is close enough if getDistanceBetweenPoints3D(camX,camY,camZ,posX,posY,posZ) <= crossViewDistance then -- Get the screen position to draw the cross local screenX, screenY = getScreenFromWorldPosition(posX,posY,posZ) -- Check if it's actually on the screen if screenX then -- Get the text color local textColor = tocolor(cross.r, cross.g, cross.b, 255) -- Draw the image dxDrawImage ( (screenX-100), screenY-83, 200, 83, "video.mp4", 0, 0, 0, tocolor(127,127,127,255) ) -- Draw the text dxDrawText( cross.name, screenX, screenY+10, screenX, screenY, textColor, crossTextScale, crossTextFont, "center" ) end end -- If the cross indeed had its time else -- Remove the cross from the list (might cause a cross to disappear for one frame, but that's why you have 36 frames in 1 second anyway) table.remove(crosses,index) end end end addEventHandler ( "onClientRender", getRootElement(), riplabel ) function mapstop () -- Delete all crosses crosses = {} end addEvent ( "onClientMapStopping", true ) addEventHandler ( "onClientMapStopping", getRootElement(), mapstop ) --[[************************************************* * Part II: next checkpoint * *****************************************************]] local localplayer = getLocalPlayer() local veh function render () if #getElementsByType("checkpoint") > 0 then local veh = getPedOccupiedVehicle ( localplayer ) if veh then if getVehicleOccupant ( veh ) then local localplayer = getVehicleOccupant ( veh ) if getElementData ( localplayer, "nextcp" ) then local cp = getElementByID ( "checkpoint".. tostring ( tonumber( getElementData ( localplayer, "nextcp" ) -1 ) ) ) if cp then local cpnumber = tostring ( tonumber ( getElementData ( localplayer, "nextcp" ) ) ) local x, y, z = getElementPosition ( cp ) local px, py, pz = getElementPosition ( localplayer ) local distance = ": " .. tostring ( math.floor ( getDistanceBetweenPoints3D ( x, y, z, px, py, pz ) + 0.5 ) ) .. " m" local xx, yy = getScreenFromWorldPosition ( x, y, z ) local twidth = dxGetTextWidth ( distance ) / 2 local theight = dxGetFontHeight () / 2 if getElementData ( cp, "nextid" ) then color = tocolor(255,128,0,255) else color = tocolor(0,255,0,255) cpnumber = "Finish" end if xx then dxDrawText ( cpnumber..distance, xx, yy, xx-twidth, yy-theight, color, 1, "default", "center", "center" ) end end end end end end end addEventHandler ( "onClientRender", getRootElement(), render ) function mapstart () setElementData ( localplayer, "nextcp", 1 ) end addEventHandler ( "onClientMapStarting", getRootElement(), mapstart ) function playerfinish () setElementData ( localplayer, "nextcp", 0 ) end addEventHandler ( "onClientPlayerFinish", localplayer, playerfinish ) addEventHandler ( "onClientMapStopping", localplayer, playerfinish ) function reachcheckpoint ( checkp ) if (getLocalPlayer() == source) then setElementData ( source, "nextcp", checkp + 1 ) end end addEvent ( "onClientPlayerReachCheckpoint", true ) addEventHandler ( "onClientPlayerReachCheckpoint", getRootElement(), reachcheckpoint ) bom tipo eu basicamente peguei um script q tinha uma imagem e coloquei um vídeo, realmente achando que ia dar certo, e n deu ;( Link to comment
Other Languages Moderators Lord Henry Posted April 22, 2020 Other Languages Moderators Share Posted April 22, 2020 Eu faria com imagem mesmo e animaria a posição da imagem com interpolateBetween. Link to comment
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