Jump to content

FLUSHBICEPS

Members
  • Posts

    99
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by FLUSHBICEPS

  1. --serverside function onHit(player) if (#m > 0 and #b > 0) then destroyElement(m[1]) destroyElement(b[1]) table.remove(m, 1) table.remove(b, 1) end for i, k in ipairs(Bomb2) do if (isElementAttached(Bomb2[i])) then detachElements(Bomb2[i], helic[1]) plantedBombs = plantedBombs + 1 outputChatBox("Bomb has been successfully installed, Do the same with the rest!", root, 34, 139, 34) outputChatBox(plantedBombs) ---- This returns what it should return triggerClientEvent(player, "updatePlantedBombs", root, plantedBombs) end end if (plantedBombs == 5) then triggerEvent("stopMission", root, onHit) givePlayerMoney(player, 50000) outputChatBox("Congratulations, you have passed the mission and got $50,000 as a reward!", root, 34, 139, 34) end end --clientside addEvent("updatePlantedBombs", true) addEventHandler("updatePlantedBombs", root, function(plantedBombsFromServer) plantedBombs = plantedBombsFromServer end) function renderTimer() local white = tocolor(255, 255, 255, 255) if (isTimer(startTimer)) then local remaining = getTimerDetails(startTimer) local remaining = remaining / 1000 outputChatBox(plantedBombs) ---- Should now print the updated value dxDrawText("Delivered Bombs : "..plantedBombs.."", 1162, 654, screenW, 711, white, 1.3, "default-bold", "right", "bottom") dxDrawText("Time Remaining : "..math.floor(remaining / 60)..":"..math.floor(remaining % 60).."", 1228, 725, screenW, 740, white, 1.3, "default-bold", "right", "bottom") end end
  2. Dynamic Weather System Ever wished to bring your server’s world to life? Dynamic weather systems offer an extra level of immersion and unpredictability to your game, giving each session a true one-of-a-kind feel. In this tutorial we are going to create dynamic basic weather system which’ll change over time and based on certain conditions. Introduction A dynamic weather system will periodically change the weather in your server, ensuring players experience a variety of conditions. This can be based on real-world data, predefined patterns, or random selections. Setting Up Weather Table: First, create a table of weather types you want to use. local weathers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} Time-Based Changes: To make the weather change based on in-game time: setTimer(function() local hour, minute = getTime() if hour == 6 or hour == 12 or hour == 18 then setWeather(table.random(weathers)) end end, 60000, 0) -- Check every minute Random Weather Patterns: If you want more unpredictability: setTimer(function() if math.random(1, 10) > 7 then -- 30% chance every 10 minutes setWeather(table.random(weathers)) end end, 600000, 0) Advanced Features Weather Transitions: Instead of abrupt changes, smoothly transition between weathers. setWeatherBlended(table.random(weathers)) Seasonal Changes: Make certain weathers more likely during specific in-game months. local winterWeathers = {12, 13, 14, 15, 16} local summerWeathers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} local month = getRealTime().month if month >= 11 or month <= 2 then setWeather(table.random(winterWeathers)) else setWeather(table.random(summerWeathers)) end Player Feedback: Notify players of significant weather changes. local weatherNames = { [0] = "Clear", [1] = "Cloudy", -- ... add all weather names } addEventHandler("onWeatherChange", root, function(newWeather) outputChatBox("The weather is now " .. weatherNames[newWeather] .. "!") end)
  3. Can you describe the issue? Why you need onPlayerWasted? getDistanceBetweenPoints3D is missing the target coordinates outputChatBox functions are missing messages to display to the player spawn points for the condition are not defined
  4. theres a small issue in your code The Z position in the createMarker function has a subtraction without proper spacing change this line bombMarker = createMarker(364.70267, 186.29311, 1019.98438 -0.5, "cylinder", 1, 255, 0, 0) to this line bombMarker = createMarker(364.70267, 186.29311, 1019.98438 - 0.5, "cylinder", 1, 255, 0, 0)
  5. https://wiki.multitheftauto.com/wiki/EngineReplaceAnimation
  6. --server side local startTime = getTickCount() addEvent("requestMusicPosition", true) addEventHandler("requestMusicPosition", root, function() local elapsedTime = getTickCount() - startTime local soundDuration = 20 * 60 * 1000 local playbackPosition = elapsedTime % soundDuration triggerClientEvent(client, "playClubMusic", client, playbackPosition) end ) --clientside addEventHandler('onClientResourceStart', resourceRoot, function() triggerServerEvent("requestMusicPosition", localPlayer) end ) addEvent("playClubMusic", true) addEventHandler("playClubMusic", root, function(playbackPosition) local sound = playSound3D("Dj_Ivan.mp3", -2677, 1411, 908, true) setSoundMaxDistance(sound, 100) setSoundVolume(sound, 4) setSoundPosition(sound, playbackPosition / 1000) end ) This setup ensures that when a player enters the club, they hear the music from the same position as everyone else
  7. I guess he wants the ability to cycle through and select different nearby players and not always target the closet one on the screen local playerSelectedTarget local alpha = 255 local nearbyPlayers = {} local selectedIndex = 1 addEventHandler("onClientRender", root, function() if getKeyState("mouse2") then local x, y, z = getElementPosition(localPlayer) nearbyPlayers = {} -- reset the table for _, target in ipairs(getElementsByType("player", root, true)) do if target ~= localPlayer then local px, py, pz = getElementPosition(target) local distance = getDistanceBetweenPoints3D(px, py, pz, x, y, z) if distance < 30 then table.insert(nearbyPlayers, target) end end end playerSelectedTarget = nearbyPlayers[selectedIndex] if isElement(playerSelectedTarget) then -- ur code to display the selection effect end else if isElement(playerSelectedTarget) then alpha = 0 setElementData(localPlayer, "Select", false) end end end ) addEventHandler("onClientKey", root, function(button, press) if button == "mouse_wheel_up" and press then selectedIndex = selectedIndex - 1 if selectedIndex < 1 then selectedIndex = #nearbyPlayers end elseif button == "mouse_wheel_down" and press then selectedIndex = selectedIndex + 1 if selectedIndex > #nearbyPlayers then selectedIndex = 1 end end end )
  8. the gate is not closing because the "Reset" event is being triggered immediately after the gate is opened local GateCloseTimer = nil -- variable to hold the timer addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if GateMenu and button == "left" and state == "down" then if isMouseInPosition(sx*.42, sy*.6, sx*.15, sy*.08) then GateMenu = false moveObject(TheGate, 5000, 51.62455, -1524.62549, 0) GateStatus = true if isTimer(GateCloseTimer) then killTimer(GateCloseTimer) end GateCloseTimer = setTimer(function() triggerEvent("Reset", localPlayer) end, 5000, 1) -- This is the delay before the gate closes end end end) addEvent("Reset", true) addEventHandler("Reset", root, function() if (GateStatus) then moveObject(TheGate, 5000, 51.62455, -1524.62549, 5.05399) GateStatus = false end end )
  9. /plant cmd is called multiple times and multiple stones being created this could cause some stones to not be destroyed because the markers are overlapping add a delay
  10. thePlayer is nil and not defined, you’ve wrote “theplayer” function Kamshodan(thePlayer) setTimer(function() if isElement(thePlayer) then -- check if thePlayer is valid setPedStat(thePlayer, 23, getPedStat(thePlayer, 23) - 2) setPedStat(thePlayer, 22, getPedStat(thePlayer, 22) + 2) end end, 3600, 1, thePlayer) end addEventHandler('onResourceStart', getResourceRootElement(getThisResource()), Kamshodan)
  11. Pretty sure it just creates an illusion of a quicker firing speed and not actually increasing the fire rate you can make a rapid fire script you'd want to listen to the onClientPlayerWeaponFire event, and when it's fired, set a timer that triggers multiple shootings
  12. MenuPoints table values are hardcoded ur using absolute positioning use relative positioning instead
  13. the logic for creating and destroying markers and blips is :Oed up status2 = false -- Initialize status2 function unit1() local playerskin = getElementModel(source) local x, y, z = getElementPosition(source) if validSkin[playerskin] then if not status2 then statusB2 = createBlipAttachedTo(source, 0, 4, 0, 0, 255) statusMarker1 = createMarker(x, y, z, "checkpoint", 4, 255, 0, 0) attachElements(statusMarker1, source) if not validSkin[playerskin] then setElementAlpha(statusMarker1,0) -- Hide the marker else setElementAlpha(statusMarker1,255) -- Show the marker end outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Sikeressen megváltoztatad az egységed állapotát: #ffffff||Üldözés||", source, 255, 255, 255, true) status2 = true else outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Már ez az egységed állapota.", source, 255, 255, 255, true) end end end addEvent("Button2", true) addEventHandler("Button2", root, unit1)
  14. validSkin table is not defined, there are some variables that are not assigned globally and it will give you nil errors and checkSkin is not checking the specific player with the current akin it simply sets the alpha value for ‘statusMarker1’ depending on the skin try changing the function to this and defining those variables local validSkin = {[1] = true, [2] = true} -- replace 1 and 2 with valid skin IDs local status2 = false local statusMarker1 = nil local statusMarker = nil local statusB1 = nil function checkSkin(oldSkin, newSkin) local playerskin = newSkin if (validSkin[playerskin]) then if source == getAttachedTo(statusMarker1) then setElementAlpha(statusMarker1, 255) end else if source == getAttachedTo(statusMarker1) then setElementAlpha(statusMarker1, 0) end end end addEventHandler("onPlayerModelChange", root, checkSkin)
  15. --you can manipulate the vehicle health addEventHandler("onClientVehicleDamage", root, function(attacker, weapon, loss) if attacker == localPlayer and weapon == 36 then local currentHealth = getElementHealth(source) setElementHealth(source, currentHealth - loss*2) -- doubling the damage end end ) you can’t directly change the dmg the damage values are usually hard coded in the game itself but you can try what I’ve posted above
  16. This could be because the rocket launcher actual damage is done by the explosion it creates in ur code it’s probably changing the rocket direct hit -- use on onClientExplosion to change the explosion damage
  17. FLUSHBICEPS

    weapon

    make sure pAttach resource is installed, use /attachweapon <weaponID>, also make adjustments on attach function function attachWeaponToBack(player, weaponModel) local weaponObject = createObject(weaponModel, 0, 0, 0) exports.pAttach:attach(weaponObject, player, "Bip01 Spine", 0, -0.1, 0.2, 0, 180, 0) end addCommandHandler("attachweapon", function(player, command, weaponID) local weaponModel = tonumber(weaponID) if weaponModel then attachWeaponToBack(player, weaponModel) outputChatBox("Weapon attached to your back.", player) else outputChatBox("Invalid weapon ID.", player) end end )
  18. local marker function markerc(command, ...) local weaponIDs = {...} if #weaponIDs < 1 then return outputChatBox("You must provide at least one weapon ID.", source, 255, 0, 0) end local weapons = {} for _, weaponID in ipairs(weaponIDs) do local id = tonumber(weaponID) if not id then return outputChatBox("Invalid weapon ID: " .. tostring(weaponID), source, 255, 0, 0) end table.insert(weapons, {id = id, ammo = 100}) end if marker then destroyElement(marker) end local x, y, z = getElementPosition(source) marker = createMarker(x, y, z + 1, "cylinder", 1.5, 0, 255, 0, 127) addEventHandler("onMarkerHit", marker, function(hitElement, matchingDimension) if getElementType(hitElement) == "player" and matchingDimension then for _, weapon in ipairs(weapons) do giveWeapon(hitElement, weapon.id, weapon.ammo, true) end end end) outputChatBox("Weapon marker created!", source, 0, 255, 0) end addCommandHandler("cw", markerc) use /cw (weapon ID) for example /cw 31 to create a marker that gives 100 bullets of m4 you also can use multiple weapons /cw 31 35 and it will create a marker that gives m4 and rocket launcher
  19. function togglePanel() local isVisible = guiGetVisible(win) if isVisible then guiSetVisible(win, false) showCursor(false) else guiSetVisible(win, true) showCursor(true) end end addEventHandler("onClientGUIClick", Close1, togglePanel, false) -- change the command to whatever u like addCommandHandler("togglepanel", togglePanel) Add this function and remove on close function
  20. Close1 = guiCreateStaticImage(215, 117, 101, 32, "s/Close.png", false, win) function onclose() guiSetVisible(win, false) end addEventHandler("onClientGUIClick", Close1, onclose, false)
  21. createMarker onMarkerHit giveWeapon
  22. you are using the same table ‘tick’ to track the timer for both the HK 417 and SNIPER
  23. function removePoliceSirens() local policeCars = getElementsByType("vehicle", root) for i, vehicle in ipairs(policeCars) do local model = getElementModel(vehicle) if model == 523 or model == 596 or model == 597 or model == 598 or model == 599 or model == 327 then setVehicleSirensOn(vehicle, false) -- addVehicleSirens(vehicle, 1, 2, true, false, true, true) end end end addEventHandler("onResourceStart", resourceRoot, removePoliceSirens) Try this one Ive removed addVehicleSirens line
  24. local sw, sh = guiGetScreenSize() local pw, ph = 300, 200 local px, py = (sw - pw) / 2, (sh - ph) / 2 local vis = false local pnl = guiCreateWindow(px, py, pw, ph, "Freeroam Panel", false) guiSetVisible(pnl, vis) local btn1 = guiCreateButton(10, 30, 280, 40, "Deathmatch", false, pnl) local btn2 = guiCreateButton(10, 80, 280, 40, "No Knife Kills", false, pnl) local btn3 = guiCreateButton(10, 130, 280, 40, "No Warp To You", false, pnl) function panel() vis = not vis guiSetVisible(pnl, vis) showCursor(vis) end bindKey("F1", "down", panel) function b1click() -- Add your Deathmatch function here end addEventHandler("onClientGUIClick", btn1, b1click, false) function b2click() -- Add your No Knife Kills function here end addEventHandler("onClientGUIClick", btn2, b2click, false) function b3click() -- Add your No Warp To You function here end addEventHandler("onClientGUIClick", btn3, b3click, false)
×
×
  • Create New...