Jump to content

Question

Posted

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

Recommended Posts

  • 0
Posted

In acest caz vin cu propunerea de a reface comanda bucatica cu bucatica. Acel if pentru admin level? O bucatica , acel ban cooldown o alta. Si testezi dupa fiecare adaugare si vezi eventual dupa ce bucatica de cod iti da unknown command , alta idee nu mai am

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.