COMMAND:disable(playerid, params[]) { if(PlayerInfo[playerid][pSpawn] == 1) { new TargetID, string[256], R[256], DU; if(PlayerInfo[playerid][pAdminLevel] < 1) { SendClientMessage(playerid,COLOR_ERROR,""ERROR_MSG ""); return 1; } if(sscanf(params, "ud", TargetID,DU)) { SendClientMessage(playerid, COLOR_ERROR, "USAGE: /disable (Name/Id) (Days) (Reason)."); return 1; } sscanf(params, "uds[256]", TargetID, DU, R); if(!IsPlayerConnected(TargetID) || TargetID == INVALID_PLAYER_ID) { SendClientMessage(playerid, COLOR_ERROR, "That Player Is Not Connected."); return 1; } if(DU > 14) { SendClientMessage(playerid,COLOR_ERROR,"You Cannot Disable Player Account for More than 14 Days."); return 1; } if(IsPlayerNPC(TargetID)) { SendClientMessage(playerid,COLOR_ERROR,"You Cannot Kick a BOT."); return 1; } if(PlayerInfo[playerid][pAdminLevel] < 2 && PlayerInfo[TargetID][pAdminLevel] > 0) { format(string, sizeof(string), "%s (%d) is Server Admin, Can Not Be Attacked.",PlayerInfo[TargetID][pName],TargetID); SendClientMessage(playerid,COLOR_ERROR, string); return 1; } if (PlayerInfo[TargetID][pAdminLevel] > 0 && PlayerInfo[playerid][pAdminLevel] < 3) { SendClientMessage(playerid,COLOR_ERROR,"You Cannot Attack On An Admin With Admin Powers."); return 1; } if(!strlen®) { R = "No Reason Given."; } new D,M,Y,H,Mi,S,BX,CA; getdate(Y,M,D); gettime(H,Mi,S); BX = D+DU; if(M == 12 && BX > 31) { Y++; } if(BX > 30 && M == 4 || M == 6 || M == 9 || M == 11) { CA = BX-30; M++; } else if(BX > 31 && M == 1 || M == 3 || M == 5 || M == 7 || M == 8 || M == 10 || M == 12) { CA = BX-31; M++; } else if(M == 2 && BX > 29 && Y%4 == 0) { CA = BX-29; M++; } else if(M == 2 && BX > 28 && Y%4 != 0) { CA = BX-28; M++; } else CA = BX; new INI:File = INI_Open(UserDisablePath(TargetID)); INI_SetTag(File,"Disable Data"); INI_WriteInt(File,"DisableExp",CA); INI_WriteInt(File,"DisableM",M); INI_WriteInt(File,"DisableY",Y); INI_WriteInt(File,"DisableH",H); INI_WriteInt(File,"DisableMi",Mi); INI_WriteString(File,"Reason",R); INI_WriteString(File,"DisabledBy",PlayerInfo[playerid][pName]); INI_Close(File); new File:Log = fopen("DisabledPlayers.txt",io_append); fwrite(Log, PlayerInfo[TargetID][pName]); fwrite(Log,"\n"); fclose(Log); DisableInfo[TargetID][pDisableExp] = CA; DisableInfo[TargetID][pDisableM] = M; DisableInfo[TargetID][pDisableY] = Y; SetPlayerPosEx(TargetID,264.905700, 77.614082, 1001.039062, 269.327789,6,0); new Day = DisableInfo[TargetID][pDisableExp], Month = DisableInfo[TargetID][pDisableM], Year = DisableInfo[TargetID][pDisableY]; format(string, sizeof(string), "Your Account Has Been Disabled By The Adminstration For %i Days (Expires %i-%i-%i)",DU,Day,Month,Year); SendClientMessage(TargetID,COLOR_ADMIN, string); format(string, sizeof(string), "Reason: %s",R); SendClientMessage(TargetID,COLOR_ADMIN, string); format(string, sizeof(string), "%s (%d) Has Been Disabled By An Admin. Reason: %s",PlayerInfo[TargetID][pName], TargetID, R); SendClientMessageToAll(COLOR_ADMIN, string); format(string, sizeof(string), "***KICK: %s (%d) (ACCOUNT DISABLED) Account Disabled.",PlayerInfo[TargetID][pName], TargetID); SendClientMessageToAll(COLOR_ADMIN, string); KickEx(TargetID); }else{ SendClientMessage(playerid,COLOR_ERROR,"You Cannot Use This Command While You're Dead."); } return 1; } |