Offline ban?
#1

here's my ban command

Код:
COMMAND:ban(playerid, params[])
{
	if(playerData[playerid][playerLoggedIn])
	{
		if(playerData[playerid][playerLevel] >= 1)
		{
			new otherID, playersIP[24], playerName[24], adminName[24], message[248], reason[300];

			if(sscanf(params, "us[300]", otherID, reason))
			{
				SendClientMessage(playerid, COLOR_ORANGE, "Usage: \"ban <playername/id> <reason>\"");
			}
			else
			{
				if(IsPlayerConnected(otherID))
				{
					if(playerData[otherID][playerLoggedIn])
					{
						if(playerData[playerid][playerLevel] >= playerData[otherID][playerLevel])
						{
							// Send message to game
							GetPlayerName(otherID, playerName, sizeof(playerName));
							GetPlayerName(playerid, adminName, sizeof(adminName));
							GetPlayerIp(otherID, playersIP, sizeof(playersIP));
							
							format(message, sizeof(message), "{A9C4E4}%s(%i) has been banned from the server.", playerName, otherID);
							SendClientMessageToAll(COLOR_WHITE, message);
							
							new aMsg[300];
							for (new i=0; i<MAX_PLAYERS; i++)
							{
								if (playerData[i][playerLevel] >= 0)
								{
									format(aMsg, sizeof(aMsg), "{FE9A2E}[ADMIN] {FFFFFF}%s(%i) has banned %s(%i) {FE9A2E}[REASON: %s]{FFFFFF}", playerData[playerid][playerNamee], playerid, playerData[otherID][playerNamee], otherID, reason);
									SendClientMessage(i, COLOR_WHITE, aMsg);
								}
							}		
							
							new log[250];
							format(log, sizeof(log), "%s(%i) has banned %s(%i)", playerData[playerid][tempAdminName], playerid, playerName, otherID);
							SendAdminText(playerid, log);
							
							new banreason[350];
							format(banreason, sizeof(banreason), "INSERT INTO `playerbans` (`banned_by`, `banned_for`, `player_banned`, `player_ip`) VALUES ('%s', '%s', '%s', '%s')", adminName, reason, playerName, playersIP);
							mysql_query(banreason, MYSQL_ADD_BAN, playerid, connection);
							
							KickWithMessage(otherID, "[BANNED]Request Unban at our forum.'");
						}
						else
						{
							SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You cannot use this command on that player.");
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not logged in!");
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not online!");
				}
			}
		}
		else
		{
			return 0;
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
	}
		
	return 1;
}
Reply
#2

What's your question?
Reply
#3

He want a /oban command or something like that how can ban offline players ... omg it's too hard to understand , i will make it in 1 hour because i need to go now .. hope you can wait .
Reply
#4

Someone pls? :3
Reply
#5

Ban them by combining their IP address and Username?
Reply
#6

Try this:
Код:
COMMAND:oban(playerid, params[])
{
			new  playersIP[24], playerName[24], adminName[24], message[248], reason[300];

			if(sscanf(params, "us[300]", PlayerName, reason))
			{
				SendClientMessage(playerid, COLOR_ORANGE, "Usage: \"ban <playername <reason>\"");
         	           return 1;
			}

			        	if(playerData[playerid][playerLevel] >= playerData[PlayerName][playerLevel])
						{
							GetPlayerName(playerid, adminName, sizeof(adminName));
							GetPlayerIp(PlayerName, playersIP, sizeof(playersIP));

							format(message, sizeof(message), "{A9C4E4}%s(%i) has been banned from the server.", playerName);
							SendClientMessageToAll(COLOR_WHITE, message);

							new aMsg[300];
							for (new i=0; i<MAX_PLAYERS; i++)
							{
								if (playerData[i][playerLevel] >= 0)
								{
									format(aMsg, sizeof(aMsg), "{FE9A2E}[ADMIN] {FFFFFF}%s(%i) has banned %s(%i) {FE9A2E}[REASON: %s]{FFFFFF}", playerData[playerid][playerNamee], playerid, playerData[playerNamee], PlayerName, reason);
									SendClientMessage(i, COLOR_WHITE, aMsg);
								}
							}

							new log[250];
							format(log, sizeof(log), "%s(%i) has banned %s(%i)", playerData[playerid][tempAdminName], playerid, playerName);
							SendAdminText(playerid, log);

							new banreason[350];
							format(banreason, sizeof(banreason), "INSERT INTO `playerbans` (`banned_by`, `banned_for`, `player_banned`, `player_ip`) VALUES ('%s', '%s', '%s', '%s')", adminName, reason, playerName, playersIP);
							mysql_query(banreason, MYSQL_ADD_BAN, playerid, connection);
						}
						
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)