Search the Community
Showing results for tags 'respawn_autos'.
-
me ayudan no puedo que la imagen duro tiempo se queta muy rapido ----- Client ----- local screenWidth,screenHeight = guiGetScreenSize() ---------------------------- function respawnVehicles ( ) dxDrawImage ( screenWidth/2 - 50, 0, 100, 240, "canakkale.png", 0, 0, tocolor( 255, 255, 255 ) ) setTimer(function () local vehicles = getElementsByType ( "vehicle" ) local seconds = getTickCount() / 1000 local angle = math.sin(seconds) * 100 dxDrawImage ( screenWidth/2 - 50, 0, 100, 240, "canakkale1.png", 0, 0, tocolor( 255, 255, 255 ) ) for k, vehicle in ipairs ( vehicles ) do if isEmpty( vehicle ) then respawnVehicle ( vehicle ) end end end, 20000, 1) end setTimer(respawnVehicles, 10000, 0) function isEmpty( vehicle ) local passengers = getVehicleMaxPassengers( vehicle ) if (type( passengers ) == 'number') then for seat = 0, passengers do if getVehicleOccupant( vehicle, seat ) then return false end end end return true end ------------------------------------------------------- -----------server----------- function respawnExplodedVehicle() setTimer(respawnVehicle, 5000, 1, source) end addEventHandler("onVehicleExplode", getRootElement(), respawnExplodedVehicle) --------------------------------- -----------meta ----------- <meta> <script src="server.lua" type="server" /> <script src="client.lua" type="client" cache="false"/> <file src="canakkale.png" /> <file src="canakkale1.png" /> </meta>
-
-----------clientee ---- local x, y = guiGetScreenSize ( ) sWidth,sHeight= guiGetScreenSize() function main() start = getTickCount() addEventHandler("onClientRender", getRootElement(), respawnVehicles ) end addEventHandler("onClientResourceStart", getResourceRootElement(), main) function respawnVehicles() xdDrawAnimWindow("hhopliio",420,400, tocolor(255, 0, 0, 255),"default-bold","InOutBack") setTimer(function () local vehicles = getElementsByType ( "vehicle" ) xdDrawAnimWindow("hhopliio",420,400, tocolor(255, 0, 0, 255),"default-bold","InOutBack") for k, vehicle in ipairs ( vehicles ) do if isEmpty( vehicle ) then respawnVehicle ( vehicle ) end end end, 10000, 1) end setTimer(respawnVehicles, 10000, 0) function isEmpty( vehicle ) local passengers = getVehicleMaxPassengers( vehicle ) if (type( passengers ) == 'number') then for seat = 0, passengers do if getVehicleOccupant( vehicle, seat ) then return false end end end return true end function xdDrawAnimWindow(text,alto,ancho,color,font,anim) btAncho = ancho btAlto = alto/20 local now = getTickCount() local elapsedTime = now - start local endTime = start + 1500 local duration = endTime - start local progress = elapsedTime / duration local x1, y1, z1 = interpolateBetween ( 0, 0, 0, ancho, alto, 255, progress, anim) local x2, y2, z2 = interpolateBetween ( 0, 0, 0, btAncho, btAlto, btAlto/11, progress, anim) posx = (x/2)-(x1/2) posy = (y/2)-(y1/2) dxDrawRectangle ( posx, posy-y2, x2, y2, color ) dxDrawRectangle ( posx, posy, x1, y1, tocolor ( 0, 0, 0, 200 ) ) dxDrawText ( text, 0, -(y1)-y2, x, y, tocolor ( 255, 255, 255, 255 ), z2, font,"center","center") --Para obtener mas animaciones visita https://wiki.multitheftauto.com/wiki/Easing end --------------------------- -----------------------server ------------------------ function respawnExplodedVehicle() setTimer(respawnVehicle, 5000, 1, source) end addEventHandler("onVehicleExplode", getRootElement(), respawnExplodedVehicle)