SA-MP Forums Archive
Bug | the server Carshed - 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)
+--- Thread: Bug | the server Carshed (/showthread.php?tid=284013)



Bug | the server Carshed - avivelkayam - 17.09.2011

hellow

sorry with my bad english ok

i learned dini but now i start to learn file fuction

is the first try in the file fuction i try to build register system but my server after i write number to register it
crashed

ok this is the code thnx for who help


Код:
new pName[MAX_PLAYER_NAME];

enum PlayerStats {
Password,
Level,
Kills,
};


new PlayerInfo[MAX_PLAYERS][PlayerStats];
Код:
public OnPlayerConnect(playerid)
{
	new file[256];
	GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
	format(file,sizeof(file),"%s.ini",pName);
	if(!fexist(file))
	{
		ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Register","дчщ аъ сйсоък лгй мдйшщн","айщеш","бйием");
	} else {
	    ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login","дчщ аъ сйсоък лгй мдъзбш","айщеш","бйием");
	 }
	return 1;
}

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new file[256];
	new string[256];
	format(file,sizeof(file),"Users/%s.ini",GetPlayerName(playerid, pName, MAX_PLAYER_NAME));
	if(dialogid == 1)
	{
		if(!response || !strlen(inputtext))
		{
		    ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Register","дчщ аъ сйсоък лгй мдйшщн","айщеш","бйием");
		    return 1;
		}
		new File: PlayerFile = fopen(file,io_append);
		format(string,256,"Name: %s",GetPlayerName(playerid, pName, MAX_PLAYER_NAME));
		fwrite(PlayerFile,string);
		PlayerInfo[playerid][Level] = 1;
		PlayerInfo[playerid][Level] = fwrite(PlayerFile,"Level");
		PlayerInfo[playerid][Kills] = 0;
		PlayerInfo[playerid][Kills] = fwrite(PlayerFile,"Kills");
		fclose(PlayerFile);
	}
	return 1;
}
and i have a little question how i do in file fuction if the password = inputtext .......

thnx for who help


Re : Bug | the server Carshed - Naruto_Emilio - 17.09.2011

Did you hash the password?, if not, try to get the register / login from this tutorial
http://forum.sa-mp.com/showthread.ph...ighlight=Login


Re: Bug | the server Carshed - =WoR=Varth - 17.09.2011

pawn Код:
if(!strcmp(password,inputtext))
{
  //Login
}
For the crashed case, debug your code.


Re: Bug | the server Carshed - avivelkayam - 17.09.2011

i had to use Y_INI?


Re: Bug | the server Carshed - avivelkayam - 17.09.2011

i know i had debug i want you help me to fix them