
subenji99
Members-
Posts
264 -
Joined
-
Last visited
Everything posted by subenji99
-
If you have the know-how to fix that up, it would be a good idea to do so, and post it. Not just to correct me, or even to answer the original poster's original question - but to teach anyone that happens to find this topic about the file functions and their proper usage. "That is wrong" is only helpful to me. Commented, readable code is helpful to anyone that reads it. A under-documented set of functions have been discussed here, and it's worth informing people on proper usage.
-
OK, 50p is correct, (and therefore I learned something ) so here's some code that should work out: myFile = fileOpen ("pathto/myfile.txt") --forwardslash prevents issues with escaping characters - thanks 50p local sizeOfFile = fileGetSize ( myFile ) fileSetPos ( myFile, ( sizeOfFile - 1 ) ) --apparently 1 byte local testString = fileRead ( myFile, 1 ) -- and again if testString ~= "\n" then --we want the compiler to parse this as a magic character here fileWrite ( myFile, "\n" ) --change to "\r\n" if you care about correct display on certain Windows programs. Windows uses \r\n, Linux uses \n, and IIRC, only Macs use just \r. end This will open your file, move to 2 bytes before the end of the file, check if it is a new line, and if not, write a new line. fileRead moves the position through the file as it reads, as does fileWrite, so now the current position would be the end of the file, ready to append data. Personally I wouldn't do a fileFlush at this point. If your script doesn't ever actually write anything to the file from here, there is little point in just saving an additional newline.
-
http://www.lua.org/manual/5.1/manual.html#pdf-file:seek curPos = myFile:seek("end")
-
http://code.google.com/p/multitheftauto ... unk/output dll there. http://code.google.com/p/multitheftauto ... ources/irc Example resource there. They linked to the google code page for a reason. Also Sebas has already fixed the "sucking up the CPU" issue.
-
So much for my thought that it was Unicode characters in the pathname, or a permissions issue. I'm out of ideas as to why, sorry.
-
You've nested all your functions inside each other, making it very difficult to follow the code. Try this, and report the results back function pedcreate () ped1 = createPed(56, -2225.376953125, 2333.6584472656, 7.546875) pedanim = setTimer ( setPedAnimation, 5000, 0, ped1, "ped", "SEAT_idle" ) --added variable here, to help clean up timers end function peddestroy ( thePlayer ) if ( isPedDead (ped1) ) then outputChatBox ( "Ped is death", thePlayer ) killTimer( pedanim ) --stop ped anim timer when destroying the ped destroyElement( ped1 ) --removed timer here, to prevent your code conflicting with the ped's respawn end end addEventHandler("onPedWasted", getRootElement(), peddestroy ) function pedrespawnafterdeath () ped1 = createPed(56, -2225.376953125, 2333.6584472656, 7.546875) pedanim = setTimer ( setPedAnimation, 5000, 0, ped1, "ped", "SEAT_idle" ) --again, define timer variable end function pednewadeath( thePlayer ) if ( isPedDead (ped1) ) then setTimer ( pedrespawnafterdeath, 5000, 1 ) outputChatBox ( "Ped Respawn work!", thePlayer ) end end addEventHandler("onPedWasted", getRootElement(), pednewadeath ) function pedspawn ( thePlayer ) setTimer ( pedcreate, 5000, 1 ) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), pedspawn ) --changed to resource root element - attaching to root element would trigger a new ped on every new resource starting
-
Post information about your system. What language is your system running on, on what OS? Where are you trying to install MTA? Where is GTA installed to on your system? And what type of account is the user you are trying to play as (Guest, Limited user, standard user, Administrator, ...)?
-
local girl1dff = engineLoadDFF ( "skins/girl1.dff", 0 ) https://wiki.multitheftauto.com/index.ph ... ineLoadDFF Although if I recall correctly, replacing a ped's model doesn't work. You can only replace their textures.
-
if you edit the resulting map file and remove the rcg16 definition, and lines creating and elements, your objects won't vanish anymore when making a race. However, you'll lose all ability in the future to edit your existing map sections besides adjusting every object manually.
-
I would second the idea of including a description of the element tree and how events work with it. A lot of novice scripters struggle with the concept.
-
They're not in a function - which means they're being run before any lines in any functions are, and before any events are called. So your GUI hasn't been created yet, and the buttons you're attaching the handlers to don't exist yet. That's your 'bad argument' - a non-existing element. Move those 3 lines directly under createAuthWindow() in the "onClientResourceStart" event handler. They'll then apply their handers directly after the GUI is created.
-
You can use /changemap or even /changemode [] But as you expected, they are for admins only.
-
Check your gamepad. Your gamepad's analog stick may be being held right.
-
You didn't paste your event handler attached to your callbackHit function, but at a guess i'd say what's happening there is the function is being triggered on colshapes you didn't intend. Bear in mind that a lot of resources make use of colshapes, and if you attach your handler to the Root Element, your event will be triggered on any of them being hit. It's often best to attach to the root element of your own resource instead, or the currently loaded map if your gamemode's maps define colshapes.
-
Indeed, understanding the element tree and it's relation to the event system can be confusing at first - especially in relation to the "getPropagated" bool. But the best way of understanding it (after you understand the element tree) is that events can be triggered on any element. Events can be handled (or captured) on the element they were triggered on - or any Parent or Child of that element IF the getPropagated bool is true. (it is by default if you don't specify it.) Events propagate to parents and children, but not to branches. As an example, say an event is triggered on a player. All players are children of the Root Element. So are all vehicles, but they are a seperate branch. If you attach a Handler to the root element (with propagated true) then the event will fire on any player or vehicle recieving the event. If you attach a handler to a specific player, it will fire when the event is triggered for that player, or a higher element (such as root), or a lower element (for example, if you assigned every player a "weapon" element), but not other players - as they are each a branch of the root element. It would also never be triggered if the event is fired on a vehicle. (vehicles are also within seperate element branches.) With getPropagated set false, the event is only recieved if the event is fired at that specific element. This is usually preferred when working with GUI elements, (did the client click this specific button, for example) so bear it in mind. When dealing with players in the server, it usually boils down to "do I want to do something on every player, or just on a specific player?" - In the case of every player, you would attach to the root element, otherwise you would attach to just the player element you are interested in. The hidden variable "source" plays into the propagation of events. It contains the element the event was triggered by. If getPropagated is false, it's not going to be particularly important - the source will be the element you attached the handler to. However, it matters otherwise: if you attached a Handler to the Root Element, but you need to know which player triggered the event for example (e.g. for "onPlayerChangeNick", you attached to the Root Element to catch anyone changing their nickname, but who actually was it that just changed their nickname?) then the source variable will contain that element, and you can run code on them. (e.g. output a confirmation message with outputChatBox(source, "Confirm Message") (serverside only ) ) Sorry, that's quite a wall of text, and it's probably very dry. I hope you can make some sense of it though
-
I think he's actually on about the SA-MP uninstaller, but it's hard to tell. His post isn't very clear.
-
No, it loads "Windows Mail" instead - more useless bloatware I don't want. There is still NO way to get WLM to open http://www.hotmail.com with my default browser. (which happens to be Opera.) Not that I care, I moved to Google Mail over a year ago.
-
engineLoadCOL and engineLoadTXD only take 1 argument, the file to load. Also, even though I said it doesn't matter (because as far as I remember, it didn't when i tested it ), play around with the order of the load lines. Again the model itself is always best last. I'd go as far as trying replacing the txd and col THEN loading, then replacing the model, just to see if that works out.
-
function onResourceStart() local sound = playSound3D("xenon.mp3", 2484.0263671875, -1668.2800292969, 13.34375, true) outputChatBox( tostring( sound ) ) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onResourceStart)
-
We get a couple of errors with dxscoreboard now and then, on resource starting, and calls to addScoreboardColumn: dxscoreboard_exports.lua:31: attempt to index global 'resourceColumns' (a nil value) dxscoreboard_exports.lua:149: attempt to index global 'resourceColumns' (a nil value) However, I tracked down the cause: on both lines 74 and 88 (in "scoreboardClearColumns(forElement)" and "scoreboardResetColumns(forElement)" respectively) you had the line: resourceColumns = nil whereas I believe you meant to use (and what I changed it to to fix it): resourceColumns = {} to reset/blank the table, rather than completely destroy it.
-
Completely crazy idea, I'm probably WAYYY off here, but maybe it's because you defined this resource as type="map" but it doesn't have a map or race file defined. Try type="script".
-
Always replace the Model LAST. (engineReplaceModel) Replace the TXD and the COL, then replace the Model. you can load them in any order however, as long as you always replace the model last.
-
Linuxserver Broken on Deb4-centOS5.3-Etch [bug:4934][solved]
subenji99 replied to DazzaJay's topic in Linux-Server
This is in race from resources revision r443, with a few slight modifications only to images and sounds. Another thing I noticed is that only DazzaJay would actually spawn in the correct position, I Spawned out at ~ +8100,+8100 with all the objects - then after a death, I would then spawn in the correct position. Also, both of us ended up with 2 blips on us, not one. I assure you no other running code was attempting to create blips on players besides race. This is from the Debian 4.0 - Etch precompiled Linux server package, where download details were available at linux.multitheftauto.com. the same resources work perfectly fine on our Windows 1.0 server, running in a Windows VM. -
Ah, my mistake. In that case, why are you attempting to get the player element's interior while they're warping in (e.g. before it is finished warping them, so they haven't switched interior yet) when the event already provides both the player that is warping (source) and the interior he is entering (interior)?