Jump to content

Molvine

Members
  • Posts

    18
  • Joined

  • Last visited

  • Days Won

    1

Molvine last won the day on March 8 2023

Molvine had the most liked content!

About Molvine

  • Birthday 15/09/2005

Details

  • Gang
    JESUS'
  • Location
    Czech Republic
  • Occupation
    сreate your own server
  • Interests
    -

Recent Profile Visitors

356 profile views

Molvine's Achievements

Square

Square (6/54)

5

Reputation

  1. Maybe because the destroyElement(Van) line is commented out?
  2. I don't remember exactly, but, it seems, the underscore does not work in export through a dot, only characters and numbers. Try this format: exports["name"]. I also can't figure out which side you are writing on? Is it client side or server side? Judging by the error, this is most likely the client side. Then instead of triggerClientEvent, you just need to use triggerEvent.
  3. Це не адмін, це антічіт МТА. Можливо, якісь програми, по-типу, Cheat Engine, чи щось таке, що впливає на МТА. Тому й кікнуло.
  4. What does the list mean? Scoreboard resource?
  5. Hello! I want to start doing at least the simplest modeling, but when creating my first model, I ran into this problem: the transform values are not applied to the object when the model is exported. I tried to make another object, but it still didn't export correctly. When I used ColEditor2, the dimensions also indicated that the height of the element was twice the width. But in the end, the model is still incorrectly exported. I am using a DragonFF script. I also tried to replace another model, not to replace the collision, but everything remained unchanged In Blender: https://ibb.co/hd3PwYX In Game: https://ibb.co/1rTzR1g
  6. The localPlayer variable does not exist on the Server-side. LocalPlayer specifies the player element on the Client-side. I found some obvious bugs in your code: In the Seed function, you are trying to specify localPlayer as the rootElement, and you are violating the arguments. You should remove the localPlayer and only call the function for your player. I would also not recommend using the varieble name "source". Better use the player, so it will be clearer to everyone: --wrong function Seed(source) if isElementWithinMarker(source, Pickup_Seed) then if getElementData(source, "GameLight:Seed") == false then setElementFrozen(source, true) setPedAnimation(source, "bar", "barcustom_get", 5000, true, false, false, false) triggerClientEvent(source, "EnableTimer3D_1", getRootElement()) setTimer(function() triggerClientEvent(localPlayer, source, "Remover_1", getRootElement()) end, 5000, 1) setTimer(function() setElementData(source, "GameLight:Seed", true) setElementFrozen(source, false) outputChatBox("#0000ff[Narkotikas] #ffffffTu savāci sēklu, ej iestādi to.", source, 255, 255, 255, true) setMarkerSize(Pickup_Planting, 1.5) setMarkerSize(Pickup_Seed, 0) end, 5000, 1) else outputChatBox("#0000ff[Narkotikas] #ffffffTev ir sēkla, iestādi to sākumā.", source, 255, 255, 255, true) end end end --right function Seed(player) if isElementWithinMarker(player, Pickup_Seed) then if getElementData(player, "GameLight:Seed") == false then setElementFrozen(player, true) setPedAnimation(player, "bar", "barcustom_get", 5000, true, false, false, false) triggerClientEvent(player, "EnableTimer3D_1", getRootElement()) setTimer(function() triggerClientEvent(player, "Remover_1", getRootElement()) end, 5000, 1) setTimer(function() setElementData(player, "GameLight:Seed", true) setElementFrozen(player, false) outputChatBox("#0000ff[Narkotikas] #ffffffTu savāci sēklu, ej iestādi to.", player, 255, 255, 255, true) setMarkerSize(Pickup_Planting, 1.5) setMarkerSize(Pickup_Seed, 0) end, 5000, 1) else outputChatBox("#0000ff[Narkotikas] #ffffffTev ir sēkla, iestādi to sākumā.", player, 255, 255, 255, true) end end end The same is true for the "onResourceStart" and "onClientResourceStart" events. These events occur when any resource is started, not just the one in which the event is written. An argument of type "resource" is passed to the function. Use validation to understand that this is exactly your resource: --wrong function StartBindKeySeed() for i, v in ipairs(getElementsByType("player")) do bindKey ( v, "h", "down", Seed ) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), StartBindKeySeed) --right function StartBindKeySeed(res) if not (resource == res) then return end for i, v in ipairs(getElementsByType("player")) do bindKey ( v, "h", "down", Seed ) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), StartBindKeySeed) I would also advise resetting the data element when the resource is turned off. This may cause problems. For example, when you restart, you will no longer be able to start work, and so on. Use this: OnResourceStop SetElementData Sorry, I can't check if the element is removed correctly, but judging by the code, there shouldn't be any problems. Correct your mistakes and check if everything works the way you want. Addition: And yet, in your functions there is no protection against repeated keystrokes. I can endlessly start planting drugs. You can see for yourself. Add a check to prevent this from happening. You can use the same SetElementData, or whatever is more convenient for you.
  7. Molvine

    camera

    Try using this: https://wiki.multitheftauto.com/wiki/SetCameraMatrix
  8. Olá! Pelo que entendi, você precisa pegar o recurso do elemento? Eu escrevi uma função que retorna um recurso de um elemento, ou false se algo der errado. Bem, junto com ele um exemplo para verificar o desempenho. Server: local vehicle = createVehicle(555, 0, 0, 5) function getResourceFromElement(element) if isElement(element) then local type = getElementType(element) for i,res in ipairs(getResources()) do if getResourceState(res) == "running" then for i,v in ipairs(getElementsByType(type, getResourceDynamicElementRoot(res))) do if v == element then return res end end end end end return false end setTimer(function() local res = getResourceFromElement(vehicle) if res then outputChatBox("Resource name: "..getResourceName(res)) end end, 500, 1)
  9. Não entendi muito bem o que você quer alcançar. Você deseja que a cor mude se o cursor estiver sobre o retângulo ou quando estiver dentro do retângulo?
  10. Thank you very much for your advice! I thought that he would not ask such a question, since the default GTA HUD has such an animation by default, and did it right on the user interface. Here is the corrected code: Client: local delay = 20 function moneyChange(commandName, count) count = tonumber(count) if type(count) ~= "number" then return end local operaceType = "give" if count < 0 then operaceType = "take" count = -count end local addMoney = 0 local modf = 1 if count > 100 then modf = modf*10 end if count > 1000 then modf = modf*10 end if count > 10000 then modf = modf*10 end if count > 100000 then modf = modf*10 end if count > 1000000 then modf = modf*10 end local timer = setTimer(function() addMoney = math.random(1,modf) count = count - addMoney if count < 1000000 and modf == 100000 then modf = modf/10 end if count < 100000 and modf == 10000 then modf = modf/10 end if count < 10000 and modf == 1000 then modf = modf/10 end if count < 1000 and modf == 100 then modf = modf/10 end if count < 100 and modf == 10 then modf = modf/10 end if count <= 0 then triggerServerEvent("money:moneyChange", resourceRoot, localPlayer, count + addMoney, operaceType) count = 0 if isTimer(timer) then killTimer(timer) timer = nil end return end triggerServerEvent("money:moneyChange", resourceRoot, localPlayer, addMoney, operaceType) end, delay, 0) end addCommandHandler("money", moneyChange) addEventHandler("onClientRender", root, function() dxDrawText(tostring(getPlayerMoney(localPlayer)), 500, 300, _, _, _, 3) end) Server: addEvent("money:moneyChange", true) addEventHandler("money:moneyChange", root, function(player, count, operaceType) if not player or not count or not operaceType then return end if operaceType == "give" then givePlayerMoney(player, count) else takePlayerMoney(player, count) end end)
  11. Hello! I tried to do something similar. It's not the best way, but it works as it should. Try it (server): local delay = 20 function moneyChange(player, commandName, count) count = tonumber(count) if type(count) ~= "number" then return end local operaceType = "give" if count < 0 then operaceType = "take" count = -count end local addMoney = 0 local modf = 1 if count > 100 then modf = modf*10 end if count > 1000 then modf = modf*10 end if count > 10000 then modf = modf*10 end if count > 100000 then modf = modf*10 end if count > 1000000 then modf = modf*10 end local timer = setTimer(function() addMoney = math.random(1,modf) count = count - addMoney if count < 1000000 and modf == 100000 then modf = modf/10 end if count < 100000 and modf == 10000 then modf = modf/10 end if count < 10000 and modf == 1000 then modf = modf/10 end if count < 1000 and modf == 100 then modf = modf/10 end if count < 100 and modf == 10 then modf = modf/10 end if count <= 0 then if operaceType == "give" then givePlayerMoney(player, count + addMoney) else takePlayerMoney(player, count + addMoney) end count = 0 if isTimer(timer) then killTimer(timer) timer = nil end return end if operaceType == "give" then givePlayerMoney(player, addMoney) else takePlayerMoney(player, addMoney) end end, delay, 0) end addCommandHandler("money", moneyChange)
  12. Hello! I tried to do something similar, but even without animation, the code came out hard to read. I'm sure it's not optimal, but at least it works. Sorry, but my knowledge is hardly enough to create an animation. But I can try if you still need it! Video: Code: local image = dxCreateTexture(":nfsmw/assets/icon.png") local selected = 1 local count = 5 local elementOffset = 10*scaleValue --padding between items in a menu list local w, h = 100*scaleValue, 100*scaleValue local offsetX, offsetY = 550*scaleValue, 50*scaleValue local x, y = getScreenStartPositionFromBox(w, h, offsetX, offsetY, "right", "bottom") function render() local selectedPos = x for i=1, count do local difference = i-selected --get the difference between the selected element and the rendered element local differenceCopy = difference if difference < 0 then differenceCopy = -difference end local height = h - (differenceCopy*20*scaleValue) --here we decrease the size as we move away from the selected element local width = w - (differenceCopy*20*scaleValue) local offset = 0 local step = 1 if difference < 0 then step = -step end if difference ~= 0 then for k=0, difference, step do --the loop calculates the offset using the width for each element. I didn't come up with a formula how to calculate it without a loop offset = offset + (20*scaleValue)*k end end if difference > 0 then offset = offset - 20*scaleValue*differenceCopy end --if the element is further than the selected one, then we decrease the offset by one point. without it, elements after the selected one have an offset one point less than required local xImage = selectedPos + (w*difference) - offset + 10*scaleValue*difference --the actual position of the x-axis of the element local yImage = y+(h-height)/2 --the actual y-axis position of the element local alpha = 255 - 100*(differenceCopy) --transparency decreases with distance from the selected element if alpha < 0 then alpha = 0 end dxDrawImage(xImage, yImage, width, height, image, _, _, tocolor(255,255,255,alpha)) --element rendering end end function startRender() addEventHandler("onClientRender", root, render) end startRender() function selectElementInMenu(key, keyState, turn) --element select function if turn == "right" then if selected >= count then selected = count return end selected = selected + 1 elseif turn == "left" then if selected <= 1 then selected = 1 return end selected = selected - 1 end end bindKey("o", "up", moveMenu, "right") bindKey("i", "up", moveMenu, "left")
  13. Hello! I ran into a problem in which the marker in the interior is invisible, but it works properly. Everything worked fine, but after I changed the screen resolution (to test adaptation to screens), the marker was no longer visible. Does anyone know how this can be fixed? Here is the part of the code where I create the marker(Client): for i,v in ipairs(foods) do local marker = createMarker(v[1],v[2],v[3]+0.8,'arrow',1.5,255,255,0) local markerInterior = createMarker(v[8],v[9],v[10]+0.8,'arrow',1.5,255,255,0) setElementData(marker,'ID',i) setElementData(marker,'Interior','outside') setElementInterior(markerInterior,v[4]) setElementData(markerInterior,'ID',i) setElementData(markerInterior,'Interior','interior') local markerFood = createMarker(v[16],v[17],v[18]-1,'cylinder',1,255,0,40,100) setElementInterior(markerFood,v[4]) setElementData(markerFood,'type',v[19]) end Shared: foods = { {811.30029, -1616.21179, 13.5468,10,814.10345, -1616.45972, 13.54688,363.51627, -74.63560, 1001.5078,365.26227, -73.70920, 1001.50781,292.3,257.6,376.54950, -68.01637, 1001.5151,'burger'} } I create a marker in the interior of Burger Shot. Neither through v[4] nor through 10 does it work, even though setElementInterior() returns true. Please help, who knows what to do with this.??
  14. Hello. I have a problem with getScreenStartPositionFromBox. When I click on the rectangle created by the function getScreenStartPositionFromBox, it goes to the front and overlays the dgs elements (eg buttons). How can I make it so that it doesn't go to the front?
×
×
  • Create New...