IPB

Welcome Guest ( Log In | Register )

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 
Reply to this topicStart new topic
> Plugin Fix
Masterchief
post Sep 27 2009, 03:02 PM
Post #1


Get Pwned By me!
***

Group: Members
Posts: 420
Joined: 20-May 08
From: Some where in the USA
Member No.: 37,171



Hello,

My plugin is geting a error and I dont see why. Can anybody fix this?

Error:

QUOTE
[3:58:28 PM] UserTalk Call Error On File> C:\Program Files\StealthBot\plugins\bestInChannel.plug
[3:58:28 PM] Error Number: 9 Description: Subscript out of range


Plugin:

CODE
'bestinchannel
'1.3
'&Best In Channel:The-Black-Ninja
'&best=Initiates command
'&37477
'&No important notes


Const bestinchannel_cmd = "bestinchannel" '// Command Name
Const bestinchannel_txtgate = "Azeroth" '// Your realm
Const bestinchannel_Access = 40 '// Access needed
Const bestinchannel_maxUsers = 15 '// For anti-spam; bot will not display more than X users's records in the channel, but will still display the best in the channel.



Sub bestinchannel_event_UserTalk(Username, Flags, Message, Ping)

bestinchannel_CallCommand Username, Message, 1
End Sub


Sub bestinchannel_Event_WhisperFromUser(Username, Flags, Message)

bestinchannel_CallCommand Username, Message, 3
End Sub


Sub bestinchannel_Event_PressedEnter(Text)

bestinchannel_CallCommand BotVars.Username, Text, 4
End Sub


Sub bestinchannel_CallCommand(Username, Message, DspId)

If Not (Left(Message, 1) = BotVars.Trigger Or Left(Message, 1) = "/") Then Exit Sub

If Len(Message) < 2 Then Exit Sub
arrCmd = Split(Mid(LCase(Trim(Message)), 2), " ")

GetDBEntry Username, myAccess, myFlags

If arrCmd(0) = bestinchannel_cmd Then
If Username = BotVars.Username And Left(Message, 1) = "/" Then VetoThisMessage
If myAccess < bestinchannel_Access And Username <> BotVars.Username Then Exit Sub

If scinet.stillexecuting Then
Dsp dspId, "Bot is still accessing the internet. Please try again later.", Username, vbGreen
Exit Sub
End If

Dsp dspId, "/me is searching for the best user of channel " & myChannel & " [" & GetInternalUserCount & " users]... This may take a few minutes...", Username, vbGreen

startWins = 0
startprcnt = 0
winStr = vbNullString
prcntStr = vbNullString
userStr = vbNullString

For i = 1 to GetInternalUserCount()
User = GetNameByPosition(i)
If Username <> vbNullString OR Username <> BotVars.Username Then
content = ScInet.OpenURL("http://classic.battle.net/war3/ladder/w3xp-player-profile.aspx?Gateway=" & bestinchannel_txtgate & "&PlayerName=" & user)

rData = Split(Split(content, "<TR style=""background-color:#000629;"">")(1), "</TR>")(0)
sData = Split(rData, vbNewLine)
wins = Split(Split(sData(2), "rankingRow"">")(1), "<")(0)
wins = Int(wins)

If wins <> 0 Then
prcnt = Split(Split(sData(4), "rankingRow"">")(1), " ")(0)
prcnt = Int(prcnt)

userStr = userStr & user & ", "
winStr = winStr & wins & ", "
prcntStr = prcntStr & prcnt & ", "
End If
End If
Next

If winStr <> vbNullString Then
userArr = Split(userStr, ", ")
winArr = Split(winStr, ", ")
prcntArr = Split(prcntStr, ", ")

minWin = 9000
bestPercent = 0
bestWin = 0
bestWinUser = vbNullString
bestPercentUser = vbNullString
bestLimitBool = False

For i = 0 To UBound(winArr) - 1
For j = 0 To UBound(winArr) - 1
If CInt(winArr(j)) < CInt(minWin) Then
tempNum = j
minWin = winArr(j)
End If
Next

If CInt(winArr(tempNum)) > bestWin Then
bestWin = CInt(winArr(tempNum))
bestWinUser = userArr(tempNum)
End If

If CInt(prcntArr(tempNum)) > bestPercent Then
bestPercent = CInt(prcntArr(tempNum))
bestPercentUser = userArr(tempNum)
End If

If i <= bestinchannel_maxUsers Then
allStr = allStr & userArr(tempNum) & " - " & winArr(tempNum) & " [" & prcntArr(tempNum) & "%]" & ", "
Else
bestLimitBool = True
End If

winArr(tempNum) = 5000
minWin = 5000
Next

If bestLimitBool Then
Dsp dspId, "User data (limited to " & bestinchannel_maxUsers & "): " & Left(allStr, Len(allStr) - 2), Username, vbGreen
Else
Dsp dspId, "User data: " & Left(allStr, Len(allStr) - 2), Username, vbGreen
End If

Dsp dspId, "Best Wins: " & bestWin & " [" & bestWinUser & "], Best Percent: " & bestPercent & " [" & bestPercentUser & "].", Username, vbGreen
Else
Dsp dspId, "Could not determine best in channel: " & GetInternalUserCount & " users did not have any wins.", Username, vbGreen
Exit Sub
End If
End If
End Sub


--------------------
IPB Image
IPB Image

IPB Image
Need help with Hdx Warden Proxy? Do it the easy way: Click here
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post Sep 27 2009, 03:49 PM
Post #2


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



Everything that uses info from battle.net may error. It works awesome for me when I'm using it, so I don't know. I'll re-write it for 2.7.


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th September 2019 - 01:16 AM
Skin by Andrea
Website Legal Information | Hosted by LunarPages