View Single Post
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-16-2016 , 20:32   Re: Static.cfg restoration
Reply With Quote #5

I did that plugin a long time ago and have learned to do things more elegantly/properly. I would change these lines:

PHP Code:
#define STATIC_MAX 64
#define STATIC_LEN 64
//...
new staticlist[STATIC_MAX][STATIC_LEN]
//...
    
new data[STATIC_LEN]
//...
    
while( !feof(f) && g_static_count STATIC_MAX
    { 
        
fgets(fdatasizeof(data) - 1
to

PHP Code:
// Removed, Not needed
//...
new staticlist[64][64]
//...
    
new data[sizeof(staticlist[])]
//...
    
while( !feof(f) && g_static_count sizeof(staticlist)) 
    { 
        
fgets(fdatacharsmax(data)) 

You forgot this:

Quote:
Originally Posted by fysiks View Post
  • For obtaining the length of a string variable (array), use charsmax() instead of sizeof()-1.
__________________

Last edited by fysiks; 02-16-2016 at 20:33.
fysiks is offline