SA-MP Forums Archive
Ban System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Ban System (/showthread.php?tid=576354)



Ban System - Seaf - 03.06.2015

When i ban some one the whole server get banned also me and the other admins and the players

Код:
code :
CMD:ban(playerid, params[])
{
	new giveplayerid, result[96];
	if(PlayerInfo[playerid][pAdmin] >= 2){
	    if(!sscanf(params, "us[96]", giveplayerid, result)){
			if(IsPlayerConnected(giveplayerid)){
				if(giveplayerid != INVALID_PLAYER_ID){
					strmid(giveplayer, PlayerRPName(giveplayerid), 0, MAX_PLAYER_NAME);
					strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
					new IP[16];
					new logstring[128];
					new banstring[128];
					new year, month, day;
					getdate(year, month, day);
					if(IsPlayerNPC(giveplayerid)) return SendClientMessage(playerid,COLOR_RED,"You cannot ban an NPC.");
					if(giveplayerid == playerid){
						return SendClientMessage(playerid,COLOR_GREY,"If you're leaving, use /q and stop being an attention whore.");
					}
					if(UseAdmCmdTimer[playerid] > 2){
						GetPlayerIp(playerid, IP, sizeof(IP));
						format(logstring, sizeof(logstring), "%s [%d/%d/%d] Name: %s Key: %s Reason: Spam.", IP, day, month, year,sendername,PlayerInfo[playerid][pKey]);
						BanLog(logstring);
						format(string, sizeof(string), "{FF6347}SERVER: %s was banned, reason: Spam.", sendername);
						SendClientMessageToAll(COLOR_WHITE, string);
						PlayerInfo[playerid][pBand] = 3;
						PlayerInfo[playerid][pPermBand] = 1;
						format(string, sizeof(string), "Ban Reason: Spam - Banned by: Autoban");
						strmid(PlayerInfo[playerid][pBanReason], string, 0, strlen(string), 255);
						BanEx(playerid, "Banned By: Autoban Reason: Spam");
						return 1;
					}
					if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin]){
						GetPlayerIp(playerid, IP, sizeof(IP));
						format(logstring, sizeof(logstring), "%s [%d/%d/%d] Name: %s Key: %s Reason: Attempting to ban a higher admin.", IP, day, month, year,sendername,PlayerInfo[playerid][pKey]);
						BanLog(logstring);
						format(string, sizeof(string), "{FF6347}SERVER: %s was banned, reason: Attempting to ban a higher admin.", sendername);
						SendClientMessageToAll(COLOR_WHITE, string);
						PlayerInfo[playerid][pBand] = 3;
						PlayerInfo[playerid][pPermBand] = 1;
						format(string, sizeof(string), "Ban Reason: Attempting to ban a higher admin - Banned by: Autoban");
						strmid(PlayerInfo[playerid][pBanReason], string, 0, strlen(string), 255);
						BanEx(playerid, "Banned By: Autoban Reason: Attempting to ban a higher admin");
						return 1;
					}
					GetPlayerIp(giveplayerid, IP, sizeof(IP));
					format(logstring, sizeof(logstring), "%s [%d/%d/%d] Name: %s Key: %s Banned by: %s Reason: %s", IP, day, month, year,giveplayer,PlayerInfo[giveplayerid][pKey], sendername, (result));
					BanLog(logstring);
					format(string, sizeof(string), "{FF6347}SERVER: %s was banned by %s, reason: %s", giveplayer, sendername, (result));
					SendClientMessageToAll(COLOR_WHITE, string);
					PlayerInfo[giveplayerid][pBand] = 3;
					format(banstring, sizeof(banstring), "Banned By: %s Reason: %s", sendername, (result));
					format(string, sizeof(string), "Ban Reason: %s - Banned by: %s",result,sendername);
					strmid(PlayerInfo[giveplayerid][pBanReason], string, 0, strlen(string), 255);
					PlayerInfo[giveplayerid][pBanDay] = day;
					PlayerInfo[giveplayerid][pBanMonth] = month;
					PlayerInfo[giveplayerid][pBanYear] = year;
					format(string,sizeof(string),"banip %s",IP);
					SendRconCommand(string);
					SendRconCommand("reloadbans");
					Kick(giveplayerid);
					UseAdmCmdTimer[playerid]++;
					SetTimerEx("UseAdmCmd",3*1000,0,"i",playerid);
					return 1;
				}
			}else{
				format(string, sizeof(string), "   %d is not an active player !", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}else{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/PartOfName] [reason]");
		}
	}else{
		SendClientMessage(playerid, COLOR_GRAD2, "   You are not authorized to use that command !");
	}
	return 1;



AW: Ban System - Kaliber - 03.06.2015

Ehhm, the command is right, but show us how you check if a player is banned

There is the mistake