Raised This Month: $51 Target: $400
 12% 

File write / read


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 08-21-2013 , 06:03   File write / read
Reply With Quote #1

hy allied modders users, i have a amxx plugin with i am trying to write details from users who tipe comand in chat to a file, name, steamid and ip, i've recently updated to not allow 2 same names to be written and for my surprise it does'nt work anymore, it creates the file in configs but it's empty and when i type the comand it said that i already exist in the file, but the file is empty what's wrong with this code

Thanks for read and help

And it will be helpfull if you can tell me how to print users from that file to a motd

Sorry for my bad english i suck at it

File removed!
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers

Last edited by CryWolf; 08-21-2013 at 09:20. Reason: :)
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 08-21-2013 , 06:30   Re: File write / read
Reply With Quote #2

its not really good idea to keep reading the file several times, do it once and save the names to a dynamic array or something like that.

also was your name CryWolf when you tested it, cause i saw this in the code:
Code:
if ( !filep )
	{
		write_file ( filen, "; File Names, 0.3 by CryWolf." );
		write_file ( filen, "; Format: [ date ] < username > | < SteamID > | < IP >" );
	}
and you check for the names like this:
Code:
if ( containi ( szData, szName ) )
jimaway is offline
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 08-21-2013 , 06:43   Re: File write / read
Reply With Quote #3

nope, my name was JasoN when i tested it!
btw i think you did not understand me plugin problems are
1. File is created but it's always empty even these are not on it
Code:
write_file ( filen, "; File Names, 0.3 by CryWolf." );
		write_file ( filen, "; Format: [ date ] < username > | < SteamID > | < IP >" );
2. I can't not use the comand it said that i am already on the list

and 3rd i whanna know how to read names from file and print it to a motd, i don't need to optimize nothing yet

AMXX 1.8.2
Metamod12.1-am
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-21-2013 , 08:02   Re: File write / read
Reply With Quote #4

If your code, you should be able to debug it. Right now you're saying "it doesn't work", but it's supposed to be your code, did you at least tried to debug it ? Like adding debug text, testing line by line, and such ?
__________________
Arkshine is offline
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 08-21-2013 , 08:10   Re: File write / read
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
If your code, you should be able to debug it. Right now you're saying "it doesn't work", but it's supposed to be your code, did you at least tried to debug it ? Like adding debug text, testing line by line, and such ?
Normaly i avoid guy's like you, but in this case i whanna tell you to avoid my topics please if you don't bring me nothing helpfully!
Thanks, i shall remake it without that function! debug mode helps me with nothing!
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers

Last edited by CryWolf; 08-21-2013 at 08:15.
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-21-2013 , 09:03   Re: File write / read
Reply With Quote #6

Quote:
Originally Posted by CryWolf View Post
Normaly i avoid guy's like you, but in this case i whanna tell you to avoid my topics please if you don't bring me nothing helpfully!
Thanks, i shall remake it without that function! debug mode helps me with nothing!
You are here asking for assistance and then you bash someone trying to help you? Saying "doesn't work" doesn't help us in determining what is actually wrong
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-21-2013 , 09:03   Re: File write / read
Reply With Quote #7

That's not your code then. Ok, thanks for confirmation.

Anyway, what I said is still valid, you should start to _debug_ "this" code. I did not say to add "debug" in plugins.ini. It's weird as coder you don't know to check your own code. I DO help you by saying what you should do, but don't worry I won't waste my time for someone who because don't understand something bash the helper.
__________________

Last edited by Arkshine; 08-21-2013 at 09:04.
Arkshine is offline
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 08-21-2013 , 09:19   Re: File write / read
Reply With Quote #8

Quote:
Originally Posted by Arkshine View Post
That's not your code then. Ok, thanks for confirmation.

Anyway, what I said is still valid, you should start to _debug_ "this" code. I did not say to add "debug" in plugins.ini. It's weird as coder you don't know to check your own code. I DO help you by saying what you should do, but don't worry I won't waste my time for someone who because don't understand something bash the helper.
I don't sleep at night with C++ / Pawn book on my chest like you do it, i have other thing in my life to do (better ones)
Of course it's not my code: i've just followed a tutorial this one in achiving what i've made.
That is not the point i didn't come here to argue, i've removed the function that verifies that the same player is not added twice to that list and solved. i will find somewere else a little help with fixing that!

@YamiKaitou: what do you find helpfull in his first reply ? that is asking me if is my code or not and what's that have someting to do with what i've requested!

Please guy's close the tread, this doesn't need to go further.

Thanks for help, and i'am sorry for disturb and trouble, it will not happen again!
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-21-2013 , 09:39   Re: File write / read
Reply With Quote #9

Quote:
did you at least tried to debug it ? Like adding debug text, testing line by line, and such
Instead of focusing on irrelevant part, did you do that ? I guess not.
Just because you don't understand that, doesn't mean you are allowed to bash someone, because for your information I was helping you.

You should have said clearly from the start that :

- That's not your code
- You are beginner
- What you have tried

That's said, since you're posting in Scripting section, you're willing to learn, right ? So, I say it again, debug your plugin : adding debug text with for example log_amx() to see if code is well executed, checking line by line to narrow down where is lying the problem, etc.
__________________

Last edited by Arkshine; 08-21-2013 at 09:40.
Arkshine is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 08-21-2013 , 10:53   Re: File write / read
Reply With Quote #10

Quote:
Originally Posted by CryWolf View Post
I don't sleep at night with C++ / Pawn book on my chest like you do it, i have other thing in my life to do (better ones)
What a waste is to put than on your chest!
If you but that book under the pillow, then see results!
Thats how i learned and learn everyday.
.Dare Devil. is offline
Reply



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 07:24.


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