case 2:
{
new name[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(string,sizeof(string),"%s.ini",name);
ini_createFile(string);
RegisterPlayer(playerid,inputtext);
}
public RegisterPlayer(playerid,password[])
{
new name[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(string,sizeof(string),"%s.ini",name);
new iniFile = ini_openFile (string);
ini_setString(iniFile,"password",password);
ini_closeFile(iniFile);
return true;
}
Уже наверное год не работал с файлами и тут затупок...
PHP Code:
PHP Code:
|
case 2:
{
new name[MAX_PLAYER_NAME];
new string[5+MAX_PLAYER_NAME];/*Стрингов нужно столько сколько (иначе пустая трата)
Макс. размер файла + сколько символов (кроме %s) + 1
*/
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(string,sizeof(string),"%s.ini",name);
new iniFile = ini_createFile(string);//Ты забыл добавить "new iniFile" и "ini_closeFile(iniFile);"
ini_closeFile(iniFile);
RegisterPlayer(playerid,inputtext);
}
Уже наверное год не работал с файлами и тут затупок...
PHP Code:
PHP Code:
|
case 2:
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
RegisterPlayer(playerid, name, inputtext);
}
stock RegisterPlayer(playerid, name[], password[])
{
new string[MAX_PLAYER_NAME + 5];
format(string, sizeof(string), "%s.ini", name);
new iniFile = ini_createFile(string);
ini_setString(iniFile, "password", password);
ini_closeFile(iniFile);
}