-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
Me parece que no entendes como funciona, esa funcion no es para usar .gif es para SIMULAR su efecto.
-
Cargaste todas las imagenes en el archivo: meta.xml y se llaman asi? imagen1.png imagen2.png imagen3.png etc
-
Click it, it has examples.
-
No, "png" es la extension de las imagenes ( los sprites ).
-
Drift = createTeam( "Players Drift",255,255,0) addEvent("Drift",true) addEventHandler("Drift",root, function ( ) setPlayerTeam ( source, Drift ) setElementData ( source, "team", getTeamName ( Drift ) ) end ) function spawn(player) local x = getElementData(player,"x") local y = getElementData(player,"y") local z = getElementData(player,"z") local team = getTeamFromName(getElementData(player,"team")) local skin = getElementData(player,"skin") spawnPlayer(player,x,y,z,0,skin,0,0,team) r, g, b = getTeamColor ( getPlayerTeam ( player ) ) setPlayerNametagColor ( player, r, g, b ) giveWeapon ( player , 16, 1 ) giveWeapon ( player , 31, 100 ) giveWeapon ( player , 24, 100 ) fadeCamera(player,true) setCameraTarget(player,player) end addEvent("spawnPlayer",true) addEventHandler("spawnPlayer",root, function () spawn(source) end ) addEventHandler("onPlayerWasted",root, function () setTimer(spawn,3000,1,source) end ) addEventHandler("onPlayerWasted",root, function (_,killer) if ( killer and killer ~= source ) then givePlayerMoney(killer,math.random(5000)) end end ) addEvent ( "takeWeapons", true ) addEventHandler( "takeWeapons", root, function ( ) takeAllWeapons ( source ) setPlayerTeam ( source, nil ) end )
-
Si, con eso deberia funcionar.
-
Podes usar mi funcion para simular el efecto de un GIF con sprites: https://wiki.multitheftauto.com/wiki/DxDrawGifImage
-
As the person above said, you must connect to mysql with dbConnect.
-
You don't need a resource called "mysql", you can do it however you want, although, you should make one resource which is used to connect to mysql and export the connection so you can use it on different resources.
-
We don't accept requests here. Learn to make it by yourself or pay someone to do it for you.
-
Well, this topic wasn't done to post suggestions for my public resources, also, the gang system I uploaded is a basic one.
-
Yeah, I just noticed that I forgot to make that, fixed.
-
You must only use the second one.
-
bindKey ("F6", "down", function ( ) local state = guiGetVisible ( wnd ) guiSetVisible ( wnd, not state ) guiSetVisible ( bHealth, not state ) guiSetVisible ( bDie, not state ) showCursor ( not state ) end )
-
You should put it here instead: https://wiki.multitheftauto.com/wiki/Useful_Functions
-
cButton = guiCreateButton(1088, 668, 125, 35, "CLOSE", false, GUIEditor.window[2]) Should be: cButton = guiCreateButton(1088, 668, 125, 35, "CLOSE", false, Window)
-
Place: addEventHandler ("onClientGUIClick", cButton, initGUI, false ) after you create the button.
-
Ok, el problema era que el disco era GUI y la aguja era DX, asi que le cambie para que tambien fuera DX: g_root = getRootElement() g_rootElement = getResourceRootElement( getThisResource() ) g_Player = getLocalPlayer() c_EnableScaling = true -- --> These values will be scaled with screen size -- Offsets from the lower right screen corner c_XOffset = 10 c_YOffset = 10 c_ImageW = 200 c_ImageH = 200 c_BarW = 50 c_BarH = 10 c_BarYOffset = 70 -- <-- -- All other values are fixed c_FireTimeMs = 5000 c_BarAlpha = 120 c_BarFlashInterval = 300 g_tFireStart = nil function drawNeedle() if not isPedInVehicle(g_Player) then -- Fallback for player exiting car without onClientVehicleStartExit event -- (e.g. falling off a bike) hideSpeedometer() end local vehSpeed = getVehicleSpeed() local vehHealth = getElementHealth(getPedOccupiedVehicle(g_Player)) dxDrawImage(g_screenWidth - g_ImageW - g_XOffset, g_screenHeight - g_ImageH - g_YOffset, g_ImageW, g_ImageH, "disc.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) if vehHealth and (vehHealth > 0) then -- Show a little red/green health bar on the speedo local hp = (vehHealth-250)/750 local curBarLen = hp*g_BarW if curBarLen < 1 then curBarLen = 1 end -- green/yellow till 50%, then yellow/red local r = 255*(1 - hp)/0.5 if r > 255 then r = 255 end local g = 255*hp/0.5 if g > 255 then g = 255 end if g < 0 then g = 0 end if hp >= 0 then g_tFireStart = nil dxDrawRectangle(x + g_ImageW/2 - g_BarW/2, y + g_BarYOffset, curBarLen, g_BarH, tocolor(r, g, 0, c_BarAlpha), true) else -- Flash red bar for 5s when car is about to blow if not g_tFireStart then g_tFireStart = getTickCount() end local firePerc = (c_FireTimeMs - (getTickCount() - g_tFireStart)) / c_FireTimeMs if firePerc < 0 then firePerc = 0 end local a = c_BarAlpha if (getTickCount()/c_BarFlashInterval)%2 > 1 then a = 0 end dxDrawRectangle(x + g_ImageW/2 - g_BarW/2, y + g_BarYOffset, firePerc*g_BarW, g_BarH, tocolor(255, 0, 0, a), true) end end -- Draw rotated needle image -- Image is scaled exactly 1 per kmh of speed, so we can use vehSpeed directly dxDrawImage(x, y, g_ImageW, g_ImageH, "needle.png", vehSpeed, 0, 0, white, true) end function showSpeedometer() addEventHandler("onClientRender", g_root, drawNeedle) end function hideSpeedometer() removeEventHandler("onClientRender", g_root, drawNeedle) end function getVehicleSpeed() if isPedInVehicle(g_Player) then local vx, vy, vz = getElementVelocity(getPedOccupiedVehicle(g_Player)) return math.sqrt(vx^2 + vy^2 + vz^2) * 161 end return 0 end addEventHandler("onClientVehicleEnter", g_root, function(thePlayer) if thePlayer == g_Player then showSpeedometer() end end ) addEventHandler("onClientVehicleStartExit", g_root, function(thePlayer) if thePlayer == g_Player then hideSpeedometer() end end ) function round(num) return math.floor(num + 0.5) end function initGui() if disc then destroyElement(disc) end g_screenWidth, g_screenHeight = guiGetScreenSize() local scale if c_EnableScaling then scale = (g_screenWidth/1152 + g_screenHeight/864)/2 else scale = 1 end g_XOffset = round(c_XOffset*scale) g_YOffset = round(c_YOffset*scale) g_ImageW = round(c_ImageW*scale) g_ImageH = round(c_ImageH*scale) g_BarW = round(c_BarW*scale) g_BarH = round(c_BarH*scale) g_BarYOffset = round(c_BarYOffset*scale) x, y = g_screenWidth - g_ImageW - g_XOffset, g_screenHeight - g_ImageH - g_YOffset end addEventHandler("onClientResourceStart", g_rootElement, function () initGui() setTimer(function() local w, h = guiGetScreenSize() if (w ~= g_screenWidth) or (h ~= g_screenHeight) then initGui() end end, 500, 0) if isPedInVehicle(g_Player) then showSpeedometer() end end )
-
It's the "getPropagated" argument, if you don't set it to false, it'll trigger the function by any other GUI element clicked.
-
Subi el recurso entero a mediafire.com y postea el link.
-
GUIEditor = { button = {}, label = {}, window = {}, } addEventHandler("onClientResourceStart", resourceRoot, function() Window = guiCreateWindow(385, 158, 478, 385, "Buy A Vehicle", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(26, 98, 326, 34, "Infernous : $30000", false, Window) guiSetFont(GUIEditor.label[1], "sa-header") bBuy = guiCreateButton(373, 108, 86, 29, "BUY", false, Window) end ) local buyVeh = createMarker(1940.5185546875, -1707.1162109375, 13.3828125, "cylinder", 1.5, 255, 255, 0, 170) function showGUIp(hitPlayer) if ( hitPlayer == localPlayer ) then setElementFrozen ( localPlayer, true ) guiSetVisible ( Window, true ) showCursor ( true ) end end addEventHandler ( "onClientMarkerHit", buyVeh, showGUIp ) function initGUI ( ) guiSetVisible ( Window, false ) guiSetInputEnabled ( false ) showCursor ( false ) end addEventHandler ( "onClientGUIClick", cButton, initGUI, false )
-
You're welcome.
-
You just need to hide the window. P.S: You put "GUIEditor.window[1]" instead of "Window" as parent.