PDA

View Full Version : Need help regarding a ban command.


Desi_Dude
20/02/2013, 03:11 PM
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.

DaRk_RaiN
20/02/2013, 03:39 PM
//This will make you ban yourself
CMD:test(playerid, params[]) {
Ban(playerid);
SendClientMessageEx(playerid, COLOR_WHITE, "w/e here...");
return 1;
}

P.S:

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

Joshman543
20/02/2013, 03:49 PM
CMD:ban(playerid, params[])
{
new playerb, string[128];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "u[128]", playerb, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid]");
if(!IsPlayerAdmin(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is an admin");
Ban(playerb);
return 1;
}

Desi_Dude
20/02/2013, 03:57 PM
CMD:test(playerid, params[]) {
Ban(playerid);
SendClientMessageEx(playerid, COLOR_WHITE, "w/e here...");
return 1;
}


Thanks for your help.

CMD:ban(playerid, params[])
{
new playerb, string[128];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "u[128]", playerb, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid]");
if(!IsPlayerAdmin(playerb)) return SendClientMessage(playerid, COLOR_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.