Jump to content
  • 0

Problema Unban


Daniel_Dani

Question

Deci am o problema pe server daca dau /ban la cineva si apoi i dau /unban ,banul tot nu i se scoate i apare ca si cum ar fi banat in continuare.

[pawn] 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] <= ' '))

{

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;

}[/pawn]

si:

[pawn]    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'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'ul %s", sendername, tmp);

ABroadCast(COLOR_YELLOW,string,1);

format(string, 256, "AdmWarning: %s a scos din lista de ban IP'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;

}[/pawn]

vqqi6h.gif
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

tu cand ii dai ban lui i se blocheaza contul pentru ca ai asta:"

PlayerInfo[giveplayerid][pLocked] = 1;

si cand ii dai unban plocked ramane la fel pe 1...ca sa iti mearga la comanda unban dupa

fremove(string);

adauga asta =>  PlayerInfo[giveplayerid][pLocked] = 0;

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.