Jump to content

pa3ck

Members
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by pa3ck

  1. Well it's up to you to modify it to your liking, of course. It fades out when the initial timeToFade ends, modify it so it fades when you turn it off. This is the part where you need to make changes: if tonumber(startEnd) and startEnd <= now and currentState == "in" then currentState = "out" outputDebugString("OUT") dxFades.outStart = now end Whenever currentState is changed to "out", it will fade out. Good luck.
  2. None of these solutions make sense... What you should do: Server: onPlayerLogin -> setElementData(source, "regen", true) | onPlayerLogout -> setElementData(source, "regen", false) Client: timer(function if getElementData(localPlayer, "regen") setElementHealth(..), 7000, 0 ) Or, if you don't want an endless timer, onClientElementDataChange -> is it "regen" that changed? Yes... is it turned on? Yes... start time timer | Is it turned off? Yes... check if there's a timer, if there's, kill it. Having the timer server side, not efficient... Having triggerServerEvent for every player every 7 secs? Highly inefficient...
  3. I don't think a single timer is gonna blow up the server, it was made to handle such things, unless it's running on a potato. In some cases you just don't have a work around, but for this specific problem, you really should attach your function to an event, like onPlayerDamage as iPrestege said, only use timers when there is no other way.
  4. pa3ck

    Problem sql

    Are you sure you are setting the element datas (the password and username) before setting the gui text? Also, why do you use the old MySQL module? MTA has native MySQL support since a really long time, it would make more sense to use it (dbConnect, dbExec, dbQuery, dbPoll, dbFree)
  5. The way I always do animations like this, I check if the endTime in your case the variable pagerStopTick is less than or equal to now (endTime <= getTickCount()), if it is, that means the interpolation is over and you can either have a timer to start the fade out animation or start the animation right away. In order to do that, you have to save the state in a variable. You are on the right track, but you forgot to update the startTime again, which means the progress is already over before starting (because of the startTime + endTime already elapsed). I have exactly the same thing implemented in the custom camera fade topic you created so you might want to take a look at the way I worked it out.
  6. Yes, something like that, but you don't MD5 the salt, it's just plain text. Let me explain why you need salting. User A's password in plain text: password123 in sha256: BDKKDKDMSBDMBKLSDBMDSKMBK User B's password in plain text: password123 in sha256: BDKKDKDMSBDMBKLSDBMDSKMBK See how is that a problem? They are hashed the same way. I don't know if you ever heard of rainbow tables, but basically they are a huge table with a combination of hashed and reversed password. To crack a simple password all you need to do is find "BDKKDKDMSBDMBKLSDBMDSKMBK" in the rainbow table and you will have the password in plain text. But, if you add random characters after the plain password (random for every user) there won't be 2 of the same passwords. So storing salt is not meant to be a secret, it's meant to change the outcome of the hashed password.
  7. I had a little bit of fun with it, I like the idea of this custom fading thing. Try this: local screenX, screenY = guiGetScreenSize() local dxFades = nil local timeToFade = 2000 local currentState = false function fadeCameraDX(state,r,g,b) if dxFades then return end dxFades = {} dxFades.timeStart = getTickCount() dxFades.barStartPoint = {} dxFades.barNumber = math.ceil(screenY / 35) -- editing this will change the number of bars | less bars -> increase it, more bars -> decrease it dxFades.barHeight = math.ceil(screenY / dxFades.barNumber) dxFades.barMargin = 4 for i = 1, dxFades.barNumber do dxFades.barStartPoint[i] = math.random(300, 500) end if not tonumber(r) then r = math.random(100,255) end if not tonumber(g) then g = math.random(100,255) end if not tonumber(b) then b = math.random(100,255) end dxFades.color = {r,g,b} addEventHandler("onClientRender", root, renderDXCameraFading) outputDebugString("Num bars: " .. dxFades.barNumber) end function renderDXCameraFading() local r,g,b = unpack(dxFades.color) local rectangleWidth = screenX local rectanglePosX = 0 local borderSize = screenY / 24 local startEnd, outEnd local now = getTickCount() if not currentState then currentState = "in" end if currentState == "in" then startEnd = dxFades.timeStart + timeToFade local elapsedTime = now - dxFades.timeStart local duration = startEnd - dxFades.timeStart local progress = elapsedTime / duration rectangleWidth = interpolateBetween( 0,0,0, screenX + 600,0,0, progress, "InOutQuad" ) else outEnd = dxFades.outStart + timeToFade local elapsedTime = now - dxFades.outStart local duration = outEnd - dxFades.outStart local progress = elapsedTime / duration rectanglePosX = interpolateBetween( 0,0,0, screenX + 600,0,0, progress, "InOutQuad" ) if outEnd <= now then removeEventHandler("onClientRender", root, renderDXCameraFading) currentState = false end end if tonumber(startEnd) and startEnd <= now and currentState == "in" then currentState = "out" outputDebugString("OUT") dxFades.outStart = now end for i = 1, dxFades.barNumber do local startWidth = dxFades.barStartPoint[i] if currentState == "in" then dxDrawRectangle(0 - 500, (i - 1) * dxFades.barHeight, rectangleWidth + startWidth, dxFades.barHeight - dxFades.barMargin,tocolor(r,g,b,255)) else dxDrawRectangle(rectanglePosX - startWidth, (i - 1) * dxFades.barHeight, rectangleWidth + startWidth, dxFades.barHeight - dxFades.barMargin,tocolor(r,g,b,255)) end end end setTimer(function() fadeCameraDX(true, 255,0,0,20) end, 2000, 1)
  8. Obviously info[1], info[2], info[3] or info[4] returns nill. That's all the help you can get from us, because you didn't show us where the table info is coming from.
  9. I have always used MySQL instead of SQLite, but don't you have to use dbPoll with SQLite as well? I would also recommend using dbQuery when reading from SQL and dbExec when writing.
  10. pa3ck

    Problem sql

    The error was, that you had the field name as userrname, with double 'r', but you know that already. Just a tip: see when you are checking if there is a user already registered with the username? You should remove the password part from the where clause, because it makes no sense. That would mean two different users would be able to register with the same name but different passwords... I'm sure that's not what you want.
  11. MD5 is not the best, I would rather use SHA256, because of the possible encryption collision issues. If you really want your password to be secure, you should use salting along with SHA. The reason is, that simple passwords like "password123" let's say gives you "BD4ZDFVscBD", if more users have the same password, they would all have the same hashed password.
  12. pa3ck

    Problem sql

    Why do you have '\' before the values? You shouldn't be using the old MTA module anyway, why don't you just use dbConnect, dbExec and dbQuery?
  13. You create a random number between 0 and 12, but in the "elseif blocks" you only have 0 to 10 and 22. Shouldn't you have 0 -> 12?
  14. When you create a marker using createMarker, you have to specify the type. If the type is 'checkpoint' or 'ring', you can use this function setMarkerTarget to point in to any direction.
  15. So the error says it's expecting string, right? Your line of code is this: triggerClientEvent (getRootElement(), pocsomoccse) Is that a string? No, strings are between " " so it should be this: triggerClientEvent (getRootElement(), "pocsomoccse")
  16. It might be the order. Because a number can be string and number but a string can't be a number. So, try to change the order. Put the elseif tostring(vehicle) under the tonumber(vehicle)
  17. dbQuery( function(qh) local result = dbPoll( qh, 0 ) if(result and #result > 0) then outputChatBox("Found") else outputChatBox("Not found") end end,connection, "SELECT id FROM players where username= ? LIMIT 1", username )
  18. addEventHandler( "onClientRender", root, function () plrs = getElementsByType("player") for i=1,#plrs do if getElementData(plrs[i], "OnDuty") and plrs[i] ~= localPlayer then dxDrawTextOnElement(plrs[i],"]-Pie clan-[",1,30,255,255,255,255,3,"default-bold") end end end )
  19. Just to let you know, I'm pretty sure that in that DayZ gamemode, only the local client sees different weapons. When you replace the TXD, whatever you do, you either change it for every client (so you can have only 1 weapon) or only 1 client and others won't see it. Why do you think you need shaders to replace car paintjobs, CJ skin color, head type etc?
  20. I just remembered how somebody I know did this. He replaced the textures of the guns with an "invisible" texture so you can't see them all. Then whenever a player has a gun in their hands, create an object and attach it to their hand.
  21. Yeah.. it's not a server side script change it to type client.
  22. Are you for real? Triple posting and begging for help at midnight? What do you expect like... my god...
  23. You are passing source in the triggerEvent, you should pass the district name. Change source to this: districts[i][5]
×
×
  • Create New...