Need help regarding a ban command.
#1

Hello , can anyone help me with a ban command?

Код:
CMD:test(playerid, params[])  {
	Ban();
	SendClientMessageEx(playerid, COLOR_WHITE, "w/e here...");
	return 1;
}
Is this a right format? , I'm not sure tho' and yes it is for banning any player who uses this command.
Reply
#2

pawn Код:
//This will make you ban yourself
CMD:test(playerid, params[])  {
    Ban(playerid);
    SendClientMessageEx(playerid, COLOR_WHITE, "w/e here...");
    return 1;
}
P.S:
pawn Код:
CMD:test(playerid, params[])
{
//banning an other player.
    new targetid, reason[64], string[128];
    if(sscanf(params, "uz", targetid, reason)) return SendClientMessage(playerid, -1, "Ban <playerid> <reason>");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Player isn't connected");
    new pTargetName[24], pName[24];
    GetPlayerName(playerid,pName,24);
    GetPlayerName(targetid,pTargetName,24);
    format(string, sizeof(string), "admin %s has banned %s reason %s", pName,  pTargetName, reason);
    SendClientMessageToAll(-1,string);
    Ban(targetid);
    return 1;
}
Reply
#3

PHP код:
CMD:ban(playeridparams[])
{
    new 
playerbstring[128];
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(
sscanf(params"u[128]"playerbparams)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /ban [playerid]");
    if(!
IsPlayerAdmin(playerb)) return SendClientMessage(playeridCOLOR_GREY"Player is an admin");
    
Ban(playerb);
    return 
1;

Reply
#4

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
pawn Код:
CMD:test(playerid, params[])  {
    Ban(playerid);
    SendClientMessageEx(playerid, COLOR_WHITE, "w/e here...");
    return 1;
}
Thanks for your help.

Quote:
Originally Posted by Joshman543
Посмотреть сообщение
PHP код:
CMD:ban(playeridparams[])
{
    new 
playerbstring[128];
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(
sscanf(params"u[128]"playerbparams)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /ban [playerid]");
    if(!
IsPlayerAdmin(playerb)) return SendClientMessage(playeridCOLOR_GREY"Player is an admin");
    
Ban(playerb);
    return 
1;

Not what i wanted , but thanks for your reply, I just wanted to make sure that If the format was correct.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)