20.05.2013, 20:18
Hey bro, I am having issues with the /ban, /br and the /unban commands and can't figure it out. It keeps on saying "Player didn't found in database."
pawn Код:
CMD:unban(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] >= 2)
{
new PlayerFile[50],string[128];
format(PlayerFile, sizeof(PlayerFile), "Saves/%s.ini", params);
if(!strlen(params)) return SendClientMessage(playerid, COLOR_GREY, "/unban [playername]");
if(!dini_Exists(PlayerFile)){SendClientMessage(playerid, COLOR_GREY, "No such player found in the database.");}
else
{
if(dini_Int(PlayerFile,"Banned")==0)return SendClientMessage(playerid,-1,"That Player is already unbanned");
dini_IntSet(PlayerFile, "Banned", 0);
SendClientMessage(playerid, COLOR_WHITE, "Account Unbanned");
format(string,sizeof(string),"unbanip %s",dini_Get(PlayerFile,"IP"));
SendRconCommand(string);
}
}else return 0;
return 1;
}
CMD:ban(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] >= 3)
{
new PlayerFile[50];
format(PlayerFile, sizeof(PlayerFile), "Saves/%s.ini", params);
if(!strlen(params)) return SendClientMessage(playerid, COLOR_GREY, "/oban [playername]");
if(!dini_Exists(PlayerFile)) {SendClientMessage(playerid, COLOR_GREY, "No such player found in the database.");}
else
{
if(dini_Int(PlayerFile,"Banned")==1)return SendClientMessage(playerid,-1,"That Player is already banned");
dini_IntSet(PlayerFile, "Banned", 1);
SendClientMessage(playerid, COLOR_WHITE, "Account Banned");}
}else return 0;
return 1;
}
//==============================================================================
CMD:br(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] >= 2)
{
new PlayerFile[50];
format(PlayerFile, sizeof(PlayerFile), "Saves/%s.ini", params);
if(!strlen(params)) return SendClientMessage(playerid, COLOR_GREY, "/banreason [playername]");
if(!dini_Exists(PlayerFile)) {SendClientMessage(playerid, COLOR_GREY, "No such player found in the database.");}
if(dini_Int(PlayerFile,"Banned")==1)
{
new str[256];
format(str,sizeof(str),"\"%s\" was banned for \"%s\" by \"%s\"",params,dini_Get(PlayerFile,"Reason"),dini_Get(PlayerFile,"Banner"));
SendClientMessage(playerid, COLOR_WHITE, str);
}else return SendClientMessage(playerid,-1,"That Player is not banned");
}else return 0;
return 1;
}