Unban cmd help?
#1

Hey so i have this for lvl 2+ admins

Код:
dcmd_unban(playerid,params[]) {
{
        if(AccInfo[playerid][Level] >= 2)
        {
            new tmp[256], Index;        tmp = strtok(params,Index);
            if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /unban [name]");
            new adminname[MAX_PLAYER_NAME], string[128], unbanname[256];
            unbanname = tmp;
            if(udb_Exists(unbanname))    {
            dUserSetINT(unbanname).("banned", 0);
            GetPlayerName(playerid, adminname, sizeof(adminname));
            CMDMessageToAdmins(playerid,"UNBANNAME");
            format(string,sizeof(string),"Server: %s (ID: %d) has unbanned the name: \"%s\" .",adminname,playerid,unbanname);
            SendClientMessageToAll(green,string);
            SaveToFile("UnBanNameLog",string);
            print(string);
            return 1;
            } else return SendClientMessage(playerid, red, "ERROR: No player with this name.");
        } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    } else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
And it gives me this warning:

Код:
C:\Users\Chris\Documents\Server\filterscripts\LuxAdmin.pwn(11191) : warning 203: symbol is never used: "dcmd_unban"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
And, there is no line 11191 -_- only up to 11190.. will this command work? I know, it is just a warning, but i just want to get rid of it.

Thanks if you can help
Reply
#2

under OnPlayerCommandText callback put "dcmd(unban, 5, cmdtext);
Reply
#3

Here is my OnPlayerCommandText

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(unban, 5, cmdtext);
    
    if(AccInfo[playerid][Jailed] == 1 && AccInfo[playerid][Level] < 1)
	return SendClientMessage(playerid,red,"ERROR: You cannot use commands in Jail!");

	new cmd[256];
	new string[128];
	new tmp[256];
	new idx;
	
	cmd = strtok(cmdtext, idx);
I get these errors:


Код:
C:\Users\Chris\Documents\Server\filterscripts\LuxAdmin.pwn(1762) : error 017: undefined symbol "CMDMessageToAdmins"
C:\Users\Chris\Documents\Gserv\filterscripts\LuxAdmin.pwn(1765) : error 017: undefined symbol "SaveToFile"
C:\Users\Chris\Documents\Gserv\filterscripts\LuxAdmin.pwn(1770) : warning 225: unreachable code
C:\Users\Chris\Documents\Gserv\filterscripts\LuxAdmin.pwn(1770) : warning 217: loose indentation
C:\Users\Chris\Documents\Gserv\filterscripts\LuxAdmin.pwn(1770) : error 029: invalid expression, assumed zero
C:\Users\Chris\Documents\Gserv\filterscripts\LuxAdmin.pwn(1770) : warning 215: expression has no effect
C:\Users\Chris\Documents\Gserv\filterscripts\LuxAdmin.pwn(1770) : error 001: expected token: ";", but found "return"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Line 1762:
Код:
CMDMessageToAdmins(playerid,"UNBANNAME");
Line 1765:
Код:
SaveToFile("UnBanNameLog",string);
Line 1770:
Код:
} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
Reply
#4

pawn Код:
dcmd_unban(playerid,params[]) {
{
        if(AccInfo[playerid][Level] >= 2)
        {
            new tmp[256], Index;        tmp = strtok(params,Index);
            if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /unban [name]");
            new adminname[MAX_PLAYER_NAME], string[128], unbanname[256];
            unbanname = tmp;
            if(udb_Exists(unbanname))    {
            dUserSetINT(unbanname).("banned", 0);
            GetPlayerName(playerid, adminname, sizeof(adminname));
            AdministratorMessage(COLOR_YELLOW, %s,1);
            format(string,sizeof(string),"Server: %s (ID: %d) has unbanned the name: \"%s\" .",adminname,playerid,unbanname);
            SendClientMessageToAll(green,string);
            dini_IntSet(file,"", 0); // Edit This, I replaced your "SaveToFile"
            print(string);
            return 1;
            } else return SendClientMessage(playerid, red, "ERROR: No player with this name.");
        } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
Sorry for the late reply
Forgot to mention, Stick both of these into your script to get the "AdministratorMessage" Working or just edit it to something else

pawn Код:
forward AdministratorMessage(color,const string[],level);
pawn Код:
public AdministratorMessage(color,const string[],level)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if (AccInfo[i][Level] >= level)
            {
            }
        }
    }
    return 1;
}
Reply
#5

Ugg this is impossible, add me on MSN ill try to get on tomorrow, but i got to go to sleep. LFwolf@live.com
Reply
#6

Put dcmd_unban out of OnPlayerCommandText, and put "dcmd(unban, 5, cmdtext)" in OnPlayerCommandText.
Reply
#7

MrDeath thats already done. Snipa, with the 1770 error you had is because you had an Extra closed "}" on line
pawn Код:
} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
You have 3 } } }. When you only have 2 { {. You only need { { } }.. You had one extra. For the rest, search through the script for the "SaveToFile" correct syntax like what i posted
pawn Код:
dini_IntSet(file,"", 0); // Edit This, I replaced your "SaveToFile"
. And the last error is simple, just check for the Admin Chat command and use what ever it uses in your command, Or else just remove it so it doesn't tell admins you un-banned the persons
Reply
#8

Here is the link to DL

http://www.mediafire.com/?oqvg49m6w1htnoi

I took it out because i was getting 26+ errors about the SaveIn. PM me back with it.
Reply
#9

Try this
pawn Код:
dcmd_unban(playerid,params[])
{
        if(AccInfo[playerid][Level] >= 2)
        {
            new tmp[256], Index;        tmp = strtok(params,Index);
            new File:open = fopen("LuxAdmin/Config/UnBanNameLog",io_write);
            if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /unban [name]");
            new adminname[MAX_PLAYER_NAME], string[128], unbanname[256];
            unbanname = tmp;
            if(udb_Exists(unbanname))    {
            dUserSetINT(unbanname).("banned", 0);
            GetPlayerName(playerid, adminname, sizeof(adminname));
            MessageToAdmins(green,string);
            format(string,sizeof(string),"Server: %s (ID: %d) has unbanned the name: \"%s\" .",adminname,playerid,unbanname);
            SendClientMessageToAll(green,string);
            print(string);
            }
        }
      return 1;
}
Only 2 warnings
Код:
C:\Users\jk\Documents\Old Shit\GTa Server\0.3B R2\filterscripts\LuxAdmin.pwn(2737) : warning 204: symbol is assigned a value that is never used: "open"
C:\Users\jk\Documents\Old Shit\GTa Server\0.3B R2\filterscripts\LuxAdmin.pwn(2737 -- 2750) : warning 217: loose indentation
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)