How to do a basic /ban command?
#1

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]
Reply
#2

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

@ Lorenc, you could use BanEx.
Reply
#4

Great! It's in dcmd, too!

Thanks.
Reply
#5

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
Reply
#6

Hes going to change it to a file system i suppose so it was a quick and easy command...
Reply
#7

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.
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)