Jump to content

zocken212

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by zocken212

  1. I have read that "focusBrowser(nil)" helps.
  2. zocken212

    timer

    @upper poster: That is more than wrong.. 2k ms = 2 seconds, 10k ms = 10 seconds 2 minutes (120 seconds) = 120000 ms 10 minutes (600 seconds) = 600000 ms (or simply do this: seconds * 1000)
  3. Thanks, I've come up to a solution with your given functions.
  4. First option: I already did this. I increased the mass (or was this wrong? dunno, am not such a handling expert) by a lot and it didn't really have any good effect (except the car being rammed continuously into the ground). Second option: I tried this as well and it also had not such a good effect for me. I'm setting the vehicles Z velocity to -0.005 every frame and it still floats around instead of sticking to the ground. Maybe I'm doing anything wrong?
  5. zocken212

    OOP

    add this to your meta: <oop>true</oop>
  6. I've been thinking some time about this and didn't come up with a solution yet. Perhaps you can help me out? Well, I want a vehicle being stuck to the ground, in other words: Instead of flying after you hit a ramp it should stay on the ground. A bit unclear but I hope you will get what I mean. Regards
  7. zocken212

    OOP

    Have you tried veh = Vehicle.create(...) ?
  8. Maybe this thread can help you a bit viewtopic.php?f=91&t=76834
  9. Do not exaggerate. A script that is huge doesn't mean it has more potential than a script with less lines but with the same functionality You must be kidding, how many loc per day do you write on average? 5? Hm.. Is your advanced script "Object-Oriented" or "Process-Oriented"? In case it is the second you cannot call it advanced imo
  10. I've written this script for you fast. Please look at the comments and change the values and also change the outputChatBox texts. This script is untested but shouldn't have any error local par = { } local running = false function startGiveaway() if running ~= true then running = true outputChatBox("Tell the players here, that the giveaway has started, the amount to win and how to participate", root, 255, 255, 255) setTimer(function () local randomWinner = par[math.random(#par)] if randomWinner then outputChatBox(("%s has won!"):format(getPlayerName(randomWinner)), root, 255, 255, 255) givePlayerMoney(randomWinner, 0) -- change the 0 to an amount you like running = false for index, p in ipairs(par) do table.remove(par, index) end end end, 0, 1) -- 0 = time in ms (1000 ms = 1 second); change the 0 to a value you like end end -- Server addEventHandler("onResourceStart", resourceRoot, function () startGiveaway() end) addCommandHandler("par", function (player, cmd) local money = getPlayerMoney(player) if money >= 500 then if not par[player] then par[player] = true takePlayerMoney(player, 500) outputChatBox("Inform the player here, that he is participating in the giveaway", player, 255, 255, 255) else outputChatBox("Inform the player here, that he is already participating", player, 255, 255, 255) end else outputChatBox("Tell the player here, that is money is not enough", player, 255, 255, 255) end end)
  11. Easierst way to handle this would be writing an own mapmanager. Load mapfile as xml and then create everything from its node
  12. Got it working.. but no need to be rude
  13. I want to know how many bytes has been transferred since the transfer has started.. example: 163/635 KB, not the percent
  14. Hey, I have used triggerLatentClientEvent and some other functions to make a custom downloader, everything works fine. But now I want to know how I can query the total bytes that has already been transferred since it has started. I hope you can help me. (Showing any code is unnecessary, if such answers occur) Best Regards
  15. If I understood you correctly: Create a new texture (or render target) with https://wiki.multitheftauto.com/wiki/Dx ... nderTarget, then draw the text to the render target and at the end draw the render target with https://wiki.multitheftauto.com/wiki/Dx ... tionLine3D at your desired position
  16. cheater solution I have a class for creating a dxEditBox, if you want it you can send me a PM.
  17. "load a map from a resource without starting the resource"
  18. hi Is there any way to load a map from a resource without starting the resource? peace
  19. I did this where it changes to "back" and it worked fine as it should be. Thank you!
  20. Hey, I want to make an information window animated (fully dx) and so far it worked. But now the fail comes, when it should go smooth back out of the screen it just disappears in like lightspeed. Here is the code: local x,y = guiGetScreenSize() local startTick = getTickCount() local animState = "start" local length = 1500 local font = 1 local text = "" local handled = false function drawIt() if animState == "start" then local x1,y1,_ = interpolateBetween(512*x/1280,10-y/3,0,512*x/1280,10*y/960,0,progress(1000),"Linear") local x2,y2,_ = interpolateBetween(512*x/1280,10-y/3,0,512*x/1280,10*y/960,0,progress(1000),"Linear") local x3,y3,_ = interpolateBetween(767*x/1280,30-y/3,0,767*x/1280,30*y/960,0,progress(1000),"Linear") local x4,y4,_ = interpolateBetween(512*x/1280,30-y/3,0,512*x/1280,30*y/960,0,progress(1000),"Linear") local x5,y5,_ = interpolateBetween(512*x/1280,170-y/3,0,512*x/1280,170*y/960,0,progress(1000),"Linear") local x6,y6,_ = interpolateBetween(512*x/1280,30-y/3,0,512*x/1280,30*y/960,0,progress(1000),"Linear") local x7,y7,_ = interpolateBetween(763*x/1280,30-y/3,0,763*x/1280,30*y/960,0,progress(1000),"Linear") local x8,y8,_ = interpolateBetween(516*x/1280,30-y/3,0,516*x/1280,30*y/960,0,progress(1000),"Linear") local x8a,y8a,_ = interpolateBetween(763*x/1280,170-y/3,0,763*x/1280,170*y/960,0,progress(1000),"Linear") dxDrawRectangle(x1, y1, 255*x/1280, 20*y/960, tocolor(0, 120, 250, 255), true) dxDrawText("Information Window", x2, y2, x3, y3, tocolor(255, 255, 255, 255), 1.00*y/960, "default", "center", "center", false, false, true, false, false) dxDrawRectangle(x4, y4, 255*x/1280, 140*y/960, tocolor(0, 120, 250, 90), true) dxDrawRectangle(x5, y5, 255*x/1280, 4*y/960, tocolor(0, 120, 250, 255), true) dxDrawRectangle(x6, y6, 4*x/1280, 140*y/960, tocolor(0, 120, 250, 255), true) dxDrawRectangle(x7, y7, 4*x/1280, 140*y/960, tocolor(0, 120, 250, 255), true) dxDrawText("This is the window", x8,y8, x8a,y8a, tocolor(255, 255, 255, 255), 1.00*y/960, "default", "center", "center", false, true, true, false, false) if getTickCount() - startTick >= length then animState = "back" end elseif animState == "back" then local x1,y1,_ = interpolateBetween(512*x/1280,10*y/960,0,512,10-y/4,0,progress(1000),"Linear") local x2,y2,_ = interpolateBetween(512*x/1280,10*y/960,0,512,10-y/4,0,progress(1000),"Linear") local x3,y3,_ = interpolateBetween(767*x/1280,30*y/960,0,767,30-y/4,0,progress(1000),"Linear") local x4,y4,_ = interpolateBetween(512*x/1280,30*y/960,0,512,30-y/4,0,progress(1000),"Linear") local x5,y5,_ = interpolateBetween(512*x/1280,170*y/960,0,512,170-y/4,0,progress(1000),"Linear") local x6,y6,_ = interpolateBetween(512*x/1280,30*y/960,0,512,30-y/4,0,progress(1000),"Linear") local x7,y7,_ = interpolateBetween(763*x/1280,30*y/960,0,763,30-y/4,0,progress(1000),"Linear") local x8,y8,_ = interpolateBetween(516*x/1280,30*y/960,0,516,30-y/4,0,progress(1000),"Linear") local x8a,y8a,_ = interpolateBetween(763*x/1280,170*y/960,0,763,170-y/4,0,progress(1000),"Linear") dxDrawRectangle(x1, y1, 255*x/1280, 20, tocolor(0, 120, 250, 255), true) dxDrawText("Information Window", x2, y2, x3, y3, tocolor(255, 255, 255, 255), 1.00*y/960, "default", "center", "center", false, false, true, false, false) dxDrawRectangle(x4, y4, 255*x/1280, 140*y/960, tocolor(0, 120, 250, 90), true) dxDrawRectangle(x5, y5, 255*x/1280, 4*y/960, tocolor(0, 120, 250, 255), true) dxDrawRectangle(x6, y6, 4*x/1280, 140*y/960, tocolor(0, 120, 250, 255), true) dxDrawRectangle(x7, y7, 4*x/1280, 140*y/960, tocolor(0, 120, 250, 255), true) dxDrawText("This is the window", x8,y8, x8a,y8a, tocolor(255, 255, 255, 255), 1.00*y/960, "default", "center", "center", false, true, true, false, false) end end function progress(tick) local now = getTickCount() local elapsedTime = now-startTick local duration = startTick+tick-startTick local progress = elapsedTime/duration return progress end function draw(teXt,foNt) if not foNt then font = 1 end assert(teXt,"Error at @draw") foNt = font teXt = text --local lengthHere = string.len(text) --local length = 150*lengthHere/2 if handled ~= true then addEventHandler("onClientRender",getRootElement(),drawIt) handled = true end end draw("hello thereaaaaaaaaaa")
  21. Hello, I want to create a custom EDF. Until now it worked fine, it gets the X,Y,Z and rotation X,Y,Z but not the vehicle ID. First the EDF: (copied most from race) <def name ="Shooter"> <element name = "spawnpoint" friendlyname = "Shooter Spawnpoint"> <data name = "position" type = "coord3d" required = "true" default = "0,0,0"/> <data name = "rotation" type = "coord3d" required = "true" default = "0,0,0"/> <data name = "vehicle" type = "vehicleID" default = "522"/> <vehicle model="!vehicle!" rotation="!rotation!"/> </element> </def> Now the code where I get the data from the spawnpoint: function getRandomSpawnPoint() local random = nil for index, p in pairs(getElementsByType("spawnpoint")) do if p ~= nil then local toRandom = math.random(#getElementsByType("spawnpoint")) if index == toRandom then local x,y,z = getElementPosition(p) local model = getElementModel(p) random = { x = x, y = y, z = z, model = model} toRandom = nil break end end end return random end local test = getRandomSpawnPoint() outputChatBox(tostring(test.model)) Where is my problem? Edit: local model = getElementData(p,"vehicle") works somehow, but just tried it now lol.. If there is another way, you can tell it me
  22. Ok thanks, the error doesn't appear anymore. Now my next problem is that the outputChatBox does not work ._. (No error or else, only there is no chatbox output) Edit: Working now (Didn't aim with a weapon on it)
  23. Hey all I want to make a firefighter job but I have a problem. Since createFire returns no element I used particle_objects to make a fire object. Now when I'm aiming on it it always says "Error: Expected element at argument 1, got boolean".. (I created the fires before in another part) addEventHandler("onPlayerTarget",getRootElement(), function (hitElement) if getElementType(hitElement) == "object" then -- Error: Expected element at argument 1, got boolean if getElementData(hitElement,"fire") == true then outputChatBox("This is a fire") end end end) Where is my problem??
  24. I tried it several times and it worked everytime. Thank you very much
×
×
  • Create New...