Raised This Month: $ Target: $400
 0% 

TFC skills rank with speed run timer


Post New Thread Reply   
 
Thread Tools Display Modes
Lt Llama
Senior Member
Join Date: Aug 2004
Old 09-16-2006 , 03:55   Re: TFC skills rank with speed run timer
Reply With Quote #31

Thanks. I see whats wrong. I used a lazy method to find the last row in the result set instead of using dbi_num_rows ( result ) and pick the last row from there. Ill try and fix this. Actually I think that there is only one place where this problem occurs.

Thx for looking into it

/Lt.
__________________
A dodo: Used to describe someone without common sense and who always has the pathetic confused look on their face when a question is asked.
Lt Llama is offline
Lt Llama
Senior Member
Join Date: Aug 2004
Old 09-16-2006 , 04:41   Re: TFC skills rank with speed run timer
Reply With Quote #32

Ok, it was as I thought. This problem only occured in one place in the plugin.
I changed

Code:
        dbi_nextrow(resultMaps)         dbi_result(resultMaps, "curDate", qryFirstDate, maxFinishedMaps-1)         len1 += format(statsMotd[len1], 2047-len1,"First time you finished a map: %s^n",qryFirstDate)         while (resultMaps && dbi_nextrow(resultMaps) > 0)             dbi_nextrow(resultMaps)         dbi_result(resultMaps, "curDate", qryFirstDate, maxFinishedMaps-1)         len1 += format(statsMotd[len1], 2047-len1,"Last time you finished a map: %s^n^n^n",qryFirstDate)         dbi_free_result(resultMaps)

to

Code:
        dbi_nextrow(resultMaps)         dbi_result(resultMaps, "curDate", qryFirstDate, maxFinishedMaps-1)         new nRows = dbi_num_rows(resultMaps)         new incrRows = 1         len1 += format(statsMotd[len1], 2047-len1,"First time you finished a map: %s^n",qryFirstDate)         while (incrRows < nRows) {             dbi_nextrow(resultMaps)             ++incrRows         }         dbi_result(resultMaps, "curDate", qryFirstDate, maxFinishedMaps-1)         len1 += format(statsMotd[len1], 2047-len1,"Last time you finished a map: %s^n^n^n",qryFirstDate)         dbi_free_result(resultMaps)

In this way, as Bailopan said, I'm shure not to query an empty result set.
I was only interested in the last row in the result set. This is a better way to do it.

Thanks for helping out

/Lt.
__________________
A dodo: Used to describe someone without common sense and who always has the pathetic confused look on their face when a question is asked.
Lt Llama is offline
Lt Llama
Senior Member
Join Date: Aug 2004
Old 09-16-2006 , 05:48   Re: TFC skills rank with speed run timer
Reply With Quote #33

Quote:
Originally Posted by DAWG View Post
But I am haveing a small problem. When i click on a name in the skillsrank page (index.php) it opens the playerstats page with no info, the page is there it just contains no player info.
I think you will find the solution here http://www.zimmertech.com/tutorials/...les-in-php.php

You have to enable passing variables through urls in your httpd.conf.
Add or change
php_value register_globals 0
to
php_value register_globals 1

If you dont want to do that you have to edit the playerstats.php and use the $_GET method as described in the page above.

/Lt.
__________________
A dodo: Used to describe someone without common sense and who always has the pathetic confused look on their face when a question is asked.
Lt Llama is offline
DAWG
Member
Join Date: Jul 2004
Old 09-16-2006 , 12:08   Re: TFC skills rank with speed run timer
Reply With Quote #34

WOW that was fast!!

Thanx for your time and effot on this great plugin!
With new fix for 1.75(
that I will implement later today) and the playerstats working on the webby, sure has made my day alot brighter.

Thanx Lt. and to BAILOPAN!
__________________

People are like slinkies. Not realy good for anything,
but they still put a smile on your face when you push'm down the stairs!
DAWG is offline
jRaven
AMX Mod X Beta Tester
Join Date: Jan 2006
Location: IA, USA
Old 09-16-2006 , 18:06   Re: TFC skills rank with speed run timer
Reply With Quote #35

Great work! Thanks Lt Llama, Bail!
jRaven is offline
Send a message via ICQ to jRaven Send a message via AIM to jRaven
-hi-
Member
Join Date: Jul 2006
Old 09-16-2006 , 19:50   Re: TFC skills rank with speed run timer
Reply With Quote #36

I noticed you are using arrays with 32 slots for storing information about players. It's possible for a player to have an ID of 32, and 32 isn't a legal slot in the arrays. I would change all the id based arrays to have 33 slots.

EDIT:
It still crashes when anyone uses the /top5 command. I'm using 1.75a

Last edited by -hi-; 09-16-2006 at 23:16.
-hi- is offline
Lt Llama
Senior Member
Join Date: Aug 2004
Old 09-17-2006 , 03:47   Re: TFC skills rank with speed run timer
Reply With Quote #37

Quote:
Originally Posted by -hi- View Post
I noticed you are using arrays with 32 slots for storing information about players. It's possible for a player to have an ID of 32, and 32 isn't a legal slot in the arrays. I would change all the id based arrays to have 33 slots.

EDIT:
It still crashes when anyone uses the /top5 command. I'm using 1.75a
Hm, I don't get it. Where to change the slots?
If I look for example in the official amxmodx plugins they use 32 slots.
For example in admincmd.sma:

Code:
new authid[32], authid2[32], name2[32], name[32], userid2, reason[32] get_user_authid(id, authid, 31) get_user_authid(player, authid2, 31) get_user_name(player, name2, 31) get_user_name(id, name, 31)

Are those such places I should change? If not, can you point out an example where I should change it?

I'll have a look at the crash problem. Btw, do you have less than 5 rows in your database? Thats the only reason when I think it would crash. I use 1.75a to but my skillsrank tables are packed ?

/Lt.
__________________
A dodo: Used to describe someone without common sense and who always has the pathetic confused look on their face when a question is asked.

Last edited by Lt Llama; 09-17-2006 at 04:08.
Lt Llama is offline
-hi-
Member
Join Date: Jul 2006
Old 09-17-2006 , 04:17   Re: TFC skills rank with speed run timer
Reply With Quote #38

Yes, my DB is practically empty.

I'm talking about places where you use a player's ID number (which can be 1-32) as an index in an array:

Code:
new bool:hasTimer[32]

Then later in the code you use the player's ID number to set things in the array:

Code:
hasTimer[id] = false

Since the player ID can be 32, this code would be wrong since the legal indices for an array of size 32 are 0-31:

Code:
hasTimer[32] = false

Last edited by -hi-; 09-17-2006 at 04:20.
-hi- is offline
Lt Llama
Senior Member
Join Date: Aug 2004
Old 09-17-2006 , 06:32   Re: TFC skills rank with speed run timer
Reply With Quote #39

Ok, it still crashed when there where fewer than 5 players to pick for the top5 lists. I have created two versions of a changed plugin.

skillranks_oldtables.sma

This is a version which use the same table names as the original skillsrank1.4.3.

skillranks_testtables.sma

This is a version which creates new tables only to use for testing.
testmaps = substitutes the original 'skillmaps' table
testrank = substitutes the original 'skillrank' table

Can you download and test these and see if it works now?
If you dont want to mess with your old tables use skillsrank_testtables.sma.

It works for me, I have tried creating new tables and used the old ones.

Confirm that it works for you to and I will update the plugin.

Quote:
Originally Posted by -hi- View Post
I noticed you are using arrays with 32 slots for storing information about players. It's possible for a player to have an ID of 32, and 32 isn't a legal slot in the arrays. I would change all the id based arrays to have 33 slots.
I have changed where I thought I had to change.
If you have time -hi-, can you have a little look and tell me if I need to change anywhere else?

Ok, hope it works now

/Lt.
Attached Files
File Type: sma Get Plugin or Get Source (skillranks_oldtables.sma - 615 views - 60.9 KB)
File Type: sma Get Plugin or Get Source (skillranks_testtables.sma - 623 views - 60.8 KB)
__________________
A dodo: Used to describe someone without common sense and who always has the pathetic confused look on their face when a question is asked.
Lt Llama is offline
-hi-
Member
Join Date: Jul 2006
Old 09-17-2006 , 07:33   Re: TFC skills rank with speed run timer
Reply With Quote #40

Ya the testtables version worked for me with only 1 row in the DB. Thanks for the quick fix!
-hi- 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 23:23.


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