Jump to content

50p

Retired Staff
  • Posts

    2,973
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by 50p

  1. 50p

    help

    @golanu, nobody asked you to do a "while loop". Your old code was more or less correct, you just need a global variable. Replace the "while" with "if". Line 6, there is no need for "local". @Alen141, Do not post the code that will not work. Your code will bring up a syntax error (line 6). Even if you fix that, at line 3 the variable will be 0 every time the greetingHandler function will be called.
  2. 50p

    help

    http://www.lua.org/pil/4.2.html
  3. 50p

    help

    @golanu21, DO NOT DOUBLE POST, PLEASE. Define a variable that will hold how many times the progress bar reached 100%. Check if the progress bar reached 100% (which you do at line 4), then add 1 to the variable and set the text of nivlab to whatever the variable holds.
  4. Do people change their keys during playing? Well, I don't, especially the key for radar. If you really need that then you can use a timer instead of onClientRender.
  5. That is correct but if order of called functions is necessary then 1 event handler is better. The file with that 1 event handler would be the last script file defined in meta.xml. @Jadore, If you don't need to worry about the order the functions get called then you can define each event handler in separate files but if you need to call functions in specific order then use only 1 event handler. The event handlers are triggered asynchronously that means 1 event handler may be triggered 1st but the next time it may be triggered 2nd. Eg. You may want to take player's weapons when he enters a col shape and give them back when he leaves. You may also want to check if player has specific weapon when he enters the col shape but in different event handler. It may fail sometimes because 1 event handler will check if player has the weapon, when triggered 1st it will work because the other event handler will take the weapons away. But if the event handler that takes the weapons away will be triggered first then checking if player has the weapon in the other handler will fail, even though he had the weapon. I hope that clarifies when to use 1 event handler and when you can use multiple event handlers.
  6. I don't think there is any other way. You can try: https://wiki.multitheftauto.com/wiki/Ge ... dToCommand to get the key for "radar" command then bindKey your own function to that key.
  7. As far as I remember, you can't have custom command handlers for hard-coded commands.
  8. @MACIEKW89, This is informal warning. If you keep double posting you will be given formal warning. Simple things like what you're doing shouldn't take longer than 10 minutes to script. You've kept asking for the script for 13 days? During the 13 days you could have learnt Lua and MTA functions and script it yourself. That script is simple text drawing. I don't know what is your problem but I'm sure you can find the answer to it on the wiki.
  9. @Jesseunit, If you will need help do not hesitate to PM me.
  10. You're welcome, no problem. Good luck.
  11. You are on the right way. If you have tested it you should know if it works. I think you have to call dxSetRenderTarget to nil once you finished drawing on it, otherwise you'd draw render target inside of render target. So, before you draw the render target, simply call: dxSetRenderTarget() without any arguments passed to the func.
  12. I suggest you make the camera look at wheels, spoilers or NOS when changing them. I wanted to add it to my old modshop but for some reason I can't get myself to get back to it. You can use getVehicleComponentPosition to get the position of upgrade components that way you can get camera's target (look at position). Their names can be found here: http://www.gtaforums.com/index.php?showtopic=158088 I'm not sure if they all work with MTA because as far as I remember, that function worked with components which have meshes attached to them. To get the camera position you can use getElementMatrix and the position of the component to find out the position of the camera. I like things to be dynamic not hardcoded so this will work with every garage, no matter what angle the vehicle is facing. I like the simplicity of UI in GTA V's mod shop. Good luck.
  13. You can create render target and draw text on it. Then use dxDrawImage to draw the render target with rotation.
  14. Simply create 2 objects in the same place. One with isLowLOD set to true and another one set to false.
  15. dxDrawMaterialLine3D has facing direction parameters (last 3 params) which you can use to make the rotation. Your example shows the facing coords is the middle of the San Andreas (0.0, 0.0, 0.0). If you want it to face up, then use the same coords of the placement with exception of Z being higher. float faceTowardX, float faceTowardY, float faceTowardZ Example: dxDrawMaterialLine3D ( k.x, k.y, k.z, k.lx, k.ly, k.lz, img, 10, tocolor(255, 255, 255, 255), k.x, k.y, k.z+1) As you can see, I used the same coords for facing as the "start" coords but I added +1 to Z, which will make the material face UP the Z axis.
  16. Topic locked as requested by its author. I'll throw in my 2 cents. If someone hires you and pays you to do the coding job, that means they employer has all the copyrights if both sides agreed or/and signed something. For instance, if you are hired by Kaspersky Lab. then you code for them and all the work stays with the company. When they get you fired you cannot publicly show any code that you wrote when you worked for them. What comes to the company, stays in the company. The situation is different when you create something (application, MTA resource, whatever it might be), licence it and you sell it to someone. Then, whoever bought it from you cannot publish it because of the licence. If author of the software (you) decides to publish his work free of charge then it's his decision and the customer who bought the product cannot complain about it and live with the fact that he had to pay for it when it wasn't free. (Unreal Engine and CryENGINE are good examples) If you still want to talk about it please solve it via PM. Do not PM me as I'm not getting involved. Thanks.
  17. Why do you need to check if skin name is equal to acl group? I added support for password in the latest version to block access to specific teams.
  18. Do you want to form a circle of explosions at the same time or you want to create bunch of explosions one after another on a circular path? -- x,y,z = center of the circle -- radius = radius of the circle -- explosionCount = how many explosions you want to create in circle function createCircularExplosion( x, y, z, radius, explosionCount ) -- creates all explosions at the same time if explosionCount == 0 then return end -- for safety: never divide by 0 for ang = 0, 360, (360/explosionCount) do -- increase ang by (360 degrees / explosions count) local xx = math.cos( math.rad( ang ) ) * radius + x; local yy = math.sin( math.rad( ang ) ) * radius + y; createExplosion( xx, yy, z, 0 ); end end -- x,y,z = center of the circle -- radius = radius of the circle -- delay = how many milliseconds between each explosion -- explosionCount = how many explosions you want to create in circle function createDelayedCircularExplosion( x, y, z, radius, delay, explosionCount ) if explosionCount == 0 then return end -- for safety: never divide by 0 local exploded = 0; local incAngle = 360 / explosionCount; -- incremental angle (eg. 360 / 40 = explosion by every 9 degree) local delayedExplosion = function ( x,y,z, radius ) local xx = math.cos( math.rad( incAngle * exploded ) ) * radius + x; local yy = math.sin( math.rad( incAngle * exploded ) ) * radius + y; createExplosion( xx, yy, z, 0 ); exploded = exploded + 1; end if explosionCount > 0 then setTimer( delayedExplosion , delay, explosionCount, x, y, z, radius ); end end There is a GTA limit of explosion visible at the same time (I think it's roughly 20 explosions), so the first function will only create about 20 explosion maximum, other remaining explosions will not be created (so for 40 explosions: only half the circle will explode). You can try the second function: -- warp yourself close to: 0, 0, 3 and call this function: createDelayedCircularExplosion( 0, 0, 3, 15, 200, 50 );
  19. You can simply set pickup "element ID", like: local pickup = createPickup( .... ); setElementID( pickup, "pickup:myPickup1" ); --------------- -- Then you can get the pickup by ID: local mypickup = getElementByID( "pickup:myPickup1" );
  20. The code should work but your local variables are pointless. They are the same as params and source so there is no point re-assigning them to local vars.
  21. @aim-killer, You're doing it wrong. DO NOT bind keys every frame! You will run out of RAM quickly. When you call bindKey, the function is stored in RAM. You're creating 3 anonymous functions and call bindKey 3 times per frame, if you're running MTA at 50fps then you're creating 150 functions each second! Also, when pressing the bound key, each function will have to be called, so after 1 second there will be 50 functions bound to 1 key, when you press that key, each function will be called. If you want to have a server-side function to do camera animations then you can have a server-side function which will then trigger client-side event, then the event could start the camera animation. You can use one of the useful functions from wiki: https://wiki.multitheftauto.com/wiki/SmoothMoveCamera which will move the camera smoothly for you. I would use interpolateBetween which gives more functionality, instead of creating objects and moving them to the target location. @6ArHxiMr'3a[Z]eF, These variables don't need to be local.
  22. You're replacing model ID: 1327 but with your server-side script you're creating object: 1644. I haven't tested the resource but changing the ID should solve the problem since the client-side script looks fine. By the way, this topic is not for people to post and ask for help.
  23. Even when you use your /laad command?
  24. As far as I remember, you can't change custom weapon's range and accuracy. There is no reason why you should change accuracy since every bullet is shot in a straight line, there is no recoil whatsoever.
  25. The code you showed us is not problematic. To me it looks just fine and has no impact on helicopter's Y movement direction. There must be something else, maybe your keys have been unbound.
×
×
  • Create New...