Server crash when logging in!? -
Jstylezzz - 09.05.2012
Hi everyone,
I have made a scratch MYSQL system, and just like I expected, there are a few problems.
The script compiles without any Errors or Warnings, but In game, 2 things go wrong.
1.The server crashes on login, It has to do with this:
Код:
[23:32:57] [join] Jari_Johnson has joined the server (x.x.x.x.x.x)
[23:32:57] [nick] Jari_Johnson nick changed to New_Name
[23:32:57] [nick] New_Name nick changed to Jari_Johnson
Then it crashes.
2.When someone is online, and another person tries to join, the server becomes stuck, and doesn't respond on commands, RCON GUI's, only to the servers GameCP.
At the second problem, I have no clues, so i hope someone experienced this earlier.
Thanks
Re: Server crash when logging in!? -
JaTochNietDan - 09.05.2012
We can't really offer you any help if you don't show us the code, as we can't tell what you've done wrong.
Re: Server crash when logging in!? - kikito - 09.05.2012
Have you re-compiled your gamemode for sa-mp 0.3e?
Re: Server crash when logging in!? -
Jstylezzz - 09.05.2012
okay, sorry

I'm not sure what to show, so ill show my onplayerconnect:
pawn Код:
public OnPlayerConnect(playerid)
{
if(!NameValidator(playerid))
{
new string[128];
format(string,sizeof(string),"%s has been kicked by The server. Reason: Get a Roleplay name, Example: Boris_Klaus.",GetPlayerNameEx(playerid));
SendClientMessageToAll(COLOR_RED,string);
SendClientMessage(playerid,COLOR_WHITE,"HINT: Your name must be in Firstname_Lastname format, (E.G: John_Gunterstein)");
Kick(playerid);
return 0;//<--I added this
}
new Query[80],pName[24],string[164];
GetPlayerName(playerid,pName,24);
format(Query,sizeof(Query),"SELECT `Username` FROM `Users` WHERE `Username` = '%s' LIMIT 1;",pName);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)//if number of rows is different from 0 then continue
{
format(string,sizeof(string),"Hey, %s! \nYour account is registered.\nPlease enter the password to log in!",pName);
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Log in",string,"Login","");
}
else
{
SendClientMessage(playerid,COLOR_RED,"Registering is currently disbled due to beta testing!");
Kick(playerid);
/*format(string,sizeof(string),"Hey, %s! \nYour account is not registered. \nPlease register to continue!",pName);
ShowPlayerDialog(playerid,DIALOG_REGISTER1,DIALOG_STYLE_PASSWORD,"Register",string,"Register","");
*/
}
}
The "namevalidator" code
pawn Код:
stock NameValidator(playerid)
{
new pname[MAX_PLAYER_NAME],underline=0;
GetPlayerName(playerid, pname, sizeof(pname));
if(strfind(pname,"[",true) != (-1)) return 0;
else if(strfind(pname,"]",true) != (-1)) return 0;
else if(strfind(pname,"$",true) != (-1)) return 0;
else if(strfind(pname,"(",true) != (-1)) return 0;
else if(strfind(pname,")",true) != (-1)) return 0;
else if(strfind(pname,"=",true) != (-1)) return 0;
else if(strfind(pname,"@",true) != (-1)) return 0;
else if(strfind(pname,"1",true) != (-1)) return 0;
else if(strfind(pname,"2",true) != (-1)) return 0;
else if(strfind(pname,"3",true) != (-1)) return 0;
else if(strfind(pname,"4",true) != (-1)) return 0;
else if(strfind(pname,"5",true) != (-1)) return 0;
else if(strfind(pname,"6",true) != (-1)) return 0;
else if(strfind(pname,"7",true) != (-1)) return 0;
else if(strfind(pname,"8",true) != (-1)) return 0;
else if(strfind(pname,"9",true) != (-1)) return 0;
new maxname = strlen(pname);
for(new i=0; i<maxname; i++)
{
if(pname[i] == '_') underline ++;
}
if(underline != 1) return 0;
pname[0] = toupper(pname[0]);
for(new x=1; x<maxname; x++)
{
if(pname[x] == '_') pname[x+1] = toupper(pname[x+1]);
else if(pname[x] != '_' && pname[x-1] != '_') pname[x] = tolower(pname[x]);
}
SetPlayerName(playerid, "New_Name");
SetPlayerName(playerid, pname);
return 1;
}
@kikito err.. no i only compiled it with the new sscanf.. do you think that that is the problem?
Re: Server crash when logging in!? - kikito - 09.05.2012
Well, try to compile your gamemode with 0.3e includes and check it out, can't say more.
-
Jstylezzz - 09.05.2012
okay, ill try that.. its just, I never heard or saw that function before..
Problem Still Persists.. Exactly the same, compiled in the new 0.3e server package..
But JaTochNietDan, you are a Bйta tester.. what does that [nick] thing mean? and waht causes it?
I can't remember using it somewhere in my script..
EDIT: oh man.. now the server also crashes if someone leaves.. i didn't have this on 0.3d.. any beta tester or admin or someone who experienced this!? Please?
Now i'm not sure if it's the MYSQL account system..
EDIT2: I have disabled the whole mysql account system, but the server still crashes on player disconnect..