Solved Add : freevip ( date added in database)

Unpaid Requests, Public Plugins
kair
Member
Member
Posts: 25
Joined: 7 years ago
Contact:

Add : freevip ( date added in database)

#1

Post by kair » 7 years ago

This plugin gives players automatically freevip, and adds it in slot.ini but i want it also to add the date this is added in the file so I know when I can remove his vip status. Is there a way this also auto adds the date the player is added in the file.

format(szWriteData, charsmax(szWriteData), "^"%s^" ^"^" ^"t^" ^"ce^" // %s", szSteamID, szName)

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <hamsandwich>
#include <time_length>

#define PRUNE_TIME 2592000

new Trie:g_tSteamIDs;
new g_SlotFile[64], g_TotalTime[33];
new cvar_timer, g_cached_time;
new g_iMsgID_SayText, g_Vault;

public plugin_init() 
{
	register_plugin("Slot Time", "1.0","Alka/OvidiuS");
	register_cvar("slottime" , "1.0" , (FCVAR_SERVER|FCVAR_SPONLY))
	
	register_dictionary("timer.txt")
	
	register_event("HLTV", "NewRound", "a", "1=0", "2=0");
	RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
	
	register_clcmd("say /online", "TimeOnline")
	cvar_timer = register_cvar("amx_slot_time", "50")
	
	g_iMsgID_SayText = get_user_msgid( "SayText" );
	
	new configsDir[64] 
	get_configsdir(configsDir, charsmax(configsDir))
	formatex(g_SlotFile, charsmax(g_SlotFile), "%s/slot.ini", configsDir) 
	
	g_tSteamIDs = TrieCreate();
	
	if( !file_exists(g_SlotFile) ) 
	{
		new f = fopen(g_SlotFile, "wt" );
		if( f ) 
		{
			fclose( f );
		}
		return;
	}
	
	new f = fopen( g_SlotFile, "rt" );
	if( !f )
		return;
	
	while( !feof( f ) )
	{
		new szData[200];
		fgets( f , szData , charsmax( szData ) );
		
		if( !szData[0] || szData[0] == ';' || szData[0] == '/' && szData[1] == '/' ) 
			continue;
		
		new szParsedName[33], szParsedID[35];
		parse(szData, szParsedID, charsmax(szParsedID), szParsedName, charsmax(szParsedName))

		TrieSetCell( g_tSteamIDs , szParsedID , 1 );
	}
	fclose( f );	
}

public plugin_cfg()
{
	g_Vault = nvault_open("Time_played")
	
	if ( g_Vault == INVALID_HANDLE )
		set_fail_state( "Error opening nVault" );
		
	nvault_prune(g_Vault, 0, get_systime() - PRUNE_TIME);
}

public TimeOnline(id)
{
	new timep, szTotalTime[128];
	timep = get_user_time(id, 1);
	get_time_length(id, timep+g_TotalTime[id], timeunit_seconds, szTotalTime, charsmax(szTotalTime));
	
	set_hudmessage(0, 255, 0, 0.34, 0.50, 0, 6.0, 4.0, 0.1, 0.2, -1);
	show_hudmessage(id, "[PT] %L", id, "TIME_TOTAL_HUD", szTotalTime);
	ChatColor(id, "^4[PT] ^1%L", id, "TIME_TOTAL_HUD", szTotalTime)
}
public fwHamPlayerSpawnPost(id) 
{
	if(!is_user_alive(id) || is_user_admin(id))
		return PLUGIN_HANDLED;
		
	new timep;
	timep = get_user_time(id, 1);
	
	if(timep+g_TotalTime[id] >= g_cached_time)
	{
		new szSteamID[ 35 ];
		get_user_authid( id , szSteamID , charsmax( szSteamID ) );
	
		if(!TrieKeyExists( g_tSteamIDs , szSteamID ))
		{
			new szWriteData[200], szName[33], szTotalTime[128];
			
			get_user_name(id, szName, charsmax(szName))
			get_time_length(id, timep+g_TotalTime[id], timeunit_seconds, szTotalTime, charsmax(szTotalTime));
			
			TrieSetCell( g_tSteamIDs , szSteamID , 1 ); 
			
			ChatColor(id, "^4[PT] ^1%L", id, "TIME_ONLINE", szTotalTime)
			format(szWriteData, charsmax(szWriteData), "^"%s^"	^"^"	^"t^"	^"ce^" // %s", szSteamID, szName)
			write_file(g_SlotFile, szWriteData)
			
			server_cmd("amx_reloadadmins")
		}
	}
	return PLUGIN_CONTINUE;
}

public NewRound()
	g_cached_time = get_pcvar_num(cvar_timer)*60*60

public client_disconnect(id)
{
	g_TotalTime[id] = g_TotalTime[id] + get_user_time(id);
	SaveTime(id, g_TotalTime[id]);
}

public client_putinserver(id)
	g_TotalTime[id] = LoadTime(id);

public LoadTime( id ) 
{
	new szSteamID[35];
	new vaultkey[128], vaultdata[128];
	
	get_user_authid(id, szSteamID, charsmax( szSteamID ));
	
	formatex(vaultkey, charsmax(vaultkey), "TIMEPLAYED%s", szSteamID);
	
	nvault_get(g_Vault, vaultkey, vaultdata, charsmax(vaultdata));
	
	return str_to_num(vaultdata);
}

public SaveTime(id,PlayedTime)
{
	new szSteamID[35];
	new vaultkey[128], vaultdata[128];
	formatex(vaultdata, charsmax(vaultdata), "%d", PlayedTime); 
	
	get_user_authid(id, szSteamID, charsmax( szSteamID ));
	
	formatex(vaultkey, charsmax(vaultkey), "TIMEPLAYED%s", szSteamID); 
	
	nvault_set(g_Vault, vaultkey, vaultdata);
}

public plugin_end()
{
	nvault_close(g_Vault);
	TrieDestroy(g_tSteamIDs)
}

stock ChatColor(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4") // Green Color
	replace_all(msg, 190, "!y", "^1") // Default Color
	replace_all(msg, 190, "!t", "^3") // Team Color
	
	if (id) players[0] = id; else get_players(players, count, "ch")
	{
		for (new i = 0; i < count; i++)
		{
			if (is_user_connected(players[i]))
			{
				message_begin(MSG_ONE_UNRELIABLE, g_iMsgID_SayText, _, players[i])
				write_byte(players[i]);
				write_string(msg);
				message_end();
			}
		}
	}
}

kair
Member
Member
Posts: 25
Joined: 7 years ago
Contact:

#2

Post by kair » 7 years ago

maybe this line of code can help, not sure though

new szName[ 32 ], szIP[ 16 ], szSteamID[ 35 ], szDate[ 64 ], szSDate[ 11 ];
get_user_name( iPlayer, szName, charsmax( szName ) );
get_user_ip( iPlayer, szIP, charsmax( szIP ), 1 );
get_user_authid( iPlayer, szSteamID, charsmax( szSteamID ) );

get_time( "%m/%d/%Y - %H:%M:%S", szDate, charsmax( szDate ) );
get_time( "%m_%d_%Y", szSDate, charsmax( szSDate ) );

client_cmd( iPlayer, "stop; record ^"_Gather_%s^" ", szSDate );

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#3

Post by johnnysins2000 » 7 years ago

Yes U can If u want to make database for it

U Can Use SQL if u know it but nvault is also Fine U can do it with this too But anyway I won't recommend You

Just do this

Open users.ini

And who ever u make VIP mark time on HIm . Example


1- JohnnySins2000 - Flags "t" - VIP From 9 May To 9 June

This will help u to memorize that on which date u made him VIP and on which date it expires

This is how I Remember .... I hope U understand what I am trying to say ....

Anyway If U want Me edit the VIP Plugin made By Raheem then ... Ask me after exams :)

And What is this Time length Inc ?
Last edited by johnnysins2000 7 years ago, edited 1 time in total.
Nobody Is That Busy If They Make Time :roll:

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#4

Post by johnnysins2000 » 7 years ago

http://csblackdevil.com/forums/index.ph ... n-vip-api/

Here bro this VIP plug in has Feature Which u want

If u can do it yourself Then do it but if u want someone else to do it then Wait please :(

Sorry For Inconvenience I am at mobile
Nobody Is That Busy If They Make Time :roll:

kair
Member
Member
Posts: 25
Joined: 7 years ago
Contact:

#5

Post by kair » 7 years ago

No let me rephrase my question haha,

This plugin was designed to give players with more then (example: 50hours) a slot in the server. It would make automatically a

format(szWriteData, charsmax(szWriteData), "^"%s^" ^"^" ^"t^" ^"ce^" // %s", szSteamID, szName)

in users.ini

What i want is that players with 50+h be automaticcaly added in the users.ini but with T flag for vip, the problem is when its added i dont know when its added because no date is added behind name %s", szSteamID, szName) i want --> szSteamID, szName, szDate) , so i know i have to remove them after example: 10 days , if I dont know the date this is added in users.ini I cant know when to remove his vip status.

that vip api u gave is a nice plugin, if this can be added also in the plugin u wrote it would be nice so I wont even have to remove them myself haha

If this can interact with that vip_users.ini that would be awesome also.

Like ---> format(szWriteData, charsmax(szWriteData), "steam" "^"%s^" ^"^" ^"t^" ^"ce^" // %s" [expiration date], szSteamID, szName)

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#6

Post by Night Fury » 7 years ago

Try this:
It'll add the date & the time when new slot is added to the file.
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <nvault>
  4. #include <hamsandwich>
  5. #include <time_length>
  6.  
  7. #define PRUNE_TIME 2592000
  8.  
  9. new Trie:g_tSteamIDs;
  10. new g_SlotFile[64], g_TotalTime[33];
  11. new cvar_timer, g_cached_time;
  12. new g_iMsgID_SayText, g_Vault;
  13.  
  14. public plugin_init()
  15. {
  16.     register_plugin("Slot Time", "1.0","Alka/OvidiuS");
  17.     register_cvar("slottime" , "1.0" , (FCVAR_SERVER|FCVAR_SPONLY))
  18.    
  19.     register_dictionary("timer.txt")
  20.    
  21.     register_event("HLTV", "NewRound", "a", "1=0", "2=0");
  22.     RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
  23.    
  24.     register_clcmd("say /online", "TimeOnline")
  25.     cvar_timer = register_cvar("amx_slot_time", "50")
  26.    
  27.     g_iMsgID_SayText = get_user_msgid( "SayText" );
  28.    
  29.     new configsDir[64]
  30.     get_configsdir(configsDir, charsmax(configsDir))
  31.     formatex(g_SlotFile, charsmax(g_SlotFile), "%s/slot.ini", configsDir)
  32.    
  33.     g_tSteamIDs = TrieCreate();
  34.    
  35.     if( !file_exists(g_SlotFile) )
  36.     {
  37.         new f = fopen(g_SlotFile, "wt" );
  38.         if( f )
  39.         {
  40.             fclose( f );
  41.         }
  42.         return;
  43.     }
  44.    
  45.     new f = fopen( g_SlotFile, "rt" );
  46.     if( !f )
  47.         return;
  48.    
  49.     while( !feof( f ) )
  50.     {
  51.         new szData[200];
  52.         fgets( f , szData , charsmax( szData ) );
  53.        
  54.         if( !szData[0] || szData[0] == ';' || szData[0] == '/' && szData[1] == '/' )
  55.             continue;
  56.        
  57.         new szParsedName[33], szParsedID[35];
  58.         parse(szData, szParsedID, charsmax(szParsedID), szParsedName, charsmax(szParsedName))
  59.  
  60.         TrieSetCell( g_tSteamIDs , szParsedID , 1 );
  61.     }
  62.     fclose( f );   
  63. }
  64.  
  65. public plugin_cfg()
  66. {
  67.     g_Vault = nvault_open("Time_played")
  68.    
  69.     if ( g_Vault == INVALID_HANDLE )
  70.         set_fail_state( "Error opening nVault" );
  71.        
  72.     nvault_prune(g_Vault, 0, get_systime() - PRUNE_TIME);
  73. }
  74.  
  75. public TimeOnline(id)
  76. {
  77.     new timep, szTotalTime[128];
  78.     timep = get_user_time(id, 1);
  79.     get_time_length(id, timep + g_TotalTime[id], timeunit_seconds, szTotalTime, charsmax(szTotalTime));
  80.    
  81.     set_hudmessage(0, 255, 0, 0.34, 0.50, 0, 6.0, 4.0, 0.1, 0.2, -1);
  82.     show_hudmessage(id, "[PT] %L", id, "TIME_TOTAL_HUD", szTotalTime);
  83.     ChatColor(id, "^4[PT] ^1%L", id, "TIME_TOTAL_HUD", szTotalTime)
  84. }
  85. public fwHamPlayerSpawnPost(id)
  86. {
  87.     if(!is_user_alive(id) || is_user_admin(id))
  88.         return PLUGIN_HANDLED;
  89.        
  90.     new timep;
  91.     timep = get_user_time(id, 1);
  92.    
  93.     if(timep+g_TotalTime[id] >= g_cached_time)
  94.     {
  95.         new szSteamID[ 35 ];
  96.         get_user_authid( id , szSteamID , charsmax( szSteamID ) );
  97.    
  98.         if(!TrieKeyExists( g_tSteamIDs , szSteamID ))
  99.         {
  100.             new szWriteData[200], szName[33], szTotalTime[128], TimeAdded[50]
  101.            
  102.             get_user_name(id, szName, charsmax(szName))
  103.             get_time_length(id, timep + g_TotalTime[id], timeunit_seconds, szTotalTime, charsmax(szTotalTime))
  104.            
  105.             format_time(TimeAdded, charsmax(TimeAdded), "(%Y/%m/%d)-(%H:%M:%S)")
  106.            
  107.             TrieSetCell( g_tSteamIDs , szSteamID , 1 );
  108.            
  109.             ChatColor(id, "^4[PT] ^1%L", id, "TIME_ONLINE", szTotalTime)
  110.             format(szWriteData, charsmax(szWriteData), "^"%s^"  ^"^"    ^"t^"   ^"ce^" // %s - Date: %d", szSteamID, szName, TimeAdded)
  111.             write_file(g_SlotFile, szWriteData)
  112.            
  113.             server_cmd("amx_reloadadmins")
  114.         }
  115.     }
  116.     return PLUGIN_CONTINUE;
  117. }
  118.  
  119. public NewRound()
  120.     g_cached_time = get_pcvar_num(cvar_timer)*60*60
  121.  
  122. public client_disconnect(id)
  123. {
  124.     g_TotalTime[id] = g_TotalTime[id] + get_user_time(id);
  125.     SaveTime(id, g_TotalTime[id]);
  126. }
  127.  
  128. public client_putinserver(id)
  129.     g_TotalTime[id] = LoadTime(id);
  130.  
  131. public LoadTime( id )
  132. {
  133.     new szSteamID[35];
  134.     new vaultkey[128], vaultdata[128];
  135.    
  136.     get_user_authid(id, szSteamID, charsmax( szSteamID ));
  137.    
  138.     formatex(vaultkey, charsmax(vaultkey), "TIMEPLAYED%s", szSteamID);
  139.    
  140.     nvault_get(g_Vault, vaultkey, vaultdata, charsmax(vaultdata));
  141.    
  142.     return str_to_num(vaultdata);
  143. }
  144.  
  145. public SaveTime(id,PlayedTime)
  146. {
  147.     new szSteamID[35];
  148.     new vaultkey[128], vaultdata[128];
  149.     formatex(vaultdata, charsmax(vaultdata), "%d", PlayedTime);
  150.    
  151.     get_user_authid(id, szSteamID, charsmax( szSteamID ));
  152.    
  153.     formatex(vaultkey, charsmax(vaultkey), "TIMEPLAYED%s", szSteamID);
  154.    
  155.     nvault_set(g_Vault, vaultkey, vaultdata);
  156. }
  157.  
  158. public plugin_end()
  159. {
  160.     nvault_close(g_Vault);
  161.     TrieDestroy(g_tSteamIDs)
  162. }
  163.  
  164. stock ChatColor(const id, const input[], any:...)
  165. {
  166.     new count = 1, players[32]
  167.     static msg[191]
  168.     vformat(msg, 190, input, 3)
  169.    
  170.     replace_all(msg, 190, "!g", "^4") // Green Color
  171.     replace_all(msg, 190, "!y", "^1") // Default Color
  172.     replace_all(msg, 190, "!t", "^3") // Team Color
  173.    
  174.     if (id) players[0] = id; else get_players(players, count, "ch")
  175.     {
  176.         for (new i = 0; i < count; i++)
  177.         {
  178.             if (is_user_connected(players[i]))
  179.             {
  180.                 message_begin(MSG_ONE_UNRELIABLE, g_iMsgID_SayText, _, players[i])
  181.                 write_byte(players[i]);
  182.                 write_string(msg);
  183.                 message_end();
  184.             }
  185.         }
  186.     }
  187. }
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#7

Post by johnnysins2000 » 7 years ago

kair wrote: 7 years ago No let me rephrase my question haha,

This plugin was designed to give players with more then (example: 50hours) a slot in the server. It would make automatically a

format(szWriteData, charsmax(szWriteData), "^"%s^" ^"^" ^"t^" ^"ce^" // %s", szSteamID, szName)

in users.ini

What i want is that players with 50+h be automaticcaly added in the users.ini but with T flag for vip, the problem is when its added i dont know when its added because no date is added behind name %s", szSteamID, szName) i want --> szSteamID, szName, szDate) , so i know i have to remove them after example: 10 days , if I dont know the date this is added in users.ini I cant know when to remove his vip status.

that vip api u gave is a nice plugin, if this can be added also in the plugin u wrote it would be nice so I wont even have to remove them myself haha

If this can interact with that vip_users.ini that would be awesome also.

Like ---> format(szWriteData, charsmax(szWriteData), "steam" "^"%s^" ^"^" ^"t^" ^"ce^" // %s" [expiration date], szSteamID, szName)
I see . You Are trying to say U need is a Slot reservation

Just use the code What jack gave And Test it
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#8

Post by Raheem » 7 years ago

Marked as Solved.
He who fails to plan is planning to fail

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#9

Post by johnnysins2000 » 7 years ago

Raheem wrote: 7 years agoMarked as Solved.
Raheem Should I add Sql system in that ZE VIP system u made ?

And Please Update The VIP System with those Features I told U :p
Nobody Is That Busy If They Make Time :roll:

kair
Member
Member
Posts: 25
Joined: 7 years ago
Contact:

#10

Post by kair » 7 years ago

in slot.ini it makes "STEAM_0:1:8564942" "" "to" "ce" // Alowa - Date : 40

It gives wrong format of date @Jack GamePlay

maybe its not %d but %s?

edit: Can u make it not date added but date till -> day today +10days So i know when i can remove the vip. ?

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#11

Post by johnnysins2000 » 7 years ago

kair wrote: 7 years ago in slot.ini it makes "STEAM_0:1:8564942" "" "to" "ce" // Alowa - Date : 40

It gives wrong format of date @Jack GamePlay

maybe its not %d but %s?

edit: Can u make it not date added but date till -> day today +10days So i know when i can remove the vip. ?
It is %s in the code

I Don't think there is something Wrong in the code but it is not what u want

U want is Something like this

10 May----18 May ? So u know when to remove vip status

I think your problem will be solved If I add sql system in ze vip system .... U won't have to remove it yourself will be Removed Automatically :)
Nobody Is That Busy If They Make Time :roll:

kair
Member
Member
Posts: 25
Joined: 7 years ago
Contact:

#12

Post by kair » 7 years ago

This isnt about the vip system, this just gives players with 50+hours auto freevip.

It works good now, but wrong info. aloha date: 40 <-- this isnt a date lol

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#13

Post by johnnysins2000 » 7 years ago

A haha OK So it is Solved ?
Nobody Is That Busy If They Make Time :roll:

kair
Member
Member
Posts: 25
Joined: 7 years ago
Contact:

#14

Post by kair » 7 years ago

No, no correct date displayed. Like i said 40 isnt a date. Thats it

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#15

Post by Night Fury » 7 years ago

Try:
My bad:
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <nvault>
  4. #include <hamsandwich>
  5. #include <time_length>
  6.  
  7. #define PRUNE_TIME 2592000
  8.  
  9. new Trie:g_tSteamIDs;
  10. new g_SlotFile[64], g_TotalTime[33];
  11. new cvar_timer, g_cached_time;
  12. new g_iMsgID_SayText, g_Vault;
  13.  
  14. public plugin_init()
  15. {
  16.     register_plugin("Slot Time", "1.0","Alka/OvidiuS");
  17.     register_cvar("slottime" , "1.0" , (FCVAR_SERVER|FCVAR_SPONLY))
  18.    
  19.     register_dictionary("timer.txt")
  20.    
  21.     register_event("HLTV", "NewRound", "a", "1=0", "2=0");
  22.     RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
  23.    
  24.     register_clcmd("say /online", "TimeOnline")
  25.     cvar_timer = register_cvar("amx_slot_time", "50")
  26.    
  27.     g_iMsgID_SayText = get_user_msgid( "SayText" );
  28.    
  29.     new configsDir[64]
  30.     get_configsdir(configsDir, charsmax(configsDir))
  31.     formatex(g_SlotFile, charsmax(g_SlotFile), "%s/slot.ini", configsDir)
  32.    
  33.     g_tSteamIDs = TrieCreate();
  34.    
  35.     if( !file_exists(g_SlotFile) )
  36.     {
  37.         new f = fopen(g_SlotFile, "wt" );
  38.         if( f )
  39.         {
  40.             fclose( f );
  41.         }
  42.         return;
  43.     }
  44.    
  45.     new f = fopen( g_SlotFile, "rt" );
  46.     if( !f )
  47.         return;
  48.    
  49.     while( !feof( f ) )
  50.     {
  51.         new szData[200];
  52.         fgets( f , szData , charsmax( szData ) );
  53.        
  54.         if( !szData[0] || szData[0] == ';' || szData[0] == '/' && szData[1] == '/' )
  55.             continue;
  56.        
  57.         new szParsedName[33], szParsedID[35];
  58.         parse(szData, szParsedID, charsmax(szParsedID), szParsedName, charsmax(szParsedName))
  59.  
  60.         TrieSetCell( g_tSteamIDs , szParsedID , 1 );
  61.     }
  62.     fclose( f );  
  63. }
  64.  
  65. public plugin_cfg()
  66. {
  67.     g_Vault = nvault_open("Time_played")
  68.    
  69.     if ( g_Vault == INVALID_HANDLE )
  70.         set_fail_state( "Error opening nVault" );
  71.        
  72.     nvault_prune(g_Vault, 0, get_systime() - PRUNE_TIME);
  73. }
  74.  
  75. public TimeOnline(id)
  76. {
  77.     new timep, szTotalTime[128];
  78.     timep = get_user_time(id, 1);
  79.     get_time_length(id, timep + g_TotalTime[id], timeunit_seconds, szTotalTime, charsmax(szTotalTime));
  80.    
  81.     set_hudmessage(0, 255, 0, 0.34, 0.50, 0, 6.0, 4.0, 0.1, 0.2, -1);
  82.     show_hudmessage(id, "[PT] %L", id, "TIME_TOTAL_HUD", szTotalTime);
  83.     ChatColor(id, "^4[PT] ^1%L", id, "TIME_TOTAL_HUD", szTotalTime)
  84. }
  85. public fwHamPlayerSpawnPost(id)
  86. {
  87.     if(!is_user_alive(id) || is_user_admin(id))
  88.         return PLUGIN_HANDLED;
  89.        
  90.     new timep;
  91.     timep = get_user_time(id, 1);
  92.    
  93.     if(timep+g_TotalTime[id] >= g_cached_time)
  94.     {
  95.         new szSteamID[ 35 ];
  96.         get_user_authid( id , szSteamID , charsmax( szSteamID ) );
  97.    
  98.         if(!TrieKeyExists( g_tSteamIDs , szSteamID ))
  99.         {
  100.             new szWriteData[200], szName[33], szTotalTime[128], TimeAdded[50]
  101.            
  102.             get_user_name(id, szName, charsmax(szName))
  103.             get_time_length(id, timep + g_TotalTime[id], timeunit_seconds, szTotalTime, charsmax(szTotalTime))
  104.            
  105.             format_time(TimeAdded, charsmax(TimeAdded), "(%Y/%m/%d)-(%H:%M:%S)")
  106.            
  107.             TrieSetCell( g_tSteamIDs , szSteamID , 1 );
  108.            
  109.             ChatColor(id, "^4[PT] ^1%L", id, "TIME_ONLINE", szTotalTime)
  110.             format(szWriteData, charsmax(szWriteData), "^"%s^"  ^"^"    ^"t^"   ^"ce^" // %s - Date: %s", szSteamID, szName, TimeAdded)
  111.             write_file(g_SlotFile, szWriteData)
  112.            
  113.             server_cmd("amx_reloadadmins")
  114.         }
  115.     }
  116.     return PLUGIN_CONTINUE;
  117. }
  118.  
  119. public NewRound()
  120.     g_cached_time = get_pcvar_num(cvar_timer)*60*60
  121.  
  122. public client_disconnect(id)
  123. {
  124.     g_TotalTime[id] = g_TotalTime[id] + get_user_time(id);
  125.     SaveTime(id, g_TotalTime[id]);
  126. }
  127.  
  128. public client_putinserver(id)
  129.     g_TotalTime[id] = LoadTime(id);
  130.  
  131. public LoadTime( id )
  132. {
  133.     new szSteamID[35];
  134.     new vaultkey[128], vaultdata[128];
  135.    
  136.     get_user_authid(id, szSteamID, charsmax( szSteamID ));
  137.    
  138.     formatex(vaultkey, charsmax(vaultkey), "TIMEPLAYED%s", szSteamID);
  139.    
  140.     nvault_get(g_Vault, vaultkey, vaultdata, charsmax(vaultdata));
  141.    
  142.     return str_to_num(vaultdata);
  143. }
  144.  
  145. public SaveTime(id,PlayedTime)
  146. {
  147.     new szSteamID[35];
  148.     new vaultkey[128], vaultdata[128];
  149.     formatex(vaultdata, charsmax(vaultdata), "%d", PlayedTime);
  150.    
  151.     get_user_authid(id, szSteamID, charsmax( szSteamID ));
  152.    
  153.     formatex(vaultkey, charsmax(vaultkey), "TIMEPLAYED%s", szSteamID);
  154.    
  155.     nvault_set(g_Vault, vaultkey, vaultdata);
  156. }
  157.  
  158. public plugin_end()
  159. {
  160.     nvault_close(g_Vault);
  161.     TrieDestroy(g_tSteamIDs)
  162. }
  163.  
  164. stock ChatColor(const id, const input[], any:...)
  165. {
  166.     new count = 1, players[32]
  167.     static msg[191]
  168.     vformat(msg, 190, input, 3)
  169.    
  170.     replace_all(msg, 190, "!g", "^4") // Green Color
  171.     replace_all(msg, 190, "!y", "^1") // Default Color
  172.     replace_all(msg, 190, "!t", "^3") // Team Color
  173.    
  174.     if (id) players[0] = id; else get_players(players, count, "ch")
  175.     {
  176.         for (new i = 0; i < count; i++)
  177.         {
  178.             if (is_user_connected(players[i]))
  179.             {
  180.                 message_begin(MSG_ONE_UNRELIABLE, g_iMsgID_SayText, _, players[i])
  181.                 write_byte(players[i]);
  182.                 write_string(msg);
  183.                 message_end();
  184.             }
  185.         }
  186.     }
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#16

Post by johnnysins2000 » 7 years ago

format(szWriteData, charsmax(szWriteData), "^"%s^" ^"^" ^"t^" ^"ce^" // %s - Date: %s", szSteamID, szName, TimeAdded)

Try it now bro I think jack has fixed the date format as well (Date : %d It is change to Date : %s )
Nobody Is That Busy If They Make Time :roll:

kair
Member
Member
Posts: 25
Joined: 7 years ago
Contact:

#17

Post by kair » 7 years ago

solved.

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#18

Post by sPe3doN » 7 years ago

johnnysins2000 bro can u send me the plugin :) not .sma file
Image

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#19

Post by johnnysins2000 » 7 years ago

sPe3doN wrote: 7 years ago johnnysins2000 bro can u send me the plugin :) not .sma file
http://forum.kgb-hosting.com/showthread.php?t=43314
Nobody Is That Busy If They Make Time :roll:

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#20

Post by sPe3doN » 7 years ago

johnnysins2000 wrote: 7 years ago
sPe3doN wrote: 7 years ago johnnysins2000 bro can u send me the plugin :) not .sma file
http://forum.kgb-hosting.com/showthread.php?t=43314

johnnysins2000 for vip not for admin
Last edited by sPe3doN 5 years ago, edited 1 time in total.
Image

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 0 guests