How to do a basic /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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to do a basic /ban command? (
/showthread.php?tid=200614)
How to do a basic /ban command? -
Sledge - 18.12.2010
Okay, this is really tricky, I can script a fully functional saving system from scratch but I can't script a basic /ban command with a reason....
So, how do I make a ban command that bans a person WITH a reason? Please post reasons, and I evolve them into my script.
/ban [id] [reason]
Re: How to do a basic /ban command? -
Lorenc_ - 18.12.2010
pawn Код:
dcmd_ban(playerid, params[])
{
new reason[24],
pID,
string[128];
if (sscanf(params, "us", pID, reason)) SendClientMessage(playerid, COLOR_YELLOW, "Usage: /ban [playerid] [reason]");
else if (pID == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "ERROR: Player not found");
else if(PlayerInfo[playerid][pAdmin] < 5) SendClientMessage(playerid, COLOR_RED, ADMINFALSE_CMD);
//else if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot ban yourself.");
else {
Ban(pID);
format(string,sizeof(string),"SERVER: %s has been ban by %s (REASON: %s)",GetName(pID), GetName(playerid), reason);
SendClientMessageToAll(COLOR_YELLOW, string);
format(string,sizeof(string),"You have been ban by %s (REASON: %s)", GetName(playerid), reason);
SendClientMessage(pID, COLOR_YELLOW, string);
}
return 1;
}
Re: How to do a basic /ban command? -
Retardedwolf - 18.12.2010
@ Lorenc, you could use BanEx.
Re: How to do a basic /ban command? -
Sledge - 18.12.2010
Great! It's in dcmd, too!
Thanks.
Re: How to do a basic /ban command? -
Mean - 18.12.2010
Quote:
Originally Posted by Retardedwolf
@ Lorenc, you could use BanEx.
|
pawn Код:
format(string, sizeof(string), "%s", params);
BanEx(playerid, string);
I think that will do it.
Just replace it with the Ban(playerid); line
Re: How to do a basic /ban command? -
Lorenc_ - 18.12.2010
Hes going to change it to a file system i suppose so it was a quick and easy command...
Re: How to do a basic /ban command? -
Mean - 19.12.2010
Quote:
Originally Posted by Lorenc_
Hes going to change it to a file system i suppose so it was a quick and easy command...
|
I don't think he knows how to do that since he doesn't know how to make this cmd.
Re: How to do a basic /ban command? -
Sledge - 26.12.2010
Quote:
Originally Posted by Mean
I don't think he knows how to do that since he doesn't know how to make this cmd.
|
I needed examples of how to use sscanf, jerk.