Tempban help
#1

Hello i made a temp ban command and now it says that something is not defined and i dont know why
here is my code
pawn Код:
CMD:tempbanip(playerid,params[])
{
    if(pInfo[playerid][Adminlevel] >= 3)
    new ip[16];
    new days;
    if(GetCurrentTempBanCount() == 24) return SendClientMessage(playerid,COLOR_RED,"Temp Ban Limit Reached.");
    if(sscanf(params, "s[16]d",ip,days)) return SendClientMessage(playerid,COLOR_RED,"Usage: /tempbanip <ip> <amount of days ahead>");
    new year,mon,d;
    getdate(year,mon,d);
    new i = GetTempBanSlot();
    TempBans[i][BannedIP] = ip;
    TempBans[i][UnbanDate] = d+days;
    new str[100];
    format(str,sizeof str,"** IP %s set to to unbanned on %d/%d/%d",mon,d+days,year);
    SendClientMessage(playerid,COLOR_RED,str);
    format(str,sizeof str,"banip %s",ip);
    SendRconCommand(str);
    return 1;
}
and here are the errors
Код:
freeroam.pwn(2977) : error 003: declaration of a local variable must appear in a compound block
freeroam.pwn(2977) : error 017: undefined symbol "ip"
freeroam.pwn(2977) : warning 215: expression has no effect
freeroam.pwn(2977) : error 001: expected token: ";", but found "]"
freeroam.pwn(2977) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
<<< Process finished. (Exit code 1)
================ READY ================
Reply
#2

Код:
CMD:tempbanip(playerid,params[])
{
	if(pInfo[playerid][Adminlevel] >= 3)
	{
		new ip[16];
		new days;
		if(GetCurrentTempBanCount() == 24) return SendClientMessage(playerid,COLOR_RED,"Temp Ban Limit Reached.");
		if(sscanf(params, "s[16]d",ip,days)) return SendClientMessage(playerid,COLOR_RED,"Usage: /tempbanip <ip> <amount of days ahead>");
		new year,mon,d;
		getdate(year,mon,d);
		new i = GetTempBanSlot();
		TempBans[i][BannedIP] = ip;
		TempBans[i][UnbanDate] = d+days;
		new str[100];
		format(str,sizeof str,"** IP %s set to to unbanned on %d/%d/%d",mon,d+days,year);
		SendClientMessage(playerid,COLOR_RED,str);
		format(str,sizeof str,"banip %s",ip);
		SendRconCommand(str);
	}
	return 1;
}
Here you go.
Reply
#3

Still the same problem
Reply
#4

Really same problem? I do not know but player ip is string, so if you want assign ip to variable you must use format.
Код:
TempBans[i][BannedIP] = ip;
Код:
new Variable[16];
format(Variable,sizeof(Variable),ip);
Reply
#5

Its a downloaded filterscript and it works normal when i run it in the filter script but when i transform it to my gm it dosent work and i did everything correctly
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)