Help with ban command
#1

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;
}
Reply
#2

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)