25.04.2013, 13:54
I have made Ban command which bans the playerid we type and kick which asks for ID and reason.
But when you type the id whom you want to ban or kick it'll give him message that they have been kicked but it kicks / bans the player/admin who types the command. I need help urgently. Rep+ for helper.
But when you type the id whom you want to ban or kick it'll give him message that they have been kicked but it kicks / bans the player/admin who types the command. I need help urgently. Rep+ for helper.
pawn Код:
CMD:kick(playerid, params[])
{
new giveplayerid;
if(GetAdminLevel(playerid) >=2) {
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid]");
if(!IsPlayerConnected(giveplayerid)) return 1;
new str[128], str2[128];
format(str, 128, "You have kicked %s from the server.", GetPName(giveplayerid));
format(str2, 128, "You have been kicked from the server by %s.", GetPName(playerid));
SendClientMessage(playerid, COLOR_RED, str);
SendClientMessage(giveplayerid, COLOR_RED, str2);
Kick(giveplayerid);
}
return 1;
}
CMD:ban(playerid, params[])
{
if(GetAdminLevel(playerid) >= 3) {
new reason[50], giveplayerid, sendername[24], year, month, day, date[128], str[128], str2[128], str3[128], pName[24], file[128];
if(sscanf(params, "us", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid] [reason]");
if(!IsPlayerConnected(giveplayerid)) return 1;
getdate(year, month, day);
format(date, sizeof(date), "Date: %02d/%02d/%d", month, day, year);
GetPlayerName(playerid, sendername, 20);
GetPlayerName(giveplayerid, pName, sizeof(pName));
format(file, 128, USER_FILE, pName);
dini_IntSet(file, "Banned", 1);
dini_Set(file, "BannedReason", reason);
dini_Set(file, "BannedBy", sendername);
dini_Set(file, "DateBanned", date);
format(str, 128, "You have banned %s. Reason: %s.",pName, reason);
format(str2, 128, "You have been banned from this server. Reason: %s", reason);
format(str3, 128, "Banned by: %s", sendername);
SendClientMessage(playerid, COLOR_RED, str);
SendClientMessage(giveplayerid, COLOR_RED, str2);
SendClientMessage(giveplayerid, COLOR_RED, str3);
SendClientMessage(giveplayerid, COLOR_RED, date);
SendClientMessage(giveplayerid, COLOR_RED, "Make a ban appeal via the forums.");
KickWithMessage(giveplayerid);
}
return 1;
}