 |
|
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
|

04-19-2021
, 10:45
Re: Write to .txt file and put +1
|
#5
|
Quote:
Originally Posted by LondoN
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.
__________________
|
|
|
|