Multiple filterscripts saving info
#1

I am trying to create a RP-Server.
I have a login system, but I want to change that login system to only save the username and password.
And I want to create another filterscript to save the adminrank and to add the commands there.
So it's basically I want to create mutliple filterscripts that has all it's own part of doing something.
Like 1 for the adminrank, 1 for the property owned, 1 for the cars. and so on.
How would I do that?
Reply
#2

You are asking to fail in scripting !....
If you do that i think that there won't anything work.
Reply
#3

Quote:
Originally Posted by xX4m4zingXx
Посмотреть сообщение
How would I do that?
I think a better question to ask yourself would be:
Why would I do that?
Reply
#4

I want to do this to create a bit of a structure in my gamemode.
I normally code java which is much nicer because everything is in different files.
Reply
#5

Well, i wouldn't recommend it to have a filterscript for each function, but if you really want it, you could use pvars and gvars to communicate values between gamemode and filterscripts. Although pvars has some advantages, it is much slower than regular variables.

https://sampwiki.blast.hk/wiki/Per-player_variable_system
Reply
#6

Better make includes rather than filterscripts
Reply
#7

Use a hooking method (ALS 7 or y_hooks or something) so you can write each module in a separate file. Then include everything in one filterscript and compile it. If you want to disable a module, comment it out and compile the script again. You could also create several different pre-compiled versions so you can load the one you want immediately.
Reply
#8

I also wanted my admin-system, housing and business systems, refuelling system and alot more inside a filterscript, and only hold the job/class systems inside my gamemode.
I didn't want to extract all those systems in case I want to create a new gamemode later on, so it was my plan to have all the systems I would need later inside a filterscript.

But it was too hard to maintain and both scripts needed to communicate too much between them.
Even some values needed to be shared and both scripts would eventually hold almost identical data to prevent too many CallRemoteFunction calls to transfer all the data all the time.

Even some commands needed to be split between both scripts (as I have alot of in-game editing commands), because I didn't want to make 2 separate commands to edit data about the same thing (vehicles for example).
The filterscript held fuel-tank size, fuel consumption, current fuel, and a few other values.
The gamemode held values such as cargobay size, the products inside the cargobay and also a few other values.
I had an /editv command, where I could adjust the fuel-values from inside the filterscript.
But because the data was split between both scripts, the gamemode would need an /editv2 command to modify data about the cargobay.
Admins would need to know which values are in which script and execute the proper command to access the right data, where the interface is nearly identical.

And making one command to edit everything would mean I had to move all data to one script and modify it there and make many CallRemoteFunction calls to transfer the data when the gamemode needed them.
Or share dialogs between both scripts to go back and forth between them, so the user doesn't even notice he's working with 2 scripts.

My head was nearly exploding while figuring out how I could make it as painless as possible for myself, keep the code simple, edit as much data as possible, get the best flexibility, have the ability to do whatever I wanted and whatever else.

I eventually decided to merge the filterscript and gamemode, since both scripts need eachother anyway to work properly, and because of this, I have to start from scratch (again), copying code and modify it to get it to work.
I was only making things harder then needed.
Reply
#9

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
I also wanted my admin-system, housing and business systems, refuelling system and alot more inside a filterscript, and only hold the job/class systems inside my gamemode.
I didn't want to extract all those systems in case I want to create a new gamemode later on, so it was my plan to have all the systems I would need later inside a filterscript.

But it was too hard to maintain and both scripts needed to communicate too much between them.
Even some values needed to be shared and both scripts would eventually hold almost identical data to prevent too many CallRemoteFunction calls to transfer all the data all the time.

Even some commands needed to be split between both scripts (as I have alot of in-game editing commands), because I didn't want to make 2 separate commands to edit data about the same thing (vehicles for example).
The filterscript held fuel-tank size, fuel consumption, current fuel, and a few other values.
The gamemode held values such as cargobay size, the products inside the cargobay and also a few other values.
I had an /editv command, where I could adjust the fuel-values from inside the filterscript.
But because the data was split between both scripts, the gamemode would need an /editv2 command to modify data about the cargobay.
Admins would need to know which values are in which script and execute the proper command to access the right data, where the interface is nearly identical.

And making one command to edit everything would mean I had to move all data to one script and modify it there and make many CallRemoteFunction calls to transfer the data when the gamemode needed them.
Or share dialogs between both scripts to go back and forth between them, so the user doesn't even notice he's working with 2 scripts.

My head was nearly exploding while figuring out how I could make it as painless as possible for myself, keep the code simple, edit as much data as possible, get the best flexibility, have the ability to do whatever I wanted and whatever else.

I eventually decided to merge the filterscript and gamemode, since both scripts need eachother anyway to work properly, and because of this, I have to start from scratch (again), copying code and modify it to get it to work.
I was only making things harder then needed.
Okay, I'm convinced. I'm going to put all the stuff into my gamemode.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)