06.04.2011, 15:15
This function doesn't work, and I don't know why. The mysql connection information, and table information is not wrong.
Anybody?
The Function
On OnPlayerConnect
Anybody?
The Function
Код:
stock IsUserNameAvailable(playername[]) { format(query,sizeof(query),"select * FROM `users` WHERE `username`='%s' limit 0,1;",playername); mysql_query(query); mysql_store_result(); playername[0]=mysql_fetch_int(); mysql_free_result(); if(playername[0]==1)return 1; return 0; }
Код:
if(!IsUserNameAvailable(PlayerName(playerid))) { //if(OnPlayerAutoLogin(playerid)){SetPVarInt(playerid, "playerstatus",2); return SpawnPlayer(playerid);} ShowPlayerDialog(playerid,DIALOGID+1,DIALOG_STYLE_MSGBOX,ServerInfo[sName],"The system found an account by your nickname. \nYou have to login to continue.","Login","Quit"); }else{ ShowPlayerDialog(playerid,DIALOGID+2,DIALOG_STYLE_MSGBOX,ServerInfo[sName],"The system didn't found an account by your nickname. You can play with or without an account. \nIf you don't register, you stats won't be restored. If you register your stats will be stored. \nPlease make your choice.","Register","Don't Reg."); }