Check my codes.
#6

Код:
CMD:ban(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/partofname] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
			{
				if(AdminDuty[playerid] == 1)
				{
					new username[MAX_PLAYER_NAME];
					GetPVarString(playerid, "TempNameName", username, sizeof(username));
					SetPVarInt(playerid, "TempName", 0);
					SetPlayerName(playerid, username);
				}
				format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", PlayerInfo[playerid][pAdminName]);
				ABroadCast(COLOR_YELLOW,string,1);
				PlayerInfo[playerid][pBanned] = 1;
				new ip[32];
				GetPlayerIp(playerid,ip,sizeof(ip));
				AddBan(ip);
				SetTimerEx("DelayedKick", 1000, false, "i", giveplayerid);
				return 1;
			}
			else
			{
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));

				if(AdminDuty[giveplayerid] == 1)
				{
					new username[MAX_PLAYER_NAME];
					GetPVarString(giveplayerid, "TempNameName", username, sizeof(username));
					SetPVarInt(giveplayerid, "TempName", 0);
					SetPlayerName(giveplayerid, username);

					format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], playerip, GetPlayerNameEx(playerid), reason);
					Log("logs/ban.log", string);
					format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
					SetTimerEx("DelayedKick", 1000, false, "i", giveplayerid);
				}
				else
				{
					format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason);
					Log("logs/ban.log", string);
					format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
					SetTimerEx("DelayedKick", 1000, false, "i", giveplayerid);
				}


				SendClientMessageToAllEx(COLOR_LIGHTRED, string);
				PlayerInfo[giveplayerid][pBanned] = 1;
				new ip[32];
				GetPlayerIp(giveplayerid,ip,sizeof(ip));
				AddBan(ip);
				SetTimerEx("DelayedKick", 1000, false, "i", giveplayerid);
				return 1;
			}

		} else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
	}
	return 1;
}
Reply


Messages In This Thread
Check my codes. - by ChuckyBabe - 23.04.2015, 12:52
Re: Check my codes. - by BleverCastard - 23.04.2015, 12:55
Re: Check my codes. - by ChuckyBabe - 23.04.2015, 12:57
Re: Check my codes. - by BleverCastard - 23.04.2015, 12:59
Re: Check my codes. - by ChuckyBabe - 23.04.2015, 13:02
Re : Check my codes. - by Golimad - 23.04.2015, 13:03
Re: Check my codes. - by BleverCastard - 23.04.2015, 13:07
Re: Check my codes. - by Konstantinos - 23.04.2015, 13:07
Re: Check my codes. - by ChuckyBabe - 23.04.2015, 13:11

Forum Jump:


Users browsing this thread: 1 Guest(s)