(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FGobasAr.png&hash=019d65e8504da17b41c691a69433371ebb497e3b)
script path
const Path = "scripts/Main/";
Functions
function RegisterPlayer( Player, Text ) {
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "Name", Player.Name );
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "IP", Player.IP );
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "Password", Text );
WriteIniInteger( Path + "Data/" + Player.Name + ".ini", "Account", "Level", 1 );
WriteIniInteger( Path + "Data/" + "Logs.ini", "Active", Player.Name , 1 );
MessagePlayer("You have been registered", Player );
}
function LogPlayer( Player, Text ) {
ReadIniInteger( Path + "Data/" + Player.Name + ".ini", "Account", "Level" );
WriteIniInteger( Path + "Data/" + "Logs.ini", "Active", Player.Name , 1 );
MessagePlayer("You have been logged in", Player, Green );
}
CMD
function onPlayerCommand( Player, Cmd, Text )
{
if ( Player.IsSpawned ) {
switch( Cmd ) {
case "register": case"reg":
{
local Level = ReadIniInteger( Path + "Data/" + Player.Name + ".ini", "Account", "Level" );
if ( Text ) {
if ( Level != 1 ) {
RegisterPlayer( Player, Text );
}
else {
MessagePlayer("You are registered!", Player );
}
}
else {
MessagePlayer("Register your account: /register [password]", Player );
}
break;
}
case "login": case"log":
{
local LoggedIn = ReadIniInteger( Path + "Data/" + "Logs.ini", "Active", Player.Name );
if( Text ) {
if( LoggedIn != 1 )
{
LogPlayer( Player, Text );
}
else {
MessagePlayer("You are logged in", Player );
}
}
else {
MessagePlayer("Login your account: /login [password]", Player );
}
break;
}
What is Wrong?
You really don't want to go down that road. You have to look a bit through the crap in the scripting section but eventually you can find better alternatives and examples (http://forum.vc-mp.org/?topic=224.0). Now you see why I hate crap snippets.
EDIT: I forgot to say but your server will be banned now that we know you don't encrypt passwords.
I understand....
I have done so many searches and nothing[ That is why i finally posted ]
Maybe my issue is due to the file saves as the Player.name instead of a file that is manually already created etc.
I will have a WHIRLPOOL i just wanted to get the script created i have not gone that far this is only beta build ;p
If you will be storing player data in ini files you'll get a directory with over 10k ini files over time.. not recommendable. Also encrypt your passwords
does the built in function whirlpool work? sorry i literally just threw this together
function Password ( Player, szParams, numArgs ) {
if ( Account [ Player.ID ].Logged == true ) {
if ( szParams ) {
if ( [some func to get the pass] ( Player ) == WHIRLPOOL ( GetTok ( szParams, " ", 1 ) ) ) {
[some func to get the pass] ( Player, GetTok ( szParams, " ", 2, numArgs ) );
MessagePlayer ( "New password: " + szParams, Player );
return;
}
There's a hashing (https://bitbucket.org/stormeus/0.4-hashing-algorithms/downloads) module that includes several hashing algorithms (http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Functions#Hashing_Functions_.28In_the_.22Hashing.22_plugin.29).
Quote from: S.L.C on Mar 05, 2016, 09:53 PMThere's a hashing (https://bitbucket.org/stormeus/0.4-hashing-algorithms/downloads) module that includes several hashing algorithms (http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Functions#Hashing_Functions_.28In_the_.22Hashing.22_plugin.29).
Thanks so much. now i just want to focus on my system to work then work in encrypted passwords
Let me repeat. INI plugin is messed up and it will not store/write data if the INI does not exist already. It will not create it and instead throw errors.
Quote from: Doom_Kill3R on Mar 06, 2016, 02:31 AMLet me repeat. INI plugin is messed up and it will not store/write data if the INI does not exist already. It will not create it and instead throw errors.
Never picked that up, but thats what i was thinking in the server.exe as it made no sense. As soon as i made this post I had to clock in and go to work.
I will separate the data to Weapons ini etc..
BUT!![I like to script and waste time sometimes and find fixes :D] What if I used another method to create the file? when it creates the Player.Name there is a Timer to ensure it is not messing up(creating file/saving/writing/etc) all at the same time.
Maybe use hashes to create the file?, Then say a 5 sec timer then WriteIniInteger? using the other method to create the file then get that file and write to it?
Or if this gives you another idea on a method like this let me know.
Your efforts will be in vain unfortunately.
Well all I wanted to do is script. Get Creative. I do not really care for the account system that S.L.C mentioned so..
I will either find another project eles where [NOT VC:MP]. As i can hardly add a Police system with stats, FireFighter system as well as Paramedic along side, and The TrashMaster [Trash Missions] as well as helicopter races and boat races, I need to do a lot of call back functions with saving the data, I need a lot of normal Squirrel scripting capability's as well. Mute player with time stamps etc.
Starting to Consider Maybe I am better off going Back to Liberty Unleashed and Continue my RPG server. At least I can Build the way I Really need to support the server. This is Rather Depressing. Was hoping to find ways to Bring in more players.
unless that plugin is fixed, I have no intentions to come back and script for this MultiPlayer.
:/
Nice meeting The VC:MP community
Quote from: Mr_Motley on Mar 06, 2016, 06:27 AMunless that plugin is fixed, I have no intentions to come back and script for this MultiPlayer.
Good bye! You would never return back since the INI plugin will never get fixed. Don't you see the message on startup? "Loaded deprecated_ini"
It's already deprecated. You should stick to either SQLite of mysql. And also, you can fix the errors yourself, you know?
For that fix, since I don't know the INI format, I'll use vargv
function WriteIniString( path, ... ){
local f = file(path,"a");
f.close();
::WriteIniString(path, vargv[ 0 ], vargv[ 1 ], vargv[ 2 ]);
}
Untested, but it should work if you don't try to bitch with it
I will play with that code sometime.
I see the error as it is trying to open a file when instead I am trying to create the file then write to it...
Unfortunately I have lost my eagered interest. I will have to give this time then come back when i am ready.
Nobody is stopping you from being creative. Be creative. What I have learned here is that without struggling and giving a worth of time you can't create a server which is 'different' from others. I myself created a server which took alot of struggle and is doing much more than what VCMP provides. You have to work hard for it.
Giving up just because you can't use an INI plugin is stupid. Even though INIs are SLOWER than SQLIte and MySQL so why not go for it? Why not learn further? The choice is yours. I or anyone can't stop you from doing so but atleast I'll tell you before you leave regretting.
It's sending an error because the file you are trying to write on does not exist, you have to create it yourself. Since the ini plugin does not have a function to create you have to use the file function.
function RegisterPlayer( Player, Text ) {
file(Path + "Data/" + Player.Name + ".ini","wb+");
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "Name", Player.Name );
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "IP", Player.IP );
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "Password", Text );
WriteIniInteger( Path + "Data/" + Player.Name + ".ini", "Account", "Level", 1 );
WriteIniInteger( Path + "Data/" + "Logs.ini", "Active", Player.Name , 1 );
MessagePlayer("You have been registered", Player );
}
That should work, although I haven't tested it ^
Quote from: Danix on Mar 06, 2016, 11:53 AMIt's sending an error because the file you are trying to write on does not exist, you have to create it yourself. Since the ini plugin does not have a function to create you have to use the file function.
function RegisterPlayer( Player, Text ) {
file(Path + "Data/" + Player.Name + ".ini","wb+");
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "Name", Player.Name );
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "IP", Player.IP );
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "Password", Text );
WriteIniInteger( Path + "Data/" + Player.Name + ".ini", "Account", "Level", 1 );
WriteIniInteger( Path + "Data/" + "Logs.ini", "Active", Player.Name , 1 );
MessagePlayer("You have been registered", Player );
}
That should work, although I haven't tested it ^
I made the same function -_-
And also, a+ will work instead of wb+ and you forgot to close the file
Quote from: KAKAN on Mar 06, 2016, 11:58 AMQuote from: Danix on Mar 06, 2016, 11:53 AMIt's sending an error because the file you are trying to write on does not exist, you have to create it yourself. Since the ini plugin does not have a function to create you have to use the file function.
function RegisterPlayer( Player, Text ) {
file(Path + "Data/" + Player.Name + ".ini","wb+");
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "Name", Player.Name );
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "IP", Player.IP );
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "Password", Text );
WriteIniInteger( Path + "Data/" + Player.Name + ".ini", "Account", "Level", 1 );
WriteIniInteger( Path + "Data/" + "Logs.ini", "Active", Player.Name , 1 );
MessagePlayer("You have been registered", Player );
}
That should work, although I haven't tested it ^
I made the same function -_-
And also, a+ will work instead of wb+ and you forgot to close the file
It's not about just giving him some code, you got to make sure he actually understands it.
!!Now that is what I am talking about Danix!! Anything is possible in scripting. as well as Thanks KAKAN.
I will test after work and if it fails I will stress test/modify that code.
If it works I will report it and the code should be added to snippets or something for others stuck with ini's
Quote from: Mr_Motley on Mar 06, 2016, 01:22 PMIf it works I will report it and the code should be added to snippets or something for others stuck with ini's
Oh well, you know what? No one uses INI's these days. I don't mean they're bad. But, INI's should
not be used for accounts, since it would be slower if there are too many queires( dunno what shall I say ) in a short period of time
They're used for mostly options, as they can be readed by humans easily and can be modified easily too. Even JSON and XML are better than INI
All I need is to script. maybe get a module/plugin to ban a UUID, subnet. That is really it.
Anything else can be scripted in the base script.
Some prefer to script this way.
I am one of these Scripter.
I really hope the code works as I am eager to script my butt off :D
You Guys are Amazing you Fixed it. added
function RegisterPlayer( Player, Text ) {
file(Path + "Data/" + Player.Name + ".ini","wb+");
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "Name", Player.Name );
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "IP", Player.IP );
WriteIniString( Path + "Data/" + Player.Name + ".ini", "Account", "Password", WHIRLPOOL ( Text ) );
WriteIniInteger( Path + "Data/" + Player.Name + ".ini", "Account", "Level", 1 );
WriteIniInteger( Path + "Data/" + "Logs.ini", "Active", Player.Name , 1 );
MessagePlayer("You have been registered", Player );
}
Now Password Encrypt :D Awesome so many things needed to be done now. Fully loaded account system etc,
WHIRLPOOL
Is pretty cool i typed pass as a Password and this is what it did
BA6C064DFDB1B7B4938BF82585A8332C89270303B6D75007F0B25FEFFE33B90BD34D3732ACF4BE708C85708C39FF6C28B87235663238B8FBFE2C4439258CC883
Anything eles I need to do to know to not get my server banned?
Great!
Quote from: Mr_Motley on Mar 06, 2016, 10:46 PMAnything eles I need to do to know to not get my server banned?
No, not now at-least. And also, if you want to ban the UUID, use player.UID aka player.UniqueID
or player.UID2 aka player.UniqueID2
Quote from: KAKAN on Mar 07, 2016, 07:54 AMGreat!
Quote from: Mr_Motley on Mar 06, 2016, 10:46 PMAnything eles I need to do to know to not get my server banned?
No, not now at-least. And also, if you want to ban the UUID, use player.UID aka player.UniqueID or player.UID2 aka player.UniqueID2
UID2 is more reliable than UID.
Quote from: Stormeus on Mar 07, 2016, 09:54 AMQuote from: KAKAN on Mar 07, 2016, 07:54 AMGreat!
Quote from: Mr_Motley on Mar 06, 2016, 10:46 PMAnything eles I need to do to know to not get my server banned?
No, not now at-least. And also, if you want to ban the UUID, use player.UID aka player.UniqueID or player.UID2 aka player.UniqueID2
UID2 is more reliable than UID.
is it possible that the UID2 is same for more than one player? I am asking this because I had this problem when I was using it while testing. Me and Kelvin had same UID2 but different UID.
Quote from: Drake on Mar 07, 2016, 10:04 AMQuote from: Stormeus on Mar 07, 2016, 09:54 AMQuote from: KAKAN on Mar 07, 2016, 07:54 AMGreat!
Quote from: Mr_Motley on Mar 06, 2016, 10:46 PMAnything eles I need to do to know to not get my server banned?
No, not now at-least. And also, if you want to ban the UUID, use player.UID aka player.UniqueID or player.UID2 aka player.UniqueID2
UID2 is more reliable than UID.
is it possible that the UID2 is same for more than one player? I am asking this because I had this problem when I was using it while testing. Me and Kelvin had same UID2 but different UID.
Yeah, many players have the same UID2.
[spoiler]
From 174 to 325
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fs10.ifotos.pl%2Fimg%2Fuid2png_swxxsnq.png&hash=ebe14086e2d6b9927c2e43b6d903f3aeef5deb55)
[/spoiler]
Quote from: Stormeus on Mar 07, 2016, 09:54 AMQuote from: KAKAN on Mar 07, 2016, 07:54 AMGreat!
Quote from: Mr_Motley on Mar 06, 2016, 10:46 PMAnything eles I need to do to know to not get my server banned?
No, not now at-least. And also, if you want to ban the UUID, use player.UID aka player.UniqueID or player.UID2 aka player.UniqueID2
UID2 is more reliable than UID.
it's more reliable, yeah!:
Quote from: rwwpl on Mar 07, 2016, 11:13 AMQuote from: Drake on Mar 07, 2016, 10:04 AMQuote from: Stormeus on Mar 07, 2016, 09:54 AMQuote from: KAKAN on Mar 07, 2016, 07:54 AMGreat!
Quote from: Mr_Motley on Mar 06, 2016, 10:46 PMAnything eles I need to do to know to not get my server banned?
No, not now at-least. And also, if you want to ban the UUID, use player.UID aka player.UniqueID or player.UID2 aka player.UniqueID2
UID2 is more reliable than UID.
is it possible that the UID2 is same for more than one player? I am asking this because I had this problem when I was using it while testing. Me and Kelvin had same UID2 but different UID.
Yeah, many players have the same UID2.
[spoiler]
From 174 to 325
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fs10.ifotos.pl%2Fimg%2Fuid2png_swxxsnq.png&hash=ebe14086e2d6b9927c2e43b6d903f3aeef5deb55)
[/spoiler]
Banning everyone :D
Quote from: KAKAN on Mar 07, 2016, 11:45 AMQuote from: Stormeus on Mar 07, 2016, 09:54 AMQuote from: KAKAN on Mar 07, 2016, 07:54 AMGreat!
Quote from: Mr_Motley on Mar 06, 2016, 10:46 PMAnything eles I need to do to know to not get my server banned?
No, not now at-least. And also, if you want to ban the UUID, use player.UID aka player.UniqueID or player.UID2 aka player.UniqueID2
UID2 is more reliable than UID.
it's more reliable, yeah!:
Well, if the UID2 come out to be same for many players, how can you say that it's more 'reliable'?
It was supposed to be more tamperproof than UID1 and worked fine in testing but a search of the forum shows absolutely nobody reported that there were issues with it until now, so thanks. I'll be looking into it now that I know there's definitely a problem.
Quote from: rwwpl on Mar 07, 2016, 11:13 AMQuote from: Drake on Mar 07, 2016, 10:04 AMQuote from: Stormeus on Mar 07, 2016, 09:54 AMQuote from: KAKAN on Mar 07, 2016, 07:54 AMGreat!
Quote from: Mr_Motley on Mar 06, 2016, 10:46 PMAnything eles I need to do to know to not get my server banned?
No, not now at-least. And also, if you want to ban the UUID, use player.UID aka player.UniqueID or player.UID2 aka player.UniqueID2
UID2 is more reliable than UID.
is it possible that the UID2 is same for more than one player? I am asking this because I had this problem when I was using it while testing. Me and Kelvin had same UID2 but different UID.
Yeah, many players have the same UID2.
[spoiler]
From 174 to 325
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fs10.ifotos.pl%2Fimg%2Fuid2png_swxxsnq.png&hash=ebe14086e2d6b9927c2e43b6d903f3aeef5deb55)
[/spoiler]
As I know, VCMP has 3 method to get UID. And it's possible to change the UID.
^^^^^ GUID is also a Terrible ban as even I know how to change GUID in 2 sec's
I have always liked this module for Mine-craft Not sure if it is possible to work with VC:MP
http://dev.bukkit.org/bukkit-plugins/maxbans/
I had thought about this before. If you could find a way to force a player to link his/her Account to a website maybe
vc-mp.org then it's possible you could do web banning to the players account. cookies/flag there linked account etc. alow the player 5 logins before locking them out of an account. This can be useful as the site can show ip changes etc. but what do I know...
\/\/\/\/
now
I need to Write Float values. Example
WriteIniFloat
But tried even though it is not a VC:MP function still didn't work.
I have tried the rest of the ini functions on Rage "LOL" but all returned errors. I also tried other methods.
This is the only way that makes any sense
Example;
local pos = player.Pos;
WriteIniFloat( Path + "Data/"+player.Name+".ini", "Account", "X", pos.x);
WriteIniFloat( Path + "Data/"+player.Name+".ini", "Account", "Y", pos.y);
WriteIniFloat( Path + "Data/"+player.Name+".ini", "Account", "Z", pos.z);
But unless there is a way to remove the spawn screen on Death, Then send to the nearest Scripted Pos[ efforts are pointless on a position database ],
If i could write these Pos :D It would be even more nice to disable Ctrl to spawn from spawn screen, if registered and logged returns false,
And a Function on login if (!player.IsSpawned) player.IsSpawn();
Anything possible? If not, I will just add //
and figure something out in a later time..
Also MD5 and WHIRLPOOL make a Password read as incorrect. :/
I tested by removing both where they dont encrypt, The login system is just fine [So not the login system{was my First Thought} just possible more scripting needed?] Re added and attempting other ways
^ Well of course.. I already added support for that in my base script. But in general anyone can bypass any ban does not matter what ban it is.
Easier to ban say a Facebook id then anything(if account is forced to be linked{legit accounts} )
______________________________________________________________________________________________________
But I still need help as this topic has crashed its course, I Basically need a function from the wiki like
MessagePlayer( "Your current Password is "+GetPasswordAC, Player );
To use to read encrypted passwords as i cant get My accounting System to Read the real password(wants the encrypted one instead)
I prefer to find a fix, If not I will build from scratch a Query Password system, If password is correct
LoadAccount(player);
My ini accounts.
But i want to store everything in the players account as it is more cleaner.
Only Thing i fear with needing to encrypt passwords is "I believe some one could just use packet sniffers to view network traffic, and possible use Cain and Able to get the players passwords as they login to there accounts"
So it is possible to have security Flaws. But of course i am 99.9% possible false as I am no hacker( I just like scripting )
Don't use ini. If you use Windows OS, maybe I can make your server bugged by using some reserved file name as player name. As I know this method can make SA:MP server crash.
Quote from: ysc3839 on Mar 08, 2016, 05:35 PMDon't use ini. If you use Windows OS, maybe I can make your server bugged by using some reserved file name as player name. As I know this method can make SA:MP server crash.
I am already at 3679 script lines(just on account system), Maybe you could Help me with bug maintenance ??? or something?
Maybe with something like
if ( player.Name == "[File Names etc]" )
{
MessagePlayer ( "File Hacks! Please Quit and Use a Proper name", player );
KickPlayer( player );
return 0;
}
^Possible run this check on scriptload
Quote from: vito on Mar 08, 2016, 06:36 PMQuote from: Mr_Motley on Mar 08, 2016, 04:47 PMOnly Thing i fear with needing to encrypt passwords is "I believe some one could just use packet sniffers to view network traffic, and possible use Cain and Able to get the players passwords as they login to there accounts"
Hashing of passwords is on server-side, so it will not help with sniffers. Hashing of passwords is needed for case if your server will be hacked and database will be stolen. Mainly it is needed for save emails of users who have same password for everything. Specific salt for each account is needed btw to keep hard way for hacker.
Thanks for that Info. Some of these Methods are Majorly built in LU so it is different for me to manually script them( Very Interesting experience to learn ) I was just thinking someone can view the text as it is entered of after with packet sniffers and the aid of cain and able..
I still can not find a way to check the real password on login( the real password not the encrypted text) I have attempted many locals, strings, etc. Can not find anything , I prefer to fix this instead of using a Query Password system then load account data "ini's"
Nothing on VC wiki tells how to read encrypted text. only Query Passwords..
Once text is hashed, it is generally unrecoverable without brute force attacks. If someone tries to log in, you wouldn't try to "decrypt" their password, you'd hash the text they give you and see if the "encrypted" texts match.
Quote from: Stormeus on Mar 08, 2016, 06:50 PMOnce text is hashed, it is generally unrecoverable without brute force attacks. If someone tries to log in, you wouldn't try to "decrypt" their password, you'd hash the text they give you and see if the "encrypted" texts match.
Thank you! I am Mind F'd Truly yet badly. Can not find examples/snipets/or anything in the script help either, as well as in the wiki,
How would I Hash the text they give( not on register, I am referring to get the password)?,as in Is this on CMD login?, Not on the function ReadIniInteger(loadaccount)? I like WHIRLPOOL, I guess i should use another method.
I will have to Think Clearly a little more clearly on this.. Or receive another Great response as you gave me Stormeus.,
Once again Thank you!!
If there is no examples of any type, if i can be told where this is located that will do the job, i will script it in.
LOL Fixed Topic Locked I think Writing now 3679++ lines in two days running checks etc messed up my brain Really bad, something so simple ??? xD LOL!!