How to use IniParser functions?

Started by NicusorN5, May 30, 2016, 06:38 PM

Previous topic - Next topic

NicusorN5

How to use IniParser functions?I looked for them one entire day,but i found nothing.

KAKAN

oh no

NicusorN5

#2
Also , other question,where i can find it's lastest version? :EDIT: The version compatible with 0.4rel004

Mötley

WriteIniNumber is what you would use to write float values, example

 
  WriteIniNumber("Accounts/"+Player.Name+".json", "account", "x", Player.Pos.x);
  WriteIniNumber("Accounts/"+Player.Name+".json", "account", "y", Player.Pos.y);
  WriteIniNumber("Accounts/"+Player.Name+".json", "account", "z", Player.Pos.z);

this would be used for giving a players position upon there next login( theres more to giving the player there position :P )
Anything else you need help on just message back hear.

KAKAN

Quote from: Mötley on May 30, 2016, 07:30 PMWriteIniNumber is what you would use to write float values, example

 
  WriteIniNumber("Accounts/"+Player.Name+".json", "account", "x", Player.Pos.x);
  WriteIniNumber("Accounts/"+Player.Name+".json", "account", "y", Player.Pos.y);
  WriteIniNumber("Accounts/"+Player.Name+".json", "account", "z", Player.Pos.z);

this would be used for giving a players position upon there next login( theres more to giving the player there position :P )
Anything else you need help on just message back hear.
.json is not INI's format.
Use .ini, that makes things easier to understand.
oh no

Mötley

Quote from: KAKAN on May 31, 2016, 11:29 AM
Quote from: Mötley on May 30, 2016, 07:30 PMWriteIniNumber is what you would use to write float values, example

 
  WriteIniNumber("Accounts/"+Player.Name+".json", "account", "x", Player.Pos.x);
  WriteIniNumber("Accounts/"+Player.Name+".json", "account", "y", Player.Pos.y);
  WriteIniNumber("Accounts/"+Player.Name+".json", "account", "z", Player.Pos.z);

this would be used for giving a players position upon there next login( theres more to giving the player there position :P )
Anything else you need help on just message back hear.
.json is not INI's format.
Use .ini, that makes things easier to understand.

Woops .. was a copy and paste

NicusorN5

I tried them , WriteIniString don't works, idk why!
function onPlayerJoin( player )
{
MessagePlayer("[#00ff00]Welcome to Romania Roleplay!",player);
MessagePlayer("[#00ff00]Use /help for commands",player);
MessagePlayer("[#00ff00]Use /updates for the lastest news!",player);
if (ReadIniString( "PlayerIP.ini", "IP", player.Name ) == player.IP)
{
WriteIniString("PlayerIP.ini","IP",player,player.IP);
MessagePlayer("[#00ff00]You autologged!Welcome!",player);
}
else
{
MessagePlayer("[#ff0000]You must create a account!",player);
MessagePlayer("[#ff0000]Use /register !",player)
}
}
function onPlayerCommand(player,cmd,text)
{
if (cmd =="register")
{
if (!text) MessagePlayer("[#ff0000]Use /register <password>");
else
{
local PLIP = player.IP;
WriteIniString("PlayerIP.ini","IP",player.Name,PLIP);
Message("[#00ff00]Player "+player.Name+" made a account!")
}
}
return 1;
}

Mötley

WriteIniString("PlayerIP.ini", "account", "ip", player.IP);
Missed a bracket. I can attempt to copy and paste a random save log for players as well reading the data but my format is different, similar to what KAKAN said. But will give you a Idea of how to fully use ini

EK.IceFlake

Quote from: NicusorN5 on May 31, 2016, 06:57 PMI tried them , WriteIniString don't works, idk why!
function onPlayerJoin( player )
{
MessagePlayer("[#00ff00]Welcome to Romania Roleplay!",player);
MessagePlayer("[#00ff00]Use /help for commands",player);
MessagePlayer("[#00ff00]Use /updates for the lastest news!",player);
if (ReadIniString( "PlayerIP.ini", "IP", player.Name ) == player.IP)
{
WriteIniString("PlayerIP.ini","IP",player,player.IP);
MessagePlayer("[#00ff00]You autologged!Welcome!",player);
}
else
{
MessagePlayer("[#ff0000]You must create a account!",player);
MessagePlayer("[#ff0000]Use /register !",player)
}
}
function onPlayerCommand(player,cmd,text)
{
if (cmd =="register")
{
if (!text) MessagePlayer("[#ff0000]Use /register <password>");
else
{
local PLIP = player.IP;
WriteIniString("PlayerIP.ini","IP",player.Name,PLIP);
Message("[#00ff00]Player "+player.Name+" made a account!")
}
}
return 1;
}
This code will reset stats when from new IP :/
And the password field isn't even used anywhere

NicusorN5

@ext-d.CrystalBlue lool i understand nothing;
@motley I don't see any missing brackets.

EK.IceFlake

Quote from: NicusorN5 on Jun 01, 2016, 11:48 AM@ext-d.CrystalBlue lool i understand nothing;
@motley I don't see any missing brackets.
Imagine I come from IP 176.202.104.226
it will registered me
Then I come from new IP 46.105.184.128
all my stats lost :( :(
And,
that Usage: /register password
- has no already registered check
- couldn't care less about the password given

NicusorN5

oh lol ,also the problem is that atfer using /register i see no new ini fuuuu !Also how do I fix stats losing?

EK.IceFlake

Quote from: NicusorN5 on Jun 01, 2016, 12:15 PMoh lol ,also the problem is that atfer using /register i see no new ini fuuuu !Also how do I fix stats losing?
Don't save by IP, save by name.

NicusorN5

Other question (again) where i can find the created ini?

Thijn

In the same directory as the server