Raised This Month: $ Target: $400
 0% 

online time plugin!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ricshs
Junior Member
Join Date: Mar 2006
Old 03-30-2006 , 10:09   online time plugin!
Reply With Quote #1

hallo!I am one amxx user from Latvia, i haw one problem, can you all help me make plugin, that shows name online time, not steam_id , but online time with name, that will look like this -player type in game /online , and shows all players, who had play`s in my server online time.
That would be nice, that some of programmers created that kind of amxx plugin!
P.S. Sry for my bad English!
ricshs is offline
ricshs
Junior Member
Join Date: Mar 2006
Old 03-31-2006 , 08:13  
Reply With Quote #2

Why no answers?!
ricshs is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 03-31-2006 , 08:20  
Reply With Quote #3

Quote:
Originally Posted by ricshs
Why no answers?!
My guess is that no one feels like doing it. I'll go try it now.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 03-31-2006 , 08:56  
Reply With Quote #4

Try this, untested:

Code:
#include <amxmodx> #include <amxmisc> #include <time> public plugin_init() {     register_plugin("Online Time","1.0","Hawk552")     register_clcmd("say /online","fnShowOnline")         register_dictionary("time.txt") } public fnShowOnline(id) {     new szMotd[1024],iPlayers[32],iPlayersnum,iPos,szName[33],szTime[64]     get_players(iPlayers,iPlayersnum)         iPos += formatex(szMotd[iPos],1023-iPos,"Online Players:^n^n")     for(new iCount = 0;iCount < iPlayersnum;iCount++)     {         get_time_length(0,get_user_time(iPlayers[iCount],1),timeunit_seconds,szTime,63)         get_user_name(iPlayers[iCount],szName,32)         iPos += formatex(szMotd[iPos],1023-iPos,"%s -- %s^n",szName,szTime)     }         show_motd(id,szMotd,"Online Players")         return PLUGIN_HANDLED }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
ricshs
Junior Member
Join Date: Mar 2006
Old 04-01-2006 , 14:35  
Reply With Quote #5

tnx, i am now testing, answer will be later ,and i hawe onli copy this in txt and rename it to sma ?
Ok, i am go test it.
ricshs is offline
ricshs
Junior Member
Join Date: Mar 2006
Old 04-01-2006 , 14:42  
Reply With Quote #6

So, when i create a txt file, i copy in txt file information you give me, than i it raname to online.sma , than i put it at scripting , an than i compile it and shows those errors.
Attached Images
File Type: jpg compile.jpg (41.7 KB, 288 views)
ricshs is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 04-01-2006 , 14:48  
Reply With Quote #7

You need AMXX 1.60+.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
ricshs
Junior Member
Join Date: Mar 2006
Old 04-01-2006 , 14:56  
Reply With Quote #8

But i hawe newest amxx v1.7 , thats aint work ?
Ps. Sory for my bad English!
ricshs is offline
ricshs
Junior Member
Join Date: Mar 2006
Old 04-01-2006 , 14:58  
Reply With Quote #9

But you were looked screen, that i take, compile.exe shows, that i dont hawe online.amx , but how to make .amx file?
ricshs is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 04-01-2006 , 21:34  
Reply With Quote #10

*Sigh* Try this:

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("Online Time","1.0","Hawk552")     register_clcmd("say /online","fnShowOnline")         register_dictionary("time.txt") } public fnShowOnline(id) {     new szMotd[1024],iPlayers[32],iPlayersnum,iPos,szName[33],szTime[64]     get_players(iPlayers,iPlayersnum)         iPos += formatex(szMotd[iPos],1023-iPos,"Online Players:^n^n")     for(new iCount = 0;iCount < iPlayersnum;iCount++)     {         get_time_length(0,get_user_time(iPlayers[iCount],1),timeunit_seconds,szTime,63)         get_user_name(iPlayers[iCount],szName,32)         iPos += formatex(szMotd[iPos],1023-iPos,"%s -- %s^n",szName,szTime)     }         show_motd(id,szMotd,"Online Players")         return PLUGIN_HANDLED } /* Time specific functions * * by the AMX Mod X Development Team * * This file is provided as is (no warranties). */ #if defined _time_included   #endinput #endif #define _time_included /* Time unit types for get_time_length() */ enum {     timeunit_seconds = 0,     timeunit_minutes,     timeunit_hours,     timeunit_days,     timeunit_weeks, } // seconds are in each time unit #define SECONDS_IN_MINUTE 60 #define SECONDS_IN_HOUR   3600 #define SECONDS_IN_DAY    86400 #define SECONDS_IN_WEEK   604800 /* Stock by Brad */ stock get_time_length(id, unitCnt, type, output[], outputLen) { // IMPORTANT:   You must add register_dictionary("time.txt") in plugin_init() // id:          The player whose language the length should be translated to (or 0 for server language). // unitCnt:     The number of time units you want translated into verbose text. // type:        The type of unit (i.e. seconds, minutes, hours, days, weeks) that you are passing in. // output:      The variable you want the verbose text to be placed in. // outputLen:   The length of the output variable.     if (unitCnt > 0)     {         // determine the number of each time unit there are         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);         // translate the unit counts into verbose text         new maxElementIdx = -1;         new timeElement[5][33];         if (weekCnt > 0)             format(timeElement[++maxElementIdx], 32, "%i %L", weekCnt, id, (weekCnt == 1) ? "TIME_ELEMENT_WEEK" : "TIME_ELEMENT_WEEKS");         if (dayCnt > 0)             format(timeElement[++maxElementIdx], 32, "%i %L", dayCnt, id, (dayCnt == 1) ? "TIME_ELEMENT_DAY" : "TIME_ELEMENT_DAYS");         if (hourCnt > 0)             format(timeElement[++maxElementIdx], 32, "%i %L", hourCnt, id, (hourCnt == 1) ? "TIME_ELEMENT_HOUR" : "TIME_ELEMENT_HOURS");         if (minuteCnt > 0)             format(timeElement[++maxElementIdx], 32, "%i %L", minuteCnt, id, (minuteCnt == 1) ? "TIME_ELEMENT_MINUTE" : "TIME_ELEMENT_MINUTES");         if (secondCnt > 0)             format(timeElement[++maxElementIdx], 32, "%i %L", secondCnt, id, (secondCnt == 1) ? "TIME_ELEMENT_SECOND" : "TIME_ELEMENT_SECONDS");         switch(maxElementIdx)         {             case 0: format(output, outputLen, "%s", timeElement[0]);             case 1: format(output, outputLen, "%s %L %s", timeElement[0], id, "TIME_ELEMENT_AND", timeElement[1]);             case 2: format(output, outputLen, "%s, %s %L %s", timeElement[0], timeElement[1], id, "TIME_ELEMENT_AND", timeElement[2]);             case 3: format(output, outputLen, "%s, %s, %s %L %s", timeElement[0], timeElement[1], timeElement[2], id, "TIME_ELEMENT_AND", timeElement[3]);             case 4: format(output, outputLen, "%s, %s, %s, %s %L %s", timeElement[0], timeElement[1], timeElement[2], timeElement[3], id, "TIME_ELEMENT_AND", timeElement[4]);         }     } }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:38.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode