sscanf warning: Strings without a length are deprecated, please add a destination size.
#1

Код:
public ReportLog(string[])
{
    new entry[128];
    format(entry, sizeof(entry), "%s\n",string);
    new File:hFile;
    hFile = fopen("HZadmin/Reports/Reports.txt", io_append);
    fwrite(hFile, entry);
    fclose(hFile);
}

Код:
COMMAND:report(playerid,params[]) {
    new
        name1[30],
        name2[30],
        id,
        text[128],
        reason[50];
    if(sscanf(params,"us",id,reason))
        return SendClientMessage(playerid,red,"USAGE: /report [id] [reason]");
    if(IsPlayerConnected(id)) {
        SendClientMessage(playerid,Green,"Your report has been sent to online admins.");
        for(new i = 0; i < MAX_PLAYERS; ++i) {
            if(IsPlayerConnected(i) && !IsPlayerNPC(i) && IsPlayerAdmin(i)) {
            GetPlayerName(playerid,name1,sizeof(name1));
            GetPlayerName(id,name2,sizeof(name2));
            new Hour,Minute,Second;
            gettime(Hour,Minute,Second);
            format(text,sizeof(text),"|| %d:%d:%d || [Report] | \"%s\" [%i] has reported \"%s\" [%i], reason: %s.",Hour,Minute,Second,name1,playerid,name2,id,reason);
            SendClientMessage(i,COLOR_WHITE,text);
            ReportLog(text);
        }
        }
    } else {
        return SendClientMessage(playerid,red,"Invalid ID");
    }
    return 1;
}
This is the script that i just recently added, that the problem occurred
Reply
#2

pawn Код:
if(sscanf(params,"us[128]",id,reason))
Reply
#3

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
pawn Код:
if(sscanf(params,"us[128]",id,reason))
Theres no Warning anymore But now its not saving
Reply
#4

Then theres something wrong with your code
Reply
#5

pawn Код:
COMMAND:report(playerid,params[]) {
    new name1[30], name2[30], id, text[128], reason[50];
    if(sscanf(params,"us",id,reason)) return SendClientMessage(playerid,red,"USAGE: /report [id] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"Invalid ID");
    SendClientMessage(playerid,Green,"Your report has been sent to online admins.");
    GetPlayerName(playerid,name1,sizeof(name1));
    GetPlayerName(id,name2,sizeof(name2));
    new Hour,Minute,Second;
    gettime(Hour,Minute,Second);
    format(text,sizeof(text),"|| %d:%d:%d || [Report] | \"%s\" [%i] has reported \"%s\" [%i], reason: %s.",Hour,Minute,Second,name1,playerid,name2,id,reason);
    for(new i = 0; i < MAX_PLAYERS; ++i) {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i) && IsPlayerAdmin(i)) SendClientMessage(i,COLOR_WHITE,text);
    }
    ReportLog(text);
    return 1;
}
Reply
#6

Quote:
Originally Posted by Donya
Посмотреть сообщение
pawn Код:
COMMAND:report(playerid,params[]) {
    new name1[30], name2[30], id, text[128], reason[50];
    if(sscanf(params,"us",id,reason)) return SendClientMessage(playerid,red,"USAGE: /report [id] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"Invalid ID");
    SendClientMessage(playerid,Green,"Your report has been sent to online admins.");
    GetPlayerName(playerid,name1,sizeof(name1));
    GetPlayerName(id,name2,sizeof(name2));
    new Hour,Minute,Second;
    gettime(Hour,Minute,Second);
    format(text,sizeof(text),"|| %d:%d:%d || [Report] | \"%s\" [%i] has reported \"%s\" [%i], reason: %s.",Hour,Minute,Second,name1,playerid,name2,id,reason);
    for(new i = 0; i < MAX_PLAYERS; ++i) {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i) && IsPlayerAdmin(i)) SendClientMessage(i,COLOR_WHITE,text);
    }
    ReportLog(text);
    return 1;
}
Thanks Buddy!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)