RSSy MYGO.pl Opublikowano Sierpień 19, 2020 o 07:24 RSSy Udostępnij Opublikowano Sierpień 19, 2020 o 07:24 Hey guys, i need help. Can anyone remake this plugin to be with public player's time info... example: /time "player name" - "player's played time is "total played time" " And if the system didn't found the player to print the message: client_print_color(id, id, "%s There is no OR multiple players with that name ->^x03 %s", szTarget); Code preview: Code: #include <amxmodx> #include <nvault> #include <time> #define MAX_PLAYERS 32 new g_iVault new g_szName[MAX_PLAYERS+1][32] new g_iLastPlayedTime[MAX_PLAYERS+1] public plugin_init() { register_plugin("Time", "0.1", "ConnorMcLeod") register_dictionary("time.txt") g_iVault = nvault_open("played_time") register_clcmd("say /time", "ClientCommand_PlayedTime") } public plugin_end() nvault_close( g_iVault ) public client_authorized( id ) { new szTime[32] get_user_name(id, g_szName[id], charsmax(g_szName[])) nvault_get(g_iVault, g_szName[id], szTime, charsmax(szTime)) g_iLastPlayedTime[id] = str_to_num(szTime) } get_user_total_playtime( id ) { return g_iLastPlayedTime[id] + get_user_time(id) } public ClientCommand_PlayedTime( id ) { new szTime[128] new szName[32] get_time_length(id, get_user_total_playtime( id ), timeunit_seconds, szTime, charsmax(szTime)) get_user_name(id, szName, charsmax(szName)) chat_color(id, "e %s.g's Time.g: .v%s", szName, szTime) } public client_disconnect( id ) { new szTime[32] formatex(szTime, charsmax(szTime), "%d", get_user_total_playtime( id )) nvault_set(g_iVault, g_szName[id], szTime) } stock chat_color(const id, const input[], any:...) { new count = 1, players[32] static msg[191] vformat(msg, 190, input, 3) replace_all(msg, 190, ".v", "^4") replace_all(msg, 190, ".g", "^1") replace_all(msg, 190, ".e", "^3") if (id) players[0] = id; else get_players(players, count, "ch") { for (new i = 0; i < count; i++) { if (is_user_connected(players)) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players) write_byte(players); write_string(msg); message_end(); } } } } Attached Files Get Plugin or Get Source (played_time.sma - 1.7 KB) time.inc (4.1 KB) Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi