Jump to content

Morelli

Members
  • Posts

    69
  • Joined

  • Last visited

Everything posted by Morelli

  1. Take a look at the Object Functions, which can be seen by a simple search on the MTA wiki.
  2. Morelli

    Skin selector

    From my own tests that I've conducted, I've concluded that using a skin ID that isn't an accepted MTA skin will not crash the server. This isn't SAMP after all . EDIT: Doesn't seem like it crashes the client, either, if that's what you're wondering.
  3. Correct. It'll be displayed in the window of the MTA server.exe An example error would look something like this:
  4. Scripts are organised as 'resources'. Resources can be run by the program MTA server.exe, by typing 'start [resource name]'. For a resource to work it needs a few things: A working code written in Lua (or XML) A meta.xml file that points to all the files that will be used All of the files placed in either an unpassworded WinZip file or a folder (either will work) To be located in the following subfolder: MTA\server\mods\deathmatch\resource\ The files are read by the server when it starts and there is no need for you to compile them. For more information, read the Scripting Introduction, on the MTA wiki.
  5. To give a player $1000, you'll need this function, which should be triggered by this event. To give a player $10 each time they kill a person, you'll need this function, again. And the event trigger for it should be this. 'Search' is the word of the day, today.
  6. Morelli

    Skin selector

    Do you have any event handlers or calls on that function? You'd probably want to add this line in, then. addEventHandler ( "onPlayerJoin", getRootElement(), seleccion ) Also, the OnPlayerJoin has no parameters, so you'd want to replace all the 'player' with source, where you're referring to the player. Read over this page for an example on how you should structure it.
  7. As I said in my post, take a look at setVehiclePaintjob. I believe the value integers are from 0 to 3, inclusive, but you'll have to check up on that one, as I'm not positive about it.
  8. By 'custom paintjobs', I'm going to assume that you're referring to the native GTA paintjobs that you can put on selected vehicles at mod shops. If so, you may want to take a look at setVehiclePaintjob.
  9. Read the MTA wiki, more specifically this page. You'll feel a lot better when you code something yourself. Be sure to search on both these forums and the MTA wiki, before posting a scripted related question, as odds are, it's already been answered, or there are already script examples to learn from.
  10. Multi Theft Auto is an online, multiplayer modification of the popular PC game, Grand Theft Auto: San Andreas. To play it, you're going to need to have the original game, GTA:San Andreas, for PC. It must also be version 1.0 of the game, if you don't have the correct version of the game, I'd advise that you google a downgrader (or look at this post). All servers and gamemodes are made by enthusiastic players of this modification, who wish to make their own interpretation of a gamemode. As for what is the best or the 'most popular', that is all up to individual opinion. For more information, you might want to read this article. Regards, Morelli.
  11. Testing on my own server. This is the Client equivalent of the OnPlayerQuit, so it should be triggered even if there is only one player. Because it writes to the Debug, I should be able to verify if it works or not, just by checking if anything has been written in the MTA server.exe. I haven't seen anything been written in any of my tests, so I am to assume that there is a problem with either my code or the event.
  12. Are you positive that it works? I've tested this event for at least 10 different tasks to perform, and none of them have had any effect. Granted, they haven't crashed the MTA server.exe, but consequently, they have had absolutely no effect whatsoever. Just by glancing at your script (not fully knowing what all those tasks represent), I can see that it appears you want to set a Player's GUI (objProgressBar, objSplash, etc) to disappear. This is automatically handled by the server by default, when a player leaves the server. So it may infact not be your code that is causing it to work, but the native MTA coding.
  13. That error occurs when you run a loop and don't break it. Lua seems to be able to process about 130,000 loops before it comes up with that error (tested on Windows version). I haven't seen the code for this, but the easiest way would be to 'break', the loop once you've achieved the outcome you wanted. example: local players = getElementsByType ( "player" ) for key, playerdata in ipairs(players) do local sourcePlayerName = getClientName( playerdata ) if ( sourcePlayerName == "Me" ) then break end end
  14. This event seems to have no effect. I've tested it with numerous codes which rely on the trigger event to be 'onClientPlayerQuit' Some test codes: -- Client-side function onQuitGame2( reason ) outputDebugString ( getPlayerName( source ).." has left the server TEST TEST ("..reason..")" ) end addEventHandler( "onClientPlayerQuit", getRootElement(), onQuitGame2 ) -- Client-side function QUIT( ) outputDebugString ( "Test" ) end addEventHandler( "onClientPlayerQuit", getRootElement(), QUIT)
  15. Then don't set the GTA clock every second. Have the GTA clock show in the following format (it's kind of obvious that an hour hand will refer to the 'hour' and the 'minute' hand will refer to the minutes) Hours:Minutes. Have the timer which updates the clock go every 10 or so seconds, and only change it when there is a change in the new minute/hour real time to the gta time. It is very much possible, all it takes is a few lines of coding and some foreign ingenuity. EDIT: Another suggestion would be to get the real time when the resource starts, then make a timer which adds + 1 minute to the minute hand, each 60 seconds. When the minute hand >59; set the hour hand + 1 and reset the minute hand to 0. That gets rid of the need to constantly sync it with the real time. I haven't tested out the whole sky flickering thing, so I'm not sure if it'll work graphically, but theoretically, it should.
  16. That can be done with scripting. Check the time functions and the game clock functions on the Wiki.
  17. Morelli

    FileWrite

    Easier or not, I'm looking for potential bugs. I tried writing the file in the native lua way of: io.write("text", "a") etc. However it showed up as undefined global variable 'io'.
  18. Morelli

    FileWrite

    I've been recently exploring the FileWrite functions and I've noticed that when a line is written, it overwrites the first line in the file (it doesn't append the line). Here's the code I've been testing on: function writeonFile( sourcePlayer, command ) local hFile = fileOpen("TEST.txt" ) if hFile then local check = fileWrite(hFile, "This is a test file 2! \n") if ( check ) then outputChatBox( "You wrote something down" ) else outputChatBox( "Didn't work...." ) end fileClose(hFile) else outputConsole("Unable to open test.txt") end end addCommandHandler( "w", writeonFile) Another person has reported the same problem, here. Quote from my TEST.txt, even though the command has been used multiple times, there is only one line of text. Any suggestions/ideas on how to make it append the entry?
  19. Ah, thanks for that. I'd been loosely basing my code on another client-side script that I had seen, which did include a source in the function name for a command. (Saw it at the client code example of Trigger Server Event) For those wishing to see a fixed code of this: function TEST ( commandName ) local weapon_1 = getPlayerWeapon( getLocalPlayer ( ) ) if ( weapon_1) then local check = outputChatBox ( "Weapon: " ..weapon_1 ) if ( not(check)) then outputChatBox ( "Didn't work. " ) end else outputChatBox("Not working...") end end addCommandHandler ( "t", TEST ) Seeing as this isn't a bug, we can sweep this thread into the corner and ignore it
  20. Alright, I'm having some trouble getting this to work client-side. It doesn't seem to want to collect my information. -- Client-side. function TEST ( sourcePlayer, commandName ) local weapon_1 = getPlayerWeapon( sourcePlayer ) if ( weapon_1) then local check = outputChatBox ( "Weapon: " ..weapon_1 ) if ( not(check)) then outputChatBox ( "Didn't work. " ) end else outputChatBox("Not working...") end end addCommandHandler ( "t", TEST ) Don't mind all the if statements and making everything a local, I was trying to isolate the problem. It seems it is unable to pass the argument if ( weapon_1 ) then... This scripting function works perfectly fine server-side. I'm in need of this function to be working client-side so I can make a cycle to return all the player's weapons.
  21. Remember not call function and event names the same thing, as Lua may confuse them. Here, you've got onVehicleStartEnter as the function name and the event name. I've also noticed similar problems with the cancelEvent() for this event. It only is triggered once, as previously mentioned.
  22. I'm pretty sure I remember seeing a way to change the chatbox size, in terms of how many lines one can type, however it's slipped my mind as to where I can find it, and searching on both these forums and the wiki return no results. Also, are the chatboxes hardcoded?
  23. You're setting it as a global variable, so if multiple people try to park, then you're going to get mixed results about who is the variable 'authorised'. Try pulling the data and having it save to an external file, and then when you need it, pull it from the file again and run a check on it.
  24. I've only seen this bug with skin ID 280 and weapon ID 22. (Police skin and 9mm pistol). When aiming and running, a good portion of the skin appears transparent. Screenshots: (standing still) Moving and aiming OS: Windows Vista Home Premium CPU: Intel Core 2 Duo CPU E6750 @ 2.66 GHz RAM: 2GB Memory RAM Graphics: NVIDIA GeForece 8600GS (256mb + shared RAM equals roughly 1 GB graphics) Achieved in windows mode
  25. Morelli

    Taxi

    By ID, I assume you are reffering to skinID 50. Well, there are multiple ways to approach this, I'd suggest structuring it in the following way function FUNCTIONAME(sourcePlayer, command, target, price) local targetPlayer = getPlayerFromNick ( target ) if ( targetPlayer ) then if ( price ) then local sourceskin = getPlayerSkin ( sourcePlayer ) if ( not (sourceskin == 50) ) then else takePlayerMoney ( target, price ) givePlayerMoney ( sourcePlayer, price ) setElementHealth ( target, 100 ) end end end end addCommandHandler("CHANGEME", FUNCTIONAME) Using the command /changeme [targetplayername] [price] you can set the person's health to 100 and take some money off them. The person using the command must have skin ID 50. Just read up on the wiki and adjust it to your liking.
×
×
  • Create New...