Raised This Month: $ Target: $400
 0% 

Please delete this topic


Post New Thread Reply   
 
Thread Tools Display Modes
SubStream
Veteran Member
Join Date: Aug 2005
Location: USA
Old 04-08-2006 , 20:37  
Reply With Quote #21

ok I removed the for loop inside of that...
download the below .sma to see it.

Here is what the log file does now
Code:
L 04/08/2006 - 19:28:07: [AMXX] Run time error 4 (plugin "fcoswarrays.amxx") - debug not enabled!
L 04/08/2006 - 19:28:07: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
So I added debug after the plugin... and here is what it did then
Code:
L 04/08/2006 - 19:32:20: [AMXX] Displaying debug trace (plugin "fcoswarrays.amxx")
L 04/08/2006 - 19:32:20: [AMXX] Run time error 4: index out of bounds 
L 04/08/2006 - 19:32:20: [AMXX]    [0] fcoswarrays.sma::fn_queryresult1 (line 288)
What is line 288??? Let's see...
Line 288
Code:
    gf_calfloatvalue = floatstr ( gf_calvalues1[gi_cvarnum] )
It just so happens to be the line right after the for loop that you said to take out.. the for loop cycled through gi_cvarnum ... so now what do I do?

If there is a way to read the CAL values from the array then please show me. Taking out the for loop did not fix the problem.

Edit: File below was removed because problem was solved. Fully fixed version on the first post.
SubStream is offline
capndurk
Senior Member
Join Date: Feb 2006
Old 04-08-2006 , 22:08  
Reply With Quote #22

Quote:
Originally Posted by SubStream
If there is a way to read the CAL values from the array then please show me. Taking out the for loop did not fix the problem.
Calm down dude, damn... I'm trying to help you, so when something doesn't work automatically you don't have to blow up in my face. You had a problem in your code, and obviously you had another problem as well, because taking out the for loop didn't cause any problems that weren't already there. Now, humor me for a second and change a few things around...

1) change that for loop inside fn_query1() to this:

Code:
while ( gi_cvarnum < SIZE ) {     query_client_cvar ( gi_playerID, gi_cvar1[gi_cvarnum], "fn_queryresult1" ) // Query the cvar from the player and forwards it to function with parameters     gi_cvarnum++ }

I just don't feel comfortable with gi_cvarnum being changed in a for loop, because it seems as though it has its own scope. I don't know if that's true, but it's better to use a while loop and eliminate any suspicions than use a for loop and have them.

2) In fn_queryresult1, take out this:

Code:
else {     return PLUGIN_HANDLED }

It's not needed, since you have another return PLUGIN_HANDLED right under it.

3) For the last time... change this:

Code:
if ( ! ( is_user_admin ( gi_playerID2 ) ) ) // If user is not admin {     return PLUGIN_HANDLED }             else {     client_print ( gi_playerID2, print_console, "%L", LANG_SERVER, "FCOS_LANG_SHOW_ADMIN", gs_logname, s_cvarname, gf_valuefromplayer, gf_calfloatvalue ) // Displays FCOS_LANG_SHOW_ADMIN in console to admin only }

to this:

Code:
if ( is_user_admin ( gi_playerID2 ) ) // If user is admin {     client_print ( gi_playerID2, print_console, "%L", LANG_SERVER, "FCOS_LANG_SHOW_ADMIN", gs_logname, s_cvarname, gf_valuefromplayer, gf_calfloatvalue ) // Displays FCOS_LANG_SHOW_ADMIN in console to admin only }


And for the record, your variable names are far too long; Hungarian Notation may be important, but KISS is more important if you want to have maximum readability.
__________________
I have left these forums because a certain respected member has been acting immaturely lately and has decided that I am not welcome in this community.
capndurk is offline
SubStream
Veteran Member
Join Date: Aug 2005
Location: USA
Old 04-08-2006 , 23:08  
Reply With Quote #23

Quote:
Originally Posted by capndurk
Calm down dude, damn... I'm trying to help you
I know that and I greatly appreciate any information you have which will help me solve my problem. And I don't know why I wouldn't be calm... this is just a forum
Quote:
Originally Posted by capndurk
so when something doesn't work automatically you don't have to blow up in my face
The thing that didn't work was something you suggested. It may be a step in the overall fixing of the problem, but as of now it has not proven to be part of the solution; and I don't recall "blowing up", as you put it.
Quote:
Originally Posted by capndurk
You had a problem in your code, and obviously you had another problem as well, because taking out the for loop didn't cause any problems that weren't already there
But it didn't fix any problems in and of itself either.
Quote:
Originally Posted by capndurk
1) change that for loop inside fn_query1() to this:
Code:
while ( gi_cvarnum < SIZE ) {     query_client_cvar ( gi_playerID, gi_cvar1[gi_cvarnum], "fn_queryresult1" ) // Query the cvar from the player and forwards it to function with parameters     gi_cvarnum++ }
There is no reason to do that because it shows in the log file on the front page that all CVARS are already going through query_client_cvar properly. That is not the problem
Quote:
Originally Posted by capndurk
2) In fn_queryresult1, take out this:
Code:
else {     return PLUGIN_HANDLED }
It's not needed, since you have another return PLUGIN_HANDLED right under it.
Maybe not needed to function but it's good programming habits for every if statement to have an else along with it.
Quote:
Originally Posted by capndurk
3) For the last time... change this:
Code:
if ( ! ( is_user_admin ( gi_playerID2 ) ) ) // If user is not admin {     return PLUGIN_HANDLED }             else {     client_print ( gi_playerID2, print_console, "%L", LANG_SERVER, "FCOS_LANG_SHOW_ADMIN", gs_logname, s_cvarname, gf_valuefromplayer, gf_calfloatvalue ) // Displays FCOS_LANG_SHOW_ADMIN in console to admin only }
to this:
Code:
if ( is_user_admin ( gi_playerID2 ) ) // If user is admin {     client_print ( gi_playerID2, print_console, "%L", LANG_SERVER, "FCOS_LANG_SHOW_ADMIN", gs_logname, s_cvarname, gf_valuefromplayer, gf_calfloatvalue ) // Displays FCOS_LANG_SHOW_ADMIN in console to admin only }
That's a matter of preference and again it's good programming habits to have an else wherever there is an if statement.
Quote:
Originally Posted by capndurk
And for the record, your variable names are far too long; Hungarian Notation may be important, but KISS is more important if you want to have maximum readability.
Not according to Good programming habits Sticky Post where it says: "Don't be afraid to use more than 10 characters in your variable names! The key is READABILITY!"
SubStream is offline
capndurk
Senior Member
Join Date: Feb 2006
Old 04-08-2006 , 23:15  
Reply With Quote #24

All right, well since you didn't decide to change things that might help your program, I guess you're not really open to my suggestions anymore... so good luck with it.
__________________
I have left these forums because a certain respected member has been acting immaturely lately and has decided that I am not welcome in this community.
capndurk is offline
SubStream
Veteran Member
Join Date: Aug 2005
Location: USA
Old 04-08-2006 , 23:19  
Reply With Quote #25

Quote:
Originally Posted by capndurk
All right, well since you didn't decide to change things that might help your program, I guess you're not really open to my suggestions anymore... so good luck with it.
That's an absurd statement. The things you want changed are preference and nothing more. The only thing you have suggested which may be part of the solution is taking out the for loop. All the other things listed above are preference. Me not wanting to change them is because I have my own style of programming and organization... if statements are accompanied by else statements.. there is nothing wrong with that. If you choose not to help that is fine. I am sure there is somebody on here who has the knowledge to help.
SubStream is offline
capndurk
Senior Member
Join Date: Feb 2006
Old 04-08-2006 , 23:22  
Reply With Quote #26

No, you needed to get rid of return PLUGIN_HANDLED, which I told you a while ago, and you still hadn't changed it. But, you just don't seem to be as cooperative with my suggestions as I thought you'd be, and so I'm not going to try to help you if you think all my suggestions are just my "personal preferences."
__________________
I have left these forums because a certain respected member has been acting immaturely lately and has decided that I am not welcome in this community.
capndurk is offline
SubStream
Veteran Member
Join Date: Aug 2005
Location: USA
Old 04-08-2006 , 23:30  
Reply With Quote #27

Quote:
Originally Posted by capndurk
No, you needed to get rid of return PLUGIN_HANDLED, which I told you a while ago, and you still hadn't changed it. But, you just don't seem to be as cooperative with my suggestions as I thought you'd be, and so I'm not going to try to help you if you think all my suggestions are just my "personal preferences."
I remember you telling me that but I didn't remember which one I was supposed to change because I had updated all of the code to be consistent with version 1.8 of the plugin. If you would like to remind me which one should be changed and explain why then I will change it if it makes sense. I never said everything was personal preference. You should offer better explanations for things than "this will help your code" or "i don't feel comfortable with" when you post reasons for changing a part of a code which is so large in nature and has so many variables. Explanations are needed so that I may learn why I am doing what I am doing. I automatically understood why I should get rid of the for loop because you explained it. If you do not explain why something should happen so that it makes sense to me then why would I do it?

Edit: Well don't worry about it anymore anyhow... I have a new problem... I fixed that problem... see the first post for an update on what the new problem is.
SubStream 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 22:35.


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