
Dealman
Members-
Posts
1,421 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Dealman
-
getPlayerAccount is returning false, make sure source is a player and that they are not a guest account. Also, you'll want to get the account name - not the element itself as it would return userdata, not a string with the name.
-
This makes absolutely no sense. In what way would this decrease CPU usage...?
-
It really doesn't serve a purpose in Lua, though some people that generally program in languages such as C++ or C# will often make use of the semicolon even when scripting in Lua simply because it becomes sort of a habit. In terms of other languages where using the semicolon is indeed mandatory, it generally marks the end of a line or block of code. For example, think of it like this; local myVariable = 10; outputChatBox(tostring(myVariable)) To be the same as this; local myVariable = 10 outputChatBox(tostring(myVariable)) It's not necessary and it doesn't cause any syntax errors, so it's entirely up to personal preference.
-
I understand your lack of motivation, especially given the very restricted environment you're trying to work with. Yet you've gotten so far with this handling. I hope you'll keep up the good work Did you manage to figure out how to use all the sound files?
-
By default I believe the push-to-talk keybind is set to Z. Other than that, you can create your own voice managing resource using the various functions available. See the Voice's Wiki page for more information.
-
Of course you can. Your issue is that you made an infinite loop. Look at your own code again, use the syntax highlighting on these forums and it'll be even easier to spot. function playSound () playSound("mysound.mp3") --plays the sound end addCommandHandler("sound", playSound) --adds the command Never name your functions the same as the native MTA functions unless your intention is to overwrite them with your own. Your command runs the function playSound, playSound then runs itself. Infinite loop has begun and Skynet will take over.
-
No, you can not use setElementRotation on attached objects. See these 2 functions instead; getElementAttachedOffsets setElementAttachedOffsets
-
Might wanna do some research before you accuse people of using leaked stuff. MADE did actually release the NG stuff some time ago.
-
Always double-check your code for typos. outputChatBox ( tostring ( myFont ) ) self.font = myFonts myFont does not equal myFonts
-
If you feel that I somehow decreased the size of your e-penis then I am truly sorry, it was not my intention. If you've "been with the game for over eight years" surely you would know the very basics of client and server communication, the standard is for the most part the same across all games. Let alone, be able to figure it out by simply looking at 2 functions. The scripting introduction is not there to learn you how to make entire roleplay gamemodes with all the needed features ready in a copy and paste format. It's there to give you the basic idea of how to create and manage your own resources. If the tutorials available doesn't hold you hand then too bad, welcome to reality. Everything isn't readily served on a silver platter for you. If you want to learn it, then sit your ass down and do some research. Don't come here acting all high and mighty demanding that X should be like this and Y should be like that. On top of that, since this is MTA you'll quickly realize that the majority of users are fairly young and as such are not necessarily experienced enough to make advanced and descriptive tutorials for spoiled brats like yourself(that said, there are some very talented individuals here despite their young age). Then also add to the fact that making scripts for games such as MTA, World of Warcraft and Roblox is about as easy as it gets. The APIs are written in such a way they are foolproof, so even people who haven't got the slightest idea of how scripting works will be able to get in. So instead of coming here being all disrespectful and making demands, sit down and do some research like everyone else. If there's something you're confused about, the people on these forums are usually very helpful. Or like previously mentioned, if it's not good enough for you - then by all means contribute to the Wiki, after all that's what a Wiki is for isn't it?
-
How are you using the sound files along with your script? I managed to extract the audio from Project CARS, but wasn't quite sure how to piece it all together. So I simply hooked the idle sound to the engine RPM as a temporary solution. Maybe it's something you'd find useful? They have quite a few sound cues for each individual car.
-
If you want to learn scripting and/or programming you'll need to face the fact that it requires patience upon more patience. Essentially it's all about trial and error, there's no easy way around it so don't expect it to be handed to you on a silver platter. The MTA Wiki is particularly well written, in fact, it's quite possibly the most detailed documentation of an API I have seen thus far. Not only does it thoroughly explain what each function does, it tells you exactly what arguments it needs - what kind they need to be and if there are any optional arguments. It tells you what it returns and more often than not have at least one example on how to use it properly. Now it's true that the MTA Wiki doesn't really have all too many tutorials, and it shouldn't. We already have a whole forum dedicated to tutorials so I'd suggest you check those out instead. If you can't take the time to sit down, do some reading and testing - then I'd say scripting is probably not your kind of cake. A good place to start would be general Lua tutorials on Google, you can use a website such as repl.it to play around with a whole plethora of stuff. For example multi-dimensional arrays, how to manipulate them and output specific values and yadda yadda.
-
triggerServerEvent and triggerClientEvent both return either true or false - depending on whether the event was successfully reached or not. So if you use triggerServerEvent to try and find out whether a certain player belongs to a certain group or not is not gonna be very useful if you try and use the state of the trigger. So long as the event is successfully triggered - it would always return true for you, whether the player is in that ACL group or not. So like Noki said, you'll need to use triggerClientEvent. Client -> Server -> Client
-
engineLoadTXD is returning a boolean value, ie, either true or false. In this case, it's returning false. This means that it's not able to load the txd file. This could be because of a variety of reasons. 1. Make sure you have the txd file added to the meta.xml 2. Make sure that the txd file is not corrupted 3. Make sure the filepath to the txd file is correct
-
Well, lets start with getting you the functions you need. It's a pretty simple solution, I'm sure you'll figure it out no problem. isPedInVehicle -- This is optional due to the function below(false = not in a vehicle) getPedOccupiedVehicle getElementModel
-
Wrong section, you should be using the tutorial section for threads like these. There is also a dedicated forum for resource related stuff.
-
It's rather simple, really. It works pretty much identically to that of triggerClientEvent and triggerServerEvent with one exception; it's one-sided. triggerClientEvent - Executed in a server-side script, it triggers a client-side event. Server -> Client triggerServerEvent - Executed in a client-sided script, it triggers a server-side event. Client -> Server triggerEvent - Can be executed in either client- or server-sided scripts, triggers an event that is in the same environment as it was executed. Client -> Client OR Server -> Server For example; -- Server Side function ExampleEvent() outputChatBox("This is my example event!") end addEvent("myExampleEvent") function TriggerCMD() triggerEvent("myExampleEvent", root) -- This will trigger the above event end addCommandHandler("Trigger", TriggerCMD, false) -- Client Side function TriggerClientCMD() triggerEvent("myExampleEvent", root) -- This will return an error, the event "myExampleEvent" does not exist end addCommandHandler("Trigger", TriggerClientCMD, false)
-
I wouldn't trust a resource that has been removed from the community once and reuploaded and obfuscated.
-
Of course it does, you expect Lua to magically know what you want to happen?
-
Yeah I said it's not very efficient It depends a lot on what format the pictures are. I highly recommend not going above 720p and a compressed jpg format. For me it's only the first loop that lags, and that's because it stores it all in memory. You could also try making them a DXT1 DDS texture, which should use a lot less memory.
-
Use the event onPlayerChat, then check their team using getPlayerTeam and getTeamName. If they're in a team, cancel the event and apply the tag you want and use outputChatBox.
-
What you're looking for is concatenation. In Lua you concatenate strings using .. "1000".."$" -- 1000$
-
Changing the mass is also a bad idea since mass is included in vehicle damage calculations. Also drag is air resistance, pretty sure it would not be of any help. Best workaround I can think of is to spawn a ped and warp the ped into the driver seat. Make the ped invisible using setElementAlpha. Then use setControlState to make the ped apply the GTA handbrake.
-
Why do you have 2 onPlayerLogout handlers? You first reset it to default values and then you try and save the data with the other function.
-
Another feature request would be a sort of ruler/grid system. It should be a fairly easy implementation, and I'm sure some people will find it useful. I know I would, because I tend to set it up all the time. For example; @Tails: Adding the render target would be rather redundant. If anything, you could simply draw a rectangle to get a sort of preview of how big it would be. Then you simply draw whatever you to be drawn onto this render target. What I usually do is I draw the rectangle, then I hold ctrl and right-click the rectangle, then you will have the option to lock it. When it's locked, it won't register right-clicking so you won't accidentally move or change it. Same applies to guiCreateBrowser and createBrowser.