dcmd_register(playerid, params[]) { new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); new password; new Query[128]; format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s'",pName); 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 query[128],string[128]; format(query, sizeof(query), "INSERT INTO `users` (`username`, `password`, `score`, `money`) VALUES ('%s', '%s', '%s', '%s')", pName, password,GetPlayerScore(playerid),GetPlayerMoney(playerid)); mysql_query(query); format(string,128,"You're Now Registered , Password: %s , Now Please /Login",password); SendClientMessage(playerid,COLOR_TEST,string); SetPVarInt(playerid,"Registered",1); } return 1; }
new password[64];
format(query, sizeof(query), "INSERT INTO `users` (`username`, `password`, `score`, `money`) VALUES ('%s', '%s', '%d', '%d')", pName, password,GetPlayerScore(playerid),GetPlayerMoney(playerid));
i am actually new to mysql but what mysql_real_escape_string() for and how to use it??
|