04.07.2012, 15:59
Why this code return message: server unknown command when i typed it:
Код:
CMD:changepass(playerid, params[]) { new string[128], password[256]; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(sscanf(params, "s[64]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /changepass [password]"); if(strlen(params) > 256) return SendClientMessage(playerid, COLOR_GREY, "Password can't be longer than 256 characters."); WP_Hash(password, sizeof(password), params); if(aDuty[playerid]) { MySQLUpdatePlayerStrSingleAdmin(RPNU(playerid),"Password",password); } else { MySQLUpdatePlayerStrSingle(PlayerInfo[playerid][pSQLID],"Password",password); } format(string, sizeof(string), " You have changed your password to: {FF6347}%s", params); SendClientMessage(playerid, COLOR_WHITE, string); return 1; } forward MySQLUpdatePlayerStrSingle(sqlplayerid, sqlvalname[], sqlupdatestr[]); public MySQLUpdatePlayerStrSingle(sqlplayerid, sqlvalname[], sqlupdatestr[]) { new query[128]; mysql_format(connectionHandle,query, "UPDATE user SET %s='%s' WHERE id=%d", sqlvalname, sqlupdatestr, sqlplayerid); mysql_function_query(connection,query,false,"",""); return 1; } forward MySQLUpdatePlayerStrSingleAdmin(pname[], sqlvalname[], sqlupdatestr[]); public MySQLUpdatePlayerStrSingleAdmin(pname[], sqlvalname[], sqlupdatestr[]) { new query[128]; mysql_format(connectionHandle,query, "UPDATE user SET %s='%s' WHERE AdminName='%s'", sqlvalname, sqlupdatestr, pname); mysql_function_query(connectionHandle,query,false,"",""); return 1; }