Jump to content
  • 0

ajutor?


Shad0wdpbgd

Question

am o comanda de banoffline si daca o folosesc efectiv imi zice server unknown command, nu mai inteleg nimic, am incercat tot ce se putea incerca...

YCMD:banoffline(playerid, params[], help)
{
    if(!PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_LGREEN, "You are not an admin!");

    if(GetPVarInt(playerid, "ban_cooldown") > gettime()) return va_SendClientMessage(playerid, COLOR_WHITE, "* Mai trebuie sa astepti %d secunde pentru a folosi iar aceasta comanda.", (GetPVarInt(playerid, "ban_cooldown") - gettime()));

    new name[MAX_PLAYER_NAME], days, reason[64];
    if(sscanf(params, "s[24]ds[64]", name, days, reason)) return SendClientMessage(playerid, COLOR_WHITE, "{CECECE}USAGE: {FFFFFF}/banoffline <name> <days (0 = permanent)> <reason>");

    foreach(new i : Player)
    {
        if(strmatch(GetNameEx(i), name))
        {
            return SendClientMessage(playerid, COLOR_GREY, "This player is online.");
        }
    }

    gQuery[0] = (EOS);
    inline banofflinePlayer()
    {
        if(!cache_num_rows()) return SendClientMessage(playerid, COLOR_GREY, "Nu exista un cont in baza de date cu acest nume.");

        new playerID = cache_get_value_name(0, "ID", gQuery); (cred ca aici e problema, am r41-4 si nu prea ma pricep)

        inline altinline()
        {
            if(cache_num_rows()) return SendClientMessage(playerid, COLOR_GREY, "Acest jucator este deja banat.");

            if(days > 0)
            {
                va_SendClientMessageToAll(COLOR_LIGHTRED, "AdmCmd: %s (offline) has been banned for %d days by admin %s, reason: %s", name, days, GetNameEx(playerid), reason);
            }
            else
            {
                va_SendClientMessageToAll(COLOR_LIGHTRED, "AdmCmd: %s (offline) has been permanently banned by admin %s, reason: %s", name, GetNameEx(playerid), reason);
            }

            gQuery[0] = (EOS);
            mysql_format(SQL, gQuery, 256, "INSERT INTO `server_bans` (PlayerName, PlayerID, AdminName, AdminID, Reason, Date, Days, Permanent) VALUES ('%s', '%d', '%s', '%d', '%s', '%s', '%d', '%d')", name, playerID, GetNameEx(playerid), PlayerInfo[playerid][pSQLID], reason, GetDateTime(), (days == 0) ? (0) : (gettime() + (days * 86400)), (days == 0) ? (1) : (0));
            mysql_pquery(SQL, gQuery);

            SetPVarInt(playerid, "ban_cooldown", (gettime() + 60));
            return 1;            
        }
        mysql_format(SQL, gQuery, 256, "SELECT * FROM `server_bans` WHERE `PlayerName` = '%s' AND `Active` = '1' LIMIT 1", name);
        MySQL_PQueryInline(SQL, using inline altinline, gQuery, "");
        return 1;
    }

    mysql_format(SQL, gQuery, 256, "SELECT * FROM `users` WHERE `Name` = '%s' LIMIT 1", name);
    MySQL_PQueryInline(SQL, banofflinePlayer, gQuery, "");    
    return 1;
}
 

daca poate sa ma ajute cineva, multumesc

Link to comment
Share on other sites

Recommended Posts

  • 0

Salutare,

Daca nu ai eroare in serverlog inseamna ca nu ai pluginul crashdetect. Baga in gamemode cu include crashdetect si la linia plugins din server cfg, compileaza, incearca comanda iar si revino cu eroarea din serverlog. Eventual si o poza din joc daca tot nu primesti nimic in serverlog.

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
On 7/31/2022 at 3:50 PM, Mister said:

Salutare,

Daca nu ai eroare in serverlog inseamna ca nu ai pluginul crashdetect. Baga in gamemode cu include crashdetect si la linia plugins din server cfg, compileaza, incearca comanda iar si revino cu eroarea din serverlog. Eventual si o poza din joc daca tot nu primesti nimic in serverlog.

salut bro, am bagat si crashdetect, tot degeaba

uite poza din joc: https://imgur.com/a/WyFvBtt

Link to comment
Share on other sites

  • 0

cel mai probabil, sscanf-ul este o versiune necompatibila cu gm-ul tau, sau ca procesor de comenzi ai PawnCMD, ce trebuie definit si in server.cfg drept plugin.

EDIT // 

Mi-am dat seama ca era vorba de comanda nu de restu' comenziilor...

 

Incepe sa scoti fiecare linie de cod, sa vezi unde e problema. de ex poti incerca si asta dupa fiecare linie de cod sa vezi unde e probl:

SendClientMessage(playerid, -1, "merge");

Edited by DanielSy
Link to comment
Share on other sites

  • 0
5 hours ago, Shad0wdpbgd said:

salut bro, am bagat si crashdetect, tot degeaba

uite poza din joc: https://imgur.com/a/WyFvBtt

Scuza-ma, probabil o sa fie o intrebare foarte idioata.

Vad ca tu pe joc folosesti /bano, ai adaugat acest alias comenzii?

Adica ai incercat /banoffline cum este definita si comanda?

Link to comment
Share on other sites

  • 0
2 hours ago, DanielSy said:

cel mai probabil, sscanf-ul este o versiune necompatibila cu gm-ul tau, sau ca procesor de comenzi ai PawnCMD, ce trebuie definit si in server.cfg drept plugin.

EDIT // 

Mi-am dat seama ca era vorba de comanda nu de restu' comenziilor...

 

Incepe sa scoti fiecare linie de cod, sa vezi unde e problema. de ex poti incerca si asta dupa fiecare linie de cod sa vezi unde e probl:

SendClientMessage(playerid, -1, "merge");

exact, am facut asta

    foreach(new i : Player)
    {
        if(strmatch(GetNameEx(i), name))
        {
            return SendClientMessage(playerid, COLOR_GREY, "This player is online.");
        }
    }

    gQuery[0] = (EOS);
    inline banofflinePlayer()
    {
        if(!cache_num_rows()) return SendClientMessage(playerid, COLOR_GREY, "Nu exista un cont in baza de date cu acest nume.");

        new playerID = cache_get_value_name(0, "ID", gQuery);

        inline altinline()
        {

pe aici cred ca este problema, mai ales la aia cu new playerid= cache_get_value_name 

Link to comment
Share on other sites

  • 0
1 hour ago, Mister said:

Posteaza server log asa cum este, poate ajuta

[20:46:34] [debug] Long callback execution detected (hang or performance issue)
[20:46:34] [debug] AMX backtrace:
[20:46:34] [debug] #0 00003918 in ?? (1768252498) in Wing.amx
[20:46:34] [debug] #1 00004a14 in ?? (-492545, 39841740, 32) in Wing.amx
[20:46:34] [debug] #2 00004378 in ?? (0, 8, 39841924, 39841952, 1) in Wing.amx
[20:46:34] [debug] #3 00042d64 in ?? (39841952) in Wing.amx
[20:46:34] [debug] #4 0004322c in ?? (51) in Wing.amx
[20:46:34] [debug] #5 000441d0 in public @Z () in Wing.amx
[20:46:34] [debug] #6 native CallLocalFunction () in samp-server.exe
[20:46:34] [debug] #7 00041240 in ?? () in Wing.amx
[20:46:34] [debug] #8 0000294c in public OnGameModeExit () in Wing.amx
[20:46:46]  
[20:46:46]  
[20:46:46]          ==============================================================
[20:46:46]          |                                                            |
[20:46:46]          |                                                            |
[20:46:46]          |    YYYYYYY       YYYYYYY    SSSSSSSSSSSSSSS  IIIIIIIIII    |
[20:46:46]          |    Y:::::Y       Y:::::Y  SS:::::::::::::::S I::::::::I    |
[20:46:46]          |    Y:::::Y       Y:::::Y S:::::SSSSSS::::::S I::::::::I    |
[20:46:46]          |    Y::::::Y     Y::::::Y S:::::S     SSSSSSS II::::::II    |
[20:46:46]          |    YYY:::::Y   Y:::::YYY S:::::S               I::::I      |
[20:46:46]          |       Y:::::Y Y:::::Y    S:::::S               I::::I      |
[20:46:46]          |        Y:::::Y:::::Y      S::::SSSS            I::::I      |
[20:46:46]          |         Y:::::::::Y        SS::::::SSSSS       I::::I      |
[20:46:46]          |          Y:::::::Y           SSS::::::::SS     I::::I      |
[20:46:46]          |           Y:::::Y               SSSSSS::::S    I::::I      |
[20:46:46]          |           Y:::::Y                    S:::::S   I::::I      |
[20:46:46]          |           Y:::::Y                    S:::::S   I::::I      |
[20:46:46]          |           Y:::::Y        SSSSSSS     S:::::S II::::::II    |
[20:46:46]          |        YYYY:::::YYYY     S::::::SSSSSS:::::S I::::::::I    |
[20:46:46]          |        Y:::::::::::Y     S:::::::::::::::SS  I::::::::I    |
[20:46:46]          |        YYYYYYYYYYYYY      SSSSSSSSSSSSSSS    IIIIIIIIII    |
[20:46:46]          |                                                            |
[20:46:46]          |                                                            |
[20:46:46]          |                      (c) 2021 MPL v1.1                     |
[20:46:46]          |            Alex "Y_Less" Cole and contributors.            |
[20:46:46]          |                                                            |
[20:46:46]          |                                                            |
[20:46:46]          ==============================================================
[20:46:46]  
[20:46:46]  
[20:46:46]  ========================================== 
[20:46:46]  |                                        | 
[20:46:46]  |  Missing YSI scriptfiles directories:  | 
[20:46:46]  |                                        | 
[20:46:46]  |      /scriptfiles/YSI/fixes/           | 
[20:46:46]  |      /scriptfiles/YSI/temp/            | 
[20:46:46]  |                                        | 
[20:46:46]  ========================================== 
[20:46:46]  |                                        | 
[20:46:46]  |   Generating code, this may take a     | 
[20:46:46]  |  little bit of time.  Note that this   | 
[20:46:46]  |  code generation works best with the   | 
[20:46:46]  |     JIT plugin, which you are not      | 
[20:46:46]  |     currently using.  Get it here:     | 
[20:46:46]  |                                        | 
[20:46:46]  |       https://git.io/jit-plugin        | 
[20:46:46]  |                                        | 
[20:46:46]  |             Please wait...             | 
[20:46:47]  |                                        | 
[20:46:47]  |                 Done!                  | 
[20:46:47]  |                                        | 
[20:46:47]  ========================================== 
[20:46:47]  |                                        | 
[20:46:47]  | Server:      0.3DL - Windows           | 
[20:46:47]  | Compiler:    3.10.08 - Windows         | 
[20:46:47]  | Codepage:    <none>                    | 
[20:46:47]  | YSI:         5.06.1932                 | 
[20:46:47]  | Started:     1659721606                | 
[20:46:47]  | JIT:         <none>                    | 
[20:46:47]  | Crashdetect: <found>                   | 
[20:46:47]  |                                        | 
[20:46:47]  ========================================== 
[20:46:47]  
[20:46:47] *** YSI Info: YSI Script ID: 1
[20:46:47] [debug] Long callback execution detected (hang or performance issue)
[20:46:47] [debug] AMX backtrace:
[20:46:47] [debug] #0 00040f28 in ?? () in Wing.amx
[20:46:47] [debug] #1 00005f18 in ?? () in Wing.amx
[20:46:47] [debug] #2 0000272c in public OnRuntimeError () in Wing.amx
[20:46:47]  
[20:46:47] Number of vehicle models: 0
[20:48:10] [debug] Long callback execution detected (hang or performance issue)
[20:48:10] [debug] AMX backtrace:
[20:48:10] [debug] #0 00063114 in public L_AFKDETECT () in Wing.amx
[21:42:08] [debug] Long callback execution detected (hang or performance issue)
[21:42:08] [debug] AMX backtrace:
[21:42:08] [debug] #0 00063110 in public L_AFKDETECT () in Wing.amx
[21:50:01] [debug] Long callback execution detected (hang or performance issue)
[21:50:01] [debug] AMX backtrace:
[21:50:01] [debug] #0 000630b8 in public L_AFKDETECT () in Wing.amx
[21:51:59] [debug] Long callback execution detected (hang or performance issue)
[21:51:59] [debug] AMX backtrace:
[21:51:59] [debug] #0 000632c4 in public L_AFKDETECT () in Wing.amx

Link to comment
Share on other sites

  • 0
On 7/30/2022 at 12:18 AM, Shad0wdpbgd said:

nu este nici o eroare, si eu am crezut ca e o eroare la inceput dar nu e 

Sa inteleg ca astea nu sunt erori?

[20:48:10] [debug] Long callback execution detected (hang or performance issue)
[20:48:10] [debug] AMX backtrace:
[20:48:10] [debug] #0 00063114 in public L_AFKDETECT () in Wing.amx

Pe langa celelalte de mai sus, dupa pluginuri si inainte sa se incarce

Verifica functia asta L_AFKDETECT, nu pare sa fie un timer pentru ca este apelata la intervale neregulate.

Si ma voi repeta dar cum nu aveai ''erori'' in serverlog poti sa mai verifici odata daca ai si #include crashdetect-ul? in gamemode trebuie sa fie primul plugin dupa a_samp logic, inainte de streamer si orice alt include, ar fi trebuit in eroarea citata de mine sa fie si linia cu problema, dar e posibil sa ma depaseasca unpic pentru ca e 0.3dl si am mai putin experienta pe el.

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

Considerand ca te folosesti de functia MySQL_PQueryInline presupun ca folosesti si YSI 5+ care include aceasta functie

https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Extra/y_inline_mysql.inc#L102

Daca citesti parametri pe care ii accepta, nu vad unde anume cere un string gol dupa query, practic in momentul de fata fucntiile tale inline nu asteapta parametri dar tu le trimiti un string gol pe care nu il asteapta/accepta

MySQL_PQueryInline(SQL, banofflinePlayer, gQuery);

MySQL_PQueryInline(SQL, using inline altinline, gQuery);

Ar fi variantele corecte si posibilul motiv pentru care iti da "unknown command"

De asemenea un mic tip: Foloseste '%e' in loc de '%s' pentru orice e introdus de cineva pentru in momentul de fata se poate face sql injection, mai exact aici

mysql_format(SQL, gQuery, 256, "SELECT * FROM `users` WHERE `Name` = '%s' LIMIT 1", name);
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.