Unban Problem.
#1

I have a problem with my /unban command.After I'm banning a player and i try to /unban him,the command /unban doesn't work.Sorry for my bad english.
Quote:

if(strcmp(cmd, "/ban", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= &#039; '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");
return 1;
}
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s a fost banat de %s, Motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
BanLog(string);
format(string, sizeof(string), "AdmCmd: %s a fost banat de %s, Motiv: %s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
PlayerInfo[giveplayerid][pLocked] = 1;
Ban(giveplayerid);
return 1;
}
}//not connected
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}

Quote:

if(strcmp(cmd,"/unbanip",true)==0)
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GRAD1,"USAGE: /unbanip [players ip]");
return 1;
}
format(string,sizeof(string),"unbanip %s",tmp);
SendRconCommand(string);
SendRconCommand("reloadbans");
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "AdmWarning: %s a scos din lista de ban la IP&#039;ul %s", sendername,tmp);
ABroadCast(COLOR_YELLOW,string,1);
}
return 1;
}
if (strcmp(cmd, "/unban", true)==0)
{
if((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >=3)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [PlayerName_PlayerLastName]");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(giveplayer));
format(string, 256, "AdmWarning: %s a scos din lista de ban IP&#039;ul %s", sendername, tmp);
ABroadCast(COLOR_YELLOW,string,1);
format(string, 256, "AdmWarning: %s a scos din lista de ban IP&#039;ul %s", sendername, tmp);
printf(string);
format(string,sizeof(string),"%s.ini",tmp);
fremove(string);
SendClientMessage(playerid, COLOR_WHITE, "Player unbanned");
SendRconCommand(string);
SendRconCommand("reloadbans");
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
}
return 1;
}

Reply
#2

I suggest you to use Sscanf2 + Zcmd.
Reply
#3

Please i need a solution.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)