every command is bugged
#1

Ok , i made some commands ex.
pawn Код:
CMD:report(playerid, params[])
{
    new id, ime[MAX_PLAYER_NAME], ime2[MAX_PLAYER_NAME], razlog[64], poruka[256], porukalog[256], IP[16], IP2[16];

    GetPlayerIp(playerid, IP, sizeof(IP));
    GetPlayerIp(id, IP2, sizeof(IP2));

    GetPlayerName(playerid, ime, sizeof(ime));
    GetPlayerName(id, ime2, sizeof(ime2));
   
    if(iIgraca[playerid][Admin] < iIgraca[id][Admin]) return SendClientMessage(playerid, BOJA_CRVENA, "• Cant report and admin with higher level than you.");
    if(sscanf(params, "ds[64]", id, razlog)) return SendClientMessage(playerid, BOJA_CRVENA, "• Error. Use /report) [ID] [reason]");
    if(strlen(razlog) > 30) return SendClientMessage(playerid, BOJA_CRVENA,"• Reason is too long (Max. 30 letters)");
   
    format(poruka, sizeof(poruka), "Report • %s[%d], %s[%d] Reason • %s", ime, playerid, ime2, id, razlog);
    format(porukalog, sizeof(porukalog), "%s [IP : %d], reported %s [IP : %d] Razlog : %s", ime, IP, ime2, IP, razlog);

    PosaljiPorukuAdminima(BOJA_ZLATNA, poruka); // sends admins the message

    new File:Prijave;
    Prijave = fopen("prijave.log", io_append);
    fwrite(Prijave, porukalog);

    fclose(Prijave);
    SendClientMessage(playerid, BOJA_ЋUTA, "• Success. Youre message was logged, and sent to online administrators.");
    return 1;
}
But heres the problem, everytime ID 0 uses the commands it returns to him , like :
MarkoN[0] reported MarkoN[1] , but i actually repoted Wolf, and when he repots me its normal
Wolf[1] repoted MarkoN[0]. idk could be a sscanf bug or something. I updated everything , even downloaded the R2 server, but no use, every command does it like that... I changed the u param to d , that didnt work eather, and heres the log.
Код:
MarkoN [IP : 49] reported MarkoN [IP : 49] Reason : test
Wolf [IP : 48] reported MarkoN [IP : 49] Reason : test
Reply
#2

Let me know if this works:
Код:
CMD:report(playerid, params[])
{
    new id, ime[MAX_PLAYER_NAME], ime2[MAX_PLAYER_AME], razlog[64], poruka[256], porukalog[256], IP[16], IP2[16];
    GetPlayerName(playerid, ime, sizeof(ime));
    if(iIgraca[playerid][Admin] < iIgraca[id][Admin]) return SendClientMessage(playerid, BOJA_CRVENA, "• Cant report and admin with higher level than you.");
    if(sscanf(params, "us[64]", id, razlog)) return SendClientMessage(playerid, BOJA_CRVENA, "• Error. Use /report) [ID] [reason]");
    if(strlen(razlog) > 30) return SendClientMessage(playerid, BOJA_CRVENA,"• Reason is too long (Max. 30 letters)");
    format(poruka, sizeof(poruka), "Report • %s[%d], %s[%d] Reason • %s", ime, playerid, ime2, id, razlog);
    format(porukalog, sizeof(porukalog), "%s [IP : %d], reported %s [IP : %d] Razlog : %s", ime, IP, ime2, IP, razlog);
    PosaljiPorukuAdminima(BOJA_ZLATNA, poruka); // sends admins the message
    new File:Prijave;
    Prijave = fopen("prijave.log", io_append);
    fwrite(Prijave, porukalog);

    fclose(Prijave);
    SendClientMessage(playerid, BOJA_ЋUTA, "• Success. Youre message was logged, and sent to online administrators.");
    return 1;
}
Reply
#3

you just changed the sscanf param 'd' into 'u' , wich wont work eather , thats why i tried changing it to d
Reply
#4

Move this to the top of your command, you are checking information which will always be set to 0, because you didn't process params yet:

pawn Код:
if(sscanf(params, "ds[64]", id, razlog)) return SendClientMessage(playerid, BOJA_CRVENA, "• Error. Use /report) [ID] [reason]");
So basically, it's grabbing ID 0s name, which would be you, try it out, let him join as ID0, and you as ID1.
Reply
#5

thanks, i didnt even know that you have to process params first. i reped you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)