WriteIniString Returns an error

Started by Mötley, Mar 05, 2016, 09:17 PM

Previous topic - Next topic

Danix

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 ^

KAKAN

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
oh no

Danix

Quote from: KAKAN on Mar 06, 2016, 11:58 AM
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
It's not about just giving him some code, you got to make sure he actually understands it.

Mötley

!!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

KAKAN

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
oh no

Mötley

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

Mötley

#21
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?

KAKAN

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
oh no

Stormeus

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.

Drake

Quote from: Stormeus on Mar 07, 2016, 09:54 AM
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.
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.

rww

Quote from: Drake on Mar 07, 2016, 10:04 AM
Quote from: Stormeus on Mar 07, 2016, 09:54 AM
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.
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


[/spoiler]
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

KAKAN

Quote from: Stormeus on Mar 07, 2016, 09:54 AM
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.
it's more reliable, yeah!:
Quote from: rwwpl on Mar 07, 2016, 11:13 AM
Quote from: Drake on Mar 07, 2016, 10:04 AM
Quote from: Stormeus on Mar 07, 2016, 09:54 AM
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.
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


[/spoiler]
Banning everyone :D
oh no

Drake

Quote from: KAKAN on Mar 07, 2016, 11:45 AM
Quote from: Stormeus on Mar 07, 2016, 09:54 AM
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.
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'?

Stormeus

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.

ysc3839

Quote from: rwwpl on Mar 07, 2016, 11:13 AM
Quote from: Drake on Mar 07, 2016, 10:04 AM
Quote from: Stormeus on Mar 07, 2016, 09:54 AM
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.
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


[/spoiler]
As I know, VCMP has 3 method to get UID. And it's possible to change the UID.