31.01.2011, 02:22
what if player forgets his or her password? how to i change it in MysQl database?
Also, what does md5 means?
Also, what does md5 means?
CMD:changeppass(playerid, params[])
{
if(PVar[playerid][pLevel] >= 4)
{
new
EscPass[40],
Query[128],
iStr[80],
PID;
if(sscanf(params, "us[40]", PID, params)) return SendClientMessage(playerid, -1, ""#CRED"Usage: "#CORANGE"/ChangePPass < Player ID > < New Password >");
if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_RED, "That user is not connected!");
mysql_real_escape_string(params, EscPass);
format(Query, sizeof(Query), "UPDATE `playerinfo` SET `password` = md5('%s') WHERE `user` = '%s'", EscPass, pName(PID));
mysql_query(Query);
format(iStr, sizeof(iStr), ""#CDGREEN"Admin: %s(%d) has changed your pass to: "#CBLUE"%s", pName(playerid), playerid, params);
SendClientMessage(PID, -1, iStr);
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "Only admin level 4 + can use that command!");
}
stock SavePInfo(playerid)
{
if(GetPVarInt(playerid, "LoggedIN") == 1)
{
new
Query[600];
format(Query, sizeof(Query), "UPDATE `playerinfo` SET `kills` = %d,`score` = %d, `deaths` = %d, `money` = %d, `Level` = %d, `Last Pos X` = %f, `Last Pos Y` = %f, `Last Pos Z` = %f, `Interior` = %d WHERE `user` = '%s'", // Also remember to update this...
PVar[playerid][pKills],
GetPlayerScore(playerid), // <---- This is my change. see score in SQL code too.
PVar[playerid][pDeaths],
GetPlayerMoney(playerid),
PVar[playerid][pLevel],
PVar[playerid][pLastX],
PVar[playerid][pLastY],
PVar[playerid][pLastZ],
GetPlayerInterior(playerid),
pName(playerid));
mysql_query(Query);
mysql_free_result();
return 1;
}
else return 0;
}
stock LoadPlayerInfo(iPlayer)
{
new
Query[700];
if(mysql_fetch_row(Query))
{
sscanf(Query, "e<p<|>s[24]s[35]ddddfffd>", PVar[iPlayer]); // Remember to update this if you add more info...
mysql_free_result();
}
return 1;
}
[14:10:45] [14:10:45] --------------------------- [14:10:45] MySQL Debugging activated (01/09/11) [14:10:45] --------------------------- [14:10:45] [14:10:45] >> mysql_connect( ) [14:10:45] CMySQLHandler::CMySQLHandler() - constructor called. [14:10:45] CMySQLHandler::CMySQLHandler() - Connecting to "89.248.172.138" | DB: "pawno_samp" | Username: "pawno_lol" ... [14:10:46] CMySQLHandler::Connect() - Can't connect to MySQL server on '89.248.172.138' (10061) (Error ID: 2003) [14:10:46] >> mysql_query( Connection handle: 1 ) [14:10:46] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead) [14:10:46] >> mysql_store_result( Connection handle: 1 ) [14:10:46] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead) [14:10:46] >> mysql_retrieve_row( Connection handle: 1 ) [14:10:46] CMySQLHandler::RetrieveRow() - You cannot call this function now. (Reason: Connection is dead) [14:10:46] >> mysql_free_result( Connection handle: 1 ) [14:10:46] CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead) [14:10:46] >> mysql_query( Connection handle: 1 ) [14:10:46] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead) [14:10:46] >> mysql_store_result( Connection handle: 1 ) [14:10:46] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead) [14:10:46] >> mysql_num_rows( Connection handle: 1 ) [14:10:46] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection) [14:10:46] >> mysql_free_result( Connection handle: 1 ) [14:10:46] CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead) |
[Err] 1046 - No database selected [Err] -- -- Database: `mysql2` -- -- -------------------------------------------------------- -- -- Table structure for table `labels` -- CREATE TABLE IF NOT EXISTS `labels` ( `LabelX` float NOT NULL, `LabelY` float NOT NULL, `LabelZ` float NOT NULL, `LabelInfo` varchar(128) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; [Msg] Finished - Unsuccessfully