-
Posts
866 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Mr_Moose
-
So you just made this topic: https://forum.multitheftauto.com/viewtopic.php?f=91&t=76874, got many replies which also included a script that made exact what you wanted it to do, from what you are trying to request in here. And then you just removed your topic, why? Do you want any help or not? If you can't even edit a few coordinates in a table of a script served to you for free why would anyone help you then?
-
So what you need is a gate system script. I'm not goanna script that "by request" either but today might be your lucky day, I helped a guy with the same problem long ago and published the complete gate system script which you may use. That will probably help you a lot so feel free to have a look at it here.
-
There is another topic posted not long ago where someone had the exact same problem, an RPG arrest system that he bought, I recognize the source code once again and this seems to be a leaked script, the person you bought it from is probably the same scammer as in the other topic, can't find that topic thought but it may help if you remember, and are able to tell us who sold the script to you.
-
It is pretty important too, having a log full of warnings isn't funny and the players may wonder why something isn't working. When you'll get a warning like that you must check the object type and inform the user with some kind of GUI response. Otherwise the players will consider the server as "bugged" and meanwhile he continues to try the feature that isn't working your logs get full of spam. The thing is that lua variables isn't always declared as a certain objects like in other languages such as C where you write string tmp = ""; to declare a string and int i = 0; for an int etc... In lua a variable can be pretty much anything. You can't always be 100% sure what the function argument 'p' is and due to that you need to verify what it is, by using an if statement like this: if p and isElement(p) and ( getElementType(p) == "ped" or getElementType(p) == "player" then end Inside your functions which use arguments that must be an certain object.
-
The lines doesn't seems to match but your error may be in this function, at line 3, the if statement let's it pass as long oldVehicle is not false, if getElementData fails the value will be nil and therefore nil is an accepted value. However nil is not an element and that's why you'll get those errors. function cl_SetVehicleOwner ( theVehicle, thePlayer ) local oldVehicle = getElementData ( thePlayer, "cl_ownedvehicle" ) if ( oldVehicle ~= false ) then -- unlock old car removeElementData ( oldVehicle, "cl_vehicleowner" ) removeElementData ( oldVehicle, "cl_vehiclelocked" ) removeElementData ( oldVehicle, "cl_enginestate" ) setVehicleLocked ( oldVehicle, false ) -- set vars for new car end setElementData ( theVehicle, "cl_vehicleowner", thePlayer ) setElementData ( theVehicle, "cl_vehiclelocked", false ) setElementData ( thePlayer, "cl_ownedvehicle", theVehicle ) setElementData( theVehicle, "cl_enginestate", true ) end The solution is to replace the if statement to this: if isElement( oldVehicle ) then
-
https://community.multitheftauto.com/index.php?p=resources&s=details&id=9348 My own resource, accidently "updated" with the wrong name. It can't be that hard to add a remove and delete function to the community right.
-
Are you really? I have experience in the scripting! Please, don't give so stupid advice, ok? Can confirm this as well, this webmap resource seems to return a white screen only by default, while viewing it. Could be html or js related maybe. Haven't seen any information in the error logs either and are not sure exactly what this resource goanna do, could be some kind of text based info as well even in you may expect a map that looks like that map in game, try google it, I'm sure there are more with the same problem.
-
After a couple of hours I realized the issues with this idea, for instance multiple apps can't write to the SQLite databases at the same time, internal database wasn't fully synced due to that and the same was seen in the resources itself, everything wasn't synced and some values seems to disappear while connecting between the servers, this with just a few players online. I gave up on this one by myself to, should have used MySQL from the beginning I guess, speaking of that does anyone know a way to convert a SQLite database to MySQL, (would save a lot of time since most of the accounts are located in one server).
-
That was just a way to use SQLite instead of MySQL but just forget it, after some tests of that method it turned out that SQLite fails when multiple instances tries to write to the file at the same time, an issue that get's noticed when players starts to join both the servers, the sync wasn't very good either so go ahead and use MySQL
-
arguments for the functions in a command handler start's on position 3, position 2 contains a string with the name of the command itself, in this case "car", try replace line 1 with this: function cars( source, cmd, valor )
-
As a test to see if it worked I made a copy of a fully working MTA server directory with data stored as SQLite and xml, copied the MTA Server.exe file and started the first server, when it finished loading I changed the mtaserver.conf with new ports and started the second server. So what we got here is basically two MTA servers running on the same path with access to the same files and resources, after running this configuration for a few hours I haven't seen any issues yet, however I could use some advices from anyone with experience in this, is this a good solution to sync multiple servers, is there anything that can go wrong and make the files corrupt for instance? To start it all up and move the configuration files to the correct destinations I'm using a regular bat file with some delays included to prevent conflicts during load. Any advices or is there better and more simple ways to keep multiple servers synced? It seems like an easy solution but you know the rules of engineering, if it seems easy it's most likely wrong. What do you think?
-
Ok the problem is as I suspected: local moneyBox = guiGetText ( editBox ) local para = getPlayerMoney(source) Are executed before: editBox = guiCreateEdit(182, 55, 102, 23, "0", false, kumarWindow) guiEditSetMaxLength(editBox, 2) To solve this replace line 39 and 40 with this block: editBox = guiCreateEdit(182, 55, 102, 23, "0", false, kumarWindow) guiEditSetMaxLength(editBox, 2) moneyBox = guiGetText ( editBox ) para = getPlayerMoney(source) The script will execute from up and then downwards, after that it will run the event triggers including "onClientResourceStart", anything that isn't inside an event handler function will be executed before the resource or player join events.
-
And you are sure you added those lines above the guiGetText function? If not, the pointer will be undefined (nil).
-
Did you tried to exit the car before reconnecting? According to the wiki the engine will turn on by default when someone enter the vehicle, if you're in the vehicle when you disconnect you'll be in it as soon you join next time, causing the engine to start again. setVehicleEngineState, could be another reason as well.
-
So the reason is to keep two (or more) servers synced? Well there is a simple solution for that as well, running them from the same directory, all you need is two different config files and a bat file that move these files during startup of the servers to prevent collisions. A pretty simple and effective solution that seems to work. Your bat file might look like this: :: Initialize multiple MTA servers echo "Server starter" echo "Initialize server 1..." :: Copies the config file for server 1 and wait 3 seconds copy "C:\mta-servers\config1\mtaserver.conf" "C:\mta-servers\mods\deathmatch\" /Y ping -n 4 127.0.0.1 > nul :: Start server 1 C:\mta-servers\mta-server1.exe Simply add that ping to localhost at the end and copy the code to load the next server, everything get's synced by default. Just note that I've only been testing this solution for a few hours, there may be issues in it but haven't found anything so far. It does it job and keeps multiple servers synced.
-
This is a server sided script, localPlayer is not defined and "source" has other issues in case this is triggered from a client, basically try to replace localPlayer and source in that code section you posted with "client" and the marker should be hidden for others.
-
dxDrawText which probably is used by kill messages has support for color codes, all you need to do is to find that function in it and set the colorcodes argument to true according to the description of the function in it's wiki page, good luck.
-
That's a bit overkill isn't it, anyway if you're looking for scripts, check the community if you haven't done it yet: https://community.multitheftauto.com/. Good luck.
-
Why not simply define it? That's how lua works basically: local globalTimer1 = setTimer( function() if getPlayerMoney(client) >= 1200 then -- Do somethnig here else -- Kill timer killTimer(globalTimer1) end end, 1000, 0) You may be able to use "break" as well, never tried it myself even thought that's how you kill a timer in other languages.
-
setTimer returns a timer pointer which can be used to kill a timer with the function killTimer: local timer = setTimer( ... ) killTimer(timer)
-
Being patient is a good idea, anyway on line 86 in your script you got this: for _, events in ipairs(getElementsByType("player")) do For some reason your script are unable to list the players in your server which seems pretty weird. Are you sure that's the right script?
-
Youtube video of what to expect of this when MTA 1.4 is released https://www.youtube.com/watch?v=gO6atdRgduE, enjoy.
-
You just upload the same way as the last time, if the file name and the name in meta.xml matches then it's considered as an update and the second text field can be used to add update news.
-
If only you can see them, then you probably just installed them on your own client. Did you use https://wiki.multitheftauto.com/wiki/EngineLoadDFF for instance to load the mod?