sscanf warning.
#1

Код:
[17:19:19] sscanf warning: 'z' is deprecated, consider using 'S' instead.
[17:19:19] sscanf warning: No default value found.
[17:19:19] sscanf warning: Strings without a length are deprecated, please add a destination size.
Command:
pawn Код:
CMD:ban(playerid, params[])
{

    new id, reason[35], name2[MAX_PLAYER_NAME], name1[MAX_PLAYER_NAME], string[128];
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GRAD2, "Grow some balls first, faggot.");
    if(sscanf(params,"uz", id, reason)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /ban [playerid/PartOfName] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY,"Invalid player specified!");
    else
    {
        if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GRAD2, " You can't ban higher level administrators!");
        new year, month, day;
        new logstring[256];
        getdate(year, month, day);
        GetPlayerName(id, name2, sizeof(name2));
        GetPlayerName(playerid, name1, sizeof(name1));
        format(string, sizeof(string), "AdmCmd: %s has been banned by %s, reason: %s", name2, GetName(playerid), reason);
        format(logstring, sizeof(logstring), "AdmCmd: %s was kicked by %s, reason: %s (%d-%d-%d).", name2, GetName(playerid), reason, month, day, year);
        BanLog(logstring);
        SendClientMessageToAll(COLOR_LIGHTRED, string);
        new plrIP[16];
        PlayerInfo[id][pBanned] = 1;
        GetPlayerIp(id,plrIP, sizeof(plrIP));
        SendClientMessage(id,COLOR_YELLOW,"|___________[BAN INFO]___________|");
        format(string, sizeof(string), "Your name: %s.",name2);
        SendClientMessage(id, COLOR_WHITE, string);
        format(string, sizeof(string), "Your IP: %s.",plrIP);
        SendClientMessage(id, COLOR_WHITE, string);
        format(string, sizeof(string), "Who banned you: %s.",name1);
        SendClientMessage(id, COLOR_WHITE, string);
        format(string, sizeof(string), "Reason: %s.",reason);
        SendClientMessage(id, COLOR_WHITE, string);
        SendClientMessage(id,COLOR_YELLOW,"|___________[BAN INFO]___________|");
        format(string,sizeof(string),"Please take a screenshot of this message (F8) and include it in your ban appeal.",GetName(playerid));
        SendClientMessage(playerid, COLOR_YELLOW,string);
        Ban(id);
    }
    return 1;
}
And i dont know why, but it doesnt show this message:
pawn Код:
SendClientMessage(id,COLOR_YELLOW,"|___________[BAN INFO]___________|");
        format(string, sizeof(string), "Your name: %s.",name2);
        SendClientMessage(id, COLOR_WHITE, string);
        format(string, sizeof(string), "Your IP: %s.",plrIP);
        SendClientMessage(id, COLOR_WHITE, string);
        format(string, sizeof(string), "Who banned you: %s.",name1);
        SendClientMessage(id, COLOR_WHITE, string);
        format(string, sizeof(string), "Reason: %s.",reason);
        SendClientMessage(id, COLOR_WHITE, string);
        SendClientMessage(id,COLOR_YELLOW,"|___________[BAN INFO]___________|");
        format(string,sizeof(string),"Please take a screenshot of this message (F8) and include it in your ban appeal.",GetName(playerid));
        SendClientMessage(playerid, COLOR_YELLOW,string);
It just shows: Server closed connection. Any ideas how to fix it?
Reply
#2

PHP код:
if(sscanf(params,"us[35]"idreason)) return SendClientMessage(playeridCOLOR_WHITE,"USAGE: /ban [playerid/PartOfName] [reason]"); 
Reply
#3

Okay, its working without errors now. And what about the second problem?
Reply
#4

could you show full what codes has second ?
Reply
#5

I reminded, I had this problem before, need to show first message and after put a TIMER for ban
pawn Код:
CMD:ban(playerid, params[])
{

    new id, reason[35], name2[MAX_PLAYER_NAME], name1[MAX_PLAYER_NAME], string[128];
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GRAD2, "Grow some balls first, faggot.");
    if(sscanf(params,"us[35]", id, reason)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /ban [playerid/PartOfName] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY,"Invalid player specified!");
        if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GRAD2, " You can't ban higher level administrators!");
        new year, month, day;
        new logstring[256];
        getdate(year, month, day);
        GetPlayerName(id, name2, sizeof(name2));
        GetPlayerName(playerid, name1, sizeof(name1));
        format(string, sizeof(string), "AdmCmd: %s has been banned by %s, reason: %s", name2, GetName(playerid), reason);
        format(logstring, sizeof(logstring), "AdmCmd: %s was kicked by %s, reason: %s (%d-%d-%d).", name2, GetName(playerid), reason, month, day, year);
        BanLog(logstring);
        SendClientMessageToAll(COLOR_LIGHTRED, string);
        new plrIP[16];
        PlayerInfo[id][pBanned] = 1;
        GetPlayerIp(id,plrIP, sizeof(plrIP));
        SendClientMessage(id,COLOR_YELLOW,"|___________[BAN INFO]___________|");
        format(string, sizeof(string), "Your name: %s.",name2);
        SendClientMessage(id, COLOR_WHITE, string);
        format(string, sizeof(string), "Your IP: %s.",plrIP);
        SendClientMessage(id, COLOR_WHITE, string);
        format(string, sizeof(string), "Who banned you: %s.",name1);
        SendClientMessage(id, COLOR_WHITE, string);
        format(string, sizeof(string), "Reason: %s.",reason);
        SendClientMessage(id, COLOR_WHITE, string);
        SendClientMessage(id,COLOR_YELLOW,"|___________[BAN INFO]___________|");
        format(string,sizeof(string),"Please take a screenshot of this message (F8) and include it in your ban appeal.",GetName(playerid));
        SendClientMessage(playerid, COLOR_YELLOW,string);
        SetTimerEx("BanP",100,false,"i",id);
        return 1;
}

forward public BanP(id)
{
Ban(id);
return 1;
}
this should work
Reply
#6

@UP
Works perfectly! Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)