When i /ban i myselft get banned.
#1

Hello i am getting some problem in my script whenever i /ban a player i along with someothers get ban dont know how that happens and also when i /w to someone the whisper shows double message for example i whispered Richard then: You whispered to Richard:text
You whispered to Richard:text
My ban cmd is like this:
Код:
CMD:ban(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 2)
	{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "[Usage]: /ban [playerid] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
			{
				format(string, sizeof(string), "AdmCmd: %s has been auto-banned by GOD, reason: Attempt to ban a higher Administrator.", GetPlayerNameEx(playerid));
				ABroadCast(COLOR_LIGHTRED,string,2);
				PlayerInfo[playerid][pBanned] = 1;
				new ip[32];
				GetPlayerIp(playerid,ip,sizeof(ip));
				AddBan(ip);
				Kick(playerid);
				return 1;
			}
			else
			{
				new year, month,day;
				getdate(year, month, day);
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
				format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
				Log("logs/ban.log", string);
				format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
				SendClientMessageToAllEx(COLOR_LIGHTRED, string);
				PlayerInfo[giveplayerid][pBanned] = 1;
				format(PlayerInfo[giveplayerid][pFlag], 128, "");
				new ip[32];
				GetPlayerIp(giveplayerid,ip,sizeof(ip));
				AddBan(ip);
				Kick(giveplayerid);
				return 1;
			}

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

Try Use This

Код:
CMD:ban(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 2)
	{
		new string[128], giveplayerid, reason[64];
		if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "[Usage]: /ban [playerid] [reason]");
                giveplayerid = strval(params);

		if(IsPlayerConnected(giveplayerid))
		{
                        if(giveplayerid == playerid) return SendClientMessage(playerid,COLOR_RED,"ERROR: You cant ban ur self");
			if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
			{
				format(string, sizeof(string), "AdmCmd: %s has been auto-banned by GOD, reason: Attempt to ban a higher Administrator.", GetPlayerNameEx(playerid));
				ABroadCast(COLOR_LIGHTRED,string,2);
				PlayerInfo[playerid][pBanned] = 1;
				new ip[32];
				GetPlayerIp(playerid,ip,sizeof(ip));
				AddBan(ip);
				Kick(playerid);
				return 1;
			}
			else
			{
				new year, month,day;
				getdate(year, month, day);
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
				format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
				Log("logs/ban.log", string);
				format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
				SendClientMessageToAllEx(COLOR_LIGHTRED, string);
				PlayerInfo[giveplayerid][pBanned] = 1;
				format(PlayerInfo[giveplayerid][pFlag], 128, "");
				new ip[32];
				GetPlayerIp(giveplayerid,ip,sizeof(ip));
				AddBan(ip);
				Kick(giveplayerid);
				return 1;
			}

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

Ill check this and what about the bug with /w cmd?
Reply
#4

Post the /w cmd too then i'll check
Reply
#5

Alright here you go
Код:
CMD:w(playerid, params[])
{
	new giveplayerid, whisper[128];

	if(gPlayerLogged{playerid} == 0)
	{
		SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
		return 1;
	}
	if(sscanf(params, "us[128]", giveplayerid, whisper))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "[Usage]: (/w)hisper [playerid] [text]");
		return 1;
	}
	if(WatchingTV[playerid] != 0 && PlayerInfo[playerid][pAdmin] < 2)
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "You can't do this while watching TV.");
		return 1;
	}
	if (IsPlayerConnected(giveplayerid))
	{
		if(HidePM[giveplayerid] > 0)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "That player is blocking whispers!");
			return 1;
		}
		new giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128];
		sendername = GetPlayerNameEx(playerid);
		giveplayer = GetPlayerNameEx(giveplayerid);
		if(giveplayerid == playerid)
		{
			if(PlayerInfo[playerid][pSex] == 1) format(string, sizeof(string), "* %s mutters something to himself.", GetPlayerNameEx(playerid));
			else format(string, sizeof(string), "* %s mutters something to herself.", GetPlayerNameEx(playerid));
			return ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		}
		if(ProxDetectorS(5.0, playerid, giveplayerid) || PlayerInfo[playerid][pAdmin] >= 2)
		{
			format(string, sizeof(string), "%s whispers to you: %s", GetPlayerNameEx(playerid), whisper);

			if(strlen(string) > 92)
			{
				new firstline[128], secondline[128];
				strmid(firstline, string, 0, 88);
				strmid(secondline, string, 88, 128);
				format(firstline, sizeof(firstline), "%s ...", firstline);
				SendClientMessageEx(giveplayerid, COLOR_YELLOW, firstline);
				SendClientMessageEx(giveplayerid, COLOR_YELLOW, secondline);
			}
			else SendClientMessageEx(giveplayerid,COLOR_YELLOW, string);

			format(string, sizeof(string), "You whispered to %s: %s", GetPlayerNameEx(giveplayerid),whisper);
			ABroadCast(COLOR_YELLOW,string,2);
			if(strlen(string) > 92)
			{
				new firstline[128], secondline[128];
				strmid(firstline, string, 0, 88);
				strmid(secondline, string, 88, 128);
				format(firstline, sizeof(firstline), "%s ...", firstline);
				SendClientMessageEx(playerid, COLOR_YELLOW, firstline);
				SendClientMessageEx(playerid, COLOR_YELLOW, secondline);
			}
			else SendClientMessageEx(playerid,COLOR_YELLOW, string);
			return 1;
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GREY, "That player isn't near you.");
		}
		return 1;
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
	}
	return 1;
}
Reply
#6

The /ban is still not working i myself get banned.
Reply
#7

hmmm .,,, sry i cant fix this
Reply
#8

ask others
Reply
#9

Would be apprecited if anyone could help me.
Reply
#10

Is there anyone that can help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)