Raised This Month: $ Target: $400
 0% 

Plugin works (allmost) but how should i have done?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
schnitzelmaker
Senior Member
Join Date: Apr 2006
Location: HERE
Old 10-12-2006 , 15:53   Re: Plugin works (allmost) but how should i have done?
Reply With Quote #2

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
Code:
iCountDiss += 1
or
Code:
iCountDiss++

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 }
__________________

Last edited by schnitzelmaker; 10-12-2006 at 16:29.
schnitzelmaker 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 04:52.


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