SA-MP Forums Archive
How to make a 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: How to make a ban command? (/showthread.php?tid=542708)



How to make a ban command? - KyLeBlaK - 21.10.2014

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)


Re: How to make a ban command? - Glossy42O - 21.10.2014

Search on ******.

There is tons of tutorials.


Re: How to make a ban command? - gurmani11 - 21.10.2014

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;
}



Re: How to make a ban command? - KyLeBlaK - 21.10.2014

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


Re: How to make a ban command? - Th3UnKnOwN - 22.10.2014

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"



Re: How to make a ban command? - Pottus - 22.10.2014

Good luck with this actually doing anything useful.


Respuesta: Re: How to make a ban command? - !R1Ch@rD! - 22.10.2014

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;
}