HALP! (Help) -
xHarshx - 24.12.2013
Hello guys, I made a /rangeban CMD and it works but I have a little problem. In the CMD, I am trying to make it also add the ban in my file I made as ban.log, but that aint working. In my scriptfiles I made a file called: ban.log which works for /ban and /permaban and saved the Ip/Bans, but I have a little problem here. First here is my Rangeban CMD, it works fine but it aint adding the IP it bans.
CMD:
pawn Код:
CMD:rangeban(playerid, params[])
{
if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
if (PlayerInfo[playerid][pAdmin] >= 1338)
{
new Target;
new Reason[100];
if(!sscanf(params, "us[100]", Target,Reason))
{
if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"ERROR: Wrong player ID");
if(Target == playerid) return SendClientMessage(playerid,-1,"ERROR: You cant ban yourself!");
new tname[MAX_PLAYER_NAME];
GetPlayerName(Target,tname,sizeof(tname));
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
new MyString[256];
new TargetString[256];
new rbandate[3];
getdate(rbandate[0], rbandate[1], rbandate[2]);
format(MyString,sizeof(MyString),"You have range banned %s(%d)! (Reason: %s)",tname, Target, Reason);
format(TargetString,sizeof(TargetString),"{FF002B}Range banned by: {FFFFFF}%s\n\n{FF002B}Reason: {FFFFFF}%s\n\n{FF002B}Date: {FFFFFF}%02d/%02d/%04d\n\n{FFFFFF}Press F8 to take a screenshot and use this in unban appeal!", pname, playerid,Reason, rbandate[2], rbandate[1], rbandate[0]);
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{FF002B}RANGE BANNED!", TargetString, "OK", "");
SendClientMessage(playerid,-1,MyString);
new AllString[256];
format(AllString,sizeof(AllString),"Administrator %s range banned player %s(%d)! (Reason: %s)",pname,tname,Target,Reason);
SendClientMessageToAll(-1,AllString);
new ip[50];
GetPlayerIp(Target,ip,sizeof(ip));
strdel(ip,strlen(ip)-4,strlen(ip));
format(ip,sizeof(ip),"%s.***",ip);
format(ip,sizeof(ip),"%s.**",ip);
format(ip,sizeof(ip),"%s.*",ip);
format(ip,sizeof(ip),"%s.***.***",ip);
format(ip,sizeof(ip),"%s.***.***",ip);
format(ip,sizeof(ip),"%s.***.***",ip);
format(ip,sizeof(ip),"%s.**.***",ip);
format(ip,sizeof(ip),"%s.**.**",ip);
format(ip,sizeof(ip),"%s.**.*",ip);
format(ip,sizeof(ip),"%s.*.***",ip);
format(ip,sizeof(ip),"%s.*.**",ip);
format(ip,sizeof(ip),"%s.*.*",ip);
format(ip,sizeof(ip),"banip %s",ip);
SendRconCommand(ip);
Kick(Target);
}
else SendClientMessage(playerid, -1, "USAGE: /rangeban [playerid] [reason]");
}
return 1;
}
So, In my other CMD, I added this to add the ban in the file directory. "Log("logs/ban.log", string);". So, What I need help with is in /rangeban where Do I add this 'Log("logs/ban.log", string);'. So please help or What do I do to make this CMD save the bans in my ban.log file and where do i add it ?
Re: HALP! (Help) -
Zamora - 24.12.2013
pawn Код:
CMD:rangeban(playerid, params[])
{
if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
if (PlayerInfo[playerid][pAdmin] >= 1338)
{
new Target;
new Reason[100];
if(!sscanf(params, "us[100]", Target,Reason))
{
if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"ERROR: Wrong player ID");
if(Target == playerid) return SendClientMessage(playerid,-1,"ERROR: You cant ban yourself!");
new tname[MAX_PLAYER_NAME];
GetPlayerName(Target,tname,sizeof(tname));
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
new MyString[256];
new TargetString[256];
new rbandate[3];
getdate(rbandate[0], rbandate[1], rbandate[2]);
format(MyString,sizeof(MyString),"You have range banned %s(%d)! (Reason: %s)",tname, Target, Reason);
format(TargetString,sizeof(TargetString),"{FF002B}Range banned by: {FFFFFF}%s\n\n{FF002B}Reason: {FFFFFF}%s\n\n{FF002B}Date: {FFFFFF}%02d/%02d/%04d\n\n{FFFFFF}Press F8 to take a screenshot and use this in unban appeal!", pname, playerid,Reason, rbandate[2], rbandate[1], rbandate[0]);
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{FF002B}RANGE BANNED!", TargetString, "OK", "");
SendClientMessage(playerid,-1,MyString);
new AllString[256];
format(AllString,sizeof(AllString),"Administrator %s range banned player %s(%d)! (Reason: %s)",pname,tname,Target,Reason);
SendClientMessageToAll(-1,AllString);
new ip[50];
GetPlayerIp(Target,ip,sizeof(ip));
strdel(ip,strlen(ip)-4,strlen(ip));
format(ip,sizeof(ip),"%s.***",ip);
format(ip,sizeof(ip),"%s.**",ip);
format(ip,sizeof(ip),"%s.*",ip);
format(ip,sizeof(ip),"%s.***.***",ip);
format(ip,sizeof(ip),"%s.***.***",ip);
format(ip,sizeof(ip),"%s.***.***",ip);
format(ip,sizeof(ip),"%s.**.***",ip);
format(ip,sizeof(ip),"%s.**.**",ip);
format(ip,sizeof(ip),"%s.**.*",ip);
format(ip,sizeof(ip),"%s.*.***",ip);
format(ip,sizeof(ip),"%s.*.**",ip);
format(ip,sizeof(ip),"%s.*.*",ip);
format(ip,sizeof(ip),"banip %s",ip);
SendRconCommand(ip);
new LogString[256];
format(LogString,sizeof(LogString),"Administrator %s range banned player %s(%d)! (Reason: %s)",pname,tname,ip,Reason);
Log("logs/ban.log", LogString);
Kick(Target);
}
else SendClientMessage(playerid, -1, "USAGE: /rangeban [playerid] [reason]");
}
return 1;
}
Try this.,
Re: HALP! (Help) -
xVIP3Rx - 24.12.2013
Also a tip: You're using a lot of "new MyString[256]" for SendClientMessage,
That should be 144/128 (The Max character for
SendClientMessage) So you're making it 265 bit while you're only using 128/144
Re: HALP! (Help) -
xHarshx - 24.12.2013
Thanks Zamora +REPed
Re: HALP! (Help) -
xHarshx - 24.12.2013
CLOSE THIS NOW!