Help please - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help please (
/showthread.php?tid=274610)
Help please -
ServerRestart - 06.08.2011
How would i make a /kick and /ban cmd with Zcmd and Sscanf ?
And the /ban command bans the people in days, thx!
Re: Help please -
emokidx - 06.08.2011
i dont know the ban command in DAYS but here's the kick command:
pawn Код:
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;
}
you need to change
pawn Код:
if(PlayerInfo[playerid][pAdminLevel] >= 1) {
this line according to your variables..
if this gives errors you can tell here..
Re: Help please -
ServerRestart - 06.08.2011
Ty very much.
Re: Help please -
ServerRestart - 06.08.2011
What about if i wanted to save the kick logs in a file?
Re: Help please -
MadeMan - 06.08.2011
pawn Код:
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);
}
Use this function
pawn Код:
SendClientMessageToAll(red, str);
Log("kicks.txt", str);
Kick(ID);
Re: Help please -
ServerRestart - 06.08.2011
Ty MadeMan