How to make a ban command?
#1

Well hello there, i've been trying to write a ban command, and i've seen threads about them on this website, but most don't work when i've rewritten them, i was wondering if anyone could help me make one, if so, can you help me with the /ban <ID> <reason> and also saving the ban in a folder? Thanks for the help (Im new at scripting sorry :S)
Reply
#2

Search on ******.

There is tons of tutorials.
Reply
#3

pawn Код:
CMD:ban(playerid, params[])
{
    new id,reason[64], str[128];
    if(sscanf(params, "us[64]", id,reason))return SendClientMessage(playerid, COLOR_RED, ">>Error: USAGE: /Ban [ID] [Reason]");
    if(id == playerid) return SendClientMessage(playerid, COLOR_RED, ">>Error: Huh!");
    if(!IsPlayerConnected(id))return SendClientMessage(playerid, COLOR_RED, ">>Error: Player is not connected!");
    format(str, sizeof(str), ">>Action: %s has been banned by an administrator %s. >>Reason: %s", pName(id), pName(playerid), reason);
    SendClientMessageToAll(-1, str);
    GameTextForPlayer(id, "~r~You have been banned!", 5000, 4);
    Ban(id);
    printf("Ban: %s Has Been Banned By %s, Reason: %s",pName(id), pName(playerid),reason);
    return 1;
}
Reply
#4

Quote:

Search on ******.

There is tons of tutorials.

Most of the tutorials don't work

And thank you Gurmani11, but i don't seem to get it to work D: +rep
Reply
#5

Quote:
Originally Posted by KyLeBlaK
Посмотреть сообщение
Most of the tutorials don't work

And thank you Gurmani11, but i don't seem to get it to work D: +rep
You can not REP People yet. You need 50 posts to be able to do that.

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
pawn Код:
CMD:ban(playerid, params[])
{
    new id,reason[64], str[128];
    if(sscanf(params, "us[64]", id,reason))return SendClientMessage(playerid, COLOR_RED, ">>Error: USAGE: /Ban [ID] [Reason]");
    if(id == playerid) return SendClientMessage(playerid, COLOR_RED, ">>Error: Huh!");
    if(!IsPlayerConnected(id))return SendClientMessage(playerid, COLOR_RED, ">>Error: Player is not connected!");
    format(str, sizeof(str), ">>Action: %s has been banned by an administrator %s. >>Reason: %s", pName(id), pName(playerid), reason);
    SendClientMessageToAll(-1, str);
    GameTextForPlayer(id, "~r~You have been banned!", 5000, 4);
    Ban(id);
    printf("Ban: %s Has Been Banned By %s, Reason: %s",pName(id), pName(playerid),reason);
    return 1;
}
There is an issue when you try to compile it.
pawn Код:
C:\Users\PhantoM21\Desktop\Cops and Robbers\filterscripts\Register.pwn(219) : error 017: undefined symbol "pName"
C:\Users\PhantoM21\Desktop\Cops and Robbers\filterscripts\Register.pwn(223) : error 017: undefined symbol "pName"
Reply
#6

Good luck with this actually doing anything useful.
Reply
#7

Quote:
Originally Posted by Th3UnKnOwN
Посмотреть сообщение
You can not REP People yet. You need 50 posts to be able to do that.



There is an issue when you try to compile it.
pawn Код:
C:\Users\PhantoM21\Desktop\Cops and Robbers\filterscripts\Register.pwn(219) : error 017: undefined symbol "pName"
C:\Users\PhantoM21\Desktop\Cops and Robbers\filterscripts\Register.pwn(223) : error 017: undefined symbol "pName"
pawn Код:
stock pName(playerid)
{
  new name[MAX_PLAYER_NAME];
  GetPlayerName(playerid, name, sizeof(name));
  return name;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)