SA-MP Forums Archive
Register error - 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: Register error (/showthread.php?tid=82361)



Register error - arnutisz - 17.06.2009

I am trying to make an register system (sure i take a look at others), but when i type /register 45621 for egzample, my server crashes. Here is the code:

Код:
dcmd_register(playerid, params[])
{
	new string[256];
	if(IsPlayerConnected(playerid))
	{
    new pname[MAX_PLAYER_NAME], ip[24];
	  	GetPlayerName(playerid, pname, sizeof(pname));
	  	GetPlayerIp(playerid, ip, sizeof(ip));
		if(!strlen(params))
		{
			SendClientMessage(playerid, COLOR_RED, "Pamirsai Yrasyti slaptazody pydare tu netikeli, pz asilas Xd");
		}
		else
		{
	  	format(string, sizeof(string), "/Vartotojai/%s.acc", pname);
	  	new File: file = fopen(string, io_read);
	  	if(file)
	  	{
				SendClientMessage(playerid, COLOR_RED, "Toks nikas jau uzregistruotas pydare");
				fclose(file);
			}
	  	new File: reg;
	  	reg = fopen(string, io_append);
	  	new pass1 = strlen(params);
	  	new var[32];
	  	format(var, sizeof(var), "Slapyvardis: %s\n\r", pname);
	  	{
				fwrite(file, var);
			}
	  	format(var, sizeof(var), "IP: %s\n\r", ip);
	  	{
				fwrite(file, var);
			}
	  	format(var, sizeof(var), "Slaptazodis: %s\n\r", pass1);
	  	{
				fwrite(file, var);
			}
			fclose(reg);
			SendClientMessage(playerid, COLOR_GREEN, "JUPY uzsireginai y serva :*");
		}
	}
	return 1;
}



Re: Register error - DracoBlue - 17.06.2009

do you have a folder called Vartotojai in your scriptfiles folder?

- Draco


Re: Register error - arnutisz - 17.06.2009

yes, i have, and there is registration file which was created when i type /register (i gues), but its empty


Re: Register error - DracoBlue - 17.06.2009

This:
new File: reg;
reg = fopen(string, io_append);

Should be just:
file = fopen(string, io_append);

- Draco




Re: Register error - arnutisz - 17.06.2009

Thanks a lot, now thats what i found in my file:
IP: 78.63.212.4
Slaptazodis: 878.63.212.4

"Slaptazodis" = "Password" , but there is my ip with some characters in front of it.


Re: Register error - Nero_3D - 17.06.2009

pawn Код:
format(var, sizeof(var), "Slaptazodis: %s\n\r", pass1);
There you used %s for strings but you have an integer, just do

pawn Код:
format(var, sizeof(var), "Slaptazodis: %s\n\r", params);



Re: Register error - SiJ - 18.06.2009

Quote:

SendClientMessage(playerid, COLOR_RED, "Pamirsai Yrasyti slaptazody pydare tu netikeli, pz asilas Xd");
SendClientMessage(playerid, COLOR_RED, "Toks nikas jau uzregistruotas pydare");

Lol..