Jump to content

scolen

Members
  • Posts

    69
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by scolen

  1. ---Why does the FPS drop when this anticheat resource is put on the server? What is the reason for that? please help function generatePass(character) local NewPass = "" for i = 1, character do local PassWordNew = string.char( math.random(97, 122) ) NewPass = NewPass..PassWordNew end setElementData(getResourceRootElement(getThisResource()),"0x0x1223#@The1523dwdS252Xoop15asd282Pass@#!", NewPass) end generatePass(30) setTimer(function() generatePass(30) end, 1000, 0) function getXoopPassword() generatePass(30) return getElementData(getResourceRootElement(getThisResource()),"0x0x1223#@The1523dwdS252Xoop15asd282Pass@#!") end
  2. I need a lot of help from you. Hackers come to my server with Lua injectors and run AddEventHandlers which are not in the server then my server gets network trouble. I can't imagine what to do with it. Please give me a solution for it. please
  3. what is problem this code ? gate = createObject(980, 364.82147, 186.89452, 1019.98438) setElementInterior(gate, 3) bombMarker = createMarker(364.70267, 186.29311, 1019.98438 -0.5, "cylinder", 1, 255, 0, 0) setElementInterior(bombMarker, 3) addEventHandler("onMarkerHit", bombMarker, function(player) outputChatBox("ugh!") end)
  4. I made a hud but it has a bug. For those who register and login, setElementData is not set. How to fix it ? If the resource is restarted, the element data will be set and saved in the account data Server Side addEventHandler("onPlayerQuit", root, function(type) if type == "Quit" then local health = getElementHealth(source) local armor = getPedArmor(source) local water = getElementData(source, "water") local food = getElementData(source, "food") local account = getPlayerAccount(source) setAccountData(account, "health", health) setAccountData(account, "armor", armor) setAccountData(account, "water", water) setAccountData(account, "food", food) end end) addEventHandler("onPlayerLogin", root, function(pa, ca) local account = getPlayerAccount(source) if not isGuestAccount(account) then local health = getAccountData(account, "health") local armor = getAccountData(account, "armor") local water = getAccountData(account, "water") local food = getAccountData(account, "food") setElementHealth(source, health) setPlayerArmor(source, armor) setElementData(source, "water", water) setElementData(source, "food", food) end end) function drinkWater(player, price, size) if getPlayerMoney(player) < System.prices.food_price then outputChatBox("water cannot be given because you have no money", player, 255, 0, 0) else if getElementData(player, "water") >= 95 then outputChatBox("You can't get more food because your stomach is full!", player, 255, 0, 0) else setElementData(player, "water", getElementData(player, "water") + 20) takePlayerMoney(player, System.prices.water_price) triggerClientEvent(player, "drinking", player) end end end function eatFood(player, price, size) if getPlayerMoney(player) < System.prices.water_price then outputChatBox("Food cannot be given because you have no money", player, 255, 0, 0) else if getElementData(player, "food") >= 95 then outputChatBox("You can't get more food because your stomach is full!", player, 255, 0, 0) else setElementData(player, "food", getElementData(player, "food") + 20) takePlayerMoney(player, System.prices.food_price) triggerClientEvent(player, "eating", player) end end end addEventHandler("onPlayerWasted", root, function() setElementData(source, "water", 50) setElementData(source, "food", 50) end) addEvent("fireStop", true) addEventHandler("fireStop", root, function(player) toggleControl(player, "fire", false) end) addEvent("fireStart", true) addEventHandler("fireStart", root, function(player) toggleControl(player, "fire", true) end) addEvent("runStop", true) addEventHandler("runStop", root, function(player) toggleControl(player, "sprint", false) end) addEvent("runStart", true) addEventHandler("runStart", root, function(player) toggleControl(player, "sprint", true) end) Client Side local screenW, screenH = guiGetScreenSize() setElementData(localPlayer, "water", 100) setElementData(localPlayer, "food", 100) showPlayerHudComponent("health", false) showPlayerHudComponent("armour", false) showPlayerHudComponent("money", false) showPlayerHudComponent("ammo", false) showPlayerHudComponent("weapon", false) showPlayerHudComponent("clock", false) function render() health = getElementHealth(localPlayer) armor = getPedArmor(localPlayer) water = getElementData(localPlayer, "water") food = getElementData(localPlayer, "food") money = getPlayerMoney(localPlayer) time = getRealTime() hour = time.hour minute = time.minute second = time.second weaponID = getPlayerWeapon(localPlayer) weaponName = getWeaponNameFromID(weaponID) ammo = getPedAmmoInClip(localPlayer) allammo = getPedTotalAmmo(localPlayer) -- health dxDrawCircle((screenW - 225), (screenH / 5000 + 30), 25, -270,(health * 3.6 - 270), tocolor(0, 255, 0), 30) -- health line dxDrawCircle((screenW - 225), (screenH / 5000 + 30), 18, 0, 360, tocolor(26, 26, 26)) -- black circle dxDrawImage((screenW - 225) - (27 / 2), (screenH / 300 + 15), 27, 27, "assets/icons/heart.png") -- health icon -- armor dxDrawCircle((screenW - 160), (screenH / 5000 + 30), 25, -270,(armor * 3.6 - 270), tocolor(194, 194, 194), 30) -- armor line dxDrawCircle((screenW - 160), (screenH / 5000 + 30), 18, 0, 360, tocolor(26, 26, 26)) -- black circle dxDrawImage((screenW - 160) - (27 / 2), (screenH / 300 + 16), 27, 27, "assets/icons/armor.png") -- armor icon -- water dxDrawCircle((screenW - 95), (screenH / 5000 + 30), 25, -270,(water * 3.6 - 270), tocolor(10, 252, 236), 30) -- water line dxDrawCircle((screenW - 95), (screenH / 5000 + 30), 18, 0, 360, tocolor(26, 26, 26)) -- black circle dxDrawImage((screenW - 95) - (20 / 2), (screenH / 300 + 12), 20, 30, "assets/icons/water.png") -- water icon -- food dxDrawCircle((screenW - 30), (screenH / 5000 + 30), 25, -270,(food * 3.6 - 270), tocolor(209, 102, 8), 30) -- food line dxDrawCircle((screenW - 30), (screenH / 5000 + 30), 18, 0, 360, tocolor(26, 26, 26)) -- black circle dxDrawImage((screenW - 28) - (27 / 2), (screenH / 300 + 13), 27, 27, "assets/icons/food.png") -- food icon --background dxDrawRectangle((screenW - 235), (screenH / 5000 + 62), 260, 50, tocolor(23, 23, 23, 230)) dxDrawCircle((screenW - 235), (screenH / 5000 + 87), 25, -90, -270, tocolor(23, 23, 23, 230)) -- money dxDrawText("MONEY: $"..money, (screenW - 203), (screenH / 5000 + 70), 20, 20 , tocolor(0, 186, 43), 0.5, "bankgothic") -- real time dxDrawText(string.format("TIME: %02d:%02d:%02d", hour,minute,second), (screenW - 200), (screenH / 5000 + 90), 20, 20 , tocolor(166, 166, 166), 0.5, "bankgothic") -- weapons if weaponID ~= 0 then dxDrawRectangle((screenW - 235), (screenH / 5000 + 120), 260, 25, tocolor(23, 23, 23, 230)) dxDrawCircle((screenW - 235), (screenH / 5000 + 132.5), 12, -90, -270, tocolor(23, 23, 23, 230)) dxDrawText(weaponName.." | "..ammo.." | "..allammo, (screenW - 203), (screenH / 5000 + 125), 20, 20 , tocolor(237, 186, 0), 0.5, "bankgothic") end if (food <= 2) then triggerServerEvent("fireStop", resourceRoot, localPlayer) else triggerServerEvent("fireStart", resourceRoot, localPlayer) end if (water <= 2) then triggerServerEvent("runStop", resourceRoot, localPlayer) else triggerServerEvent("runStart", resourceRoot, localPlayer) end end addEventHandler("onClientRender", root, render) setTimer(function(player) if (getElementData(localPlayer, "water") <= 2) then return else setElementData(localPlayer, "water", getElementData(localPlayer, "water") - 1) end end, System.decrease.water, 0) setTimer(function(player) if (getElementData(localPlayer, "food") <= 2) then return else setElementData(localPlayer, "food", getElementData(localPlayer, "food") - 1) end end, System.decrease.food, 0)
  5. Can I include this in my code and show it?
  6. I made this so that when a player's health is 0, this circle ends. But why is it not t function render() health = getElementHealth(localPlayer) dxDrawCircle(200, 400, 100, -270,(health * 6.3 / 2 - 90), tocolor(0, 255, 0)) --dxDrawCircle(200, 400, 90, 0, 360, tocolor(0, 0, 0)) end addEventHandler("onClientRender", root, render) he same, why is it only reduced by half?
  7. how to create dx progressbar with percentage ?
  8. Why doesn't the vehicle destroy when the player disconnects ? marker = createMarker(2169.62500, -1983.23706, 13.55469, "cylinder", 1) vehicles = {} addEventHandler("onMarkerHit", marker, function(player) vehicles[player] = createVehicle(408, 2169.62500 + 3, -1983.23706, 13.55469) end) addEventHandler("onPlayerQuit", root, function(type) if (type == "Quit") then destroyElement(vehicles[player]) end end)
  9. Why is outPutChatBox saying false instead of 1 ? What I need is to get the outPutChatBox as 1 marker = createMarker(2093.75464, -1948.29468, 13.54688, "cylinder", 1) addEventHandler("onClientMarkerHit", marker, function(player) setElementData(player, "item", 1) outputChatBox("hitted") end) addEventHandler("onClientRender", root, function(player) count = tostring(getElementData(player, "item")) outputChatBox(count) end)
  10. its worked. Thank you very much for explaining it to me
  11. This is a dirt job script I'm currently working on... There's a bug here, why isn't the marker destroyed when the player exits the vehicle? client side -- client side local screenW, screenH = guiGetScreenSize() local w, h = 400, 330 local jobMarker = createMarker(-1895.57104, -1660.41797, 22.11562, "cylinder", 1.0, 0, 255, 0) local window setMoonSize(1000) function getJob(player, matchingDeminsion) if player == localPlayer and matchingDeminsion then if not isPedInVehicle(player) then if isPedOnGround(player) then if not (window) then window = guiCreateWindow((screenW / 2) - (w / 2), (screenH / 2) - (h / 2), w, h, "garbage job", false) memo = guiCreateMemo(0, 30, w, 200, "this is garbage job!", false, window) guiMemoIsReadOnly(memo) accept = guiCreateButton(0, 290, 100, 40, "Accept", false, window) leave = guiCreateButton(130, 290, 100, 40, "Leave Job", false, window) close = guiCreateButton(250, 290, 100, 40, "Close", false, window) showCursor(true) else guiSetVisible(window, false) window = nil showCursor(false) end end end end end addEventHandler("onClientMarkerHit", jobMarker, getJob) function clicks() if (source == accept) then guiSetVisible(window, false) window = nil showCursor(false) triggerServerEvent("acceptJob", resourceRoot, localPlayer) elseif (source == leave) then guiSetVisible(window, false) window = nil showCursor(false) triggerServerEvent("leaveJob", resourceRoot, localPlayer) elseif (source == close) then guiSetVisible(window, false) window = nil showCursor(false) end end addEventHandler("onClientGUIClick", root, clicks) Server side -- server side addEventHandler("onResourceStart", root, function() team = createTeam("garbage", 0, 255, 0) end) addEvent("acceptJob", true) addEvent("leaveJob", true) function checkAccept(player) -- [accept job function] if (getElementData(player, "Jobs") == "garbage") then outputChatBox("you have alrady garbage job sorry!", player, 255, 0, 0) else setElementData(player, "Jobs", "garbage") setElementData(player, "trashlocation", 0) outputChatBox("job accept successfully!", player, 0, 255, 0) startJob(player) if (team) then setPlayerTeam(player, team) end end end addEventHandler("acceptJob", root, checkAccept) vehicles = { [408] = true } garbages = { [1] = {-1881.14380, -1707.47888, 21.75000}, [2] = {-1885.83081, -1723.84656, 21.75641}, [3] = {-1896.03723, -1731.46301, 21.75000}, [4] = {-1908.80933, -1733.61536, 21.75000}, [5] = {-1930.82690, -1767.77832, 26.18353}, [6] = {-1938.78809, -1781.46545, 29.32999}, [7] = {-1936.23059, -1760.15820, 24.36698}, [8] = {-1935.32361, -1742.58679, 22.91065}, [9] = {-1935.62610, -1719.10291, 21.75000}, [10] = {-1921.58350, -1706.34143, 21.90317}, [11] = {-1902.96033, -1704.98352, 21.75000} } function pickUpLocation(player, id) local x, y, z = garbages[id][1],garbages[id][2],garbages[id][3] local marker = createMarker(x, y, z, "cylinder", 3.0) -- <<<<<< Marker is here addEventHandler("onMarkerHit", marker, function(player) if getElementModel(getPedOccupiedVehicle(player)) == 408 then destroyElement(marker) marker = nil outputChatBox("hitted") setElementData(player, "trashlocation", getElementData(player, "trashlocation")+1) newLocation = getElementData(player, "trashlocation") pickUpLocation(player, newLocation) end end) end addEventHandler("onPlayerVehicleEnter", root, function(vehicle, seat, jacked) --[on player vehicle enter] if (vehicles[getElementModel(vehicle)]) and (getElementData(source, "Jobs") ~= "garbage") then removePedFromVehicle(source) x, y, z = getElementPosition(source) setElementPosition(source, x+1, y, z) outputChatBox("You don't have a garbage job", player, 255, 0, 0) end end) addEventHandler("onPlayerVehicleExit", root, function(vehicle, seat, jeacked) --[on player vehicle exit] if (getElementData(source, "Jobs") == "garbage") then if (getElementModel(vehicle) == 408) then outputChatBox("exited") setElementData(source, "Jobs", nil) destroyElement(marker) -- <<<<<<< problem is ehere end end end) trashVehicles = {} trashVehiclesBlips = {} function startJob(player) trashVehicle = createVehicle(408, -1879.74951, -1672.44751, 21.75000, 0, 0, 180) trashVehicleBlip = createBlipAttachedTo(trashVehicle, 51) trashVehicles[player] = trashVehicle trashVehiclesBlips[player] = trashVehicleBlip function checkVehicle(player) local vehicle = getPedOccupiedVehicle(source) local vehicleId = getElementModel(vehicle) outputChatBox(vehicleId) if (vehicleId == 408) then pickUpLocation(player, 1) setElementData(player, "trashlocation", 1) end end addEventHandler("onPlayerVehicleEnter", root, checkVehicle) end function leave(player)-- [leave job function] setElementData(player, "Jobs", nil) setPlayerTeam(player, nil) outputChatBox("leave successfully garbage job!", player, 255, 255, 0) end addEventHandler("leaveJob", root, leave)
  12. When one of the markers here is hit, why does the chat run 3 times in the outputchatbox? What is the reason for it? addEventHandler("onResourceStart", root, function() team = createTeam("garbage", 0, 255, 0) end) addEvent("acceptJob", true) addEvent("leaveJob", true) function checkAccept(player) -- [accept job function] if (getElementData(player, "Jobs") == "garbage") then outputChatBox("you have alrady garbage job sorry!", player, 255, 0, 0) else setElementData(player, "Jobs", "garbage") setElementData(player, "trashlocation", 0) outputChatBox("job accept successfully!", player, 0, 255, 0) startJob(player) if (team) then setPlayerTeam(player, team) end end end addEventHandler("acceptJob", root, checkAccept) vehicles = { [408] = true } addEventHandler("onPlayerVehicleEnter", root, function(vehicle, seat, jacked) if (vehicles[getElementModel(vehicle)]) and (getElementData(source, "Jobs") ~= "garbage") then removePedFromVehicle(source) x, y, z = getElementPosition(source) setElementPosition(source, x+1, y, z) outputChatBox("You don't have a garbage job", player, 255, 0, 0) end end) trashVehicles = {} trashVehiclesBlips = {} function startJob(player) trashVehicle = createVehicle(408, -1879.74951, -1672.44751, 21.75000, 0, 0, 180) trashVehicleBlip = createBlipAttachedTo(trashVehicle, 51) trashVehicles[player] = trashVehicle trashVehiclesBlips[player] = trashVehicleBlip function checkVehicle(player) local vehicle = getPedOccupiedVehicle(source) local vehicleId = getElementModel(vehicle) outputChatBox(vehicleId) if (vehicleId == 408) then pickUpLocation(player, 1) setElementData(player, "trashlocation", 1) end end addEventHandler("onPlayerVehicleEnter", root, checkVehicle) end garbages = { [1] = {-1881.14380, -1707.47888, 21.75000}, [2] = {-1885.83081, -1723.84656, 21.75641}, [3] = {-1896.03723, -1731.46301, 21.75000}, [4] = {-1908.80933, -1733.61536, 21.75000}, [5] = {-1930.82690, -1767.77832, 26.18353}, [6] = {-1938.78809, -1781.46545, 29.32999}, [7] = {-1936.23059, -1760.15820, 24.36698}, [8] = {-1935.32361, -1742.58679, 22.91065}, [9] = {-1935.62610, -1719.10291, 21.75000}, [10] = {-1921.58350, -1706.34143, 21.90317}, [11] = {-1902.96033, -1704.98352, 21.75000} } function pickUpLocation(player, id) local x, y, z = garbages[id][1],garbages[id][2],garbages[id][3] marker = createMarker(x, y, z, "cylinder", 3.0) addEventHandler("onMarkerHit", marker, function(player) destroyElement(marker) outputChatBox("hitted") setElementData(player, "trashlocation", getElementData(player, "trashlocation")+1) newLocation = getElementData(player, "trashlocation") pickUpLocation(player, newLocation) end) end function leave(player)-- [leave job function] setElementData(player, "Jobs", nil) setPlayerTeam(player, nil) outputChatBox("leave successfully garbage job!", player, 255, 255, 0) end addEventHandler("leaveJob", root, leave)
  13. When one of these markers is hit, another marker is destroyed. After that, even if other markers are hit, none of the markers will be destroyed. What is the reason for it ? garbages = { {-1881.14380, -1707.47888, 21.75000}, {-1885.83081, -1723.84656, 21.75641}, {-1896.03723, -1731.46301, 21.75000}, {-1908.80933, -1733.61536, 21.75000} } function pickup(player) for i,garbage in pairs(garbages) do marker = createMarker(garbage[1], garbage[2], garbage[3], "cylinder", 3.0) function picked(player) destroyElement(marker) end addEventHandler("onMarkerHit", marker, picked) end end
  14. I made a trashman job. But there is a small problem, how can only those who have the trashman job try to enter the trash vehicle? -- client side local screenW, screenH = guiGetScreenSize() local w, h = 400, 330 local jobMarker = createMarker(-1895.57104, -1660.41797, 22.11562, "cylinder", 1.0, 0, 255, 0) local window function getJob(player, matchingDeminsion) if player == localPlayer and matchingDeminsion then if not isPedInVehicle(player) then if isPedOnGround(player) then if not (window) then window = guiCreateWindow((screenW / 2) - (w / 2), (screenH / 2) - (h / 2), w, h, "garbage job", false) memo = guiCreateMemo(0, 30, w, 200, "this is garbage job!", false, window) guiMemoIsReadOnly(memo) accept = guiCreateButton(0, 290, 100, 40, "Accept", false, window) leave = guiCreateButton(130, 290, 100, 40, "Leave Job", false, window) close = guiCreateButton(250, 290, 100, 40, "Close", false, window) showCursor(true) else guiSetVisible(window, false) window = nil showCursor(false) end end end end end addEventHandler("onClientMarkerHit", jobMarker, getJob) function clicks() if (source == accept) then guiSetVisible(window, false) window = nil showCursor(false) triggerServerEvent("acceptJob", resourceRoot, localPlayer) elseif (source == leave) then guiSetVisible(window, false) window = nil showCursor(false) triggerServerEvent("leaveJob", resourceRoot, localPlayer) elseif (source == close) then guiSetVisible(window, false) window = nil showCursor(false) end end addEventHandler("onClientGUIClick", root, clicks) --server side addEvent("acceptJob", true) addEvent("leaveJob", true) function checkAccept(player) -- [accept job function] if (getElementData(player, "Jobs") == "garbage") then outputChatBox("you have alrady garbage job sorry!", player, 255, 0, 0) else setElementData(player, "Jobs", "garbage") outputChatBox("job accept successfully!", player, 0, 255, 0) startJob(player) end end function startJob(player) trashVehicle = createVehicle(408, -1879.74951, -1672.44751, 21.75000, 0, 0, 180) end addEventHandler("acceptJob", root, checkAccept) function leave(player)-- [leave job function] setElementData(player, "Jobs", nil) destroyElement(trashVehicle) outputChatBox("leave successfully garbage job!", player, 255, 255, 0) end addEventHandler("leaveJob", root, leave)
  15. access denied @ kickplayer
×
×
  • Create New...