Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/07/22 in all areas

  1. When incrementing the attempts counter, check if it just surpassed 10 (that is, it was below 10 before the increment and is now equal or greater than 10), and if so, either start a timer for 24 hours to clear the lock, or store the current timestamp + 86400 sec, and ensure the next time the user attempts to do the same thing, the current timestamp is greater or equal to the previously stored timestamp (of course all of this, per IP). Something like this: local attempts = {} local lockouts = {} function isIPLockedOut(ip) -- check if the lockout needs to be cleared if (lockouts[ip]) then -- if ip was locked out before if (lockouts[ip] < getRealTime().timestamp) then -- if lockout timestamp hasn't been reached return true else -- if lockout timestamp is in the past, lockouts[ip] = nil -- clear the lockout and continue the function attempts[ip] = 0 -- clear the attempts count end end local offenseCount = attempts[ip] or 0 if (offenseCount >= 10) then return true -- if count is above 10, return true end return false -- otherwise return false end function incrementOffenseCount(ip) local offenseCount = attempts[ip] or 0 -- default to 0 offenses if not set if (offenseCount >= limit) then -- if limit exceeded lockouts[ip] = getRealTime().timestamp + 86400 -- lockout for 24h else -- otherwise attempts[ip] = offenseCount + 1 -- increment offense count end end -- example usage function attemptLogin(player, username, password) local ip = getPlayerIP(player) if isIPLockedOut(ip) then local seconds = lockouts[ip] - getRealTime().timestamp local hours = math.floor((seconds%86400)/3600) local mins = math.floor((seconds%3600)/60) outputChatBox(string.format("You've attempted this action too many times. Your IP is blocked for %dh %02dm.", hours, mins), player, 255, 0, 0) else if getAccount(username, password) then logIn(player, username, password) else incrementOffenseCount(ip) -- only call this within a conditional block on isIPLockedOut(ip) == false outputChatBox("Wrong username or password", player, 255, 0, 0) end end end For the above provided code, make sure you only ever call incrementOffenseCount if isIPLockedOut returned false, otherwise you'll be resetting the lockout timer.
    1 point
  2. We all know high FPS limits cause various GTA bugs. But the most common annoyance, is that at FPS limits higher than 70, it becomes hard to move around while aiming a weapon (e.g start walking sidewards) which happens between 71-74 FPS, after which at extremely high FPS limits (80-100 FPS) it's no longer possible to strafe. For all server owners that have a reason to set high FPS limit but don't want to get this annoying bug, i wrote this scripted solution: local previousTask = false local defaultFpsLimit -- Store FPS limit on resource start to ensure its reliability (as server FPS limit) function getLimit() defaultFpsLimit = getFPSLimit() end addEventHandler("onClientResourceStart", resourceRoot, getLimit) local isAdded = false -- Just optimization for the render event to limit unnecesary execution function optimizeRender(prevSlot, curSlot) if not isAdded and (curSlot >= 2 and curSlot <= 6) then addEventHandler("onClientRender", getRootElement(), fixStrafing) isAdded = true elseif isAdded and (curSlot <= 1 or curSlot >= 7) then removeEventHandler("onClientRender", getRootElement(), fixStrafing) isAdded = false end end addEventHandler("onClientPlayerWeaponSwitch", localPlayer, optimizeRender) function fixStrafing() local weapon = getPedWeaponSlot(localPlayer) -- Don't execute if player isn't holding a (suitable) weapon -- This selects only weapons that are guns and suffer from strafing bug (slot 2, 3, 4, 5 and 6) -- Allowing other weapon types will bug the script as throwing/punch weapons don't support 'release' state of TASK_SIMPLE_USE_GUN if not (weapon >= 2 and weapon <= 6) then return end local newTask = getPedTask(localPlayer, "secondary", 0) if (previousTask ~= "TASK_SIMPLE_USE_GUN" or false) and (previousTask ~= newTask) then setFPSLimit(70) elseif (previousTask == "TASK_SIMPLE_USE_GUN") and (previousTask ~= newTask) then setFPSLimit(defaultFpsLimit) end previousTask = newTask end So basically it temporarily sets the player's local FPS limit to 70 (which fully supports walking sideways) only when you are aiming a weapon and restores it when they stop aiming down the sights. Now it works perfectly and seamlessly (player doesn't feel it) and it's also optimized. Again, if you have a reason to use high FPS limits.. this script only lifts the boundary (takes away the first serious GTA bug in line - moving while aiming) but when you reach the next boundary, you'll get a range of other FPS and physics related GTA bugs. But yeah, depending on your server, using this script may allow you to use even higher FPS limits than 70 / 74 by delaying the problems. Download link (community): TBA
    1 point
  3. Start : screen -d -m -S Prozess ./mta-server Select: screen -ls Open: screen -r Prozess
    1 point
  4. The ban for cheating is correct. If you feel you didn't use any cheats, it may be someone else who were in control of your device who used a cheat on MTA.
    0 points
×
×
  • Create New...