addEvent("onDrinkAlcohol",true) addEventHandler("onDrinkAlcohol",root,function() if not isTimer(pije) then pije = setTimer(setCameraShakeLevel,60000,1,0) end local shake = getCameraShakeLevel() setCameraShakeLevel(shake+50) end) addEventHandler( "onClientElementStreamIn", root, function ( ) if getElementType( source ) == "object" then setObjectBreakable(source, false) end end) addEvent("setBreakable",true) addEventHandler("setBreakable",root,function(obj) setObjectBreakable(obj, false) end) addEvent("addNotification",true) addEventHandler("addNotification",root,function(tekst,typ) if not tekst then return end if not typ then return end outputChatBox(tekst) end) addEvent("addNotificatione",true) addEventHandler("addNotificatione",root,function(tekst,typ) if not tekst then return end if not typ then return end exports['notices']:addNotification(tekst,typ) end) local function getAverageFPSOfFPSArray(table) -- Average FPS = (FPS1 + FPS2 + ... + FPSX) / X local totalFPS = 0 for _, fps in ipairs(table) do totalFPS = totalFPS + fps end return totalFPS / #table end local currentSecondFPS = {} local lastSecondTicks = getTickCount() local lastFiveSecondsFPS = {} local function smoothFPS() -- Do we have a FPS rate already? if not getCurrentFPS() then return end -- Insert current FPS into a table for reference table.insert(currentSecondFPS, getCurrentFPS()) -- If a second passed, get the average FPS using the table (we always have at least one frame rendered, so dividing by 0 it's not a problem) local averageFPSPerSecond if getTickCount() - lastSecondTicks >= 1000 then averageFPSPerSecond = getAverageFPSOfFPSArray(currentSecondFPS) -- Reset variables currentSecondFPS = {} lastSecondTicks = getTickCount() end -- If a second has passed, update the table containing last five seconds FPS. -- Also update the FPS limit accordingly. if averageFPSPerSecond then table.insert(lastFiveSecondsFPS, averageFPSPerSecond) -- Silently discard too old average FPS if #lastFiveSecondsFPS == 6 then table.remove(lastFiveSecondsFPS, 1) end -- Get the average FPS of the average FPS of each of the last five seconds, and use the result as the frame limit. setFPSLimit(math.ceil(getAverageFPSOfFPSArray(lastFiveSecondsFPS))) end end --addEventHandler("onClientHUDRender", root, smoothFPS) function stopMinigunDamage ( attacker, weapon, bodypart ) if ( weapon == 0 ) then cancelEvent() end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage ) function nodamage(attacker, bodypart) if not attacker then return end if getElementType(attacker) == 'vehicle' then cancelEvent() end end addEventHandler("onClientPlayerDamage", getLocalPlayer(),nodamage) function blokada ( prevSlot, newSlot ) if getPedWeapon(getLocalPlayer(),newSlot) == 0 and getElementData(getLocalPlayer(),"player:admin") == true then toggleControl ( "fire", true ) toggleControl("aim_weapon", true) elseif getPedWeapon(getLocalPlayer(),newSlot) == 7 then toggleControl ("fire", false ) toggleControl("aim_weapon", false) return false elseif getPedWeapon(getLocalPlayer(),newSlot) ~= 0 and getPedWeapon(getLocalPlayer(),newSlot) ~= 22 then toggleControl ("fire", true ) toggleControl("aim_weapon", true) elseif getPedWeapon(getLocalPlayer(),newSlot) == 22 and getElementData(getLocalPlayer(),"player:admin") == true then toggleControl ("fire", false ) toggleControl("aim_weapon", true) elseif getPedWeapon(getLocalPlayer(),newSlot) == 22 and getElementData(getLocalPlayer(),"player:admin") == false then toggleControl ("fire", true ) toggleControl("aim_weapon", true) else toggleControl ( "fire", false ) toggleControl("aim_weapon", false) end end addEventHandler ( "onClientPlayerWeaponSwitch", getRootElement(), blokada ) setTimer(function() local czas=tonumber(getElementData(localPlayer, "player:online")) if not czas then return end setElementData(localPlayer, "player:online", czas+1) end, 60000, 0) function chat() if isChatVisible() then --Check or the chat is visible. showChat(false) --If it is, hide it. else showChat(true) --If it is not, show it. end end addCommandHandler('schowajchat', chat) addEvent("core:blipyaut", true) addEventHandler("core:blipyaut", root, function(plr) if plr ~= localPlayer then return end local uid=getElementData(plr,"player:uid") for id, veh in ipairs( getElementsByType ( "vehicle" ) ) do if uid == getElementData(veh,"vehicle:ownedPlayer") then createBlipAttachedTo(veh,0,0,5000,0,0.3,0,255,0,255,1,99999) end end end) function destroyBlipsAttachedTo(elemente) local attached = getAttachedElements ( elemente ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end function veh_blips() for i,v in pairs(getElementsByType("vehicle")) do if getElementData(v,"vehicle:spawn") == true then if getElementData(v,"vehicle:ownedPlayer") == getElementData(localPlayer,"player:uid") then createBlipAttachedTo(v,0,1,255,0,0,255,1,9999) end if getElementData(v,"vehicle:ownedGroup") == getElementData(localPlayer,"player:organization") and (getElementData(v,"vehicle:ownedPlayer") ~= getElementData(localPlayer,"player:uid")) then createBlipAttachedTo(v,0,1,246,48,87,255,1,9999) end local rent = getElementData(v,"vehicle:rent") if rent and (type(rent) == "table") then for i,s in pairs(rent) do if tonumber(s) == getElementData(localPlayer,"player:uid") then createBlipAttachedTo(v,0,1,0,0,255,255,1,9999) end end end end end end setTimer(veh_blips,10000,0) addEventHandler("onClientElementDestroy", root, function () if getElementType(source) == "vehicle" then destroyBlipsAttachedTo(source) end end) addEventHandler ( "onClientElementDataChange", root, function ( dataName ) if getElementType ( source ) == "vehicle" and dataName == "vehicle:ownedPlayer" then destroyBlipsAttachedTo(source) end if getElementType ( source ) == "vehicle" and dataName == "vehicle:rent" then destroyBlipsAttachedTo(source) end if getElementType ( source ) == "vehicle" and dataName == "vehicle:ownedGroup" then destroyBlipsAttachedTo(source) end end )