02.06.2013, 10:56
Hello can this code be converted to a normal cmd?:
and if yes please someone do so
Код:
CMD:unban(playerid, params[]) { if(pInfo[playerid][pLogged] == 1) { if(pInfo[playerid][pAdminLevel] >= 2) { new Query[200]; if (!strlen(params)) return SendClientMessage(playerid,-1,""chat" /unban [name]"); format(Query, sizeof(Query), "SELECT `Name` FROM `banlog` WHERE Name = '%s' AND pAccountLock = 1 LIMIT 1", escstring(params)); mysql_query(Query); mysql_store_result(); if(!mysql_num_rows()) { new string[200]; format(string, sizeof(string), ""chat" Nobody under the name of %s is banned!", params); mysql_free_result(); return SendClientMessage(playerid,-1,string); } else if(mysql_num_rows() != 0) { format(Query, sizeof(Query), "UPDATE `banlog` SET `pAccountLock` = 0 WHERE Name = '%s'", escstring(params)); mysql_query(Query); mysql_store_result(); new string[200]; format(string, sizeof(string), ""chat" %s has been unbanned!", params); SendClientMessage(playerid, 0x66FF33, string); } } } return 1; } /* CMD:unban(playerid, params[]) { if(pInfo[playerid][pAdminLevel] >= 2) { if(IsPlayerConnected(playerid)) { new name[24], query[128], string[128]; if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, -1, ""chat" /unban [player name] CASE SENSITIVE!"); format(query, sizeof(query), "SELECT * FROM users WHERE Username = '%s'", name); mysql_query(query); mysql_store_result(); new row = mysql_num_rows(); if(row == 1) { format(string, sizeof(string), "UPDATE banlog SET pBannedReason ='none',pBannedBy='none',pIPBanned='unbanned',pAccountLock='0',pIPBanned='0' WHERE Username='%s'", name); mysql_query(string); format(string, sizeof(string), ""chat" You have unbanned account %s", name); SendClientMessage(playerid, -1, string); } else SendClientMessage(playerid, -1, ""chat" Username is invalid!"); mysql_free_result(); } } else { SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!"); } return 1; } */