Jump to content

Dealman

Members
  • Posts

    1,421
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Dealman

  1. Money given to the player via client-side givePlayerMoney is considered "fake" by the server. You'll have to set their money server-side.
  2. I tried using that method as it was recommended in the Wiki, but it made absolutely no difference. The issue was that the image was not in a power of two. Scaling it looks fine.
  3. I haven't really had to rotate images before, but now I do and it does not work well. No matter how I size or design my image and try to rotate it, be it a cricle or be it a rectangle - it always get really nasty white along its edges. I do not get those artifacts at angles such as 0/90/180 and so on... Is there any way to prevent this from happening? I've tried all texture edge methods but they do absolutely nothing to remedy this. Edit: Meh, figured it out right after I posted this. I had made a typo and saved it as 255x256 instead of 256x256. Well at least it's there if someone else gets the same thing happening
  4. Search for community resources. Use keywords such as killmessages and health/armor.
  5. Dealman

    Bullet fired

    The Wiki page he linked has 2 examples already, go from there. Besides, you gave us no details on what you're looking for. Try to make it yourself first, then we'll help from there
  6. You can use setPlayerName to change the players nickname temporarily. Obviously, this will be reset to their default whenever they quit your server. This is a sort of security measure so servers can't "troll" people.
  7. As for bug reports, I can't tell whether I'm doing something wrong or not. But more often than not, whenever I click to change for example Start X or End X and etc, it'll 2 or 3 or sometimes all of these options with the proper one at the very back of them all. Thus having to close 2-3 windows before I can change what I want. Nothing major, of course. I'm actually not sure what causes it.
  8. The difference between Scripting and Programming has been wildly thrown around throughout the years, but here's how I see it; Programming This is when you create something that then has to be compiled, in order to run. For example, MTA was made via programming C++ and can execute Scripts(see it as a sort of addon). Scripting Is mostly a simplified way of programming, using languages such as Lua and Python which doesn't have to be compiled to run(there's a few exceptions I believe), therefore lets the playerbase create their own scripts to alter the otherwise hardcoded gameplay mechanics/logic. And this is where most people get confused, while they may seem knowledgeable regarding scripting for MTA, they most of the time wouldn't stand a chance doing "raw" coding. What we're using in MTA is but an API that is so well-documented in the Wiki, it's hard not to understand it. (Sorry if this offended someone?) That said, however. It's a great way to learn the very basics of programming. Learning what variables, integers and such are and how you can use them. As well as logical thinking To me programming and scripting has absolutely nothing to do with whether you're doing it professionally or not. Then again as I said, the definitions of those has been thrown around a lot. People always say they mean different things and I don't think there's any absolute definition written in stone.
  9. dxSetRenderTarget Read the optional arguments carefully.
  10. Try it yourself first and I'll help you from there. You'll learn the most by trying yourself and reading the examples provided on the wiki.
  11. Use the event onClientClick. Check if the button was "right" and then whether the state was "down" or "up", I usually always go with "down". Then after that is detected, get the position of the click and move the GUI there or draw the DX interface there.
  12. Don't mind my terrible photoshop But this might help you figure out how to work the offsets; As for if it goes outside of a window and you want it to disappear, I believe you'll have to use dxCreateRenderTarget.
  13. Woah there stallion. Calm down
  14. Can't you just remove the onClientRender event handler and call the function itself once like this; x,y,z = getElementVelocity(vehicle) MyB()
  15. Not entirely sure what the problem is, but could it be due to the fact that the timer repeats infinitely? NumToCount is set to 0.05 and I'm pretty sure the timer only accepts an integer, so it'll interpret it as 0 which means infinite looping.
  16. Read about Lua's String Library. There are many ways you could achieve this, most commonly using patterns with regular expressions. You'll find lots of helpful answers if you use Google a bit. For example if you searched the forums regarding colour-coded nicknames you'd find this popular line of code; string.gsub(theString, "#%x%x%x%x%x%x", "") -- Can also be used like this; theString:gsub("#%x%x%x%x%x%x", "") Now you can use the above pattern with whichever string function you'd like to either prevent them from entering hex colour-codes or replace it. You'll learn the most by trial and error and getting used to searching Google for potential hints in the right direction. People providing you full code/examples is but a lazy way to get someone to do it for you.
  17. You'll find some info on the Wiki Page for Writing_Gamemodes.
  18. setCameraMatrix spawnPlayer createTeam setPlayerTeam bindKey
  19. That's because it will always be true so long as your cursor is within the position you defined. if isMouseInPosition ( imgX, imgY, imgWidth, imgHeight ) then playSound("click.mp3") One way to remedy this would be to use a variable, for example; local shouldPlaySound = true function onClickCross(button,state) if button=="left" and state=="down" then local imgX, imgY, imgWidth, imgHeight = (810/1024)*sx, (200/768)*sy , (20/1024)*sx, (20/768)*sy --- Button Location on the screen if isMouseInPosition ( imgX, imgY, imgWidth, imgHeight ) then if(shouldPlaySound == true) then playSound("click.mp3") --- The click sound when you click on the button end --- Close all the pages removeEventHandler("onClientRender",getRootElement(),playPanel) removeEventHandler("onClientRender",getRootElement(),registerPanel) removeEventHandler("onClientRender",getRootElement(),updatesPanel) --- Close the onClickCross function (this function) removeEventHandler("onClientRender",getRootElement(),onClickCross) end else return false end end And then just change this variable between true and false depending on whether the interface is showing or not.
  20. Then post what you currently have.
  21. Interesting, I'll experiment a little with this and see what I can come up with.
  22. A few days ago I decided to try to re-create Pong within MTA to further get used with DX interaction and some of the Vector2D functions. After roughly 3 hours I had a basic working prototype done, and seeing as how it worked pretty well within MTA I came up with some ideas what to do with it, however, I don't think it would do much good without multiplayer. Which means 2 players. The problems I have run into are; 1. Synchronization With one of my other projects requiring synchronization between players, I found that using Element Data seemed to be the fastest(probably not the most efficient, obviously). Simply triggering events between 2 players and the server won't be fast enough. Are there any other methods I might have missed which could be used as well? I thought about creating a new element, which would act as a sort of a room between those 2 players. This element would then store all the game-specific stuff such as the Ball X/Y Position, Ball Velocity/Speed/Direction, Player Paddle Locations and etc. 2. Pong Multiplayer Feasibility in General Is this even a feasible thing to try to achieve at all? Pong is a pretty precision-based game, and I fear that a 60-150ms latency might become a rather big obstacle to overcome. 3. Vector2D Confusion I've never worked with Vectors before, and I'm not particularly good with math either. But I have studied some tutorials over at Khan Academy(I highly recommend their videos!) so I know the basics of Vectors. Basically I thought I'd use these functions to take care of the ball, however I can't figure out whether I'm using it wrongly or if I've just mistaken the use of vectors. I can normalize my vector and get the X and Y magnitudes just fine, however, I can only set X and Y with absolute pixel values. Where as I assumed I'd have to enter magnitude values such as -1 to +1. The Wiki doesn't have any information regarding these whatsoever, which is why I'm afraid I'm using them entirely wrong. So if someone has some experience with this, I'd appreciate some advice! Basically this is what I wanted to be achieve;
  23. We can't really help you if you don't provide us your code
  24. That resource is pretty old and I can't recall if it's still being worked on. In all honesty, if you don't have the experience to make additions and edits to the resource to suit your needs - you'd be better off doing it the usual way where you just check the cursor position to detect if it's hovering over a DX drawing. Otherwise, if you do want to try it, you'll want to start with dxCreateWindow.
×
×
  • Create New...