i think it is the typical "for" problem:
here what i mean:
Code:
new i, k //i,k have 0
for(i = k; i <= iCountDiss; i++)
{
//increase every loop i to "<=" icountDiss(33).
}
"<=" mean increase the "i" until it is higher that icountDiss, and this is 33 not 32.
and i are increase every loop.A little script to show it.
Code:
new i
for(i=0;i<=10;i++)
{
client_print(id,print_chat,"i:%d",i) //i begin with 0,but end with 11
}
//i have now 11 not 10
I make this most also wrong.
And a little tip,you can also write this
Code:
iCountDiss = iCountDiss + 1
same effect
or
a little better
Code:
public client_disconnect(id)
{
if(is_user_bot(id) || (is_user_hltv(id))) {
return PLUGIN_CONTINUE
}
if (iCountDiss > 32) {
new iMaxUser = 32
for(new c = 0;c < iMaxUser; c++) {
copy(g_szLastPlrName[c],32,g_szLastPlrName[c+1])
}//this copy every playername 1 slot backwards and put the oldest out.
else iCountDiss++
get_user_name(id, g_szLastPlrName[iCountDiss], 32);
get_user_authid(id, g_szLastPlrAuth[iCountDiss], 32);
if(get_cvar_num("amx_showdissconnects") == 1) {
client_print(0,print_chat, "Nick: %s SteamID: %s dissconnected", g_szLastPlrName[id], g_szLastPlrAuth[id]);
}
//return PLUGIN_CONTINUE optional, not needed
}
public leftserver(id) //id of the one who issued the command
{
new k = iCountDiss-get_cvar_num("amx_showlast")
if(k<0)
k= 0 //arrays begin with 0
for(new i = iCountDiss;i>=k ; i--) {
client_print(id,print_chat, "[Nick] %s - [SteamID] %s", g_szLastPlrName[i], g_szLastPlrAuth[i]);
console_print(id,"[Nick] %s - [SteamID] %s", g_szLastPlrName[i], g_szLastPlrAuth[i]);
#if defined DEBUG
server_print(g_szLastPlrName[i])
server_print(g_szLastPlrName[i])
server_print("%i", i)
#endif
}
//return PLUGIN_CONTINUE optional, not needed
}
__________________