SA-MP Forums Archive
File read/write question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: File read/write question (/showthread.php?tid=205553)



File read/write question - psoftware - 01.01.2011

Hello!!!! In my gamemode I always used dini for my login system. But in a lot of Threads i read that dini is older and slower. I want to try another system, similar to dini. What do you recommend me ??


Re: File read/write question - Grim_ - 01.01.2011

SII - https://sampforum.blast.hk/showthread.php?tid=58458


Re: File read/write question - psoftware - 01.01.2011

Can you help me?? I want to convert this dini code to SII

if(!dini_Exists(file))
{
dini_Create(file);
dini_Set(file,"Name",Name);
dini_Set(file,"Ip",Ip);
dini_IntSet(file,"Registered",0);
dini_IntSet(file,"Password",0);
dini_IntSet(file,"Level",0);
dini_IntSet(file,"Wired",0);
dini_IntSet(file,"Jailed",0);
dini_IntSet(file,"Money",0);
dini_IntSet(file,"Score",0);
dini_IntSet(file,"Gov",0);
SendClientMessage(playerid, blue,"{0080FF}Il tuo NickName non и presente nel nostro server. Registrati digitando {FF0000} /register {0080FF}per continuare.");
}
strcat(AgPlayerInfo[playerid][PLAYER_NAME2], dini_Get(file,"Name"));
strcat(AgPlayerInfo[playerid][PLAYER_IP2], dini_Get(file,"Ip"));
AgPlayerInfo[playerid][PLAYER_REGGED2]= dini_Int(file,"Registered");
AgPlayerInfo[playerid][PLAYER_PASS2] = dini_Int(file,"Password");
AgPlayerInfo[playerid][PLAYER_LEVEL2] = dini_Int(file,"Level");
AgPlayerInfo[playerid][PLAYER_WIRED2] = dini_Int(file,"Wired");
AgPlayerInfo[playerid][PLAYER_JAILED2] = dini_Int(file,"Jailed");
AgPlayerInfo[playerid][PLAYER_MONEY2] = dini_Int(file,"Money");
AgPlayerInfo[playerid][PLAYER_SCORE2] = dini_Int(file,"Score");
AgPlayerInfo[playerid][PLAYER_GOV2] = dini_Int(file,"Gov");


Re: File read/write question - Grim_ - 01.01.2011

pawn Код:
if( fexist( file ) )
{
   new File: o = fopen( file, io_write );
   fclose( o );
 
   INI_Open( file );
   INI_SetString("Name",Name);
   INI_SetString("Ip",Ip);
   INI_SetInt("Registered",0);
   INI_SetInt("Password",0);
   INI_SetInt("Level",0);
   INI_SetInt("Wired",0);
   INI_SetInt("Jailed",0);
   INI_SetInt("Money",0);
   INI_SetInt("Score",0);
   INIi_SetInt(,"Gov",0);
   INI_Save( );
   INI_Close( );
You may just be able to use INI_Open, but I haven't looked at the code lately, so I created the file with the default functions just in case. I also haven't used it in awhile, so it may not be INI_SetInt, but INI_IntSet. Please make sure I didn't mix them up.


Re: File read/write question - psoftware - 01.01.2011

Thank you Grim!!!! I want to do only a little question: How can i put pawno code in that box in a Thread?? Sorry for this newbie question and thanks for the support!!!!


Re: File read/write question - _rAped - 01.01.2011

[pawn]

(8char)


Re: File read/write question - Grim_ - 01.01.2011

You need to use the [ pawn ] Code here [ /pawn ] tags (without the spaces). That example would look like:
pawn Код:
Code here