CMHDev Posted April 22, 2018 Share Posted April 22, 2018 (edited) I have seen the example posted by rootcause with a rescue command as it is on samp for java script and i said to do one for C #. You must use the System.IO library using System.IO; And this is the proper command.. [Command("save","Use /save [Position Name]", GreedyArg = true)] public void CMD_SavePosition(Client player, string PosName = "No Set") { var pos = (player.IsInVehicle) ? player.Vehicle.Position : player.Position; var rot = (player.IsInVehicle) ? player.Vehicle.Rotation : player.Rotation; using (var stream = File.AppendText("SavePos.txt")) { if (player.IsInVehicle) { NAPI.Notification.SendNotificationToPlayer(player, "~g~In car ~w~postion saved with name ~r~" + PosName, true); stream.WriteLine("IN VEH || " + PosName + ":" + pos.X + ", " + pos.Y + ", " + pos.Z + " Rot: " + rot.Z); stream.Close(); } else { NAPI.Notification.SendNotificationToPlayer(player, "~g~On foot ~w~position saved with name ~r~" + PosName, true); stream.WriteLine("ON FOOT|| " + PosName + ":" + pos.X + ", " + pos.Y + ", " + pos.Z + " Rot: " + rot.Z); stream.Close(); } } } The positions you find saved in the SavePos.txt file in the server folder That's how they look ON FOOT|| No Set: -439.8961, 6023.063, 31.49012 Rot: 2.175138 ON FOOT|| Police: -440.5302, 6034.081, 31.34053 Rot: 2.944162 IN VEH || Spawn Adder: -440.6177, 6035.974, 30.93323 Rot: 2.784058 Edited April 22, 2018 by CMHDev add images 2 Link to comment Share on other sites More sharing options...
Jorge Santamaria Posted April 2, 2019 Share Posted April 2, 2019 It is useful. Thank you. Link to comment Share on other sites More sharing options...
robearded Posted April 2, 2019 Share Posted April 2, 2019 Good job for helping the community, but I don't understand why people abuse 'var' on C# when you know the type of the variable you're dealing with 1 Link to comment Share on other sites More sharing options...
LT.Steiner Posted March 8, 2020 Share Posted March 8, 2020 @CMHDev Thanks for your Presentation buddy, I have a question, is there any way to save client data automatically without any /save or some like that with manually event? I mean i want to write a script that save client Data when Disconnected from the server, is there any way? How? can you post any script? Link to comment Share on other sites More sharing options...
cH4rLy Posted April 10, 2020 Share Posted April 10, 2020 On 4/2/2019 at 6:33 AM, robearded said: Good job for helping the community, but I don't understand why people abuse 'var' on C# when you know the type of the variable you're dealing with Totally agree with this. "'var' on C# when you know the type of the variable" Link to comment Share on other sites More sharing options...
CMHDev Posted May 1, 2020 Author Share Posted May 1, 2020 On 3/8/2020 at 1:13 PM, LT.Steiner said: @CMHDev Thanks for your Presentation buddy, I have a question, is there any way to save client data automatically without any /save or some like that with manually event? I mean i want to write a script that save client Data when Disconnected from the server, is there any way? How? can you post any script? I didn't quite understand what you wanted to do? I think you want to save the players' data. Practically you need help with the client logout event with mySQL Link to comment Share on other sites More sharing options...
Heathen Posted May 14, 2020 Share Posted May 14, 2020 (edited) On 3/8/2020 at 3:13 PM, LT.Steiner said: @CMHDev Thanks for your Presentation buddy, I have a question, is there any way to save client data automatically without any /save or some like that with manually event? I mean i want to write a script that save client Data when Disconnected from the server, is there any way? How? can you post any script? Process the saving on the event when the player disconnects, think simple. Edited May 14, 2020 by Heathen Link to comment Share on other sites More sharing options...
qPaul7 Posted May 2, 2022 Share Posted May 2, 2022 Life saver! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now