Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Forum Support

    3. Suggestions

[BETA] Szabo's Persistance Mod - Scripthook (LUA)


Szabo
 Share

Recommended Posts

Thank you guys.

 

I just updated both the persistance and car shop mods to work with the latest lua plugin v10 (get them on github).

 

I've used some code from GTAGeek123 but I had to change a lot of other things in order to preserve backward compatibility (e.g.: cars from old versions won't have the pink neon now) and also because v10 changed some things so some customizations were not being loaded correctly.

 

Everything should be working correctly by now, lemme know if it's not. Plates texts aren't being saved though. The latest lua plugin is returning a meaningless integer instead of a string. Other than that, I believe that at the moment all car data is being saved correctly.

 

Please note that I've changed the save path to a much simpler directory because it was not possible to use the users folders in Lua due non-ascii character incompatibility. You must manually create the folder in savepath though (and give permissions, what's not necessary in most machines I believe).

 

I'm still not able to reproduce the duplication issues. I'm going to try saving more airplanes and boats (I've never saved a single boat).

Link to comment
Share on other sites

GTAGeek123

Welcome back Szabo!

 

Your new script is working well (and was glad to be of assistance). However, some of the Planes colors still do not save (like the Bersa for example changes from its grey and yellow form to its green and black form and vice versa). I believe it may have to do with one or both of the below natives, but they did not work when I tried using them. Of course it is very possible that I may have missed something so you might have more luck in getting them to work.

 

Possible natives that affect Plane color:

GET_VEHICLE_COLOURS(Vehicle vehicle, int *col1, int *col2) // A19435F193E081AC 40D82D88
GET_VEHICLE_COLOUR_COMBINATION(Any p0) // 6A842D197F845D56 77AC1B4C

 

 

Also, I have verified that the duplication issue is still happening. In order to reproduce it stand near a saved bicycle (or possibly a motorcycle (have tested with a motorcycle yet)), plane, or boat (also have not tested yet, but assume it would occur based on reports by other users). Then reload the reload the LUA plugin (not the mod) using lctrl + r and the vehicle will duplicate.

 

headscript also provided the below response to me with a possible method to fix the duplication issue. However, it seems that the script is already in your mod, but not enabled. I tried enabling it, but the duplication issue still occurred.

 

Quote from headscript:

 

define a function called

modulename.unload

and destroy all vehicles which got spawned by the mod

 

 

Your script thaty is already in the mod, but not enabled:

 

function szabopersist.unload()
--NOTE: this is only used for development
-- print('unloading szabopersist')
-- unloadspawnedsavedcars()
-- disablepersistent()
end

 

 

I also noticed the mapkey I added in my last version isn't in your lasted version (which I can kind of understand why (crashes are bad)). However, I would like to know your thoughts on it and if you plan on implementing something like it in the future.

Link to comment
Share on other sites

Welcome back Szabo!

 

I also noticed the mapkey I added in my last version isn't in your lasted version (which I can kind of understand why (crashes are bad)). However, I would like to know your thoughts on it and if you plan on implementing something like it in the future.

 

Thank you GTAGeek123!

 

If the duplication problem occurs only when you reload the script with ctrl+r, then that's somewhat expected because that should only be used for development (along with the sdk). The 'release' version of the lua plugin doesn't have that hotkey afaik and for gameplay one should use the "reloadkey" which is the proper way to reload the saved cars data and reset their positions. I've commented the lines in the unload function because they stopped working properly in v9 (if memory serves) and honestly I don't see the point in maintaining that. It's inevitable that using ctrl+r will break things badly sooner or later.

 

Regarding the planes colors, I'm going to take a look.

 

The problem with the mapkey is that bad things will happen when you have many vehicles saved on the map. My idea is to only create blips for the locations of the vehicles that are far and not actually spawn them. Also, I'd like that to run automatically when you press the pause key, so when you open the map all the blips for the cars are always there (perhaps in a neutral color like gray) so you at least can position your waypoint there.

 

The problem is, I couldn't find a way to know when the game was paused. I've tried UI.IS_PAUSE_MENU_ACTIVE(), UI.GET_PAUSE_MENU_STATE(), CAM.IS_SCREEN_FADING_OUT(), CAM.IS_SCREEN_FADED_OUT() and none of them works. The plugin will stop ticking the mods when the game is paused. Perhaps headscript knows a way to somehow make an independent timed loop to check if the game is paused or a proper way to check that.

Link to comment
Share on other sites

GTAGeek123

I kind of thought the lctrl + r duplication issue was an expected result and I agree with you about the mapkey (it was never really meant to be a long term solution anyway).

 

The pause menu is definitely stopping the ticks (I can't even reload the plugin when in the pause menu).

 

Also, thanks in advance for looking into the Plane's colors.

Link to comment
Share on other sites

headscript

 

the problem is the ScriptHook V is pausing the Scriptthread once its in the Pause Menu (which is also default gta5 behaviour)

you could check right before and after if the pause menu key got pressed (hacky i know and i dont know if it works)

Link to comment
Share on other sites

†Tyranick†™

Welcome back szabo :). Glad to see you are back working on this again, please keep up the good work!

 

EDIT

 

Actually I have a problem...saving is not working, orange dots remain orange when trying to save the car, never goes green. Why might this be? The persistent cars work, the orange dots but I am unable to save any cars :\.

Edited by †Tyranick†™
Link to comment
Share on other sites

machine4578

i am having the same problem as Tyranick. the updated mod is not saving the cars. i am using the v10 LUA and have also tried it with no other mod installed.

 

and thanks alot for making this mod!

Edited by machine4578
Link to comment
Share on other sites

Thank you guys.

 

 

 

the problem is the ScriptHook V is pausing the Scriptthread once its in the Pause Menu (which is also default gta5 behaviour)

you could check right before and after if the pause menu key got pressed (hacky i know and i dont know if it works)

 

Yes, I could check the pause key but the behaviour is not consistent, for example, when polling the pause key, the following results may return:

 

0,1,0,0,(GAME PAUSES HERE)

0,1,1,0,(GAME PAUSES HERE)

0,0,1,1,(GAME PAUSES HERE)

 

So, the pause key state sometimes goes 'false' before the game actually pauses, so I can't simply run the stuff when the pause key is 'true' and undo it on the next tick that returns false because all of that will happen before the game actually pausing.

 

Of course the obvious solution is to run a filter and wait for some false returns before undoing the stuff, but that's going to happen when the game is not paused any longer and I don't know if that's going to have a negative impact somehow, what's very unlikely but possible... the only solution I can think of is showing the blips when the pause key is pressed (esc or pause button on controller) and waiting for a few 'false' returns to undo the blips, that may work properly but needs some testing.

 

Welcome back szabo :). Glad to see you are back working on this again, please keep up the good work!

 

EDIT

 

Actually I have a problem...saving is not working, orange dots remain orange when trying to save the car, never goes green. Why might this be? The persistent cars work, the orange dots but I am unable to save any cars :\.

i am having the same problem as Tyranick. the updated mod is not saving the cars. i am using the v10 LUA and have also tried it with no other mod installed.

 

and thanks alot for making this mod!

Did you guys configure your 'savepath'? I've changed it in the newer version for better compatibility with other windows versions and also usernames with non-ascii characters, the save path now is c:\szabo_mods and you must create that folder manually and place your old szabopersist file in there, or you can just configure your savepath to the one you were using previously if it was working for you. Please also note that c: may not be your main storage device.

 

The worst part of the mod is saving the data because it varies wildly across windows versions and also the user configurations (uac and that stuff). So far I couldn't find a decent way to retrieve a safe path from the system, perhaps c:\something is the best possible and perhaps in the future i'll figure a safe way to create that szabo_mods folder from the mod itself so it should work outta the box in most cases. Unfortunately lua doesn't include the batteries to create directory and it's necessary to run OS commands to do that.

 

Also, there's a problem with the blips, they were broken in v10 so I had to workaround the issues with an ugly fix, but that's going to be fixed in the future as new lua plugin versions arrive :).

Edited by Szabo
Link to comment
Share on other sites

machine4578

@Szabo

i was using you 0.1.07b(which was on github) because of gamepad support. and it was working fine for me(even with v10 LUA). so today i updated to your new release 0.0.1.08bWIP using the exact same save dir i was using for 0.1.07b. but the saving is not working anymore :(

Link to comment
Share on other sites

@Szabo

i was using you 0.1.07b(which was on github) because of gamepad support. and it was working fine for me(even with v10 LUA). so today i updated to your new release 0.0.1.08bWIP using the exact same save dir i was using for 0.1.07b. but the saving is not working anymore :(

I just updated the version on github, I was able to run it properly even without changing the default configs (windows 7 here)... here are some things you can try:

 

Try running it without changing any settings, you can try manually creating the c:\szabo_mods folder and giving full permissions just to make sure. try running (or reloading the mod with ctrl+r) and see if it creates a file szabopersist in there.

 

If that works, as a quick fix you can just copy the szabopersist from previous version over the szabopersist file the mod created (overwrite it). Copy the file don't move it so you have a backup just in case. The new standard path for the save files will be c:\szabo_mods because of lua limitations and windows permissions problems.

 

If that still doesn't work, perhaps you could paste the configs here.

Link to comment
Share on other sites

machine4578

i just tried the newest build on github, and i cant get the gamepad to work now too.. also its still not saving. i made a folder named "K:/GTAV GARAGE/". and it made the blank szabopersist file, and it also made a GTAV folder???

could the issue be now the "space" between words? just a fyi, i have had a space in the dir since your org release without issue.

Link to comment
Share on other sites

headscript

Thank you guys.

 

 

 

the problem is the ScriptHook V is pausing the Scriptthread once its in the Pause Menu (which is also default gta5 behaviour)

you could check right before and after if the pause menu key got pressed (hacky i know and i dont know if it works)

 

Yes, I could check the pause key but the behaviour is not consistent, for example, when polling the pause key, the following results may return:

 

0,1,0,0,(GAME PAUSES HERE)

0,1,1,0,(GAME PAUSES HERE)

0,0,1,1,(GAME PAUSES HERE)

 

So, the pause key state sometimes goes 'false' before the game actually pauses, so I can't simply run the stuff when the pause key is 'true' and undo it on the next tick that returns false because all of that will happen before the game actually pausing.

 

Of course the obvious solution is to run a filter and wait for some false returns before undoing the stuff, but that's going to happen when the game is not paused any longer and I don't know if that's going to have a negative impact somehow, what's very unlikely but possible... the only solution I can think of is showing the blips when the pause key is pressed (esc or pause button on controller) and waiting for a few 'false' returns to undo the blips, that may work properly but needs some testing.

 

Welcome back szabo :). Glad to see you are back working on this again, please keep up the good work!

 

EDIT

 

Actually I have a problem...saving is not working, orange dots remain orange when trying to save the car, never goes green. Why might this be? The persistent cars work, the orange dots but I am unable to save any cars :\.

i am having the same problem as Tyranick. the updated mod is not saving the cars. i am using the v10 LUA and have also tried it with no other mod installed.

 

and thanks alot for making this mod!

Did you guys configure your 'savepath'? I've changed it in the newer version for better compatibility with other windows versions and also usernames with non-ascii characters, the save path now is c:\szabo_mods and you must create that folder manually and place your old szabopersist file in there, or you can just configure your savepath to the one you were using previously if it was working for you. Please also note that c: may not be your main storage device.

 

The worst part of the mod is saving the data because it varies wildly across windows versions and also the user configurations (uac and that stuff). So far I couldn't find a decent way to retrieve a safe path from the system, perhaps c:\something is the best possible and perhaps in the future i'll figure a safe way to create that szabo_mods folder from the mod itself so it should work outta the box in most cases. Unfortunately lua doesn't include the batteries to create directory and it's necessary to run OS commands to do that.

 

Also, there's a problem with the blips, they were broken in v10 so I had to workaround the issues with an ugly fix, but that's going to be fixed in the future as new lua plugin versions arrive :).

for paths you could use "scripts/addins/szabo/persistance" or something like that i've used something like that for my bus driver mod already

edit: oh yeah sorry forgot that u cant edit files in C:/program files , didnt notice it because i have it on D:

Edited by headscript
Link to comment
Share on other sites

†Tyranick†™

I noticed for me it was because I was running an older version of LUA...lol /facepalm my bad! Works fine now :), well, as fine as usual, besides the colours messing around but yeah, it works and that's awesome for now :).

Edited by †Tyranick†™
Link to comment
Share on other sites

i just tried the newest build on github, and i cant get the gamepad to work now too.. also its still not saving. i made a folder named "K:/GTAV GARAGE/". and it made the blank szabopersist file, and it also made a GTAV folder???

could the issue be now the "space" between words? just a fyi, i have had a space in the dir since your org release without issue.

That's strange, I'm going to try reproducing the issue but I don't think the problem is the space. It's certainly not causing the controller to not work also. Do you have a C drive? Perhaps you could try running the latest mod as-is without changing its configs just to check if it's working properly. Hopefully it should create the necessary folders and files. Are you running the latest lua plugin?

 

for paths you could use "scripts/addins/szabo/persistance" or something like that i've used something like that for my bus driver mod already

I don't know if that's a safe path because generally people install the games under "Program Files" which is possibly one of the worst places to write stuff in Windows systems. I think when people copy their mods to the GTA V folder they usually do that as normal user but Windows will allow them to write stuff there as administrator (Windows Explorer asks for permissions) so I think generally the normal user doesn't have permission to write stuff in there unless they run the game as administrator.

 

As a matter of fact I never install games under "Program Files" but under C:/Games (or D:/Games). I never had a single problem with permissions :).

 

It seems a somewhat safe place would be the "AppData/Roaming" (var %appdata%) but unfortunately that is located under the user folder. To make things worse there's the Windows localization of common folders (I don't know if it's still like that after XP) so for example the "C:\Users\Public" folder are not present in other languages since they are translated, for example: C:\Benutzer\Öffentlich, so I'd need to figure out a way to get those system folders what's a pain in the arse.

 

The problem is the roots of the operating system, in my opinion it was badly engineered in terms of permissions from the beginning so the average user is not used to permissions. They are necessary of course and the MS guys took a long time to realize that, but Windows just over complicates the whole shebang. First thing I'm gonna say to Cortana probably is gonna be: Damn madam, just chmod 777 those damn folders for me :). I don't think she's going to make me a sandwich though, not even using sudo. Sudoers file misconfiguration I suppose :p. (I know that <1% are going to get this but anyway)

 

They say chmod 777 is plain bad practice and I agree but as a Windows user I miss that so much.

Edited by Szabo
  • Like 1
Link to comment
Share on other sites

reddevilthp

 

i just tried the newest build on github, and i cant get the gamepad to work now too.. also its still not saving. i made a folder named "K:/GTAV GARAGE/". and it made the blank szabopersist file, and it also made a GTAV folder???

could the issue be now the "space" between words? just a fyi, i have had a space in the dir since your org release without issue.

That's strange, I'm going to try reproducing the issue but I don't think the problem is the space. It's certainly not causing the controller to not work also. Do you have a C drive? Perhaps you could try running the latest mod as-is without changing its configs just to check if it's working properly. Hopefully it should create the necessary folders and files. Are you running the latest lua plugin?

 

for paths you could use "scripts/addins/szabo/persistance" or something like that i've used something like that for my bus driver mod already

I don't know if that's a safe path because generally people install the games under "Program Files" which is possibly one of the worst places to write stuff in Windows systems. I think when people copy their mods to the GTA V folder they usually do that as normal user but Windows will allow them to write stuff there as administrator (Windows Explorer asks for permissions) so I think generally the normal user doesn't have permission to write stuff in there unless they run the game as administrator.

 

What about using "%userprofile%/szabopersist" ? Shouldnt that bypass the non-standard character limitations?

 

And im pretty sure cortana has been coded to revert your account from administrator to guest if she (it?) detects 777 or rwx in any string. So cortana, whats the capacity of a boeing 777? BOOM guest privileges!

 

Edit: creating a folder in %userprofile% MIGHT need permission but %userprofile%/documents/szabo shouldnt need permissions

Edited by reddevilthp
Link to comment
Share on other sites

machine4578

@Szabo

i am using the v10 LUA.asi(crc 887BA306), do we need to use the SDK version?

Edited by machine4578
Link to comment
Share on other sites

What about using "%userprofile%/szabopersist" ? Shouldnt that bypass the non-standard character limitations?

No, you can't use environment vars 'in-string' as if you were using the command prompt directly afaik. I'd need to get the variables directly and then insert them into the path string, but that brings us to the main problem of non-ascii characters.

 

And im pretty sure cortana has been coded to revert your account from administrator to guest if she (it?) detects 777 or rwx in any string. So cortana, whats the capacity of a boeing 777? BOOM guest privileges!

High-quality MS engineering as usual.

 

 

@Szabo

i am using the v10 LUA.asi(crc 887BA306), do we need to use the SDK version?

No, you don't need to use the SDK version but that surely helps debugging since it will print some useful data in a console.

Try using the latest lua plugin (v10) and the default settings of the script. If you're on windows 7, have a C drive, and your user has admin rights, it should create all the necessary stuff automatically.

  • Like 1
Link to comment
Share on other sites

Szabo i'm glad You here :)

Question: why F4 key reloading Your mod (using 0.1.06b) and duplicating saved bicyles and every time when I pressing F4 for Native Trainer clutter of bicycles is increasing

Sorry for my english :)

Edited by matinez
Link to comment
Share on other sites

Szabo i'm glad You here :)

Question: why F4 key reloading Your mod (using 0.1.06b) and duplicating saved bicyles and every time when I pressing F4 for Native Trainer clutter of bicycles is increasing

Sorry for my english :)

Thank you.

That's because you're using lua plugin v8 which is way outdated. You can either use the lua plugin v9 (aka the "Normal" version) with the 'stable release' of my mod, or you could also use the latest version of my mod (on github) which is highly improved and the lua plugin v10.

Link to comment
Share on other sites

 

Szabo i'm glad You here :)

Question: why F4 key reloading Your mod (using 0.1.06b) and duplicating saved bicyles and every time when I pressing F4 for Native Trainer clutter of bicycles is increasing

Sorry for my english :)

Thank you.

That's because you're using lua plugin v8 which is way outdated. You can either use the lua plugin v9 (aka the "Normal" version) with the 'stable release' of my mod, or you could also use the latest version of my mod (on github) which is highly improved and the lua plugin v10.

 

OOOOOh thank You, thank You, thank You :lol:

Link to comment
Share on other sites

machine4578

thanks Szabo for the mod, but no matter what i try your updated mod does NOT work properly, it never saves and the gamepad functions stopped working. i guess i will have to be happy using your org beta 0.1.07b :(

 

and yes i have v10lua and tried using all defalt funtions with only this mod installed, but still the controller wont work and it wont save. i put back the 0.1.07b and it all works normally(even with v10lua).

Edited by machine4578
Link to comment
Share on other sites

sadly saving no longer works for me on both geek's and your newest version, which is quite odd cause it worked just fine before - I'm guessing LUA autoupdate screwed it up? I updated LUA to newest version just to make sure, same problem. The szabopersist.sav actually exists but it's blank, I'll try launching the game in admin mode....

edit: admin mode doesn't fix anything....by the way if it helps when pressing num 0 I just get a second-two second freeze then nothing happens once it's gone...

edit2: I believe newest lua just went back to original booleans / commands whatever it's called, because now your newest version of car shop mod has flashing menu all over again....interesting

edit3: after downgrading to non SDK v10 lua, car shop works fine (no menu flicker) but I still can't save cars

Edited by lolleroz
Link to comment
Share on other sites

Works fine for me. I had to remap the buttons as they were being used by other mods, and thus weren't activating the mod correctly. Also I made sure the path was changed to an existing folder. Also, disabling LUA scripts in Bilago's mod manager will prevent the loading of other LUA mods, so either delete the mods you dont want, or enable them.

Link to comment
Share on other sites

headscript

Works fine for me. I had to remap the buttons as they were being used by other mods, and thus weren't activating the mod correctly. Also I made sure the path was changed to an existing folder. Also, disabling LUA scripts in Bilago's mod manager will prevent the loading of other LUA mods, so either delete the mods you dont want, or enable them.

disabling LUA scripts in Bilago's mod manager will prevent the loading of other LUA mods

thats fixed on the version on github

Link to comment
Share on other sites

 

Works fine for me. I had to remap the buttons as they were being used by other mods, and thus weren't activating the mod correctly. Also I made sure the path was changed to an existing folder. Also, disabling LUA scripts in Bilago's mod manager will prevent the loading of other LUA mods, so either delete the mods you dont want, or enable them.

disabling LUA scripts in Bilago's mod manager will prevent the loading of other LUA mods

thats fixed on the version on github

 

Thanks. Still, there will be quite a few people having the issue until everyone updates to the next version.

Link to comment
Share on other sites

headscript

 

 

Works fine for me. I had to remap the buttons as they were being used by other mods, and thus weren't activating the mod correctly. Also I made sure the path was changed to an existing folder. Also, disabling LUA scripts in Bilago's mod manager will prevent the loading of other LUA mods, so either delete the mods you dont want, or enable them.

disabling LUA scripts in Bilago's mod manager will prevent the loading of other LUA mods

thats fixed on the version on github

 

Thanks. Still, there will be quite a few people having the issue until everyone updates to the next version.

 

yep this issue will be until i updated the plugin, also i dont even know many people use bilagos mod manager

Link to comment
Share on other sites

Could you guys link me the lua version you're using? looks like I'm missing something here lol....

Link to comment
Share on other sites

Holy sh*t headscript! We really need some 'stable' v10 versions so we can point the users to the same version of the lua plugin we (the devs) are using... at the moment pretty much every user is using a different plugin version (cause of the auto-build) and it seems nativedb gets screwed often, so this is a recipe for the disaster :).

 

I'm going to install the latest v10 version and update my mod momentarily guys.

Link to comment
Share on other sites

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
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.