Created
March 10, 2013 12:48
-
-
Save dennorske/5128446 to your computer and use it in GitHub Desktop.
Ban Command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CMD:ban(playerid, params[]) | |
{ | |
new suspect, string[200], reason[200],string1[100],string4[600],year,month,date, hour,minute,second, string5[150];//variables needed for the ban :P | |
if (AccInfo[playerid][aLevel] < 3) | |
return SendClientMessage(playerid, grey, " - Only Level 3+ can perform this command - "); | |
if(sscanf(params, "k<player_name>s[200]", suspect, reason)) | |
return SendClientMessage(playerid, grey, " - USAGE: "cgrey"/BAN [playerid/name] [reason of ban] - Will ban the selected player from the server"); | |
AccInfo[suspect][banreason] = reason; | |
if(suspect == INVALID_PLAYER_ID) | |
return SendClientMessage(playerid, grey, " - - - - - Player was not found online / Wrong name/id - - - - - -"); | |
if(suspect == playerid) | |
{ | |
ShowPlayerDialog(playerid, selfban, DIALOG_STYLE_MSGBOX, "Confirm:", "Are you sure you want to ban yourself?", "Yep", "No"); | |
return 1; | |
} | |
if(AccInfo[suspect][aLevel] == 5 && AccInfo[playerid][aLevel] < 5) | |
{ | |
SendClientMessage(playerid, grey, "You can't ban the Owner! - He is now warned about this."); | |
format(string1, sizeof(string1), " - [Warning]: %s %s just attempted to ban you with the command /ban -", Rank(playerid),PlayerName(playerid)); | |
SendClientMessage(suspect, grey, string1); | |
return 1; | |
} | |
else | |
{ | |
format(string, sizeof(string), " - - Administrator %s has banned %s from OverGrown Stunting || Reason: %s - - ", PlayerName(playerid), PlayerName(suspect),reason); | |
SendClientMessageToAll(grey, string); | |
AccInfo[suspect][banreason] = reason; | |
getdate(year, month, date); | |
gettime(hour,minute,second); | |
format(string5,sizeof(string5), "Date: %d/%02d/%02d -||- Time: %02d:%02d:%02d",date, month, | |
year, hour, minute, second); | |
new INI:acc = INI_Open(INI_adress(suspect)); | |
INI_SetTag(acc, "Baninfo"); | |
//INI_WriteInt(acc, "Banned", AccInfo[suspect][banned]); | |
INI_WriteString(acc, "BanTime", string5); | |
INI_WriteString(acc, "AdminName", PlayerName(playerid)); | |
INI_WriteString(acc, "BanReason", reason); | |
INI_Close(acc); | |
SendClientMessage(playerid, -1, "Ban saved into your account"); | |
//printf("Reason after banning, accinfo[playerid][banreason] = %s", AccInfo[suspect][banreason]); | |
//printf("Reason as variable reason, on /ban: %s", reason); | |
format(string4, sizeof(string4),"Hello %s! \n\nYou were just banned from the \ | |
server, and you will have\nto make an unban application at %s if you\nwant to get unbanned \ | |
again \n\n BAN INFORMATIOM: \ | |
\n - %s \n - Reason of ban: %s\n - Admin who banned you: %s\n - Your Name: %s\n - IP Adress: %s\n\n", | |
PlayerName(suspect), forum(), string5, reason, PlayerName(playerid), PlayerName(suspect), ip(playerid)); | |
ShowPlayerDialog(suspect, BanDialog, DIALOG_STYLE_MSGBOX, "BANNED", string4, "Kick",""); | |
SetTimerEx("Kickplayer",2000,0,"i",playerid); | |
SendClientMessage(playerid, -1, "Ban saved into your account"); | |
} | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment