SA-MP Forums Archive
[CODE] /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: [CODE] /ban command (/showthread.php?tid=331573)



[CODE] /ban command - squomp - 05.04.2012

I have this so far -

dcmd_ban(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, red, "You do not have permission to use this command");
return 1;
}
else
{
static ID, reason, theBan[128], name[MAX_PLAYER_NAME], banername[MAX_PLAYER_NAME], IP[16];
if (sscanf(params, "is", ID, reason)) return SendClientMessage(playerid, red, "Usage: /ban [playerid/name] [reason]");
GetPlayerIp(ID, IP, sizeof(IP));
GetPlayerName(ID, name, sizeof(name));
GetPlayerName(playerid, banername, sizeof(banername));
format(theBan, sizeof(theBan), "%s was kicked by %s. - REASON: %s", name, banername, reason);
Ban(name);
SendClientMessageToAll(red, theBan);
return 1;
}
}

but how would I ban the IP? because I dont wont to ban the actual name.


Re: [CODE] /ban command - Toreno - 05.04.2012

First of all, you need to ban the ID, instead of name; Also, ban function does it automatically.


Re: [CODE] /ban command - squomp - 05.04.2012

oh really cool thanks