Jump to content

[REL] Save'N'Load locations 1.3


50p

Recommended Posts

I have seen a topic where Rusch69 asked for a script which allows you to save your locations using commands and spawn at these locations using keys 1-9.

I decided to write such script.

So here it is: http://y50p.50g.com/archives/mta/saveandload.zip

Installation:

Place "saveandload.zip" in your server's "resources" folder.

Usage:

Type command /s[1-9] which represents each 1-9 key respectively.

New saving position style also included. Now you can set what key you have to hold to save and load locations (meta.xml)

Default keys are:

Left Ctrl - hold it and press a number to save location on the number

Left Alt - hold it and press a number to spawn at the saved location

Have fun teleporting around places!

Don't forget to post feedback and suggestions (what to improve or add), also post all bug which you find (if you find).

Update 1.1:

* added: saving locations using lctrl+(1-9)

* added: loading locations using lalt+(1-9)

* added: settings in meta.xml file (you can change hold-keys, defaults: lctrl, lalt)

Update 1.2:

* added: now set 100% health to vehicle after you load saved locations

* fixed: rotations now should work correctly

Update 1.3:

* less code used, only 1 function handles commands and keys to save position

* added: onPlayerJoin, will display a message that server runs the script

* added: command which tells the player how to save/load location

Edited by Guest
Link to comment

Why not use the keys Control+[number] to set the location. E.g. control+1 is the same as the /s1 command.

It looks like if you press 1 before you've done /s1 you'll get warped under the ground at 0,0,0... Perhaps add a 'hasBeenSet' boolean to your table for each teleport location which defaults to false and is set to true in savePlayerCurrentLocation?

Link to comment

You DO NOT have to create folders in your resourcecache directory. You should never have to touch any files in there, they are purely the files extracted there temporarily from the zip files in your resources folder. To install a resource, just copy it to your resources/ folder and type refresh in the console if the server is already running.

Link to comment
You DO NOT have to create folders in your resourcecache directory. You should never have to touch any files in there, they are purely the files extracted there temporarily from the zip files in your resources folder. To install a resource, just copy it to your resources/ folder and type refresh in the console if the server is already running.

I don't know why your method doesn't work, maybe works for you but not for me. That's why I wrote what works for me.

Great i've been looking for that since i started working on my stunt gamemode 3 weeks ago =)

Is it Ok if i edit it a little bit? I just want to use like eAi already suggested customized hotkeys.

You can edit as much as you want, as far as full credit is included.

Why not use the keys Control+[number] to set the location. E.g. control+1 is the same as the /s1 command.

It looks like if you press 1 before you've done /s1 you'll get warped under the ground at 0,0,0... Perhaps add a 'hasBeenSet' boolean to your table for each teleport location which defaults to false and is set to true in savePlayerCurrentLocation?

I haven't noticed that, since I bind key only when command was entered.

Link to comment
I have seen a topic where Rusch69 asked for a script which allows you to save your locations using commands and spawn at these locations using keys 1-9.

I decided to write such script.

Thanks a lot. :D But could you also do something which adds automatical something like "/bind 1 spawn nrg500" when you type "/s1" ? So when a client pushes 1-9 he gets that vehicle which he had before he spawned.

Another simple example:

1. Player (is in Infernus):/s1

2. Player pushes 1 on keyboard

3. Player spawns with Infernus at position 1

Because it's annoying to write for each spot "/bind 1-9 spawn vehicle". :|

But btw thanks a lot agian

Great i've been looking for that since i started working on my stunt gamemode

exactly like me...

Link to comment

Thanks again dude!

But spawns the client only at that /s1 position with a NRG500? At 2-9 the player spawns without any vehicle. And each time after spawning he watches to the north :o. MTA DM DP2 needs a vehicle despawner ;/. At a stuntingspot when the player bailed and I push 1-9 to spawn at the runup for that spot the bike is the way. The player has each time at spawning a new vehicle (NRG500 at pushing 1 ?!), would be better if he gets his last vehicle or the server destoyes that old vehicle at spawning.... but MTA DM DP2 despawner >_<

Hope you understand what I mean (maybe bad english but dunno....) :mrgreen:

Edited by Guest
Link to comment

In meta.xml you have possible settings, there you can choose which keys should be hold to save/load location.

If at the time of saving you are in a vehicle, you'll be warped in the vehicle when you load the location.

And each time after spawning he watches to the north :o

Yes I know. I must be a bug or something. Your rotation is saved, but for some reason can't be set to vehicles.

The player has each time at spawning a new vehicle, would be better if he gets his last or the server destoyes that vehicle at spawning.... but MTA DM DP2 despawner

Do you mean you want to have fixed vehicle each time you load you location?

BTW, If you want to load a location when the vehicle you saved is in use, you'll be spawned there without vehicle.

Link to comment
If at the time of saving you are in a vehicle, you'll be warped in the vehicle when you load the location.

Just download and watch this:

http://www.megaupload.com/de/?d=LFL7MOQT

Only at that "/s1" location the player spawns with a vehicle. I can save the "/s1" location with any vehicle I want but I spawn each time with a NRG500. Should be so that I spawn with exactly that vehicle which I had when I saved that position. In the clip at pushing 1 I should spawn with that Infernus which stands next to the "/s1" position not with a new NRG500.

Do you mean you want to have fixed vehicle each time you load you location?

Yes, exactly. So the bikes aren't lie all over the spot.

Simple example again :p: At that spot it's a ramp 2 wallride 2 billboard. But when the player bails and spawns at the saved location of his runup the bikes are in the way. Maybe the player hits one bike that lies in the way and bail again. Then is one more bike there and blocks... It's annoying that they don't get despawned / automaticly destroyed after bailing.

bikeseverywherekn9.th.jpg

Link to comment

My script saves you current location and the vehicle you are in. It is not possible that you'll spawn at you saved location with a different vehicle!

Anyway, I'll take a look at this. Thanks for the report.

BTW, are you using new version which allows you to save location with Ctrl+number(1-9)?

EDIT:

Redownload, and try new version 1.2

Update:

* added: now set 100% health to vehicle after you load saved locations

* fixed: rotations now should work correctly

Link to comment
My script saves you current location and the vehicle you are in. It is not possible that you'll spawn at you saved location with a different vehicle!

I didn't mean that I save my location with a for example NRG500 and spawn then there with another vehicle. It just didn't work. The player spawned each time on foot. Just at /s1 he spawned with one and that one was each time a NRG500. But now it works! Thx again.

BTW, are you using new version which allows you to save location with Ctrl+number(1-9)?

Yes, I do. But when I save a location for example ctrl+1 and push alt+1 he spawns at the saved location. That is really that what I wanted! After a few spawns at that location the player doesn't spawn anymore at that location. He gets his last vehicle back but he doesn't spawn at that location. After a rejoin it works again for a few spawns.

Update:

* added: now set 100% health to vehicle after you load saved locations

* fixed: rotations now should work correctly

Both really helpful.

Doesn't work the full bike skill script for those spawned vehicles at the spawn at a location? The player bails more than often when I use vehicles which got spawned with your script.

Maybe would be good if you add a lil bit to the z axis at a spawn. When I drive with a car on my custom map and save a position it works. But when I leave my map and push then alt+4 for example to spawn at a location on my map the vehicle is stucked in the objects, it flips in the air or the player just bails. So would be good if the player spawns a lil bit it the air like 5ft or something of the saved location. In that time where the vehicle spawns the server has enough time to spawn the objects of the map.

Link to comment

You spawn with NRG-500, probably because you have bound 1 to "spawn nrg-500" or somthing.

Go to line 94 and change the value (0.5) if you want to spawn higher eg. 1.0 (units in-game are more like meters).

Link to comment
You spawn with NRG-500, probably because you have bound 1 to "spawn nrg-500" or somthing.

Yes, that was a mistake I made. I bounded it cuz first I didn't work but now everything is right.

Go to line 94 and change the value (0.5) if you want to spawn higher eg. 1.0 (units in-game are more like meters).

Works, thanks!

But now the problem is that the spawning doesn't work at each time. Sometimes it doesn't work that the player gets spawned at his saved locations.

Another lil clip which shows better:

http://www.megaupload.com/de/?d=NX03QHZ0

After rendering I saw a mistake in that clip. In the console stands 7 saved and i wrote "location 8 saved"... so all 7's should be 8's and all 8's should be 7's >_

Link to comment
Redownload updated version.

It should be OK now.

:| Watch again:

http://www.megaupload.com/de/?d=Y049D7SU

Sometimes it works really good! But there are still some failures... to getting the last vehicle by pushing alt+1-9 works without problems. But often he doesn't spawn at the saved location. The client just get spawned into his last vehicle and not to the location.

The other thing is that with the stats/skills. It runs the "maxstats" resource and it works. But if a client spawns at a location the skill is completly away. He bails at each lil driving mistake... like hitting another player -> bail.

Link to comment

I haven't experienced the bug that spawns me in different vehicle, yet.

What other resources do you run?

Does it happen (not spawning at the saved location) only with bikes now?

Try to drive a car and jump out then load the saved location with the car you just jumped out.

Link to comment
I haven't experienced the bug that spawns me in different vehicle, yet.

What other resources do you run?

resourcesdcdJPG.jpg

Does it happen (not spawning at the saved location) only with bikes now?

Try to drive a car and jump out then load the saved location with the car you just jumped out.

Same problem is with cars, planes, boats etc.

Link to comment

Okay, I installed a new server to test something. It's a completly new clean server without any modifications and so on. I only added your saveandload script to test it. It worked like on the other server. Sometimes just failures happen. I thought maybe on my real server that another resource made this error/blocked the saveandload resource. But it's still there. You said the code hasn't got any bugs I can't say it cuz I'm a 0 in scripting (lua). Dunno what to do now too.

But btw: Thanks a lot for doing this nice public location save & load script. It has a failure sometimes but better sometimes than having no script! :)

E: Answerd your PM.

Link to comment
  • 5 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...