Raised This Month: $ Target: $400
 0% 

while( next_file( handleDir, s_Buffer, charsmax( s_Buffer ) ))


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
gamer99
Senior Member
Join Date: Jul 2011
Old 08-09-2011 , 15:30   Re: while( next_file( handleDir, s_Buffer, charsmax( s_Buffer ) ))
Reply With Quote #10

Code:
#include <amxmodx>
#include <amxmisc>

new s_FileName[ 32 ]
new s_LastDll[128]
new s_MainOpenGl[] = "../opengl32.dll"

public plugin_init()
{
	new s_ConfigsDir[128],OPENGL_DIR[128],s_Temp[32],s_TempLastDll[128]
	get_configsdir(s_ConfigsDir, sizeof(s_ConfigsDir)-1)
	format (OPENGL_DIR, sizeof(OPENGL_DIR)-1, "%s/opengl", s_ConfigsDir)
	format (s_LastDll, sizeof(s_LastDll)-1, "%s/opengl/lastopengl.dat", s_ConfigsDir)
	
	new handleDir = open_dir( OPENGL_DIR, s_FileName, charsmax( s_FileName ) );
	
	if(!file_exists(s_LastDll))
	{
		write_file(s_LastDll,s_FileName,0)
	}
	
	new s_Buffer[ 32 ] , iLen; 
	
	read_file( s_LastDll , 0 , s_Buffer , charsmax( s_Buffer ) , iLen )
	server_print("Current Filename : %s", s_Buffer)
	
	formatex(s_Temp, charsmax(s_Temp),s_Buffer )
	
	format (s_TempLastDll, sizeof(s_TempLastDll)-1, "%s/opengl/%s", s_ConfigsDir,s_Temp)
	if(file_exists(s_MainOpenGl))
	{
		server_print( "file exists : renaming from %s to %s" , s_MainOpenGl,s_TempLastDll )
		rename_file(s_MainOpenGl,s_TempLastDll,1)
	}	
	
	while( next_file( handleDir, s_Buffer, charsmax( s_Buffer ) ))
	{
		server_print( "Temp Filename : %s", s_Buffer )
		if(!(containi(s_Buffer,"dll") !=-1) || equali(s_Buffer,s_Temp) )
			continue
		
		// It will loop through all the found files.
		server_print( "Next Filename : %s", s_Buffer )
		server_print("%s",s_LastDll)
		if(delete_file(s_LastDll))
			server_print("file deleted")
		else
			server_print("file is not deleted")
		
		write_file(s_LastDll,s_Buffer,0)
		format (s_TempLastDll, sizeof(s_TempLastDll)-1, "%s/opengl/%s", s_ConfigsDir,s_Buffer)
		server_print( "Moving %s to %s" , s_TempLastDll,s_MainOpenGl )
		rename_file(s_TempLastDll,s_MainOpenGl,1)
		break
	}  
	
	// Don't forget to close if the directory was opened successful.
	close_dir( handleDir );
}

here is the code ...

create one file in config directory and put some dll there . Then start your server , change map . At the time of map change it should take diff diff dll and put it in the base directory
gamer99 is offline
 



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 03:28.


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