How to use IniParser functions?I looked for them one entire day,but i found nothing.
You mean those INI functions provided by the INI plugin?
If so, then here you go:- http://liberty-unleashed.co.uk/LUWiki/Squirrel/Server/Functions#Ini_Functions
Also , other question,where i can find it's lastest version? :EDIT: The version compatible with 0.4rel004
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.
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.
Quote from: KAKAN on May 31, 2016, 11:29 AMQuote 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
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;
}
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
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
@ext-d.CrystalBlue lool i understand nothing;
@motley I don't see any missing brackets.
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
oh lol ,also the problem is that atfer using /register i see no new ini fuuuu !Also how do I fix stats losing?
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.
Other question (again) where i can find the created ini?
In the same directory as the server
Yeah,i tested the server , the WriteIniString was called,i closed the game ,then the server and i see no ini file lol
Quote from: NicusorN5 on Jun 06, 2016, 06:58 PMYeah,i tested the server , the WriteIniString was called,i closed the game ,then the server and i see no ini file lol
The INI plugin doesn't create files. You either need to rewrite the function or simply make the file yourself :)
So i need to create a empty .ini file???
Yes create a file by yourself, you can only read things from it and not write things in it.
Quote from: NicusorN5 on Jun 07, 2016, 01:33 PMSo i need to create a empty .ini file???
Nein. Use the file function.
function CreateFileAndWriteIni( fileName, and, your, shitty, arguments )
{
//Lets create the file:-
file( fileName, "a+" ).close(); //Search for C++ fopen flags and choose a better one.
//File created, yey!
WriteIni( .... );
}
I created it myself. lol