Unban command -
Droxx - 31.05.2017
I have searched all over the forum for this command and i have not found it yet.
I have a COD server, I tried making the unban cmd myself but i failed.
I need someone to make it for me please.
I have ladmin script.
This is the ban cmd.
Code:
CMD:ban(playerid,params[]) {
if(PlayerInfo[playerid][LoggedIn] == 1) {
if(PlayerInfo[playerid][Level] >= 2) {
new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE:{FFFFFF} /Ban [playerid] [reason]");
if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE:{FFFFFF} /Ban [playerid] [reason]");
new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
CMDMessageToAdmins(playerid,"BAN");
format(string,sizeof(string),"*** Player %s has been banned by Administrator %s.",playername,adminname);
SendClientMessageToAll(red,string);
format(string,sizeof(string),"[Reason: %s]",params[2]);
SendClientMessageToAll(red,string);
SaveToFile("BanLog",string);
print(string);
if(udb_Exists(PlayerName2(player1)) && PlayerInfo[player1][LoggedIn] == 1) dUserSetINT(PlayerName2(player1)).("banned",1);
format(string,sizeof(string),"banned by Administrator %s. Reason: %s", adminname, params[2] );
return BanEx(player1,params[2]);
} else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
} else return SendClientMessage(playerid,red,"ERROR:{FF9E00} You are not a high enough level to use this command");
} else return SendClientMessage(playerid,red,"ERROR:{FF9E00} You must be logged in to use this commands");
}
EDIT:
This is the unban cmd i tried to make but did not work idk why..
Code:
CMD:unban(playerid, params[])
{
if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))
{
new target[50];
if(sscanf(params,"s[50]", target)) return SendClientMessage(playerid, red,"[USAGE]: /unban [player name]");
CMDMessageToAdmins(playerid,"UNBAN");
} else return SendClientMessage(playerid, RED,"ERROR: You need to be level 2 to use this command!");
return 1;
}
Thanks.
Re: Unban command -
coool - 31.05.2017
Code:
CMD:unban(playerid,params[])
{
new string[124],string1[124];
if(isnull(params)) return ShowUsageMessage(playerid,"/unban [playername]");
format(string,sizeof(string),"Users/%s.ini",params);
if(fexist(string))
{
new INI:file = INI_Open(string);
INI_WriteInt(file,"Banned",0);
INI_Close(file);
}
else SendClientMessage(playerid,-1,"Account not found");
return 1;
}
Re: Unban command -
Droxx - 31.05.2017
I still have one error.
Code:
C:\Users\Tannos\Desktop\My server\gamemodes\cod.pwn(11450) : warning 213: tag mismatch
C:\Users\Tannos\Desktop\My server\gamemodes\cod.pwn(11451) : error 035: argument type mismatch (argument 1)
C:\Users\Tannos\Desktop\My server\gamemodes\cod.pwn(11452) : warning 202: number of arguments does not match definition
C:\Users\Tannos\Desktop\My server\gamemodes\cod.pwn(11450) : warning 204: symbol is assigned a value that is never used: "file"
C:\Users\Tannos\Desktop\My server\gamemodes\cod.pwn(11445) : warning 204: symbol is assigned a value that is never used: "string1"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Code:
CMD:unban(playerid,params[])
{
new string[124],string1[124];
if(isnull(params)) return SendClientMessage(playerid, red, "/unban [playername]");
format(string,sizeof(string),"Users/%s.ini",params);
if(fexist(string))
{
new INI:file = INI_Open(string);
INI_WriteInt(file,"Banned",0); //this is the error line..
INI_Close(file);
}
else SendClientMessage(playerid,-1,"Account not found");
return 1;
}
Re: Unban command -
Droxx - 31.05.2017
I still have a problem, I fixed the error but when i try unbanning the player it says
"Account not found" and the ban stays.
Code:
CMD:unban(playerid,params[])
{
new string[124],string1[124];
if(isnull(params)) return SendClientMessage(playerid, red, "/unban [playername]");
format(string,sizeof(string),"Users/%s.ini",params);
if(fexist(string))
{
SaveToFile("AdminLog",string);
dUserSetINT(PlayerName2(playerid)).("banned",0);
}
else SendClientMessage(playerid, red, "Account not found");
return 1;
}
Re: Unban command -
JasonRiggs - 31.05.2017
Where are you saving your accounts? MySQL? Or Accountes folder in "scriptfiles" or "users" or just like that inside the scriptfiles?
Re: Unban command -
Droxx - 31.05.2017
scriptfiles >> ladmin >> users
Re: Unban command -
JasonRiggs - 31.05.2017
Code:
CMD:unban(playerid,params[])
{
new string[124],string1[124];
if(isnull(params)) return SendClientMessage(playerid, red, "/unban [playername]");
format(string,sizeof(string),"ladmin/users/%s.ini",params);
if(fexist(string))
{
SaveToFile("AdminLog",string);
dUserSetINT(PlayerName2(playerid)).("banned",0);
}
else SendClientMessage(playerid, red, "Account not found");
return 1;
}
then you will need this code instead of that you have.
Re: Unban command -
Droxx - 31.05.2017
Its not .ini, its .sav..
Re: Unban command -
Sumit4 - 31.05.2017
Quote:
Originally Posted by Droxx
Its not .ini, its .sav..
|
Change .ini to .sav if you already done it and tried it the issue resolved or no?
Re: Unban command -
Droxx - 31.05.2017
I did it and its not working