y_ini ban/unban
#1

pawn Code:
CMD:unban(playerid, params[])
{
    new string, gstring[128];
    if(sscanf(params,"us[128]",string,gstring)) return Use(playerid, "/unban [name] [reason]");
    else if(PlayerInfo[playerid][pAdmin] < 2)return SendAdmin(playerid, "You are not Admin!");
    format(gstring,128,"{FCFCFC}Admin {EE0000}%s {FCFCFC}has unban {EE0000}%s {FCFCFC},Reason:{EE0000} %s",PlayerName(playerid),string,gstring);
    SendClientMessageToAll(0xFF0000AA, gstring);
    PlayerInfo[string][pBan] = 0;
    new uFile[35];
    format(uFile, 35, USER_FILE, PlayerName(string));
    new INI:playerFile = INI_Open(uFile);
    INI_WriteInt(playerFile,"Ban",0);
    INI_Close(playerFile);
    return 1;
}
CMD:ban(playerid, params[])
{
    new player, string[128];
    if(sscanf(params,"us[128]",player,string))return Use(playerid, "/ban [ime/ID] [razlog]");
    else if(PlayerInfo[playerid][pAdmin] < 2)return SendAdmin(playerid, "You not admin!");
    format(string,128,"{FCFCFC}Admin {EE0000}%s {FCFCFC}has ban {EE0000}%s {FCFCFC}Reason:{EE0000} %s",PlayerName(playerid),PlayerName(player),string);
    SendClientMessageToAll(0xFF0000AA, string);
    PlayerInfo[player][pBan] = 1;
    new uFile[35];
    format(uFile, 35, USER_FILE, PlayerName(player));
    new INI:playerFile = INI_Open(uFile);
    INI_WriteInt(playerFile,"Ban",1);
    INI_Close(playerFile);
    Kick(player);
    return 1;
}
it bans player but not unban, pls help
Reply
#2

INI_WriteInt(playerFile,"Ban", PlayerInfo[playerid][pBan]);

Not saying this is a soultion because i havnt looked at it propery but why are you setting value when your just writing it and the Vlue becomes unused?
Reply
#3

Quote:
Originally Posted by IceCube!
View Post
INI_WriteInt(playerFile,"Ban", PlayerInfo[playerid][pBan]);

Not saying this is a soultion because i havnt looked at it propery but why are you setting value when your just writing it and the Vlue becomes unused?
Nope, problem is still here :S

/unban dosent unban a player :S
Reply
#4

pawn Code:
new string, gstring[128];
    if(sscanf(params,"us[128]",string,gstring))
Reply
#5

Quote:
Originally Posted by ******
View Post
Oh yeah. But if a player is banned, surely they're not connected to the server, no? In which case they aren't going to be found by "u" and aren't going to have a player ID.
but, if he has pBan = 1, he will get kick if he is banned

pawn Code:
if(PlayerInfo[playerid][pBan] == 1)
                            {
                                SendClientMessage(playerid, -1, "You are banned!");
                                Kick(playerid);
                            }
Reply
#6

what parametar those ?
Reply
#7

bump, can someone help me?
Reply
#8

instead of sscanf(params, "u
have sscanf(params, "s[MAX_PLAYER_NAME+1]
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)