Working on a plugin. Little help please :)
Well I have put my War plugin on hold, and I decided to make this plugin. What it does is when someone types amx_login <username> <password>into console it checks with the file custom\amx_login\loginusers.ini and sees if they user and pass are correct, then sets them as admin.
Code:
This is what I have in my loginusers.ini Code:
"pxl" "password" "abcdefghijklmnopqrstuz"Then I type into console amx_login pxl password and it freezes my server! I get connection lost and I can't see any error code because the Steam HLDS is screwed. So can someone just check over my code /methinks there is something wrong with the looping. |
Weeell, I don't have the time to go through all that, but what ive seen so far:
Code:
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:
Code:
Edit: Oh, I just noticed one more thing which could be really dangerous: Code:
Code:
|
Thank you jghg. Your ace :)
|
Ok, it works now, except that when you put in the correct name and password it says you have admin status, but you don't. Secondly if you get the password or username wrong, it crashes the HLDS. Any ideas anyone?
Code:
|
Code:
Looks like you dont increment the line counter. |
| All times are GMT -4. The time now is 14:48. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.