SA-MP Forums Archive
Help with ban command - 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: Help with ban command (/showthread.php?tid=563291)



Help with ban command - Nabster - 15.02.2015

I want to remove the custom ban message "You are banned from server" and also i want to save the ban

Код:
CMD:ban(playerid,params[])
{
	if(PInfo[playerid][Level] < 2)
	return SendClientMessage(playerid,STEALTH_BLUE,"You need to be level 2 to ban players.");
	new id, reason[128];
	if(sscanf(params,"us",id,reason))
	return SendClientMessage(playerid,STEALTH_BLUE,"USAGE: /ban [id] [reason]");
	if(!IsPlayerConnected(id))
	return SendClientMessage(playerid,STEALTH_BLUE,"That player is not connected.");
	new Name[MAX_PLAYER_NAME], BanMessage[128];
	new Name2[MAX_PLAYER_NAME];
	GetPlayerName(playerid,Name,sizeof(Name));
	GetPlayerName(playerid,Name2,sizeof(Name2));
	format(BanMessage,sizeof(BanMessage),"Administrator %s(%d) has banned player %s(%d) |Reason:%s",Name,playerid,Name2,id,reason);
	SendClientMessageToAll(STEALTH_BLUE,BanMessage);
	format(BanMessage,sizeof(BanMessage),"You got banned from this server by administrator %s.",Name);
	SendClientMessage(id,STEALTH_BLUE,BanMessage);
	SetTimerEx("DelayedBan",1000,false,"i",id);
	new ban[64];
	new file[64],PlayerName[24];
	GetPlayerName(playerid,PlayerName,sizeof PlayerName);
	format(file,sizeof file,"Bans/%s.ini",PlayerName);
	INI_Open(file);
	INI_WriteString("Ban",ban);
	INI_WriteInt("Banned",PInfo[playerid][Banned]);
	INI_Save();
	INI_Close();
	PInfo[playerid][Banned] = 1;
	return 1;
}



Re: Help with ban command - lean1337 - 15.02.2015

Well, you simply just dont actually ban them from the server, (banplayer) just kick them then you simply check when they connect if they are banned
pawn Код:
if (PInfo[playerid][Banned] == 1) do something here