Jump to content

The_GTA

Helpers
  • Posts

    822
  • Joined

  • Last visited

  • Days Won

    86

Everything posted by The_GTA

  1. You're welcome! It seems like your DX UI is not finished yet. If you have any further trouble making your script then feel free to ask me.
  2. Hello BogdanRTB, it seems like you have forgotten to put down... addEventHandler("onClientRender", root, rentVeh)
  3. I think that you have not properly applied my code to your shader. Since you are using XNA you might have overwritten the file again and the technique definition is missing. Try creating the newest .fx file and putting in the technique definition. The error message you have provided above does not happen if you put the technique definition inside of the file. Please try giving us the actual, most recent error message!
  4. Hello Krokara, have you looked at the MTA wiki documentation for the HLSL shaders? The error message should point you at a very specific detail of Direct3D9 effect files: the technique definition. Inside of a technique you define passes. In each pass you define the associated render-states and shader functions. For example, you could define the following technique in your effect file: technique TS { pass P0 { VertexShader = compile vs_2_0 VS_Electricity(); PixelShader = compile ps_3_0 PS_Electricity(); } } Good luck!
  5. Glad to be of help to you! I admit that I wanted to get you to look at your own code instead of me solving it outright for you. In my opinion a really good way to learn is to self-reflect based on your own accomplishments. If you would have posted the code I could have given my solution of course. But this is not required anymore since you have solved the issue.
  6. This post is my personal statement. It could be detached from views of other members of this board. I invite everyone into an open discussion that follows the rules of this forum. In this article I want to talk about the meaning of copyright in contrast to how the wild specimen known as gamer perceives it. It is my careful accumulation of experiences around here-unnamed internet communities. It is a delicate subject in the case of vibrant communities that express themselves in their identity surrounding copyrighted works. But there appear to be misunderstandings regarding facts such as the untouchability of present copyright holders, much profoundedly so due to being champions and creators of said works, and their enactable rights. Thus an unbiased observer, taking no defaulted side could be confused if not deluded about what is right in this situation. Let's start by explaining the intentions of good-faith which the core values of our society build upon. They overreach the primitive understanding of laws as expressions of restriction. In a commercial direction we want to cherish - the action in good-faith - entrepreneurs who create works and take the initial risk to distribute this previously unheard-of content. More works will be encouraged if we protect their commercial interest in creations. It fundamentally brings us together as community to act as protectors of (copy-)rights as well as the procedures of lawful acquirements. The essence of buying a work - the driving factors of markets, innovation - is agreed upon by the copyright holder in his distribution interest. We must never forget the interconnectedness of the good-faith that has spawned its roots into every facet of todays society to keep our world intact. Disdainfully in eyes of creators could be a creeping misunderstanding of good-faith. As an entrepreneur - good-faith creators of favorable works - it has to be your natural reflex to protect yourself against it. Starting with the most-generous opening argument we could say that there are people who have been tricked into downloading software - which has a lot of man-hours of work behind it, countless of designers smithing away in their creativity - without permission on the internet. Down this line more radical are people who consider that abandonware is a legal concept and that it in principle could overrule the copyright. Worse yet, the entrepreneur could enter the attempted dispute with a legal entity about the value of aging works and their copyright enactability. But I digress. When laws change, good-faith keeps us together. A world where creators work for free hardly exists in good-faith. Oh joy, they get to distribute the new excitement to everyone, but their kids at home starve amongst the countless spent man-hours. On the other hand a world with rising yet unexplained prices is risking a growing, deeply-rooted misunderstanding by the consumers. In particular a good businessman does keep both sides - the accountability and the protectivity - in good balance. We started this article by mentioning gamers. These people consume works of the game industry. The game industry is a set of companies with many designers, programmers, sound/visual/expressionary artists and their suits. With each game - a work of said industry - each of the previously mentioned industry components wants to get paid during the making process as well as afterwards to continue a good-faith job. It is my - the article authors - point of view that many gamers do not understand how hard it is to make and sell a game. We as a society have to raise the importance of copyright with truthful explanations of the work that resulted in said rights. Then can we expect the newcomer to understand the core-values of our society. I - the article author - want to apologize for leaving this delicate topic on this unfinished note. May you have a good and understanding future about the topics explored herein.
  7. I recommend you to use interpolateBetween using the "OutInQuad" easing function. It expects a value between 0..1 inclusive as progress parameter. This can be a time parameter if you divide elapsed time by a duration. If the time has elapsed completely then you should not use interpolateBetween anymore but instead treat the vehicle as completely visible. How about you try your hands at it? If you know the above modular details then it is not a matter of experience but mathematical profoundness.
  8. You're welcome! Hoping to see you back here asking more questions. I will be there to help you again.
  9. Oh, those points are not supposed to span an area? I wonder why you mentioned a "massive" then. You want to get the point which is the closest of a fixed set of points, right? Then just do the following: local function getClosestSpawnPoint(points, x, y, z) local closest_dist = false; local closest_x, closest_y, closest_z = false, false, false; for m,pt in ipairs(points) do local ptx, pty, ptz = pt[1], pt[2], pt[3]; local dist = getDistanceBetweenPoints3D(x, y, z, ptx, pty, ptz); if not (closest_dist) or (closest_dist > dist) then closest_dist = dist; closest_x, closest_y, closest_z = ptx, pty, ptz; end end return closest_x, closest_y, closest_z; end ... -- The place you want to use the spawn point. local player_x, player_y, player_z = getElementPosition(player); local spawn_x, spawn_y, spawn_z = getClosestSpawnPoint(points, player_x, player_y, player_z); -- TODO: use spawn_x, spawn_y, spawn_z
  10. You could divide that area into triangles and solve the closest-point problem for each rectangle, then take the point with the minimum distance out of all rectangles.
  11. How about you don't draw nametags that are not visible on screen? Since the 3D projection is a frustum which has a bottom plane (far-clip) too far players do not get a screen position either. Or just use the function I have linked for you. It does not return false in the far-clip case. HINT: you need to enable OOP in your MTA resource to use the get_screen_coordinates function! HINT: the get_screen_coordinates function does return relative values; you have to multiply them with the screen dimensions to get pixel values.
  12. Hello ysj4, did you know that if (bX, bY, bZ + 0.35) are outside of your GTA SA game client screen then the getScreenFromWorldPosition function does return false? If you want to know about a more generic way to get a blip position in the camera-orriented direction then take a look at this thread in which I responded last year: The reason for this issue is very simple: you cannot see any world position on your screen that is outside of your game client window. Thus you should not expect the getScreenFromWorldPosition function to return anything that you cannot see! ?
  13. You're welcome! Don't worry, I am a patient man. So my hunch about the transpilation debug message adjustment was correct. I think that the users of your library have to be made aware that in support cases they have to show us both the transpiled as well as the input code for proper support. I like that you want to keep the transpilation output human-friendly. I think it is a very important strategy to the success of your product. Being able to understand how the code was generated from the original source will aid developers in the trust into your code generator. It will also raise the confidence that your product performs well. Good choice! You seem to go beyond my expectations in overriding default Lua debug facilities. While this is an interesting concept I am afraid not many people make use of these. There should be more tutorials on MTA forums about proper debugging of code and you should contribute to those with how your product is really well made regarding debugability!
  14. If the new engine does provide us with plugin-sdk like modding API at launch, I can see a bright future ahead for the MTA project on the new engine.
  15. And guess what: I just fixed another tiny mistake that I made in my supposed fix to your code.. It happens to the best of us. ?
  16. OK. Here is my adjustment to match your specification: -- Put at the top of your script. local interval_show = 1000; local interval_hide = 2000; local full_interval = ( interval_show + interval_hide ); local interval_start = getTickCount(); local function get_beep_alphafactor() local now = getTickCount(); local ms_diff = ( now - interval_start ); local interval_progress = ( ms_diff % full_interval ); if (interval_progress < interval_show) then return 1.0; else return 0.0; end end -- Adjust the triangle dxDrawImage: dxDrawImage(1649, 529, 252, 323, "poze/bgroalert.png", 0, 0, 0, tocolor(255, 255, 255, 255 * get_beep_alphafactor()), false) I don't know what funny business you wanna do with this, lol. But I like that you are working on some inspiring work of art! ??
  17. BogdanRTB, you have not told us exactly how you wanted that thing to work. First you say beep and then bleep. So you want that triangle to switch from half transparency to full transparency? You want the animation to be fluent? The issue with IIYAMA's solution is that the triangle does not fade out (probably a little oversight by him). Maybe try the following adjustment by me: local animationDuration = 1000 local timeNow = getTickCount() local progress = (timeNow % animationDuration) / animationDuration local opacityProgress = progress * 2 if progress > 0.5 then opacityProgress = -(progress - 0.5) * 2 + 1 end local bleepColor = tocolor(255, 255, 255, 255 * (0.5 + opacityProgress * 0.5))
  18. I do not recommend you to do the following: function postAnn(msg, r1, b1, g1, playsound) if msg and (string.len(msg) > 0) then ... addEventHandler("onClientRender", getRootElement(), drawAnnText) end end MTA does not allow you to add the event twice but this will be reported as bad usage inside the debug console. Triggering these warnings is a bad idea. Instead add the event handler just like the other event handlers outside of any named function and use a boolean to control the execution. Or you could check if the event handler is already registered using that boolean and remove/add only after the check. But now on to the problem you face regarding your report... If you want to make the orange triangle "bleep", then you have to change the following clientside line: dxDrawImage(1649, 529, 252, 323, "poze/bgroalert.png", 0, 0, 0, bleepColor, false) ... where bleepColor is the variable from IIYAMA's solution. Could you try adjusting your code and the reporting back to us?
  19. Hello BogdanRTB, I think that @IIYAMA has made a wonderful solution if you want the UI to blend in and out using alpha. If you want to simulate a beep-like appearing and disappearing then I think that you might be interested in instant animation instead. This can be solved by the use of a simple timer in connection with the "beep"-duration. -- The beep duration basically how long a visibility or non-visibility phase -- is supposed to last. local beepDuration = 1000; -- This is the variable that you should use in your DX UI to determine whether -- to draw it or not. You should reset it to true when you "call" your DX UI. local is_dx_ui_beep_visible = true; -- This variable should store the timer. It should be reset if the DX UI is "called". local uiBeepTimer = false; -- Call this function whenever you "call" or show your DX GUI. local call_dx_gui() is_dx_ui_beep_visible = true; uiBeepTimer = setTimer( function() is_dx_ui_beep_visible = not is_dx_ui_beep_visible; end, beepDuration, 0 ); end -- Call this function whenever you hide your DX GUI. local hide_dx_gui() is_dx_ui_beep_visible = false; killTimer(uiBeepTimer); end -- Example drawing code. local show_dx_gui = true; call_dx_gui(); addEventHandler("onClientRender", root, function() if (show_dx_gui) and (is_dx_ui_beep_visible) then dxDrawRectangle(100, 100, 400, 400, tocolor(255, 0, 0, 255)); end end );
  20. If you link a script to a fixed IP you imply that the script is meant to be run on the specified IP only. I think this is an interesting idea. You can use this IP check in serverside scripts if you have defined the IP inside the mtaserver.conf file. Please note that I have no experience with the practicability of such a check! Look at the getServerConfigSetting function wiki entry for further details. Add the following statement to the top do-end block of your script: local run_server_ip = ""; -- put server IP here (example: 127.0.0.1) if not (getServerConfigSetting("serverip") == run_server_ip) then error("FATAL ERROR: script not licensed to run on this server!"); end
  21. You're welcome! I like helping people that really need my experience and insight. ?
  22. Hello DenizD, there are multiple issues with your script. The third-party MTA-MySQL module is outdated. Please use the dbConnect family of functions instead. MySQL queries return a table of multiple possible results. You have to decide which result you want to work with. In the most common scenario it is enough to just get the first-indexed entry of the table (result[1]) and use that one for your code. You have used a non-existant function of an unsupported library. Please use new functions instead. I recommend you to use the dbQuery function. Good luck and have fun! ?
  23. Today I have made significant progress in programming model maintainability and freedom in the Eir lexer. The great new feature inside the SDK is selector-based steps. This is a very important feature to split CFG syntax parsing away from associativity rules as well as language rule simplifications that result from using selectors. I dare to say that the implementation quality of my lexer is above industry standard. Not only can you use the scientific notations that you know from various books and lectures, but you are provided with a meaningful set of optimizing deterministic production templates. I have created and used the Eir SDK which is filled with performant, robust and powerful algorithms/data-structures. That is why I can recommend the Eir lexer for professional compilation software from the bottom of my heart. Lexing CFG rules does suffer from the P != NP problem. Not only does it have implications on performance but on the complexity of programming models. In my lexer I have decided to stay inside the deterministic space of CFG rules for various reasons: guarantee halting and maximum performance for CFG syntaxes that are both deterministic (strong requirement) and progressive-only (weak requirement) building upon the strong and intuitive foundation of no-progress-termination inside CFG syntaxes which paves the way for good CFG language diagnostics non-determinism is hard to understand for developers Now, to explain to you the difference between non-determinism and determinism I want to give you an example of the binary operator +. Non-deterministic CFG syntax for operator +: S -> S '+' S S -> A | empty This CFG syntax resembles all associative possibilities to create brackets around the + operator. But it does also resemble concatenations of the + token without any A productions. While it does contain the essence of binary nodes, it is very ambiguous in nature and is not supported by the Eir lexer. Deterministic CFG syntax for operator +: S -> A S -> A '+' S This CFG syntax creates productions of type A+A+...+A which is internally creating a list of A data nodes with the implication that each is separated by a + operator. While this by default is not a binary-tree representation, it can be easily converted into one by the use of selector-based steps. This grammar is fully supported by the Eir lexer. The above example of the + operator should explain to you why it is a good idea to stick to deterministic rules in general. I promise you that the Eir lexer is the best toolkit to work with the deterministic space of CFG syntaxes. Selectors are a simple scientific concept. Imagine that each data node that is lexed from a CFG sequence is a tuple of child data nodes. The job of the selector is to pick one possible tree arrangement from this list that is best suited for your program. It is being fed with each attributed token or data node in sequence. Instead of storing the + operator node as a list, it can easily create a left- or right-associative tree. This tree can then be transformed into a direct representation by CPU instructions (they are often working on two operands to keep things simple).
  24. The_GTA

    help please

    Hello Karem197, you seem to use CEGUI as a button instead of DX. For that reason I will not go into details about DX GUI creation. If you want to learn more about creating your own GUI systems then read about UI layouts, layout engines and UI design. To handle clicks you should use the onClientGUIClick event using the button variable as base element and propagate = false, like this... ... dxDrawRectangle(232, 623, 122, 32, tocolor(0, 0, 0, 39), true) local button = guiCreateButton(232, 623, 122, 32, "button", false) addEventHandler("onClientGUIClick", button, function() outputChatBox("clicked the button"); -- TODO: add or remove money from the local player. end, false ) guiSetAlpha(button, 0) dxDrawRectangle( 232, 623, 122, 32, tocolor(0, 0, 0, 39), true) end In order to to handle the player money you should tell the server about it using event handling. You can generate a random number by using the Lua math.random function. This way you can create an integer in the range of [m,n) where m and n are parameters to math.random. To generate a random text you can sequentially generate random integers in the inclusive range of [48,57] or [65,90] or [97,122] and calculate the ASCII character using the string.char function and concatenate the ASCII characters. This way you get a (pseudo) randomly generated string. It is best to ask the server for random strings because you could implement the use of a better RNG than Luas on it.
×
×
  • Create New...