SA-MP Forums Archive
My server is restarting... - 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: My server is restarting... (/showthread.php?tid=309436)



My server is restarting... - Larry123 - 07.01.2012

Hey

Yesterday i started with new GM, i started to go in game, but i can`t. My server don`t connect and restarting.



I have 0.3d samp files, what i downloaded yesterday, i got sscanf plugin from here, and mysql too, Where can be the problem ?


Re: My server is restarting... - Artie_Scorpion - 07.01.2012

Maybie you have a house or car script maybie...
Problem can be because you didnt created some folder in scriptfiles maybie?


Re: My server is restarting... - BlackWolf120 - 07.01.2012

all plugins and needed scripts loaded?
Does the server also crash if players dont connect or only when someone tries to connect?

If it only crashes as soon as someone connetcs we need your code from OnPlayerConnect callback...


Re: My server is restarting... - Wickeed - 07.01.2012

What it is your server version ? 3d too ?


Re: My server is restarting... - Larry123 - 07.01.2012

Now i founded problem, if my user is not found in database, then server restart, if it is, it won`t

My code, what is problem there

format(Query, sizeof(Query), "SELECT * FROM `kasutajad` WHERE `Name` = '%s'", UuriM2ngijanimi(playerid));
mysql_query(Query);
mysql_store_result();

if(mysql_num_rows() == 1)
{

If user is
}
else
{
If user not found
}

what is the right code?


Re: My server is restarting... - BlackWolf120 - 07.01.2012

pawn Код:
new Query[192],pname[24];
GetPlayerName(playerid,pname,24);
format(Query, sizeof(Query), "SELECT * FROM `kasutajad` WHERE `Name` = '%s' Limit 1", pname);//Limit 1 important!
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() == 1)
{
    //User found.
}
else
{
    //User not found!
}
mysql_free_result(); //important!!



Re: My server is restarting... - Larry123 - 07.01.2012

Код:
stock M2ngijaYhineb(playerid)
{
	ChatPuhtaks(playerid);
	format(Query, sizeof(Query), "SELECT * FROM `kasutajad` WHERE `Name` = '%s' Limit 1", UuriM2ngijanimi(playerid));
	mysql_query(Query);
	mysql_store_result();
	if(mysql_num_rows() == 1)
	{
               SendClientMessage(playerid, -1, "User found");
	}
	else
	{
		SendClientMessage(playerid, -1, "User NOT found");
		Kick(playerid);
	}
	mysql_free_result();
	return 1;
}
Still, when i don`t got user in database it restart server.


Re: My server is restarting... - BlackWolf120 - 07.01.2012

i see ure using a stock function for this.
Gimme the whole code.


Re: My server is restarting... - Larry123 - 07.01.2012

Код:
stock UuriM2ngijanimi(playerid)
{
	new
		Nimii[MAX_PLAYER_NAME]
	;
	if(IsPlayerConnected(playerid))
	{
		GetPlayerName(playerid, Nimii, sizeof(Nimii));
		mysql_real_escape_string(Nimii, Isikunimi);
	}
	else Isikunimi = "Tundmatu";
	return Isikunimi;
}
And

Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    SetPlayerColor(playerid, -1);
	M2ngijaYhineb(playerid);
	return 1;
}
I use a lot of stocks everywhere


Re: My server is restarting... - Larry123 - 07.01.2012

BUMP

I need fast help please