Jump to content

scolen

Members
  • Posts

    67
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by scolen

  1. I made a bank rob script and there is a big problem. When a person plants the bomb, if another player hits the markers to get money, nothing will happen to him. The person who planted the bomb will get those things. How to fix it? ped1 = createPed(76, 2306.65967, -3.14179, 26.74219, -90) ped2 = createPed(76, 2312.06738, -11.00959, 26.74219, 90*2) ped3 = createPed(76, 2318.17793, -7.16190, 26.74219, 90) entranceGate = createObject(3036, 2304.04873, -17.82764, 26.74219, 0, 0, 90) exitgate = createObject(2930, 2314.72744, 0.79857, 27.94219, 0, 0, 90) marker = createMarker(2303.18848, -16.23989, 25.58438, "cylinder", 1.5, 255,0,0) createBlipAttachedTo(marker, 36) addEventHandler("onMarkerHit", marker, function(thePlayer) destroyElement(marker) setPedFrozen(thePlayer, true) setTimer(function()-- repeat animation set bomb setPedAnimation(thePlayer, "BOMBER", "BOM_Plant", -1, false, false, false, false) end, 1000, 15) setTimer(function()-- bomb planting time Dynamite = createObject(1654, 2303.78211, -16.25232, 25.78438, 0, 90, -90) setObjectScale(Dynamite, 2) setPedFrozen(thePlayer, false) outputChatBox("Run! Run! Run! The bomb was planted", thePlayer, 255,0,0) end, 15000, 1) setTimer(function()-- settimer to expolsion x = 1 while (x < 20) do expolsion = createExplosion(2304.04873, -17.82764, 26.74219, 10) x = x+1 end if expolsion then outputChatBox("The entrance of the bank was destroyed", thePlayer, 255,255,0) destroyElement(entranceGate) destroyElement(Dynamite) setPedAnimation(ped1, "ped", "handsup", -1, false) setPedAnimation(ped2, "ped", "handsup", -1, false) setPedAnimation(ped3, "ped", "handsup", -1, false) end moneyOb1 = createObject(1212, 2312.23828, -17.32469, 27.38801) moneyOb2 = createObject(1212, 2314.83828, -17.32469, 27.38801) setObjectScale(moneyOb1, 2) setObjectScale(moneyOb2, 2) moneyOne = createMarker(2312.33984, -16.28635, 25.84957, "cylinder", 1, 0,255,255) moneyTwo = createMarker(2314.93530, -16.28635, 25.84957, "cylinder", 1, 0,255,255) addEventHandler("onMarkerHit", moneyOne, function() setPedFrozen(thePlayer, true) destroyElement(moneyOne) setTimer(function() setPedAnimation(thePlayer, "BOMBER", "BOM_Plant", -1, false, false, false, false) end, 500, 20) setTimer(function() setPedFrozen(thePlayer, false) mathRandomMoney = math.random(40000, 60000) givePlayerMoney(thePlayer, mathRandomMoney) outputChatBox("You have received $"..mathRandomMoney, thePlayer, 0,255,0) destroyElement(moneyOb1) moneyBag = createObject(1550,0,0,0) exports.bone_attach:attachElementToBone(moneyBag,thePlayer,3, 0, -0.17, 0.07, 0, 0, 0) setTimer(function() ---- Money bag destroy Time 5min (1000*60*5) destroyElement(moneyBag) end, 1000*60*5, 1) end, 1000*35, 1) end) addEventHandler("onMarkerHit", moneyTwo, function() setPedFrozen(thePlayer, true) destroyElement(moneyTwo) setTimer(function() setPedAnimation(thePlayer, "BOMBER", "BOM_Plant", -1, false, false, false, false) end, 500, 20) setTimer(function() setPedFrozen(thePlayer, false) mathRandomMoney = math.random(40000, 60000) givePlayerMoney(thePlayer, mathRandomMoney) outputChatBox("You have received $"..mathRandomMoney, thePlayer, 0,255,0) destroyElement(moneyOb2) moneyBag = createObject(1550,0,0,0) exports.bone_attach:attachElementToBone(moneyBag,thePlayer,3, 0, -0.17, 0.07, 0, 0, 0) setTimer(function()---- Money bag destroy Time 5min (1000*60*5) destroyElement(moneyBag) end, 1000*60*5, 1) end, 1000*35, 1) end) end, 25000, 1) end)
  2. I made a bank rob but there is a little problem with it. Even if a vehicle goes to the marker, the bomb will be installed, how to stop it?
  3. How to increase the shooting speed of a weapon ?
  4. progressBar = guiCreateProgressBar(0.03, 0.96, 0.1, 0.02, true, nil,nil,22) guiProgressBarSetProgress(progressBar, 100)
  5. How to remove the folded Border on both sides of the gui progress bar https://i.ibb.co/cxQJNR8/mta-screen-2023-04-12-01-05-54.png
  6. There is another problem. I made this wood cut job. When a marker is hit, that marker is destroyed and randomly created from another place. But after I accept the job together with my friend, when my friend hits a marker, the marker shown to me is destroyed. How can I fix it?
  7. How to do it?
  8. outputChatBox("Wood cutting job start", source, 0,255,255) local table = { {866.98505, -37.24827, 63.04229}, {890.52130, -37.67257, 63.19531}, {889.49915, -47.77541, 62.52142}, {903.36798, -48.64642, 64.13943}, {849.61884, -17.29530, 64.28951}, {842.59650, -30.73505, 62.30632} } getElementData() function startJob(thePlayer) if not (getElementData(thePlayer, "Jobs") == "WoodMan") then setElementData(thePlayer, "Jobs", "WoodMan") woodCut(thePlayer) else outputChatBox("you are alrady Woodman", thePlayer, 0, 255,255) end end function woodCut(thePlayer) local one = math.random(#table) local x = table [one][1] local y = table [one][2] local z = table [one][3] marker = createMarker(x,y,z-1, "cylinder", 2.0, 0, 255, 0) blip = createBlipAttachedTo(marker, 22) setElementVisibleTo(blip, getRootElement(), false) setElementVisibleTo(blip, thePlayer, true) setElementVisibleTo(marker, getRootElement(), false) setElementVisibleTo(marker, thePlayer, true) outputChatBox("now Wood Man"..x..y..z, thePlayer, 0, 255,255) check() end function check() addEventHandler("onMarkerHit", marker, function(thePlayer) outputChatBox("Hitted", thePlayer, 0,255,255) destroyElement(marker) destroyElement(blip) woodCut(thePlayer) end ) end function cancelJob(thePlayer) setPlayerSkin(thePlayer, 210) end function leaveJob(thePlayer) setElementData(thePlayer, "Jobs", nil) destroyElement(marker) destroyElement(blip) end addEvent("acceptWoodJob", true) addEventHandler("acceptWoodJob", root, startJob) addEvent("leaveJob", true) addEventHandler("leaveJob", root, leaveJob) addEvent("cancelButton", true) addEventHandler("cancelButton", root, cancelJob)
  9. If a player hits this marker, every player on the same server will start working. What I want to do is to make it work only for the player who hits the marker. How to fix this?
  10. If a player hits this marker, every player on the same server will start working. What I want to do is to make it work only for the player who hits the marker. How to fix this? getJobMarker = createMarker(872.03754, -29.07278, 62.3000, "cylinder", 1.0, 0, 255, 255, 255, getRootElement()) ped = createPed(159, 872.92389, -27.08743, 63.94565, 160) setPedFrozen(ped, true) blip = createBlipAttachedTo(getJobMarker, 56) function hitMarkerWindow() window = guiCreateWindow(0.35, 0.35, 0.35, 0.30, "wood job", true) memo = guiCreateMemo(0.10, 0.20, 0.80, 0.4, "this is wood cutting job", true, window) accept = guiCreateButton(0.10, 0.75, 0.22, 0.14, "Accept Job", true, window) leave = guiCreateButton(0.35, 0.75, 0.22, 0.14, "Leave Job", true, window) close = guiCreateButton(0.60, 0.75, 0.22, 0.14, "Close", true, window) showCursor(true) guiMemoSetReadOnly(memo, true) end addEventHandler("onClientMarkerHit", getJobMarker, hitMarkerWindow) function clientClick() if source == close then guiSetVisible(window, false) showCursor(false) triggerServerEvent("cancelButton", resourceRoot, localPlayer) elseif source == accept then guiSetVisible(window, false) showCursor(false) triggerServerEvent("acceptWoodJob", resourceRoot, localPlayer) elseif source == leave then guiSetVisible(window, false) showCursor(false) triggerServerEvent("leaveJob", resourceRoot, localPlayer) end end addEventHandler("onClientGUIClick", root, clientClick)
  11. getJobMarker = createMarker(872.03754, -29.07278, 62.3000, "cylinder", 1.0, 0, 255, 255, 255, getRootElement()) ped = createPed(159, 872.92389, -27.08743, 63.94565, 160) setPedFrozen(ped, true) blip = createBlipAttachedTo(getJobMarker, 56) function hitMarkerWindow() window = guiCreateWindow(0.35, 0.35, 0.35, 0.30, "wood job", true) memo = guiCreateMemo(0.10, 0.20, 0.80, 0.4, "this is wood cutting job", true, window) accept = guiCreateButton(0.10, 0.75, 0.22, 0.14, "Accept Job", true, window) leave = guiCreateButton(0.35, 0.75, 0.22, 0.14, "Leave Job", true, window) close = guiCreateButton(0.60, 0.75, 0.22, 0.14, "Close", true, window) showCursor(true) guiMemoSetReadOnly(memo, true) end addEventHandler("onClientMarkerHit", getJobMarker, hitMarkerWindow) function clientClick() if source == close then guiSetVisible(window, false) showCursor(false) triggerServerEvent("cancelButton", resourceRoot, localPlayer) elseif source == accept then guiSetVisible(window, false) showCursor(false) triggerServerEvent("acceptWoodJob", resourceRoot, localPlayer) elseif source == leave then guiSetVisible(window, false) showCursor(false) triggerServerEvent("leaveJob", resourceRoot, localPlayer) end end addEventHandler("onClientGUIClick", root, clientClick)
  12. I am new to Mtasa scripting. May I know what is Root and Source and in what situations they are used?
×
×
  • Create New...