AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Run time error 11: divide (https://forums.alliedmods.net/showthread.php?t=336345)

Id0x. 02-13-2022 07:52

Run time error 11: divide
 
1 Attachment(s)
HTML Code:

L 02/08/2022 - 10:47:33: [AMXX] Displaying debug trace (plugin "dmc233.amxx", version "2.33")
L 02/08/2022 - 10:47:33: [AMXX] Run time error 11: divide
L 02/08/2022 - 10:47:33: [AMXX]    [0] dmc233.sma::ShowVoteMenu (line 1122)
L 02/08/2022 - 10:47:33: [AMXX]    [1] dmc233.sma::Counter (line 1074)
L 02/08/2022 - 10:47:33: [AMXX]    [2] dmc233.sma::StartMapChooser (line 961)
L 02/08/2022 - 10:47:33: [AMXX]    [3] dmc233.sma::VoteCounter (line 711)

Line 1122:
PHP Code:

MapPercent[Num] = ((MapVote[Num]*100)/(AllVotes)); 

Line 1074:
PHP Code:

ShowVoteMenu(Num); 

Line 961:
PHP Code:

Counter(); 

Line 711:
PHP Code:

StartMapChooser(); 


Shadows Adi 02-13-2022 08:08

Re: Run time error 11: divide
 
Try to round the number using floatround()

Code:

MapPercent[Num] = floatround((MapVote[Num]*100 ) / AllVotes);

HamletEagle 02-13-2022 11:32

Re: Run time error 11: divide
 
Make sure AllVotes is not 0 before you divide by it. You can not divide something by 0.


All times are GMT -4. The time now is 11:30.

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