Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/03/21 in all areas

  1. 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
    5 points
  2. If you are looking for an already made script you are in the wrong section, if you want to make one you will have to use: https://wiki.multitheftauto.com/wiki/AddPedClothes P.S go to resources section for already made!
    1 point
  3. thank you everyone
    1 point
  4. Are you interested about how to calculate K/D? It's kills count / deaths count, a simple division... just make sure deaths count is not 0 because you can't divide by zero.
    1 point
  5. Hi. When you check the element-data, here 'if getElementData(Planta, "Planta") == true then', you have to use source instead of Planta. On wiki, you can see source is the element that got clicked by the player. Because now, you only always check the last created object's element-data. Always make your variables local otherwise they become global variables, and most of times you don't want that... mostly on server-side. In your case, I see why you didn't make it local, but it's a bad practise. You can't store multiple players' carried objects in one single variable... so you have to store them in a table. Something like that: local objectCarries = {} -- store carryed objects in this table function PegarVaso( player ) local Px, Py, Pz = getElementPosition( player ) local Vaso = createObject( 2203, Px, Py, Pz ) objectCarries[player] = Vaso -- store: player carry this object setPedAnimation( player, "CARRY", "crry_prtial", 4.1, true, true, true ) exports.pAttach:attach(Vaso, player, 1.7, 0, 0.4, 0.4, 90, 0, 0 ) end addCommandHandler( "pegarvaso", PegarVaso ) function LargarVaso( player ) local Px, Py, Pz = getElementPosition( player ) setPedAnimation( player, "CARRY", "putdwn", 1.0, false, false, false, true ) setTimer(function() setPedAnimation( player ) if objectCarries[player] and isElement(objectCarries[player]) then -- is player carrying an object? destroyElement( objectCarries[player] ) -- yes... so destroy it objectCarries[player] = nil -- and don't forget to remove it from our table too end local Planta = createObject( 2203, Px , Py , Pz -0.85) setElementData( Planta, "Planta", true ) end, 1200, 1) end addCommandHandler( "soltarvaso", LargarVaso ) function Planta( button, state, player ) -- Add the function if button == "left" and state == "down" then if getElementData(source, "Planta") == true then triggerClientEvent( "MenuPlantar", player ) end end end addEventHandler( "onElementClicked", root, Planta ) ... and one more thing, source is a hidden variable what MTA define for you in most of times. Don't call your variables as source because you overwrite the hidden one... and can cause other problems.
    1 point
  6. define table: local table = {}; player joins: table[player] = 0; when a player kills another: table[killer] = table[killer] + 1; To see how much he have: outputChatBox(tostring(table[playerYouWantToGetKillsOf])); You store them when they kill someone, those are not stored by default so there’s no getPlayerKillDeaths
    1 point
  7. This warning appears when you try to add an event handler, which is already attached to that function. You can either use a variable: local drawingStatus = false if not drawingStatus then addEventHandler("onClientPreRender", getRootElement(), draw) drawingStatus = true end if drawingStatus then removeEventHandler("onClientPreRender", getRootElement(), draw) drawingStatus = false end Or you can use the following utility function isEventHandlerAdded, which you can copy out of the example: https://wiki.multitheftauto.com/wiki/GetEventHandlers
    1 point
  8. Because this will work when the player is entering the vehicle not after so use onPlayerVehicleEnter instead Also, in MTA we have pre-defined variables like getRootElement() you can use just root you can find them here
    1 point
  9. I just noticed that I added an image instead of the video:
    1 point
  10. I have added a useful function to the wiki, for positioning dx-effects: https://wiki.multitheftauto.com/wiki/GetScreenStartPositionFromBox Enjoy! ?
    1 point
  11. You can change door's rotation with setVehicleDoorOpenRatio. Also here is a resource.
    1 point
  12. I have added a useful function to the wiki, for positioning: https://wiki.multitheftauto.com/wiki/GetScreenStartPositionFromBox
    1 point
  13. Como te comente por discord, fuiste baneado por Pedophilia, por divulgar informacion confidencial de los usuarios y incentivar a que tu comunidad de usuarios ataque a dichos usuarios. Esto no es el comportamiento que el owner de un servidor de MTA deba tener, ademas de ser completamente illegal. Te recuerdo que la info que tenemos sobre la denuncia no se limita exclusivamente a lo recabado en capturas de pantalla, esta es una denuncia que se estudio durante un buen tiempo y lo unico que encontramos fueron cosas ilegales. Yo mismo precencie en un discord dichas actividades asi que me parece gracioso que vengas a tratar al staff de MTA de mentiroso. La denuncia esta denegada y la informacion sera compartida con las autoridades si llega el caso.
    1 point
  14. 1 point
×
×
  • Create New...