Raised This Month: $ Target: $400
 0% 

Run time error 11: divide


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 04-07-2011 , 21:32   Run time error 11: divide
Reply With Quote #1

See LOG and pug_modspecific.inc

Code:
L 04/07/2011 - 22:26:04: Start of error session.
L 04/07/2011 - 22:26:04: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20110407.log")
L 04/07/2011 - 22:26:04: [AMXX] Displaying debug trace (plugin "pug_menu.amxx")
L 04/07/2011 - 22:26:04: [AMXX] Run time error 11: divide 
L 04/07/2011 - 22:26:04: [AMXX]    [0] pug_modspecific.inc::pug_teams_optimize (line 28)
L 04/07/2011 - 22:26:04: [AMXX]    [1] pug_menu.sma::voteteam_count (line 325)

Code:
stock pug_teams_optimize() {     new skillz[33], sorted[33]         static Players[32];     new playerCount, i, player;     get_players(Players, playerCount, "ch")     for (i=0; i<playerCount; i++)     {         player = Players[i];         sorted[player] = skillz[player] = get_user_time(player,1) / get_user_frags(player);     }         SortIntegers(sorted,33,Sort_Descending);     new check = 1, teams = pug_num_teams();     for (i=0; i < 33; i++)     {         for(new a = 0; a < playerCount; a++)         {             player = Players[a]             if(skillz[player] == sorted[i])             {                 pug_set_client_team(player,check);                 check++;                 if(check > teams) check = 1;             }         }     } }
Any ideas?
Attached Files
File Type: log error_20110407.log (457 Bytes, 285 views)
File Type: inc pug_modspecific.inc (1,009 Bytes, 335 views)
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 04-07-2011 at 21:34. Reason: Added: pug_modspecific.inc
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
padilha007
Senior Member
Join Date: Jul 2008
Old 04-07-2011 , 21:47   Re: Run time error 11: divide
Reply With Quote #2

this?

PHP Code:
(get_user_time(player,1) / get_user_frags(player)); 
__________________

padilha007 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 04-07-2011 , 21:48   Re: Run time error 11: divide
Reply With Quote #3

Quote:
Originally Posted by padilha007 View Post
this?

(get_user_time(player,1) / get_user_frags(player));

Yes this is error, how to correct this?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-07-2011 , 22:35   Re: Run time error 11: divide
Reply With Quote #4

It's dividing by 0 if player has 0 frags.
Check if player has 0 frags before dividing.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 04-07-2011 , 22:42   Re: Run time error 11: divide
Reply With Quote #5

PHP Code:
if(!get_user_frags(player))
{
    continue;
}

??

Or 
Possible to check only by connected time ?? 
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 04-07-2011 , 23:57   Re: Run time error 11: divide
Reply With Quote #6

Solved, thanks.

I Choosed players Based on ping, more eficient
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-09-2011 , 00:23   Re: Run time error 11: divide
Reply With Quote #7

Quote:
Originally Posted by ^SmileY View Post
I Choosed players Based on ping, more eficient
Ping? What? I fail to see what ping has anything to do with your code.
__________________
fysiks is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 04-09-2011 , 01:56   Re: Run time error 11: divide
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
Ping? What? I fail to see what ping has anything to do with your code.
SOLVED! I added ping check, but dont post
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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 20:12.


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