Raised This Month: $ Target: $400
 0% 

Write to .txt file and put +1


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-19-2021 , 10:45   Re: Write to .txt file and put +1
Reply With Quote #5

Quote:
Originally Posted by LondoN View Post
Code:
#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
	new g_szFileName[128];
	formatex(g_szFileName[get_configsdir(g_szFileName, charsmax(g_szFileName))], charsmax(g_szFileName), "/file.txt");
	new p_file = fopen(g_szFileName, "r+t");
	new szBuffer[16], num_to_string[16];
	new p_index_num = 0;
	new p_max_number = 1500;

	if(fgets(p_file, szBuffer, charsmax(szBuffer)))
	{
		while(str_to_num(g_szBuffer) <= p_max_number)
			p_index_num++;

		num_to_str(p_index_num, num_to_string, charsmax(num_to_string));
		fpus(p_file, num_to_string);
	}

	fclose(p_file);
}
not tested.
Smells like infinite loop.
__________________
HamletEagle 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 02:31.


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