[HELP]Death System and Damage System
#1

Everytime i ban a player all user getting kicked out from the server

Code:
CMD:ban(playerid, params[])
{
	new targetid, reason[128];

	if(PlayerInfo[playerid][pAdmin] < 2)
	{
	    return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	if(sscanf(params, "us[128]", targetid, reason))
	{
	    return SendClientMessage(playerid, COLOR_GREY3, "[Usage]: /ban [playerid] [reason]");
	}
	if(!IsPlayerConnected(targetid))
	{
	    return SendClientMessage(playerid, COLOR_GREY, "The player specified is disconnected.");
	}
	if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin])
	{
	    return SendClientMessage(playerid, COLOR_GREY, "The player specified has a higher admin level than you. They cannot be banned.");
	}

	Log_Write("log_punishments", "%s (uid: %i) banned %s (uid: %i), reason: %s", GetPlayerNameEx(playerid), PlayerInfo[playerid][pID], GetPlayerNameEx(targetid), PlayerInfo[targetid][pID], reason);

	SendClientMessageToAllEx(COLOR_LIGHTRED, "AdmCmd: %s was banned by %s, reason: %s", GetPlayerRPName(targetid), GetPlayerRPName(playerid), reason);
	BanPlayer(targetid, GetPlayerNameEx(playerid), reason);
	return 1;
}
Reply
#2

Removed. (Op edited thread)
Reply
#3

Show us your BanPlayer function.
Reply
#4

try this

Code:
CMD:ban(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pBanAppealer] >= 1 || PlayerInfo[playerid][pModerator] >= 1 || PlayerInfo[playerid][pSecretAdmin] >= 1)
	{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/partofname] [reason]");

        //if(AntiAdv(playerid, params)) return 1;
		if(IsPlayerConnected(giveplayerid))
		{
			if(PlayerInfo[giveplayerid][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,2);
				PlayerInfo[playerid][pBanned] = 1;
				new ip[32];
				GetPlayerIp(playerid,ip,sizeof(ip));
				AddBan(ip);
				Kick(playerid);
				return 1;
				SendClientMessageEx(playerid, COLOR_REALRED, "You are not authorized to ban administrators.");
			}
			else
			{
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));

				if(AdminDuty[giveplayerid] == 1 || PlayerInfo[playerid][pAdmin] >= 5)
				{
					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);
					ABroadCast(COLOR_LIGHTRED, string, 1);
				}
				else if(PlayerInfo[playerid][pSecretAdmin] >= 1)
				{
					new username[MAX_PLAYER_NAME];
					GetPVarString(giveplayerid, "TempNameName", username, sizeof(username));
					SetPVarInt(giveplayerid, "TempName", 0);
					SetPlayerName(giveplayerid, username);

					format(string, sizeof(string), "SecretAdmin: %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), "SecretAdmin: {FFFF00}%s was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
					foreach(Player, i)
					{
					    if(PlayerInfo[i][pSecretAdmin] >= 1)
					    {
					        SendClientMessage(i, COLOR_REALRED, string);
					    }
					}
				}


				ABroadCast(COLOR_LIGHTRED, string, 1);
				new ip[32], hour, minute, second, day, month, year;
				gettime(hour, minute, second);
				getdate(year, month, day);
				GetPlayerIp(giveplayerid,ip,sizeof(ip));
				SendClientMessageEx(giveplayerid, COLOR_REALRED, "You're banned from New Mustang Roleplay. You can appeal your ban at Blaze-rp.tk");
                SendClientMessageEx(giveplayerid, COLOR_LIGHTRED, "-------------------- BAN REPORT --------------------");
				format(string, sizeof(string), "Reason: %s", reason);
				SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
				format(string, sizeof(string), "Current Warnings: %d (3 for BAN)", PlayerInfo[giveplayerid][pWarns]);
				SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
				format(string, sizeof(string), "Staff: %s", GetPlayerNameEx(playerid));
				SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
				format(string, sizeof(string), "IP Address: %s", ip);
				SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
				format(string, sizeof(string), "Time: %02d:%02d:%02d on %02d/%02d/%d", hour, minute, second, day, month, year);
				SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
				SendClientMessageEx(giveplayerid, COLOR_LIGHTRED, "It is strongly recommended that you keep this report for future reference (Press F8)");
				SendClientMessageEx(giveplayerid, COLOR_LIGHTRED, "You may appeal this ban at "WEBSITE".");
				SetTimerEx("BanTimer", 2000, 0, "ds", giveplayerid, ip);
				format(string, sizeof(string), "(%02d:%02d:%02d on %02d/%02d/%d) BanLogs: %s has banned %s, reason: %s",hour,minute,second, day, month, year, GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), reason);
			 	//UpdateRecentBans(string);
				return 1;
			}

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

Quote:
Originally Posted by TitoRayne
View Post
try this

Code:
CMD:ban(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pBanAppealer] >= 1 || PlayerInfo[playerid][pModerator] >= 1 || PlayerInfo[playerid][pSecretAdmin] >= 1)
	{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/partofname] [reason]");

        //if(AntiAdv(playerid, params)) return 1;
		if(IsPlayerConnected(giveplayerid))
		{
			if(PlayerInfo[giveplayerid][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,2);
				PlayerInfo[playerid][pBanned] = 1;
				new ip[32];
				GetPlayerIp(playerid,ip,sizeof(ip));
				AddBan(ip);
				Kick(playerid);
				return 1;
				SendClientMessageEx(playerid, COLOR_REALRED, "You are not authorized to ban administrators.");
			}
			else
			{
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));

				if(AdminDuty[giveplayerid] == 1 || PlayerInfo[playerid][pAdmin] >= 5)
				{
					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);
					ABroadCast(COLOR_LIGHTRED, string, 1);
				}
				else if(PlayerInfo[playerid][pSecretAdmin] >= 1)
				{
					new username[MAX_PLAYER_NAME];
					GetPVarString(giveplayerid, "TempNameName", username, sizeof(username));
					SetPVarInt(giveplayerid, "TempName", 0);
					SetPlayerName(giveplayerid, username);

					format(string, sizeof(string), "SecretAdmin: %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), "SecretAdmin: {FFFF00}%s was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
					foreach(Player, i)
					{
					    if(PlayerInfo[i][pSecretAdmin] >= 1)
					    {
					        SendClientMessage(i, COLOR_REALRED, string);
					    }
					}
				}


				ABroadCast(COLOR_LIGHTRED, string, 1);
				new ip[32], hour, minute, second, day, month, year;
				gettime(hour, minute, second);
				getdate(year, month, day);
				GetPlayerIp(giveplayerid,ip,sizeof(ip));
				SendClientMessageEx(giveplayerid, COLOR_REALRED, "You're banned from New Mustang Roleplay. You can appeal your ban at Blaze-rp.tk");
                SendClientMessageEx(giveplayerid, COLOR_LIGHTRED, "-------------------- BAN REPORT --------------------");
				format(string, sizeof(string), "Reason: %s", reason);
				SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
				format(string, sizeof(string), "Current Warnings: %d (3 for BAN)", PlayerInfo[giveplayerid][pWarns]);
				SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
				format(string, sizeof(string), "Staff: %s", GetPlayerNameEx(playerid));
				SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
				format(string, sizeof(string), "IP Address: %s", ip);
				SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
				format(string, sizeof(string), "Time: %02d:%02d:%02d on %02d/%02d/%d", hour, minute, second, day, month, year);
				SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
				SendClientMessageEx(giveplayerid, COLOR_LIGHTRED, "It is strongly recommended that you keep this report for future reference (Press F8)");
				SendClientMessageEx(giveplayerid, COLOR_LIGHTRED, "You may appeal this ban at "WEBSITE".");
				SetTimerEx("BanTimer", 2000, 0, "ds", giveplayerid, ip);
				format(string, sizeof(string), "(%02d:%02d:%02d on %02d/%02d/%d) BanLogs: %s has banned %s, reason: %s",hour,minute,second, day, month, year, GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), reason);
			 	//UpdateRecentBans(string);
				return 1;
			}

		} else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
	}
	return 1;
}
How is you posting your own gamemode's code going to help this person? They probably don't have the exact same variables, or functions as you do. So therefore the information that you are giving them is completely useless. And rather than just giving them your gamemode's code, why don't you try and explain to the user what is wrong with their code if you can find the issue, otherwise move onto the next topic.

OT:

It seems that the issue may be within your BanPlayer function, please can you show us your BanPlayer function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)