30.12.2010, 23:30
Код:
dcmd_register(playerid, params[]) { new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); new Escpname[24]; GetPlayerName(playerid, pName, 24); mysql_real_escape_string(pName, Escpname); new password[128]; new Query[128]; format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s'",Escpname); mysql_query(Query); mysql_store_result(); if(mysql_num_rows()) return SendClientMessage(playerid,COLOR_TEST,"This Account Is Already Registered"); else if(sscanf(params,"s",password)) return SendClientMessage(playerid,COLOR_TEST,"Usage: /register [Password]"); else { new string[128],string2[128]; format(string, sizeof(string), "INSERT INTO `users` (`username`, `password`, `score`, `money`, `kills`, `deaths`, `warns`) VALUES ('%s', '%s', 0, 0, 0, 0, 0)", Escpname, password); mysql_query(string); format(string2,128,"You're Now Registered , Password: %s",password); SendClientMessage(playerid,COLOR_TEST,string2); } return 1; }