Jump to content

JR10

Retired Staff
  • Posts

    2,947
  • Joined

  • Last visited

Everything posted by JR10

  1. JR10

    [HELP] KILL

    Are you using my code? It should kill you only once when you execute the command.
  2. JR10

    onPlayerQuit

    Just tested your code (without db and the check) and it did output the correct values.
  3. JR10

    [HELP] KILL

    You should check the wiki pages for examples; this is not how setTimer works. The 0 in setTimer will make it execute every 5 seconds, you only need it once. addCommandHandler("kill", function(player) setTimer(setElementHealth, 5000, 1, player, 0) end)
  4. JR10

    onPlayerQuit

    The health and model functions shouls return the correct values, even on quit. Make sure that no other scripts are changing them. Also, does it return the position and the money correctly?
  5. You can use element data (without sync) to identify if he's on duty or off duty and change it. You didn't post the part where you make the player invincible.
  6. You can disable the old sirens sound with setWorldSoundEnabled You can play your realistic custom sound with playSound3D
  7. He needs in on login. There is no on login event client side so he needs to trigger a client event whenever a player logins.
  8. You're using source inside the timer function, source is only defined inside the handler function. Just define a player variable that points to the source. Or you can send the source as an argument to the timer function. function outputLoss(loss) if not isElement(source) then return end if getElementModel(source) ~= 897 then return end local oldHealth = getElementHealth(source) local hitX, hitY, hitZ = getElementPosition(source) local object = source setTimer(function() local newHealth = getElementHealth(object) outputChatBox("Real loss: "..(newHealth-oldHealth)) outputChatBox("Theoretical loss: "..loss) if getElementHealth(object) == 0 then destroyElement(object) createExplosion(hitX, hitY, hitZ, 8, true, -1.0, false) end end,100,1) end addEventHandler("onClientObjectDamage", root, outputLoss)
  9. onClientPlayerDamage provides the attacker and his weapon as an argument.
  10. Use onClientPlayerDamage.
  11. No need, I just didn't notice the positioning arguments.
  12. JR10

    Question

    A simple message like that shouldn't cause issues. Good luck though.
  13. JR10

    Question

    There is no registration message, only login. But no, you can't remove that hard-coded login message.
  14. Are you sure? I mean, you're using dxDrawImage which will just draw the full image. He wants to draw a section of the image.
  15. @Et-win Why do you reset the blend mode twice? Also, this doesn't really address his issue, nor what caused the bug, he wants dxDrawImageSection not to draw the full image.
  16. After experimenting with it, I figured it out. For some reason, the postGUI parameter in dxDrawText causes the text to be drawn to the screen and not the render target. I also tweaked dxDrawImageSection to achieve the effect you want. Here's the code: target = dxCreateRenderTarget ( 500, 500, true ) function onClientRendere () if (target) then dxSetRenderTarget (target, true) dxSetBlendMode("modulate_add") dxDrawText ( "TEEEEEEEEEEEEEST", 0, 0, 500, 100, tocolor(255,255,255,255), 2, "sans", "left", "top", false, false, false, false ) dxSetRenderTarget() dxSetBlendMode("add") dxDrawImage(500, 200, 500, 500, target); --Draw the full render target to check the diff, you can remove this after testing dxDrawImageSection(500, 100, 500, 15, 0, 0, 500, 15, target, 0, 0, 0, tocolor(255,255,255,255), true) dxSetBlendMode("blend") end end addEventHandler ("onClientRender", getRootElement(), onClientRendere) Here's an image:
  17. This is not a forum for requests. Read this: viewtopic.php?f=91&t=47897
  18. Try something out first and then we can help you with your code. Check the community for examples.
  19. onClientPlayerJoin triggers when other players join and not the client. Replace it with onClientResourceStart. As for any errors, you're going to have to post some of them so we can help you.
  20. Just check the wiki. You need to design the GUI with the gui functions. trigger events and use the account functions to add accounts and log in the player. It's simple really. Check the existing resources.
  21. No, definitely not an RPG gamemode. You'll probably never finish it and get discouraged easily. Start with, for instance, a GUI account system. Once your done, expand it to include a forget option. Of course, that's just an example. Oh and please don't double post, use the edit button.
  22. You're using the full width and height in dxDrawImageSection that's why it's drawing the full text, try this: target = dxCreateRenderTarget ( 100, 100, false ) function onClientRendere () dxSetRenderTarget (target, true) dxSetBlendMode("modulate_add") dxDrawText ( "TEEEEEEEEEEEEEST", 500, 550, 500, 500, tocolor(255,255,255,255), 2, "sans", "left", "center", false, false, true, false ) dxSetRenderTarget() dxSetBlendMode("add") dxDrawImageSection(650, 500, 50, 50, 0, 0, 50, 25, target, 0, 0, 0, tocolor(255,255,255,255), true) dxSetBlendMode("blend") end addEventHandler ("onClientRender", getRootElement(), onClientRendere)
  23. There are no tips/tutorials on "creating bigger systems". The best way to learn is to just learn by doing. Start coding something no matter how big it is, stick to it and learn as you fail or get lost.
  24. Did you check the tutorial first? If so, just browse the community and find some examples. The tutorial topic has some examples and replies as well, you could check them. Once you get familiar with the basic functions, it will be easy to understand any query string.
  25. There's none posted on the forums, you can Google for a MySQL one, the functions for it are the same in MTA, you just gotta learn the differences between them. The queries are very similar as well. So start by learning SQLite then Google for MySQL.
×
×
  • Create New...