SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 09/01/2018, 02:12 PM   #1
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Posts: 1,395
Reputation: 438
Default zSave - Save Data in any custom format

- zSave v1.0 by NaS -


What does it do?

Are you tired of spamming /save a hundred times for a bunch of spawns and copy out the coords one by one afterwards?
Or do you want to save a lot more data than just positions, CreateVehicle lines etc.?
Then take a look at this! It will certainly make your life easier.

This Filterscript lets you save your current position/rotation/velocity/camera position and more, in any format you can define yourself.

Instead of copying around line for line from savedpositions.txt into your script, you can just create a new format type and select an output file to write to.
After that you can simply use /z to save the current state.

I created this a longer time ago but thought it might be useful for someone.
The /z command isn't done super efficient but it works perfectly fine.


Advantages over /Save:

- Fast - Adding a new Format Type as well as the saving process is a lot faster than extracting x, y, z out of the AddPlayerClass line or writing a FS to do the job for you.
- Dynamic and easy - You can quickly add or edit any desired output format and also switch between formats instantly.

The only thing /Save is better at is, that the output is saved client-side. In this case it is only saved in the scriptfiles directory of the server.


Example:

Assume you have an Array for Random Spawns, and each entry consists of the position, the facing angle and the name for the Spawn.

To save the data in this format (including array brackets and the comma), you can add a new format type:

Code:
{&x, &y, &z, &rz, "&c"},
After that you can type "/z Four Dragons Casino" and the following will get appended to the selected file.

Code:
{2033.4517, 1009.9388, 10.8203, 190.0721, "Four Dragons Casino"},
After saving a couple of locations you can then copy the whole array into your script in one piece - and done!
No need to waste time copying around coordinates.


This is just a very simple example. A more complex example would be

Code:
{&s, &x, &y, &z, &rz, &cpx, &cpy, &cpz, &cvx, &cvy, &cvz, "&c"},
which saves the current Skin ID, Position, Facing Angle, Camera Position, Camera Vector and the Name.
This can be used to save an Array of Class Selection Positions - instead of copying around coords for Player Position, Camera Position and Camera Look At you can just use /z.

Each of these Format Types can be added and managed ingame.


Screenshots:

Here are some screenshots of the dialogs and how to add a new format type, select a file and save a position.

https://imgur.com/a/0ylhy

After that the selected file contained the following line:

Quote:
Originally Posted by random_spawns.txt
{1958.347290, 1342.999023, 15.374607, 270.339508, "High Roller"},
Commands:

/zfile (filename) - Selects a File to write to. Leave empty to view the currently selected file (per-player).
Default: "zsave_default_output.txt" (see define FILE_DEFAULT_OUTPUT).

/zformat (id) - Opens the Format Type Dialog. Here you can select the current Format Type, edit existing types or add new ones (per-player). Optional: specify an ID to quick-select a format type.

/z (comment) - Saves your current State. The comment can be used as specifier (optional).
Requires at least /zformat to select a format type first.


Download & Installation:

You can download the FilterScript from GitHUB:

CLICK

Download zsave.pwn and place it into your filterscipts folder.

After that add it to the filterscripts line in your server.cfg and start up your server (or load it via RCON).


ColAndreas Support:

If you are running ColAndreas, you can enable it by setting the define ENABLE_CA to true. This will enable &gx, &gy, &gz as well as the &grx, &gry and &grz specifiers which allow saving the current terrain height and angle.

It is disabled by default.


Granting Permissions by PVar:

To be able to use any of the zSave Features you must be logged into RCON and/or enable the PVar Admin Level.

To enable the PVar Admin Level, your game mode or admin script must use PVars to save Admin Levels for Players.
If it does, set the define USE_ADMIN_PVAR to true, adjust ADMIN_PVAR_NAME to the Name of your Level PVar (eg. "AdminLevel") and finally adjust ADMIN_PVAR_LEVEL to the minimum required level.


Restricting file output to a specific folder:

To disallow esacping a specified directory, you can set the define LOCK_TO_FOLDER to true and set LOCK_PATH to the desired path. This will prevent users from escaping the selected directory using /zfile


Suggestions for new Specifiers:

If you have more ideas for useful specifiers, just suggest them here. I'll gladly add them!


Credits:

- ZCMD
- ColAndreas
NaS is offline   Reply With Quote
Old 09/01/2018, 02:33 PM   #2
SonnyGamer
Big Clucker
 
SonnyGamer's Avatar
 
Join Date: Jun 2017
Location: Europe
Posts: 149
Reputation: 42
Default Re: zSave - Save Data in any custom format

You've done a good job dude.

Just one thing I wanna say is that this is indeed useful script but I also like old school /save which is not gonna be replaced for me with any system.

+REP for hardwork you did over here
__________________
Owner of TMS - The Matrix Stuntage

SonnyGamer is offline   Reply With Quote
Old 09/01/2018, 09:47 PM   #3
Trucksamp
Little Clucker
 
Trucksamp's Avatar
 
Join Date: Dec 2017
Location: İstanbul
Posts: 11
Reputation: 0
Default Re: zSave - Save Data in any custom format

good joob
__________________
TruckSamp - (V5.1.1 U3) - CONVOY/JOB+16/COMPANY
IP: samp.trucksamp.com:7777
Trucksamp is offline   Reply With Quote
Old 10/01/2018, 01:35 AM   #4
Castiel17
Little Clucker
 
Castiel17's Avatar
 
Join Date: Jun 2017
Location: Norway
Posts: 23
Reputation: 0
Default Re: zSave - Save Data in any custom format

Nice work
__________________
Castiel17 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
custom data type? Maheerali Scripting Help 8 01/10/2016 12:22 PM
Need format formula, for custom float aLTeR Scripting Help 4 25/09/2013 06:07 PM
[Tutorial] How to create custom functions, format, set timers and PVars. RajatPawar Tutorials 6 16/01/2013 05:19 AM
can anyone convert this HUGE map to my custom format pls? at me convertffs crashes... niels44 Scripting Help 10 21/11/2012 05:43 PM
Placeholder for boolean data type in format-function DeathOnaStick Help Archive 2 24/12/2010 01:44 PM


All times are GMT. The time now is 01:00 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.