IsUserNameAvailable doesn't work
#1

This function doesn't work, and I don't know why. The mysql connection information, and table information is not wrong.

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;
}
On OnPlayerConnect
Код:
	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.");
	}
Reply


Messages In This Thread
IsUserNameAvailable doesn't work - by BritishBoy - 06.04.2011, 15:15
Re: IsUserNameAvailable doesn't work - by BritishBoy - 06.04.2011, 21:51
Re: IsUserNameAvailable doesn't work - by Sergei - 06.04.2011, 22:00
Re: IsUserNameAvailable doesn't work - by Voldemort - 06.04.2011, 22:01
Re: IsUserNameAvailable doesn't work - by BritishBoy - 06.04.2011, 22:26
Respuesta: IsUserNameAvailable doesn't work - by anonymousx - 07.04.2011, 19:43
Re: IsUserNameAvailable doesn't work - by BritishBoy - 08.04.2011, 09:44

Forum Jump:


Users browsing this thread: 2 Guest(s)