-
Posts
189 -
Joined
-
Last visited
Everything posted by MaddDogg
-
You have to create a serverside script file with a timer in it, which gets started at resource start. This timer checks every car for its position. If it is at -23 or less, then --> blowVehicle. To get all cars, you can use getElementsByType.
-
Has no one made experience with this function? I would really like to know, if this is a general problem and a possible bug or if it is just me, who does something wrong.
-
Then you should leave your hands off of those topics, because they are inevitably a bit of work. I just did a very similar script yesterday, where there are texts above pickups, and it took me 5 minutes. It's not that hard. 50p gave you a good start, it is probably the best way to do it.
-
Have a look at this: https://wiki.multitheftauto.com/wiki/OnVehicleStartEnter The source is not the player..
-
So, mode and playerData.mode are two different things? Then I'm sorry, my mistake I thought that you wanted to check the same variable you just created at that point.
-
In addition to that, I also don't really get these lines: playerData = {} playerData.mode = 1; if mode == 1 then First of all, mode will probably be nil, you have to use playerData.mode within your if clause. Also, it doesn't make much sense, because you just set a variable to a value and then check, if the variable has this exact same value. That will always return true, so there is no need for the if clause.
-
Omg.. next time use some periods.. So, you want only letters and the space char to be valid chars for the edit field and a next button, which only is clickable, when there is something in the edit field. You can do this: First of all set up a counter holding the length of your edit field input. Then use the event onClientGUIChanged to check, if the user changed the content of the edit field. If he added a character (string.len(guiGetText(editfield)) > editfieldLength), you just check, whether this character is a valid one. For this you extract the character first via string.sub and then perhaps run it through a function, which checks, whether the ASCII value of this character is between a certain range (the range of the letters) + the space character value. If yes, you don't do anything, otherwise you delete the character, again using string.sub and guiSetText. Also, everytime the event is triggered, you check, whether the input length after the checks above here is longer than 0 and if there is a space with following letters, so that you know that the string is something like "BLA BLA". This is just a rough solution to your problem, there is more to it and you should only work with it, if you understand everything used here completely. Otherwise this topic may still be too difficult for you and you should get more general experience with working with strings, GUI and events. There might also be a simpler way or function to use, but this here is definitely one way.
-
Hi! I just tried to work with dxDrawImageSection for the first time, but just can't figure out, how it is working. The wiki article says that the arguments u, v, usize, vsize determine the section of the image to be shown. I understood it like this: u and v are the absolute coordinates of the starting point (left top) of the section, whereas the zero point is at the corner of the image (and not the whole screen). usize and vsize are the absolute values for the width and height, starting at the point defined by u and v. But somehow, it just does, what it wants, when I set the values to something. I can't figure out, what MTA is doing there, because for example when I make vsize smaller than the actual image height, the image is moved downwards from it's original position. This makes no sense to me, since vsize just defines the vertical size. With other images I tried, the usize and vsize just have no effect at all. Do I just have a mental block or is someone having the same problems? Also I looked into the MTA source code, and it seems very weird to me. I'm not a programmer expert, but if you search for the function definition in the source code, you find that a function named DrawTextureQueued is called, which for some reason does not expect the image section arguments. The function is called like this: DrawTextureQueued ( fX, fY, fWidth, fHeight, fU, fV, fSizeU, fSizeV, false, strPath, fRotation, fRotCenOffX, fRotCenOffY, ulColor, bPostGUI ) But the function prototype looks like this: bool DrawTextureQueued ( float fX, float fY, float fWidth, float fHeight, const std::string& strFilename, float fRotation, float fRotCenOffX, float fRotCenOffY, unsigned long ulColor, bool bPostGUI ); You see? The image section arguments (fU, fV, fSizeU, fSizeV) are not used by the actual function. So, am I understanding something wrong or is there really a mistake? Thanks for any help and explanation! Madd
-
The serverside errors are very easy to fix. 1. You omitted an argument at setElementData. You have to provide a third argument as value for the element data, in your case it would be: setElementData(sourcePlayer, "hidden", true) 2. It's 'setPlayerNametagShowing', not 'setPlayerNameTagShowing'. Functions are always case sensitive! Because of the second mistake, the script probably stopped at this point and the clientside event never got triggered. That should fix all your problems but the one with the graphics.
-
What is wrong with your GTA? Why can't you get coordinates? And what do you mean by "inside LS LV"? I sounds like you're just lazy and quit after 1 min trying.
-
That could have been found in like 5 seconds of search in the wiki: https://wiki.multitheftauto.com/wiki/Meta.xml
-
I just tested table.insert and it just works fine. It is always a good idea to post the respective part of the script, which is not working. So you should post it here, there is probably a mistake in it. Also you should never use a GUI system to store data. It should always only be used to display it and maybe an entry in a gridlist can be marked with a certain value to be able to identify it, but you should never use the gridlist data variables as a kind of table to store your values. I say this, because you talked about a table you needed and that guiGridListGetRowCount does not return a table. Btw, here is my test script I just used, maybe it will help you: client-side: testTable = {} addCommandHandler("tableadd", function (cmdtext, value) if isnumber(value) then table.insert(testTable, tonumber(value)) printTestTable() end end , false) addCommandHandler("tableprint", function () printTestTable() end , false) function printTestTable() outputChatBox("TEST TABLE - PRINT OUT:") for index, value in ipairs(testTable) do outputChatBox(" " .. index .. ": " .. value) end end
-
Hi! I hope that there is none other topic requesting this and I don't spam here I recently thought of the idea, if it would be possible to change the file downloading management in a way so that files could be still loaded after the joining of a player. In the meta.xml, files would get an extra attribute, for example "auto-download", which would prevent a file to be downloaded automatically at join of a player. But because the file is mentioned in the meta.xml, the server still knows that it is there and it can be post-loaded when needed. A more practical example would be this: A player with only a very small bandwith connects to a server, which uses a lot of files, let's say a total of 50MB data to download. 99% of this data is not loaded automatically, when he joins, but the player is rather asked, if he wishes to have some "extra features", which are only available by downloading 49MB of data. So, he can choose, whether he wants to download this or not. To check, if certain files are downloaded, a function like "isFileAvailable" or "isFileDownloaded" would be needed to check, whether the optional data can be used. I know that this is a quite big request and maybe it is already requested, but I just try my luck with this request
-
I don't really know, what you want to say with this, but you need to put the script snippet into a script file, which itself is added with a 'type="client"'. So let's say that your file is called client.lua. Then your meta.xml line would look like this: <script src="client.lua" type="client" /> Here is another help for it: https://wiki.multitheftauto.com/wiki/Client_side_scripts
-
Thanks! That's the function I searched the whole day for, but couldn't find it! Thank you again!
-
Hi! I just ran into the problem of not having a source for the epoch time. So I decided to try my best and script my own function. I'm as far as the following: function getEpochTime() local nowTime = getRealTime() return ((1900 + nowTime.year) - 1970) * 365.25 * 24 * 60 * 60 + nowTime.month * 30.4167 * 24 * 60 * 60 + nowTime.monthday * 24 * 60 * 60 + nowTime.hour * 60 * 60 + nowTime.minute * 60 + nowTime.second end But still, there is something incorrect. I think it has something to do with the leapyear, but I can't figure it out. It would be cool if you could help me or even give me a finished function, if there is one. Thanks in advance! Madd
-
Ohh okay, thank you. Now I understand why. Thanks for the help.
-
Thanks! It worked! But why is string.format escaping the new line character? I mean, in the original string there is this character. But as soon as string.format processes it, it does that. And it only happens, when I pass the string through a variable to it instead of directly writing it into the function.
-
Hi! I just ran into a problem, I didn't notice ever before. I have a script, which is at one point supposed to send the player a message. The text for this message is first read from an xml file, then put into a string.format function and finally used in guiCreateLabel. It looks like this: xml file: <text catg="CHARACTER" identifier="LEVEL_UP_TEXT" text="You just leveled up!\nNew level: %d" /> Lua script: GUI_LevelUp["text"] = guiCreateLabel(1606,480,148,32,string.format(getLanguageText("CHARACTER", "LEVEL_UP_TEXT"), getElementData(getLocalPlayer(), "level")),false) My problem now is that the new line character ('\n') is output not as a new line but rather as the characters '\n' itself. This is caused by string.format for some reason. Now I don't really know, how to get the new line into the final string. Can someone please help me with this issue? And no, I can't just leave the xml stuff out of it and put the string directly into string.format Thanks in advance, Madd
-
I don't get why this is still discussed. I mean, why do you want to know that? To do "evil"? Serial bans are very effective, but are not 100% safe, as this is impossible.
-
But you cannot use '®', unless it's really a registered trademark. '™' is AFAIK no problem..
-
What if....2 player got same pc ....i mean identical What you imply won't happen, because I suppose that the generation is based on hardware IDs, too, and those are practically unique.
-
I agree to what Gamesnert said. For example line 2 and 3, there are two "end" parts, but no chunk to close. Also have a look, to which handler function you attached the onPlayerWasted event. The random function is still logically incorrect. I would recommend you to read and learn some more about tables, events and their handlers and chunks.
-
1. The timer can't be in the very same function it calls, or else it will create an endless loop. 2. You don't have an onPlayerWasted event handler. Also, the timer belongs in here. 3. The random function has a logical error. The first argument (0 in your script) should be 1, because lua tables start their index with a 1. 4. The timer has a 2 as repetition argument, that's probably unwanted..
-
I think you misinterpreted by answer I told him that it is possible to ban people via serial even if they're not registered, because the community isn't responsible for generating and assigning the serials. But yes, you are right