Jump to content

Dealman

Members
  • Posts

    1,421
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Dealman

  1. Just as a future heads-up, you can search through multiple files with Notepad++, it will do everything for you. Go to Search -> Find in Files and choose the root directory and what string to search for. It'll save you a lot of time.
  2. Pretty sure it's an image of a simple gradient, that's why it fades in at the start. I'd probably try and find some better beeping sound, that one kinda made my ears bleed.
  3. How are you storing the data? I wrote a killcam of sorts for destruction derby a while back and I recall using both position, rotation and velocity. I never got around to finishing it before I left MTA, so I can't speak for its efficiency but it "replayed" vehicle movement pretty nicely.
  4. Because to modelers, their models are highly valuable. You'll have to keep in mind that making a model is just as, if not more time consuming than coding. Other people using your content without your consent isn't very nice, whether they're scripts or models. However, for a mod such as MTA where most content in terms of models and textures are just exports from other games or free downloads - it doesn't really matter. @OP: I really do not see the purpose in using this service, though. It seems like you'd be able to write a far better approach simply using functions available - rather than a third party service. I wouldn't really call it protecting your assets in the same way compiling your scripts does not protect it. Someone dedicated enough will get what he wants either way. So seems like a waste of time and money, really.
  5. Dealman

    Solved.

    playSound has a boolean for looping already, you've set it to false. Set it to true and it'll loop automatically. sound = playSound("sound/music.mp3", true)
  6. Since when did someone's post count on a forum reflect their ability to accomplish something? So if I registered on another forum about Lua scripting - all my current knowledge would magically be gone?
  7. Dealman

    collisons issue

    3ds Max, I'd be surprised if you can even move a mesh around in Sketchup
  8. Dealman

    collisons issue

    I took a look at that model and it's messed up, not only is it poorly modeled and textued - a lot of the faces are flipped(probably due to bad conversion from sketchup to 3ds, try converting to .obj if possible). What this means is that those polygons will not show up ingame, to remedy this simply select all those faces using either polygon/element editing mode and then click the Flip button. The polygons you need to flip are the black ones. I downloaded your DFF so I don't really know what's missing.
  9. I merely provided but a few examples of how it can be done, I never claimed them to be the best solutions. getPlayerIdleTime only works if the player doesn't move, so that means they'd have to stand still and do nothing for an hour. Doesn't sound particularly fun to me.
  10. You're defining them as local. px, py and pz variables are local to the function outputLocalPlayerPosition. This means the function gg2 can not reach those variables and thus - returns a nil value(so you should have received errors, make sure you've enabled Debugging properly). So there are a few different solutions for this. Here's two possible ways you could achieve what you want; 1. Call the gg2 function passing px, py, pz as parameters; function outputLocalPlayerPosition() local px, py, pz = getElementPosition(localPlayer) gg2(px, py, pz) end setTimer(outputLocalPlayerPosition, 5000, 0) function gg2(px, py, pz) local x, y, z = getElementPosition(localPlayer) if(x == px and y == py and z == pz) then guiSetVisible(wind, true) end end 2. Use return and then call outputLocalPlayerPosition to return the px, py and pz values; function outputLocalPlayerPosition() local px, py, pz = getElementPosition(localPlayer) return px, py, pz end function gg2() local px, py, pz = outputLocalPlayerPosition() local x, y, z = getElementPosition(localPlayer) if(x == px and y == py and z == pz) then guiSetVisible(wind, true) end end setTimer(gg2, 5000, 0) To see if one hour has passed since last, you can use either account data(server-side, permanent data) or element data(both, but data is lost upon disconnection). Then you can use either getTickCount or getRealTime.
  11. Anyway you don't know how to make anything. So guys please close this thread, it cannot be solved. Hey now, that's not very nice. He's as entitled to getting help here as anyone else is. Blue Pie's would work but he made a mistake, getPlayerTeam returns a team element, not a team name. The fix is simple, use getTeamName to check if the name of the team matches. local gate = createObject(10828, 276.60000610352, 2503.3000488281, 28.10000038147, 0, 0, 90) local state = 0 local theTeam = "TeamName" function move() if(getTeamName(getPlayerTeam(localPlayer)) == theTeam) then if(state == 0) then moveObject(gate, 4000, 276.5, 2537.1999511719, 28.10000038147) state = 1 elseif(state == 1) then moveObject(gate, 4000, 276.60000610352, 2503.3000488281, 28.10000038147) state = 0 end else outputChatBox("#BB0000You're not allowed to open this gate!", 0, 0, 0, true) end end addCommandHandler("gate", move) You'll also want to use Debugging to see what kind of warnings and/or errors you are receiving. It will help you fix them yourself and help us help you faster.
  12. So try and debug it. Try without checking if the id is 432, add output messages to see where it fails or if it runs at all.
  13. It's running client-side I suppose since you're using localPlayer? Read the wiki entry for setControlState more thoroughly. Only server-side need an element, a player element - not a vehicle element. Using it client-side, you needn't enter any element since it's run on the client. So it's obvious you want to do it on the client. function brake() local vehicle = getPedOccupiedVehicle(localPlayer) local id = getElementModel(vehicle) if(id == 432) then setControlState("handbrake", true) end end bindKey("w", "up", brake) Other than that, make sure you use debugscript to catch any errors and warnings. Go to the wiki to further study the function that is outputting an error and thus help yourself instead of rushing to the forums. In my opinion, trial and error is what programming and scripting is all about - best way to learn it.
  14. Doing it every 50ms will result in somewhat choppy rotation though, wouldn't it? Majority of games use prediction for a number of reasons, it's efficient and allows for smooth and interpolated movement. It's a system that would take a lot of time and testing to make - but I'm fairly certain the pros heavily outweigh the cons. Also, triggering events and element data is not the same thing. I believe one of the MTA devs made a nice summary of the differences in some thread a while ago but I can't remember from the top of my head what was said. But keep in mind that MTA already natively use element data for positions and rotations(though I do not know if this is what MTA use to synchronize it). For example, those two produce the same results; local oX, oY, oZ = getElementPosition(objectElement) local oX, oY, oZ = getElementData(objectElement, "posX", "posY", "posZ") I'm not saying one is better than the other, because I quite frankly don't know as I haven't done any testing. It just seems that triggering an event with every frame - or even every 50ms for that matter is not a very good thing to do. Especially not if it goes like this; Player 1 -> Server -> All clients Player 2 -> Server -> All clients Depending on how you set it up, you could end up with a situation where if you have a server with 32 people - one player alone would tell the server to trigger 32 client events. Then, you'd have 31 other clients which tell the server the same thing resulting in 1024 client-events being triggered every ~16ms or 50ms. Does this seem like a logical way to do it for you? Element data is synchronized by default unless you set it to false. So it may be better? I don't know.
  15. Yeah, it's something I worked on a while ago. I just re-visited and made some quick testing. While it works, you can't control your vehicle while the cursor is showing. So you'd probably get the best results the way you're already doing it. Synchronization will be a bit messy, you can synchronize it real fast for testing purposes using element data and onElementDataChange. Though I this is not the best way to do it, obviously. For synchronization you'll want to predict movement to reduce bandwidth and CPU usage as much as possible. Keep in mind that if you get a lot of people playing there will be A LOT of turrets and barrels moving around. Also I edited the previous post, check the bottom of it.
  16. I think you'll want to consider re-building that from scratch, that's a rather horrible way of doing things. You trigger a server event with every frame, you then use this server-side event to trigger a client-event on all clients with every frame. Do you even realize how many events you would be triggering like this? While this might potentially work with 1 or 2 players, the lag would be tremendous and you'd be using a lot more bandwidth than necessary. Personally, I'd make use of onClientCursorMove to rotate the turret and barrel instead of fiddling with the camera rotation and component rotations. Basically how games work is they actively re-center the cursor(some games re-center it in the middle of the screen, others at the top left). Also by doing this, you can easily add a variable for mouse sensitivity. If I can find my old script I'll edit this post. This way, you can develop a system similar to this; As for synchronization, I never quite got that far but I would assume using element data would be the way to go. Though, I could be wrong. If I ever get back to working on a gunnery system I'll do some proper performance testing, but I haven't worked with MTA for a while so I'll let someone else chime in on what may be the best way to synchronize it. Edit: I guess scratch that, if you use the method I described above you lose control of your vehicle since you need to have the cursor showing. And as far as I know, there is no possible way to maintain control of your vehicle while also having the cursor showing. It works great for vehicles that are operated by 2 or more people, though. One driver, one gunner. Oh well
  17. Because you need to restore it, see; engineRestoreCOL
  18. [quote name=..&G:..] finally someone to point me in the right direction! Now that I fixed the double clicking, what other event should I use? For what? For the above you use onClientClick. Or are you referring to the rendering? What you're doing should work just fine just make sure stuff like createLoginEditBoxes() is only run once when needed. You can do so by either using an if statement or simply executing it when they click a button instead - which would be the logical way to go. Edit: Just noticed that you're trying to use onClientClick on GUI elements. For this you'll want to use onClientGUIClick instead. Edit2: I was bored, so I re-wrote your code a bit to show how I personally would write it. Of course, nothing is tested so don't copy and paste it and expect it to work. It's very likely I may have missed something It's just to give you an idea of how it could be better organized. Also to further optimize it, you'll want to avoid doing hardcoded math when drawing frames if necessary. For example, you're doing this to make your drawings relative; s[1]*161/1920 you could instead do this s[1]*0.0838541666666667. Yes, it looks uglier, but it's one calculation less. And this is a calculation you'll be doing every frame. While the difference may not be noticeable at all, it's good to keep such things in mind as optimization is very important. To speed the process up you can use this;
  19. You'll need to read the function and event descriptions more thoroughly. All the answers you're looking are there. 1. Render events are run with every frame, so whatever you do here need to be done carefully. As stated before, you were probably creating new GUI elements with every frame. This would mean 30-60 new GUI elements per second. No wonder it stops responding, eh? 2. The reason onClientClick is triggering twice is because you're not checking whether it was pressed down or released. It triggers for both of those. Example; function ExampleCode(theButton, theState) if(theButton == "left" and theState == "down") then -- Left mouse button was pressed down end end
  20. Dealman

    deleted

    Then reduce the delay? I simply said that having instant feedback like that, especially with those loud sounds would be rather annoying.
  21. Dealman

    deleted

    Good work, some things I'd like to point out however is that the sound when you hit someone is obnoxiously loud also - add some delay to it. The sound playing the very instant you hit someone doesn't sound all too good, maybe a 300-400ms delay would work?
  22. Then it's probably because of this for loop; for vehicleKey, veh in ipairs(vehicles) do local x, y = getVehicleTurretPosition ( veh ) x = math.deg ( x ) y = math.deg ( y ) dxDrawImage ( screenWidth/2 + 504, screenWidth/2 - 155, 50, 130, 'turret.png', x, 0 ) end
  23. Then could you upload the body.png and turret.png? It looks to me like the body.png already has the turret on it, thus it looks like it's duplicating. To change the pivot point, look at dxDrawImage. You'll want to change rotationCenterOffsetX and rotationCenterOffsetY to find the pivot point you want.
  24. I can confirm that you'd need to use a virtual machine and from my experience VMWare works the best. I tried Sandboxie but wasn't able to get it to work. I think this is rather unfortunate as it makes testing rather bothersome, when we could easily have had a server-sided option for the server to be in development/testing mode or whatnot and as such enable multiple instances on the same machine. Though they have their reasons for preventing it, as Moose mentioned. We'll just have to bite the sour apple.
  25. So let me get this straight, judging from your previous posts you don't even know the very basics of scripting - you couldn't even figure out how to use a for loop to count from 1 to 5. Yet, you're trying to claim that you have made this? An entire DayZ-based gamemode? I'm sorry, but people like you should just be permanently banned from any any all MTA interaction. Trying to sell something that isn't yours is literally theft whether it's physical or virtual, we don't help people with leaked scripts let alone selling them.
×
×
  • Create New...