Hi! this is my first plugin and I got stuck whith this while loop and I can't figure out where is the problem.
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Plugin"
#define VERSION "1.0"
#define AUTHOR "author"
new id, confdir[128], logfile[128], log[64], log2[64], name[32], Players[32];
new playerCount, player, emtline;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
get_configsdir( confdir, 127 );
format(logfile, 128, "%s/logfile.log", confdir);
set_task(5.0, "CTspeletaji",id,"",0, "b");
}
public CTspeletaji() {
new CTsprnd = 7;
new i;
get_players(Players, playerCount, "e", "CT")
for (i=0; i<playerCount; i++) {
player = Players[i]
get_user_name(player, name, 31);
format(log, 63, "%s%d%d%d", name, i, playerCount, CTsprnd);
write_file(logfile, log, CTsprnd); //writes line with player name
CTsprnd++;
}
if(i==0) {
emtline = CTsprnd; //if there is no players in CT team start write from 7 line
}
else {
emtline = CTsprnd + i;
}
while(emtline<17) {
format(log2, 63, "%d%d%d%d", emtline, i, playerCount, CTsprnd);
write_file(logfile, log2, emtline); //writes emty line to log
emtline++;
}
}
output for this code is(if one CT player is connected):
player017
8007
9118
10118
11118
12118
13118
14118
15118
16118
so, my problem is, why second line is 8007 while it must be 8118
amxx is just putting some info in log, it's not reading log file
in full code there is some more functions like CTspeletaji(), but they are doing the same(and have the same bug) and they actualy are the same, they only differs from CTspeletaji() with that, that they ar colecting info about Terrorist team player names or kills and so... but code of function is same, so I didn't post them becose then code would be very long
p.s sorry for my eanglish, hope u can understand what i wrote