Jump to content

SkittlesAreFalling

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by SkittlesAreFalling

  1. Were you high when you made this? Should leave out boats.
  2. Use JSON: SavePlayer = function(player) if getElementType(player) ~= "player" then return false; end local data = {}; data.health = getElementHealth(player); data.armour = getPedArmor(player); data.money = getPlayerMoney(player); data.position = {}; data.position.dimension = getElementDimension(player); data.position.interior = getElementInterior(player); data.position.x, data.position.y, data.position.z = getElementPosition(player); data.position.rz, data.position.ry, data.position.rx = getElementRotation(player); data.isAdmin = getElementData(player, "isAdmin"); local file; if fileExists("Players\\" .. getPlayerName(player) .. ".json") == false then file = fileCreate("Players\\" .. getPlayerName(player) .. ".json"); else file = fileOpen("Players\\" .. getPlayerName(player) .. ".json"); end if file == false then return false; end fileWrite(file, toJSON(data, true)); fileClose(file); return true end LoadPlayer = function(player) if getElementType(player) ~= "player" then return false; end if fileExists("Players\\" .. getPlayerName(player) .. ".json") == false then return false; end local file = fileOpen("Players\\" .. getPlayerName(player) .. ".json", true); if file == false then return false; end local data = fromJSON(fileRead(file, fileGetSize(file))); fileClose(file); setElementHealth(player, data.health); setPedArmor(player, data.armour); setPlayerMoney(player, data.money, true); setElementDimension(player, data.position.dimension); setElementInterior(player, data.position.interior); setElementPosition(player, data.position.x, data.position.y, data.position.z); setElementRotation(player, data.position.rx, data.position.ry, data.position.rz); setElementData(player, "isAdmin", data.isAdmin); return true; end SavePlayer(player) - Saves Health, Armour, Position, and a custom value to ResourceName/Accounts/playerName.json. LoadPlayer(player) - Loads Health, Armour, Position, and a custom value from ResourceName/Accounts/playerName.json if exists.
  3. Thanks. I see how it works, I don't think it's fully developed.
  4. I meant like: var HandleResourceStart = function(resource) { if(resource == getThisResource()) { print("Hello world from JavaScript!"); return; } return; } var HandlePlayerJoin = function() { var player = source; outputChatBox("This server is completely scripted in JavaScript instead of Lua!", player, 0, 128, 128, false); return; } addEventHandler("onResourceStart", getRootElement(), HandleResourceStart); addEventHandler("onPlayerJoin", getRootElement(), HandlePlayerJoin); I'm not sure if it's okay to link a link from the other multiplayer mod to show you an example.
  5. It is a command that was added by the MTA team, so I don't think you can. https://wiki.multitheftauto.com/wiki/Server_Commands removeCommandHandler("login"); -- Would only work in the resource it was created in, so this won't work. Try: HandleCommand = function(name) if name == "login" then cancelEvent(); end end addEventHandler("onPlayerCommand", getRootElement(), HandleCommand);
  6. https://msdn.microsoft.com/en-us/librar ... ctory.aspx Thank you for the reply. This worked flawlessly with the samp-server.exe, but sadly not with MTA Server.exe. If anyone else has any suggestions? I am open-minded. Might help me find what I missed from the StartInfo variable: https://msdn.microsoft.com/en-us/librar ... o(v=vs.110).aspx UnityEngine.Debug.Log("Starting MTA Server.exe..."); /// Navigate to MTA Server.exe this.mtaServer = new Process(); this.mtaServer.StartInfo.FileName = @"C:\Program Files (x86)\Rockstar Games\MTA San Andreas 1.5\server\MTA Server.exe"; this.mtaServer.StartInfo.WorkingDirectory = @"C:\Program Files (x86)\Rockstar Games\MTA San Andreas 1.5\server\"; this.mtaServer.StartInfo.Arguments = "-t"; /// Set up to run in the background. this.mtaServer.StartInfo.UseShellExecute = false; this.mtaServer.StartInfo.RedirectStandardOutput = true; this.mtaServer.StartInfo.RedirectStandardError = true; this.mtaServer.StartInfo.RedirectStandardInput = true; /// this.mtaServer.StartInfo.CreateNoWindow = true; this.mtaServer.ErrorDataReceived += HandleProcessOutput; this.mtaServer.OutputDataReceived += HandleProcessOutput; this.mtaServer.EnableRaisingEvents = true; /// Execute. bool started = this.mtaServer.Start(); if(started == true) { UnityEngine.Debug.Log("MTA Server.exe started."); this.mtaServer.BeginOutputReadLine(); this.mtaServer.BeginErrorReadLine(); } else { UnityEngine.Debug.Log("MTA Server.exe did not start."); }
  7. I have been attempting to do this ALL DAY, and I think I FINALLY know why it is not working, well it is but I know why it's not working as intended. When I tried executing samp-server.exe (San Andreas Multiplayer, pls forgive me I needed something else to test) it told me "Unable to exec file 'server.cfg'" and that's when it hit me, what if I moved server.cfg to the bin of the executable trying to control samp-server.exe, so I did, and this is the result of doing that [18:50:52] I couldn't load any gamemode scripts. Please verify your server.cfg [18:50:52] It needs a gamemode0 line at the very least. Now I know what the problem is, it CAN redirect the output just I need a way of my Server Manager to execute the MTA Server.exe and use it as if it was in the C:/Program Files (x86)/Rockstar Games/MTA San Andreas 1.5/server/ directory?
  8. Thank you for replying, but that did not work. Is there a list of command line arguments that MTA uses I can view? Alright it worked as you said on the MTA Server.exe when I set the short-cut target to "PATH" -t. I must be doing something wrong C# wise because my program can't get it to redirect the output. /// Navigate to MTA Server.exe this.mtaServer = new Process(); this.mtaServer.StartInfo.FileName = "C:\\Program Files (x86)\\Rockstar Games\\MTA San Andreas 1.5\\server\\MTA Server.exe"; this.mtaServer.StartInfo.Arguments = "-t"; /// Set up to run in the background. this.mtaServer.StartInfo.UseShellExecute = false; this.mtaServer.StartInfo.RedirectStandardOutput = true; this.mtaServer.StartInfo.RedirectStandardError = true; this.mtaServer.StartInfo.RedirectStandardInput = true; /// this.mtaServer.StartInfo.CreateNoWindow = true; this.mtaServer.ErrorDataReceived += HandleProcessOutput; this.mtaServer.OutputDataReceived += HandleProcessOutput; this.mtaServer.EnableRaisingEvents = true; /// Execute. this.mtaServer.Start(); this.mtaServer.BeginOutputReadLine(); this.mtaServer.BeginErrorReadLine();
  9. I was making a C# server manager but am not able to redirect output from the console. if(this.mtaServer != null && this.mtaServer.HasExited == false) { this.mtaServer.Kill(); this.mtaServer = null; } /// Navigate to MTA Server.exe this.mtaServer = new Process(); this.mtaServer.StartInfo.FileName = "C:\\Program Files (x86)\\Rockstar Games\\MTA San Andreas 1.5\\server\\MTA Server.exe"; /// Set up to run in the background. this.mtaServer.StartInfo.UseShellExecute = false; /// this.mtaServer.StartInfo.RedirectStandardOutput = true; /// this.mtaServer.StartInfo.RedirectStandardError = true; this.mtaServer.StartInfo.CreateNoWindow = true; this.mtaServer.ErrorDataReceived += HandleProcessOutput; this.mtaServer.OutputDataReceived += HandleProcessOutput; this.mtaServer.EnableRaisingEvents = true; /// Execute. this.mtaServer.Start(); /// this.mtaServer.BeginOutputReadLine(); /// this.mtaServer.BeginErrorReadLine(); ^ This will work, because the output redirecting is disabled. How can I retrieve server console messages using C#? What I have: if(this.mtaServer != null && this.mtaServer.HasExited == false) { this.mtaServer.Kill(); this.mtaServer = null; } /// Navigate to MTA Server.exe this.mtaServer = new Process(); this.mtaServer.StartInfo.FileName = "C:\\Program Files (x86)\\Rockstar Games\\MTA San Andreas 1.5\\server\\MTA Server.exe"; /// Set up to run in the background. this.mtaServer.StartInfo.UseShellExecute = false; this.mtaServer.StartInfo.RedirectStandardOutput = true; this.mtaServer.StartInfo.RedirectStandardError = true; this.mtaServer.StartInfo.CreateNoWindow = true; this.mtaServer.ErrorDataReceived += HandleProcessOutput; this.mtaServer.OutputDataReceived += HandleProcessOutput; this.mtaServer.EnableRaisingEvents = true; /// Execute. this.mtaServer.Start(); this.mtaServer.BeginOutputReadLine(); this.mtaServer.BeginErrorReadLine(); // Function. private void HandleProcessOutput(object sender, DataReceivedEventArgs data) { string output = data.Data; Console.WriteLine(output); } ^ will not work, can't even connect to the server locally. After this is fixed I would like to know how to send messages to the server console as well.
  10. Yes Noki, the favicon like on the web browser's tab. Shows the icon and title of the webpage. https://en.wikipedia.org/wiki/Favicon
  11. Just an idiot ranting on about nothing, move along. (<-- This is an insult, enjoy it )
  12. I'm running it on Windows 10, 8.1 = 80 - 100 fps, 10 = 100 fps (even when recording with the new xbox recording [windows + g] feature), glad I switched.
  13. After a page is done loading, get the Icon texture.
  14. Eh' kind of... it does make a slight difference so good job I think you accomplished what you wanted. I do have a suggestion, when you're turning the camera should turn along with you (like turning right should make the camera go left)
  15. LOL Pay to be a cop, that's actually a little bit brilliant.
  16. Found my answer! https://wiki.multitheftauto.com/wiki/FetchRemote It's in the example.
  17. http://media.moddb.com/cache/images/mod ... s_rims.jpg Do want, where can I get it? (saw the image on multitheftauto home page.)
  18. I'm just going to assume no this is not possible.
  19. That's not what I mean, I already know how to do that, it's simple. Players can log onto the website (website resource), they can select "Upload Photo", they can select the photos from their desktop, they can hit 'send', I want the pictures to be uploaded and sent to my MTA server and saved in a resource, I reload said resource, the website reloads and the image appears on the website for others to view. The bolded part of my description is what I'm wondering is possible. Just like on Facebook or any other website you can upload pictures onto their servers and then have it displayed on the website for everyone to see. I want the same thing.
×
×
  • Create New...