[Problem] Plugin /online
Results 1 to 16 of 16

Thread: Plugin /online

  1. #1
    Banovani spamer Array
    Join Date
    Jun 2017
    Karma
    0

    Default Plugin /online

    Posto iz one teme niko nije hteo da mi da ispravan kod od plugina /online ja sam nasao nekako e sada neko ko se razumije treba da mi edituje plugin za /online bio bi zahvalan.



    Code:
    #include <amxmodx>
    #include <amxmisc>
    #include <nvault>
    
    #if !defined MAX_PLAYERS
        #define MAX_PLAYERS 32
    #endif
    
    #if defined client_disconnected
        #define player_disconnect client_disconnected
    #else
        #define player_disconnect client_disconnect
    #endif
    
    #if (AMXX_VERSION_NUM < 183)
        enum
        {
            print_team_default = 0,
            print_team_grey = -1,
            print_team_red = -2,
            print_team_blue = -3
        };
    #endif
    
    enum eTime {
        timeunit_seconds = 0,
        timeunit_minutes,
        timeunit_hours,
        timeunit_days,
        timeunit_weeks,
    }
    
    #define SECONDS_IN_MINUTE 60
    #define SECONDS_IN_HOUR 3600
    #define SECONDS_IN_DAY 86400
    #define SECONDS_IN_WEEK 604800
    
    #define cmax(%1) (sizeof(%1)-1)
    
    new const g_szValut[] = "online_time";
    
    new g_szAuthID[MAX_PLAYERS + 1][35];
    
    new g_TotalTime[MAX_PLAYERS + 1];
    
    public plugin_init()  {
        register_plugin("Online Time", "1.0","WrongTurn");
        register_cvar("onlinetime" , "1.0" , (FCVAR_SERVER|FCVAR_SPONLY));
    
        register_clcmd("say /online", "cmdOnlineTime");
        register_concmd("amx_onlinetime", "cmdAdminShowTime", ADMIN_RCON,"<#Player Name>");
    
        prune();
    }
    
    public prune() {
        new n_Vault = getVaultFile();
    
        nvault_prune(n_Vault, 0, get_systime() - (30 * 86400));  
        nvault_close(n_Vault);
    }
    
    public client_authorized(id) {
        if (!is_user_bot(id) && !is_user_hltv(id)) {
            get_user_authid(id, g_szAuthID[id], cmax( g_szAuthID[] ));
            g_TotalTime[id] = PlayedTime(id);
        }
    }
    
    public player_disconnect(id) {
        if (!is_user_bot(id) && !is_user_hltv(id)) {
            g_TotalTime[id] += get_user_time(id);
            SavePlayedTime(id, g_TotalTime[id]);
        }
    }
    
    public cmdAdminShowTime(id,level,cid) {
        if(!cmd_access(id, level, cid, 2))
            return PLUGIN_HANDLED;
    
        static arg[MAX_PLAYERS];
        read_argv(1, arg, cmax(arg));
        remove_quotes(arg);
    
        new player = cmd_target(id, arg, 2);
    
        if(!player) {
            getTimeById(id, arg);
            return PLUGIN_HANDLED;
        }
    
        new name[MAX_PLAYERS], iTime;
        get_user_name(player, name, cmax(name));
        iTime = (get_user_time(player, 1) + g_TotalTime[player]);
    
        ShowTimeUser(id, iTime, name, 0);
        return PLUGIN_HANDLED;
    }
    
    public cmdOnlineTime(id) {
        new iTime = (get_user_time(id, 1) + g_TotalTime[id]);
    
        ShowTimeUser(id, iTime, "", 1);
        return PLUGIN_HANDLED;
    }
    
    public getTimeById(id, userID[]) {
        new iVault, iAttempt, iTimestamp, szTime[64];
    
        iVault = getVaultFile();
        iAttempt = nvault_lookup(iVault, userID, szTime, cmax(szTime), iTimestamp);
    
        nvault_close(iVault);
    
        if(iAttempt) 
            ShowTimeUser(id, str_to_num(szTime), userID, 0);
    }
    
    public ShowTimeUser(id, iTime, szUser[], iColor) {
        new szTotalTime[128];
        GetTimeLength(iTime, timeunit_seconds, szTotalTime, cmax(szTotalTime), iColor);
    
        if(iColor != 0) {
            client_print_color(id, print_team_default, "^4[Online Time] ^1Proveo si %s ^1na ovom serveru.", szTotalTime);
        } else {
            console_print(id, "--------------------(Online Time)--------------------");
            console_print(id, "[Igrac] %s", szUser);
            console_print(id, "[Vreme] %s", szTotalTime);
            console_print(id, "---------------------------------------------------------");
        }
    }
    
    public SavePlayedTime(id, iTime) {
        if(!g_szAuthID[id][0])
            return;
    
        static szTime[64], iVault;
    
        iVault = getVaultFile();
        num_to_str( iTime, szTime, cmax( szTime ) );
    
        static szData[64], iAttempt, iTimestamp;
    
        iAttempt = nvault_lookup(iVault, g_szAuthID[id], szData, cmax(szData), iTimestamp);
    
        nvault_set(iVault, g_szAuthID[id], szTime);
        if(iAttempt)
            nvault_touch(iVault , g_szAuthID[id] , iTimestamp);
    
        nvault_close(iVault);
        g_szAuthID[id][0] = EOS;
    }
    
    static PlayedTime( id ) {
        if(!g_szAuthID[id][0])
            return 0;
    
        static iVault, iTime;
        iVault = getVaultFile();
    
        iTime = nvault_get( iVault , g_szAuthID[id] );
        nvault_close(iVault);
    
        return iTime;
    }
    
    static getVaultFile() {
        static iVault;
        iVault = nvault_open(g_szValut);
    
        if(iVault == INVALID_HANDLE)
            set_fail_state("nValut returned invalid handle");
    
        return iVault;
    }
    
    stock GetTimeLength(unitCnt, eTime:type, output[], outputLen, iColor) {
        if (unitCnt > 0) {
            new weekCnt = 0, dayCnt = 0, hourCnt = 0, minuteCnt = 0, secondCnt = 0;
    
            switch (type) {
                case timeunit_seconds: secondCnt = unitCnt;
                case timeunit_minutes: secondCnt = unitCnt * SECONDS_IN_MINUTE;
                case timeunit_hours: secondCnt = unitCnt * SECONDS_IN_HOUR;
                case timeunit_days: secondCnt = unitCnt * SECONDS_IN_DAY;
                case timeunit_weeks: secondCnt = unitCnt * SECONDS_IN_WEEK;
            }
    
            weekCnt = secondCnt / SECONDS_IN_WEEK;
            secondCnt -= (weekCnt * SECONDS_IN_WEEK);
    
            dayCnt = secondCnt / SECONDS_IN_DAY;
            secondCnt -= (dayCnt * SECONDS_IN_DAY);
    
            hourCnt = secondCnt / SECONDS_IN_HOUR;
            secondCnt -= (hourCnt * SECONDS_IN_HOUR);
    
            minuteCnt = secondCnt / SECONDS_IN_MINUTE;
            secondCnt -= (minuteCnt * SECONDS_IN_MINUTE);
    
            new iLen = 0;
    
            if (weekCnt > 0)
                iLen = formatex(output, outputLen, (iColor != 0) ? "^3%i^1 nedelj%s" : "%s%i nedelj%s", weekCnt, (weekCnt > 1) ? "e" : "u");
            if (dayCnt > 0)
                iLen += formatex(output[iLen], outputLen - iLen, (iColor != 0) ? "%s^3%i^1 dan%s" : "%s%i dan%s", (iLen) ? ", " : "", dayCnt, (dayCnt > 1) ? "a" : "");
            if (hourCnt > 0)
                iLen += formatex(output[iLen], outputLen - iLen, (iColor != 0) ? "%s^3%i^1 sat%s" : "%s%i sat%s", (iLen) ? ", " : "", hourCnt, (hourCnt > 1) ? "a" : "");
            if (minuteCnt > 0)
                iLen += formatex(output[iLen], outputLen - iLen, (iColor != 0) ? "%s^3%i^1 minut%s" : "%s%i minut%s", (iLen) ? ", " : "", minuteCnt, (minuteCnt > 1) ? "a" : "");
            if (secondCnt > 0)
                formatex(output[iLen], outputLen - iLen, (iColor != 0) ? "%s^3%i^1 sekund%s" : "%s%i sekund%s", (iLen) ? ", " : "", secondCnt, (secondCnt > 1) ? "e" : "");
        } else {
            output[0] = EOS;
        }
    }
    
    #if (AMXX_VERSION_NUM < 183)
    stock client_print_color(const id, const iSender, const input[], any:...)
    {
        static iSayText = 0;
        if (!iSayText) {
            iSayText = get_user_msgid("SayText");
        }
        new iReceiver, iNum = 1, Players[MAX_PLAYERS], Msg[190];
        vformat(Msg, charsmax(Msg), input, 3);
        if(id)
        {
            if(!is_user_connected(id)) {
                return;
            }
            Players[0] = id;
        } else {
            get_players(Players, iNum, "ch");
        }
        for (new i = 0; i < iNum; i++)
        {
            iReceiver = Players[i];
            message_begin(MSG_ONE, iSayText , _, iReceiver);
            write_byte(iSender ? iSender : iReceiver);
            write_string(Msg);
            message_end();
        }
    }
    #endif


    Bivsa tema: https://forum.kgb-hosting.com/showthread.php?t=101712

  2. #2

    Default

    Ja da znam ja bi ti pomogao ali jbg neznam.

  3. #3
    Senior Member Array
    Join Date
    Jun 2015
    Location
    Belgrade
    Karma
    6

    Default

    Quote Originally Posted by Kliplica "voleo bi" Klipica View Post
    Ja da znam ja bi ti pomogao ali jbg neznam.
    Hvala sto si nas obavestio.

  4. #4

    Default

    Quote Originally Posted by luka317 View Post
    Hvala sto si nas obavestio.
    Cemu sad ovo?

  5. #5
    Banovani spamer Array
    Join Date
    Jun 2017
    Karma
    0

    Default

    Neko da edituje?

  6. #6
    Senior Member Array
    Join Date
    Aug 2013
    Location
    Forbidden Forest
    Karma
    6

    Default

    Ja mislim da se ljudi uplase kad vide koliko si detaljno i puno informacija dao sta treba da se edituje i da zbog toga niko nije odgovorio na temu.
    Pomoc oko plugina, TS3-a, discord-a mozete dobiti samo u vidu objasnjenja.
    P.S. Nemojte smarati/hejtovati obzirom da to niko ne voli a ja licno cu samo da vas kuliram.
    P.P.S. Nemojte pitati stvari na PM vec otvori temu.

  7. #7
    Banovani spamer Array
    Join Date
    Jun 2017
    Karma
    0

    Default

    Quote Originally Posted by SkazzY View Post
    Ja mislim da se ljudi uplase kad vide koliko si detaljno i puno informacija dao sta treba da se edituje i da zbog toga niko nije odgovorio na temu.
    Pa ja da znam da editujem nebi sigurno postavio ovu temu.

  8. #8
    Senior Member Array
    Join Date
    Jun 2015
    Location
    Belgrade
    Karma
    6

    Default

    lol..

  9. #9
    Junior Member Array
    Join Date
    May 2017
    Karma
    0

    Default

    NE treba nista da se edituje vec da se compiluje u AMXX file. Kopiras ovo sve u NewTextDocument.txt i kad sve lepo proveris uradis Save As imeplugina.sma nakon toga nadjes neki online compiler, kucas naprimer sma to amxx i udaris enter i izbaci ce ti neki compiler, ides na upload i uploadujes sma i onda ides na compile i kad compiluje dobi ces amxx tj dobi ces plugin za server.

    Ja sam sve to uradio samo sto nisam ubacivao plugin na server pa ne znam da li radi. https://ufile.io/1cixq ovo ti je download link, skini taj plugin, ubaci ga na server u folder plugins, i u folderu configs nadji plugins.ini i upisi online.amxx i to je to, promeni mapu na serveru i kucaj /online i on ce krenuti da ti pokazuje online vreme ako plugin radi :_)

  10. #10
    Banovani spamer Array
    Join Date
    Jun 2017
    Karma
    0

    Default

    Quote Originally Posted by n0 GoOd View Post
    NE treba nista da se edituje vec da se compiluje u AMXX file. Kopiras ovo sve u NewTextDocument.txt i kad sve lepo proveris uradis Save As imeplugina.sma nakon toga nadjes neki online compiler, kucas naprimer sma to amxx i udaris enter i izbaci ce ti neki compiler, ides na upload i uploadujes sma i onda ides na compile i kad compiluje dobi ces amxx tj dobi ces plugin za server.

    Ja sam sve to uradio samo sto nisam ubacivao plugin na server pa ne znam da li radi. https://ufile.io/1cixq ovo ti je download link, skini taj plugin, ubaci ga na server u folder plugins, i u folderu configs nadji plugins.ini i upisi online.amxx i to je to, promeni mapu na serveru i kucaj /online i on ce krenuti da ti pokazuje online vreme ako plugin radi :_)
    Drug ja neznam da editujem a kada to ubacim na server pise mi sledece "[Online Time] Proveo si [Online Time] Proveo si .::ElectriX::. na ovom serveru. na ovom serveru." treba da neko izedituje sma zapravo plugin.
    Last edited by .::ElectriX::.; 15-07-2017 at 16:16.

  11. #11

  12. #12
    Banovani spamer Array
    Join Date
    Jun 2017
    Karma
    0

    Default

    Quote Originally Posted by Wtf. Kill me ! ^^ View Post
    Neradi za /online evo sta pise

  13. #13
    Senior Member Array
    Join Date
    Jun 2013
    Location
    Beograd
    Karma
    0

    Default

    Radi lokalno compile sledeci put

    Evo ti posto vidim da se mucis. https://www.sendspace.com/file/uc8b7m

  14. #14
    Banovani spamer Array
    Join Date
    Jun 2017
    Karma
    0

    Default

    Quote Originally Posted by aleks. View Post
    Radi lokalno compile sledeci put

    Evo ti posto vidim da se mucis. https://www.sendspace.com/file/uc8b7m
    Daj sma ovde ili na pm inace hvala mucio sam se ko konj.

  15. #15
    Senior Member Array
    Join Date
    Jun 2013
    Location
    Beograd
    Karma
    0

    Default

    Druze ja sam ti compile plugin posto ti vidim da nisi znao od wtf kill me sto je postavio. Ako hoces ubaci ako ne neces ne znam snadji se. Sma ti je ostavio wtf

  16. #16
    Banovani spamer Array
    Join Date
    Jun 2017
    Karma
    0

    Default

    Sve je reseno hvala svima.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •