-
Posts
60 -
Joined
-
Last visited
SkittlesAreFalling's Achievements
Snitch (10/54)
0
Reputation
-
powerhd started following SkittlesAreFalling
-
Were you high when you made this? Should leave out boats.
-
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.
-
Scripting the server&client in JavaScript
SkittlesAreFalling replied to SkittlesAreFalling's topic in Scripting
Thanks. I see how it works, I don't think it's fully developed. -
Scripting the server&client in JavaScript
SkittlesAreFalling replied to SkittlesAreFalling's topic in Scripting
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. -
Is it possible?
-
Bump would still like help
-
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);
-
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."); }
-
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?
-
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();
-
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.
-
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
-
Just an idiot ranting on about nothing, move along. (<-- This is an insult, enjoy it )
-
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.
-
After a page is done loading, get the Icon texture.