21.12.2011, 08:36
sorry about my bad english
i tried to built register system in MySQL but my server is fall down
when i try to get in its check if the player exists its ok (its not exists)
and when i try to register (i do password) its fall down
the samp-server.exe
thanx for helps
this is the code
i tried to built register system in MySQL but my server is fall down
when i try to get in its check if the player exists its ok (its not exists)
and when i try to register (i do password) its fall down
the samp-server.exe
thanx for helps
this is the code
Код:
public OnPlayerConnect(playerid) { new string[1024]; format(string, sizeof(string), "SELECT * FROM `users` WHERE `Name`='%s'",GetName(playerid)); mysql_query(string); mysql_store_result(); if(mysql_num_rows() > 0) { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login","Write password","Login",""); } else { ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "Register","Write password","Register",""); } mysql_free_result(); return 1; }
Код:
public OnGameModeInit() { // Don't use these lines if it's a filterscript SetGameModeText("Blank Script"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); mysql_debug(1); mysql_connect(SQL_HOST,SQL_USER,SQL_PASS,SQL_DB); return 1; }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new string[1024]; if(dialogid == 1) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login","Write password","Login",""); new Password[30],Name[24]; mysql_real_escape_string(GetName(playerid),Name); mysql_real_escape_string(inputtext,Password); format(string, sizeof(string), "SELECT * FROM `users` WHERE `Name`='%s' AND `Password`='%s'",Name,Password); mysql_query(string); mysql_store_result(); if(mysql_num_rows() == 1) { SendClientMessage(playerid, 0xff0000ff, "! дъзбшъ бдцмзд"); } else { SendClientMessage(playerid, 0xff0000ff, "! сйсоа щвейд"); ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login","Write password","Login",""); } mysql_free_result(); } if(dialogid == 2) { new Name[24],Password[30]; if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "Register","Write password","Register",""); mysql_real_escape_string(GetName(playerid),Name); mysql_real_escape_string(inputtext,Password); format(string, sizeof(string), "INSERT INTO `users`(Name,Password) VALUES ('%s',%s')",Name,Password); mysql_query(string); mysql_store_result(); } mysql_free_result(); return 1; }