Jump to content

..:D&G:..

Members
  • Posts

    1,028
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ..:D&G:..

  1. I like DX, it looks nicer and it's better optimized (in a way...).
  2. I don't know why, I don't know how, but look:
  3. I managed to find the problem, but I am so pissed that I can't figure out how to solve it :@ So if I do this: outputDebugString(""..userName.."WORD") it comes up as: INFO: Username WORD, now how do I remove the space at the end of the username so I have the username and 'WORD' joined together?
  4. showChat(false) -- hide chat showChat(true) -- show chat or use guiSetInputMode("no_binds_when_editing")
  5. PLEASE someone tell me what is wrong with this before I go nuts! function checkLoginCreditals(name, pass) local result = db:query( "SELECT * FROM users WHERE name ='"..name.."'") if result then if md5(pass) == tostring(result[1]['password']) then return true else return false end end return false end It outputs the password and username as it should, but from line 3 onwards it doesn't work.... I've used THE SAME THING, in another function and it works perfectly! function setPlayerDatas(player, accountName) local result = db:query("SELECT * FROM users WHERE name = '"..accountName.."'") if result then setData(player, "deaths", tonumber(result[1]['deaths'])) setData(player, "woodHarvested", tonumber(result[1]['woodHarvested'])) setData(player, "kills", tonumber(result[1]['kills'])) setData(player, "accountName", tostring(accountName)) end end addEvent("setPlayerDatas", true) addEventHandler("setPlayerDatas", getRootElement(), setPlayerDatas) So what the hell is wrong with the first function? -.-
  6. I sorted it out now, now it removes the handler for the old function before adding it to a new one, and now there is only 1 function for the buttons. But now after a few seconds, the font just failes and turns to a boolean, and when I click a "button", it clicks 2 times instead of once...
  7. So I made this login panel with DX, but after a few seconds having the window (renderLoginWindow()) open and clicking the buttons a few times, my game freezes but it doesn't go into "not responding". loginMod = 0 local rustFont = dxCreateFont(":Main/files/Rust.ttf", 30) function build_loginWin() loginMod = 1 dxDrawText("Login", s[1]*161/1920, s[2]*635/1080, s[1]*357/1920, s[2]*718/1080, tocolor(255, 255, 255, 255), 1.00, rustFont, "center", "center", false, false, false, false, false) dxDrawText("Register", s[1]*136/1920, s[2]*728/1080, s[1]*380/1920, s[2]*799/1080, tocolor(255, 255, 255, 255), 1.00, rustFont, "center", "center", false, false, false, false, false) dxDrawText("Quit", s[1]*161/1920, s[2]*809/1080, s[1]*347/1920, s[2]*886/1080, tocolor(255, 255, 255, 255), 1.00, rustFont, "center", "center", false, false, false, false, false) showChat(false) showCursor(true) guiSetInputMode("no_binds_when_editing") end function showLoginOnJoin() addEventHandler("onClientRender",root,build_loginWin) addEventHandler("onClientClick", getRootElement(), onLoginButtonsClick ) end addEventHandler("onClientPlayerJoin", getRootElement(), showLoginOnJoin) function showLoginOnStartup() showLoginOnJoin() end addEventHandler("onClientResourceStart", getRootElement(), showLoginOnJoin) function renderLoginWindow() createLoginEditBoxes() loginMod = 2 dxDrawText("Close", s[1]*1130/1920, s[2]*613/1080, s[1]*1260/1920, s[2]*662/1080, tocolor(255, 255, 255, 255), 1.00, lRustFont1, "center", "center", false, false, false, false, false) dxDrawText("Login", s[1]*931/1920, s[2]*613/1080, s[1]*1109/1920, s[2]*662/1080, tocolor(255, 255, 255, 255), 1.00, lRustFont1, "center", "center", false, false, false, false, false) end function onLoginButtonsClick() if clickLoginClose and (getElementData(getLocalPlayer(), "loggedin") == false) and (loginMod == 2) then removeEventHandler("onClientRender",getRootElement(),renderLoginWindow) loginMod = 1 elseif clickLoginButt and (getElementData(getLocalPlayer(), "loggedin") == false) and (loginMod == 2) then -- LOGIN FUNCTION elseif clickLogin and (getElementData(getLocalPlayer(), "loggedin") == false) and (loginMod == 1) then addEventHandler("onClientRender",root,renderLoginWindow) elseif clickRegister and (getElementData(getLocalPlayer(), "loggedin") == false) and (loginMod == 1) then outputDebugString("Clicked register") --addEventHandler("onClientRender",root,renderRegisterWindow) elseif clickQuit and (getElementData(getLocalPlayer(), "loggedin") == false) and (loginMod == 1) then outputDebugString("Quit") --addEventHandler("onClientRender",root,renderQuitWindow) end end Thanks.
  8. Wut? I don't get it What does that have to do with having an event handler in more than 1 function?
  9. So I need more than 1 function to have the onClientClick handler, but it says that the handler is already tied to another function and the player just freezes... So, is there a way to have onClientClick on more than 1 function? Thanks.
  10. The image doesn't change, its just only 1 that flashes like mad. I'm lucky I don't have epilepsy, lol
  11. Well, this was supposed to do that: if apmode == true then if ap < 255 then ap = ap + 5 else ap = 255 end else if ap > 0 then ap = ap - 5 else ap = 0 end end It fades out at the first image, then nothing, it just changed to the next image.
  12. Well it kinda works, but the images don't fade in and out as they should... And their alpha is like 50, I can barely see them, lol
  13. The pictures just flash on the screen for like half a second. If you want I can give you the server details and you can have a look.
  14. Oh gosh, I did that before and I ended up creating 100 of timers and crashed the server
  15. Managed to make it add, by adding this in the code: i = i+1
  16. Here, use this: local frame = 0 local goingRight = true local goingLeft = false function rotateCamera( ) if frame <= 400 and goingRight then local a, b, c, d, e, f = getCameraMatrix() setCameraMatrix(a, b, c, d + 0.2, e + 0.2, f) elseif frame <= 200 and goingLeft then local a, b, c, d, e, f = getCameraMatrix() setCameraMatrix(a, b, c, d - 0.2, e - 0.2, f) end frame = frame + 1 if frame == 400 and goingRight then goingRight = false goingLeft = true frame = -400 elseif frame == 200 and goingLeft then goingRight = true goingLeft = false frame = -200 end end And add this in the function where you render your login panel: addEventHandler("onClientRender", getRootElement(), rotateCamera) Don't forget to use removeEventHandler when you remove your login panel.
  17. I think I know why it's not working... It's because I took off onClientRender so that it doesn't create 100 of renders.
  18. Sooo, I did this yeah... local ap = 0 local apmode = true time = 5000 i = 0 local images ={ ":Main/files/images/menu_bg1.jpg", ":Main/files/images/menu_bg2.jpg", ":Main/files/images/menu_bg3.jpg", ":Main/files/images/menu_bg4.jpg", ":Main/files/images/menu_bg5.jpg", ":Main/files/images/menu_bg6.jpg" } function testBackground(current) if apmode == true then if ap < 255 then ap = ap + 5 else ap = 255 end else if ap > 0 then ap = ap - 5 else ap = 0 end end image = images[current] if current == #image then i = 0 end dxDrawImage(s[1]*0/1440,s[2]*0/900, s[1]*1440/1440,s[2]*900/900, image, 0, 0, 0, tocolor(255, 255, 255, ap),false) end setTimer(testBackground,time,#images,i + 1) But it doesn't get the image It kinda looks weird that "current" isn't defined anywhere, but maybe it's something I don't know..
  19. Yeah, I had a closer look at the table and noticed that it had the paths inside tables But I don't know how to make the images to change every 5 seconds. I never used this "for i = 1, #images do" thing and I don't know how it works..
  20. Still gets the table "images" instead of its content
  21. It says it gets a table instead of the image path
  22. Hey, I want to do this cool intro for a project server I am working on. I don't really know how to loop through a series of pictures without repeating them. Here is what I managed to do till now: local ap = 0 local apmode = true function testBackground() if apmode == true then if ap < 255 then ap = ap + 5 else ap = 255 end else if ap > 0 then ap = ap - 5 else ap = 0 end end dxDrawImage(s[1]*0/1440,s[2]*0/900, s[1]*1440/1440,s[2]*900/900, ":Main/files/images/menu_bg1.jpg", 0, 0, 0, tocolor(255, 255, 255, ap),false) end I have 6 image files that go like this: "menu_bg1.jpg, menu_bg2.jpg, menu_bg3.jpg, etc" and at the start, the image will have a fade out effect, and what I want to do is have the current image fade in and disappear after 5 seconds, and the new image should fade out and appear clearly (255 alpha) on the screen. Thanks.
  23. Try this: addEventHandler( "onClientRender", root, function() for i, vehicle in ipairs(getElementsByType("vehicle")) do local x, y, z = getElementPosition( vehicle ) local sX, sY = getScreenFromWorldPosition( x, y, z ) local health = math.floor( getElementHealth( vehicle )/10) local Rhealth = 50 local lineLength = 56 * ( health / 100 ) if health < 25 then health = 0 else math.floor( getElementHealth( vehicle )/10) end if isElementOnScreen( vehicle ) then if sX then dxDrawText( health, sX, sY ) dxDrawRectangle( sX-32, sY-82, 60, 14, tocolor( 0, 100, 0, 120 ) ) dxDrawRectangle( sX-30, sY-80, 56, 10, tocolor( 0, 220, 0, 120 ) ) dxDrawRectangle( sX-30, sY-80, lineLength, 10, tocolor( 0, 220, 0 ) ) end end end end ) Those changes should render the HP bar for all the vehicles.
  24. I don't know which link is the one that has both the good dff's and col's as both kinda have cols Thanks for offering to help!
  25. It's not that. The thing is that the map is made from small pieces. Each col/dff represents 1 part of the map, but I want the whole map assembled and made into only 1 dff/col file. Doesn't matter if the dff is separated from the col, I just want the entire map assembled.
×
×
  • Create New...