06.08.2011, 16:09
How would i make a /kick and /ban cmd with Zcmd and Sscanf ?
And the /ban command bans the people in days, thx!
And the /ban command bans the people in days, thx!
command(kick, playerid, params[])
{
new reason[128], pname[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME], str[128], ID;
GetPlayerName(playerid, aname, sizeof(aname));
if(PlayerInfo[playerid][pAdminLevel] >= 1) {
if(sscanf(params, "us[128]", ID, reason)) {
SendClientMessage(playerid, red, "Usage: /kick [playerid] [reason]");
return 1;
}
if(!IsPlayerConnected(ID)) {
SendClientMessage(playerid, red, "INVALID ID");
return 1;
}
GetPlayerName(ID, pname, sizeof(pname));
format(str, sizeof(str), "Admin {4ADAED}%s(%d){FF0000} has kicked {5F4AED}%s(%d){FF0000} Reason: %s", aname, playerid, pname, ID, reason);
SendClientMessageToAll(red, str);
Kick(ID);
return 1;
}
else if(PlayerInfo[playerid][pAdminLevel] < 1) {
SendClientMessage(playerid, red, "You are not an Admin!");
}
return 1;
}
if(PlayerInfo[playerid][pAdminLevel] >= 1) {
stock Log(const filename[], const string[])
{
new hour, minute, second;
gettime(hour, minute, second);
new year, month, day;
getdate(year, month, day);
new timestamp[32];
format(timestamp, sizeof(timestamp), "[%02d/%02d/%02d | %02d:%02d:%02d] ", day, month, year, hour, minute, second);
new File:logfile = fopen(filename, io_append);
fwrite(logfile, timestamp);
fwrite(logfile, string);
fwrite(logfile, "\r\n");
fclose(logfile);
}
SendClientMessageToAll(red, str);
Log("kicks.txt", str);
Kick(ID);