Raised This Month: $ Target: $400
 0% 

Working on a plugin. Little help please :)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 06-11-2004 , 04:48  
Reply With Quote #2

Weeell, I don't have the time to go through all that, but what ive seen so far:

Code:
  format(text, 128, "[AMXX AUTH] You are now logged in, with the flags: s%.", flags)

Change s% to %s...

Commands should end with return PLUGIN_HANDLED, else they will be like "Unknown command".

Also linestring[255] is 255 cells big so you can't set a max at 255 in read_file for that. Set 254 instead. (read_file(usercfg,i,linestring,254,linesize) ).

Also getting the cmd arguments within the loop is a bad idea. They will be the same each iteration of the loop, so be sure to retrieve those before the loop starts. (read_argv())

Also the two ifs that do the same evaluation, only the later use a "!", looks odd. Why not remove that last if and put it outside the loop. I assume you will have more entries in that ini file. Else if the right accoutn is not on first line, only the first one will ever work. actually I think you'll remove the second if altogether and outside the loop say "Sorry, incorrect password/username", because you return from the function whenever there's a match with user/password.

AND, one more thing :-)
Code:
                new text[64]                 format(text, 128, "[AMXX AUTH] You are now logged in, with the flags: s%.", flags)                     client_print(id, print_chat, text)
Ouch, why? If you're gonna do this, you can't set maxsize to 128 when text[64] is 64! Use 63 in that case. But why bother, just scrap all that and do this:
Code:
client_print(id, print_console, "[AMXX AUTH] You are now logged in, with the flags: %s.", flags) // don't forget %s, not s%
Btw I assume you want the output in console, not chat area...

Edit: Oh, I just noticed one more thing which could be really dangerous:
Code:
parse(linestring, username[31], 31, password[31], 31, flags[31], 31)
Should be
Code:
parse(linestring, username, 31, password, 31, flags, 31)
Else you start writing from the 32nd character in username, password and flags, and you tell it it's okay to write 31 characters from there, writing beyond the limit of the strings. That will totally mess things up.
Johnny got his gun 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 14:48.


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