SA-MP Forums Archive
Restart game after register - 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: Restart game after register (/showthread.php?tid=385431)



Restart game after register - SweetCZ - 15.10.2012

Hi all.. when i choose "Ok" in dialog, my game will restart (bad connecting with the server) and when i connect again, dialog doesnt show for me... i dont understand it

Код:
	new path[256];
	format(path, sizeof(path), soubor, PlayerConnectName(playerid));
	if(fexist(path))
	{
	    SPD(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Prihlaseni", "{FFFFFF}Vнtejte zpбtky na serveru {ffd700}Mafia Roleplay{FFFFFF} přihlaљte se zadбnнm hesla prosнm!\n\nVytvořili:\n{FFFFFF}Pawner a maper: {00ffff}SweetCZ\n{FFFFFF}Testeři: {00ffff}TheTotifus, Ar3st, MiskulunCZ, Skrilex\n{FFFFFF}Webmaster: {00ffff}ManSlayer", "Ok", "Odejit");
	}
	else
	{
		SPD(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registrace", "{FFFFFF}Vнtejte na serveru {ffd700}Mafia Roleplay{FFFFFF} zaregistrujte se zadбnнm hesla prosнm!\n\nVytvořili:\n{FFFFFF}Pawner a maper: {00ffff}SweetCZ\n{FFFFFF}Testeři: {00ffff}TheTotifus, Ar3st, MiskulunCZ, Skrilex\n{FFFFFF}Webmaster: {00ffff}ManSlayer", "Ok", "Zavrit");
	}
Код:
	new path[256];
	format(path, sizeof(path), soubor, PlayerConnectName(playerid));
	if(dialogid == DIALOG_REGISTER)
	{
		if(response)
		{
			new pwlength = strlen(inputtext);
			if(pwlength > 0)
			{
			    new string[256];
				new File:RegFile = fopen(path, io_write);
				if(RegFile)
				{
				    strmid(Information[playerid][Heslo], inputtext, 0, strlen(inputtext), 255);
				    format(string, sizeof(string), "Heslo=%s", Information[playerid][Heslo]);
				    fwrite(RegFile, string);
				    fclose(RegFile);
					Information[playerid][NewRegister] = true;
					Mafia[playerid][ID] = 0;
					Mafia[playerid][Hodnost] = 0;
					Mafia[playerid][Sidlo] = 0;
					format(MafiaName[Mafia[playerid][ID]],24,"None");
					//---------------------------------------------------------
					Log(playerid, "Hrac se zaregistroval");
				}
			}
 			else
 			{
        		SPD(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registrace", "{FFFFFF}Zadejte heslo prosнm!", "Ok", "Zavrit");
 			}
		}
	}



Re: Restart game after register - Cameltoe - 15.10.2012

Is fopen(path, io_write); Created?


Re: Restart game after register - Roel - 15.10.2012

Are you sure your scriptfiles folders are correct?
And what is this?
pawn Код:
format(path, sizeof(path), soubor, PlayerConnectName(playerid));
can you show me what soubor includes?


Re: Restart game after register - SweetCZ - 15.10.2012

Yes, i tested it with dini, DOF2 but problem is same.

Yea, folders are created ... #define soubor "/Mafia/Ucty/%s.sav"


Re: Restart game after register - SweetCZ - 15.10.2012

some idea please?


Re: Restart game after register - Face9000 - 15.10.2012

When you're using a code that prevents the use of file save/load and the file isn't located in the correct folder/subfolder, the server can crash.

Mafia folder must be in /scriptfiles folder.
Ucty subfolder must be inside /Mafia folder.

So: /scriptfiles/Mafia/Ucty/%s.sav

Also, try to change from .sav to .ini to see if works.


Re: Restart game after register - SweetCZ - 15.10.2012

I have created folders, but server dont crash, only my game ... i connected to server, write password to register dialog and after clicking on button my game crashed (it write server restarting)


Re: Restart game after register - Face9000 - 15.10.2012

It crashes only at you? Did you checked server_log?


Re: Restart game after register - SweetCZ - 15.10.2012

Yes, only me. But when some player want register.. he has same problem


Re: Restart game after register - Face9000 - 15.10.2012

PM me the IP, i'll check it out.

EDIT: Give me your OnPlayerConnect.