Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:ban(playerid, params[])
- {
- new pID, reason[128], string[128], Year, Month, Day;
- if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorized to use this command.");
- if(sscanf(params, "us[128]", pID, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ban (Username/ID) (Reason)");
- if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Wrong ID or that player is not connected.");
- SetTimerEx("BanTimer", 100, 0, "d", playerid);
- format(string,sizeof(string), "{33CCFF}[BAN] %s {FFFFFF}has been banned from the server by {33CCFF}%s (%s).", pInfo[pID][pName], pInfo[playerid][pName], reason);
- SendClientMessageToAll(-1, string);
- getdate(Year, Month, Day);
- pInfo[pID][pBanAdmin] = pInfo[playerid][pName];
- pInfo[pID][pBanReason] = reason[64];
- pInfo[pID][pBanD] = Day;
- pInfo[pID][pBanM] = Month;
- pInfo[pID][pBanY] = Year;
- new query[256];
- mysql_format(Database, query, sizeof(query), "INSERT INTO `banned` (`Username`, `Admin`, `Reason`, `Day`, `Month`, `Year`) VALUES ('%s', '%s', '%s', '%d', '%d', '%d')", pInfo[pID][pName], pInfo[playerid][pName], reason, pInfo[pID][pBanD], pInfo[pID][pBanM], pInfo[pID][pBanY]);
- mysql_query(Database, query);
- printf("Ban Admin: %s", pInfo[pID][pBanAdmin]);
- printf("Ban Reason: %s", pInfo[pID][pBanReason]);
- printf("Ban Day: %d", pInfo[pID][pBanD]);
- printf("Ban Month: %d", pInfo[pID][pBanM]);
- printf("Ban Year: %d", pInfo[pID][pBanY]);
- //Textdraws
- TextDrawShowForPlayer(playerid, BanBox1);
- TextDrawShowForPlayer(playerid, BanBox2);
- TextDrawShowForPlayer(playerid, BanOverview);
- TextDrawShowForPlayer(playerid, BanAppeal);
- TextDrawShowForPlayer(playerid, BanBox3);
- PlayerTextDrawShow(playerid, PlayerName[playerid]);
- PlayerTextDrawShow(playerid, AdminName[playerid]);
- PlayerTextDrawShow(playerid, BanReason[playerid]);
- PlayerTextDrawShow(playerid, BanDate[playerid]);
- new PlayerNameTextdraw[256], AdminNameTextdraw[256], BanReasonTextdraw[256], BanDateTextdraw[256];
- format(PlayerNameTextdraw, sizeof(PlayerNameTextdraw), "Player Name: %s", pInfo[pID][pName]);
- format(AdminNameTextdraw, sizeof(AdminNameTextdraw), "Admin Name: %s", pInfo[playerid][pName]);
- format(BanReasonTextdraw, sizeof(BanReasonTextdraw), "Reason: %s", reason);
- format(BanDateTextdraw, sizeof(BanDateTextdraw), "Date: %d/%d/%d", pInfo[pID][pBanD], pInfo[pID][pBanM], pInfo[pID][pBanY]);
- PlayerTextDrawSetString(pID, PlayerName[playerid], PlayerNameTextdraw);
- PlayerTextDrawSetString(pID, AdminName[playerid], AdminNameTextdraw);
- PlayerTextDrawSetString(pID, BanReason[playerid], BanReasonTextdraw);
- PlayerTextDrawSetString(pID, BanDate[playerid], BanDateTextdraw);
- TogglePlayerControllable(playerid, 0);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment