Jump to content

Gallardo9944

Members
  • Posts

    442
  • Joined

  • Last visited

Everything posted by Gallardo9944

  1. Something like this. Untested. local turn = true -- OUTSIDE THE RENDERER local alpha = 255 -- OUTSIDE THE RENDERER local vehHP = 100 -- YOUR VALUE function renderHealth() if ( vehHP <= 300 ) then if turn == true then alpha = alpha + 2 if alpha > 255 then alpha = 255 turn = false end elseif turn == false then alpha = alpha - 2 if alpha < 0 then alpha = 0 turn = true end end dxDrawText("Warning", 0.37*x, 0.962*y, 0.5*x, 1.0*y, tocolor(255, 0, 0, alpha), 0.0012*x, 0.0019*y, "default", "center", "center", false, false, true, false) else return end end addEventHandler("onClientRender",getRootElement(),renderHealth)
  2. Should be working. Didn't test though. -- SERVERSIDE local text = [[ -- Double bracket is made to have an ability to write multiple lines in lua string. Don't need if you have the text in a variable. outputChatBox("Here it goes") outputChatBox("And here too") ]] -- your code function triggerIt(player) triggerClientEvent(player,"launchCode",player,text) -- trigger to clientside end addCommandHandler("launch",triggerIt) -- it will happen when you write /launch -- CLIENTSIDE addEvent("launchCode",true) function launchCode(code) local compiledCode = loadstring(code) -- compile the code local handler = pcall(compiledCode) -- load the code if handler then outputChatBox("It loaded, yeah") else outputChatBox(":(") end end addEventHandler("launchCode",getRootElement(),launchCode)
  3. in fact, the question is stated incorrectly. The player will have the rectangle at 300,300 with any resolution, but if you mean you want to scale it, you could easily do it like that: local sx,sy = 300,300 -- Your size local px,py = 300,300 -- Your position local x,y = guiGetScreenSize() -- Get the resolution of the player local scale = y/768 -- Scale to your screen height (Divide by some smaller value to make it scale more, divide by bigger value to scale less) I divided it by your screen height so the scale is 1 for you and it changes for other players depending on their resolution. sx,sy = sx*scale,sy*scale -- Calculate the absolute size depending on the resolution. px,py = px*scale,py*scale -- Calculate the position as well. I suggest to always scale by the screen height as it is never bigger than the screen width, so the image/rectangle/whatever won't get out of the box.
  4. you can also send a string with your code and do a loadstring + pcall clientside.
  5. try getSkyGradient() when you have the original GTA night and then restore its values when needed. Or resetSkyGradient() + setWeather(0)
  6. remove every single "element1" statement, including destroyElement. And it should be working. local screenWidth,screenHeight = guiGetScreenSize() function updateHUD () arma = getPedWeapon( getLocalPlayer() ) clip = getPedAmmoInClip ( getLocalPlayer() ) bala = getPedTotalAmmo ( getLocalPlayer() ) showPlayerHudComponent ("weapon", false ) showPlayerHudComponent ("ammo", false) showPlayerHudComponent ("clock", false) if getElementData(getLocalPlayer(),"Watch") >= 1 then local hour, minutes = getTime() dxDrawText(" "..hour..":"..minutes, screenWidth*0.887, screenHeight*0.157, screenWidth*0.988, screenHeight*0.194, tocolor(35, 98, 36, 255), 1.70, "sans", "left", "top", false, false, false, false, false) end dxDrawText(""..clip.." | "..bala,screenWidth*0.896, screenHeight*0.059, screenWidth*0.988, screenHeight*0.089, tocolor(23, 112, 31, 255), 1.50, "default-bold", "left", "top", false, false, false, false, false) if ( arma==31 ) dxDrawText(" M4 ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==30 ) then dxDrawText(" AK-47 ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==27 ) then dxDrawText(" Combat Shotgun ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==28 ) then dxDrawText(" TEC ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==29 ) then dxDrawText(" MP5 ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==26 ) then dxDrawText(" SAWN-OFF ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==25 ) then dxDrawText(" Shotgun ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==24 ) then dxDrawText(" Desert Eagle ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==23 ) then dxDrawText(" Silencer ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==22 ) then dxDrawText(" Pistol ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==8 ) then dxDrawText(" Katana ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==6 ) then dxDrawText(" Shovel ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==4 ) then dxDrawText(" Knife ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==5 ) then dxDrawText(" Baseball Bat ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==2 ) then dxDrawText(" Golf Club ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==33 ) then dxDrawText(" Rifle ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==34 ) then dxDrawText(" Sniper ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==16 ) then dxDrawText(" Grenade ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false)end if ( arma==17 ) then dxDrawText(" Tear Gas ", screenWidth*0.845, screenHeight*0.024, screenWidth*0.978, screenHeight*0.59, tocolor(23, 112, 31, 255), 1.50, "sans", "left", "top", false, false, false, false, false) end end addEventHandler ( "onClientRender", getRootElement(), updateHUD )
  7. image = guiCreateStaticImage(0.19, 0.01, 0.63, 1.00, "img/level/levelUP.png", true) timer = setTimer(guiSetVisible,20000,1,image,false)
  8. lol no. Create a custom function which handles that in and remove/add event handlers when needed.
  9. yep, that's right, cause you need to add onClientRender to dx functions as they are working for 1 frame.
  10. does your admin resource have access to the acl?
  11. you can use client pre-render together with getting the player's position and setting the marker's location to the player's one.
  12. function open() opened = not opened if opened == true then addEventHandler("onClientRender", getRootElement(), Panel) showCursor(true) guiSetVisible(Cheatbutton1, true) guiSetVisible(Cheatbutton2, true) guiSetVisible(Cheatbutton3, true) guiSetVisible(Cheatbutton4, true) else guiSetVisible(Cheatbutton1, false) guiSetVisible(Cheatbutton2, false) guiSetVisible(Cheatbutton3, false) guiSetVisible(Cheatbutton4, false) showCursor(false) removeEventHandler("onClientRender", getRootElement(), Panel) end end bindKey("F7","down",open)
  13. addEventHandler("onClientPlayerJoin", getRootElement(), HandleTheRendering) Nope. It will execute the code when the player joins, not when the player finishes downloading. Do it like this: addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),HandleTheRendering)
  14. function renderIng(ID) addEventHandler( "onClientRender", getRootElement( ),renderIng) ID there is nil. onClientRender doesn't send anything to the function. local tables = { [1]={-2421.69238, -582.35858, 133.61719, "Caine"}, } function renderIng() local x, y, z = getCameraMatrix( ) for ID,v in ipairs(tables) do local px, py, pz = tables[ID][1], tables[ID][2], tables[ID][3] local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z ) if distance <= 20 then local text = tables[ID][4] if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 0.7, true, true, true, true, false, false, true, localPlayer ) ) then local sx, sy = getScreenFromWorldPosition( px, py, pz + 0.7 ) if sx and sy then local w = dxGetTextWidth( tostring( text ) ) local h = ( text and 2 or 1 ) * dxGetFontHeight( ) dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1, "default", "center", "center" ) end end end end end addEventHandler( "onClientRender", getRootElement( ),renderIng) Didn't test though.
  15. local r,g,b = 255,255,255 -- Default is white function renderImage() dxDrawImage(100,100,200,200,"image.png",0,0,0,tocolor(r,g,b,255)) -- Draw your image end addEventHandler("onClientRender",getRootElement(),renderImage) -- Render it cause dx functions are drawn for 1 frame. function setColours(command,c1,c2,c3) c1 = tonumber(c1) -- We have strings by default, so try to make them numbers c2 = tonumber(c2) c3 = tonumber(c3) if not c1 or not c2 or not c3 then return end -- If some value can't be a number, then don't apply the changes r,g,b = c1,c2,c3 end addCommandHandler("color",setColours) /color 255 0 0 and it sets the image to be red. The code is untested though.
  16. if so, you'd better some something, but not the pot (otherwise you'll have to collide the middle of the object to make it move, rotate, etc), depending on the size and shape of the object.
  17. ehm, do projectiles have physics then? They also fly directly by the line, without any boost or speed changes. So you can do the same with objects and it won't be different. As Saml1er said, moveObject + explosion will be enough. Just get the position of the object each frame and calculate if someone is over it to toggle explosion there.
  18. MySQL uses RAM, CPU, admin's time, ... Please, ask proper questions.
  19. Well, try increasing the speed of transfering in the latent event, maybe it's not loading just cause it didn't manage to. Also, try getting the latent event state and get the percentage.
  20. Well, another way is to push map clientside and build it there but hide other players clientside to other dimensions.
  21. why not destroyElement on the variable containing the TXD?
×
×
  • Create New...