28.01.2015, 19:23
Hello. I have mysql on R39-2 and on my home server I never have problem with login I always get login dialog type my pass and enter to server. Since I transfer gamemode to host server sometimes player just connect and they don't get login dialog they just spawn on server and beacuse of that they lost everything cars bikes etc. I was cheking under onplayerconnect code many times and I don't see a problem but I don't have any choice but ask for help here. Thanks and I hope so that you understand my problem. On host in many cases they get login but somehow and sometime they just enter on server without typing password. Like I said on text above I never have this problem on my home server I always get login dialog. Thanks
so here is check under onplayerconnect
here is public CheckAccount
so here is check under onplayerconnect
pawn Код:
new query[300],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
mysql_format(mysql,query,sizeof(query),"SELECT * FROM `users` WHERE `Nick` = '%e' LIMIT 1",name);
mysql_tquery(mysql,query,"CheckAccount","i",playerid);
pawn Код:
forward CheckAccount(playerid);
public CheckAccount(playerid)
{
new rows,fields;
cache_get_data(rows,fields,mysql);
if(rows)
{
//here if player name is found in database he get dialog for login
cache_get_row(0,2,PlayerInfo[playerid][Password],mysql,129);
PlayerInfo[playerid][ID] = cache_get_row_int(0,0);
new name[MAX_PLAYER_NAME],loginstring[512];
GetPlayerName(playerid,name,sizeof(name));
format(loginstring,sizeof(loginstring),"Welcome %s\n\nPlease enter your password to log in on server",name);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Login",loginstring,"Login","Exit");
}
else
{
here I show dialog for register if player name doesn't found in database.
}
return 1;
}