• Welcome to Valhalla Legends Archive.
 

SafeList Help

Started by dodge, June 20, 2004, 09:51 PM

Previous topic - Next topic

dodge

I'm making a safelist, and everytime it's call the bot inputs from a text file and puts the names in a hidden listbox, if the last letter is "M" or "S" (flags Master or SafeList) but I'm stuck on finding out if the last letter is "M"... this is what I had


If Right((LCase(i)), 1) = ("M") Then
               lstSafeList.AddItem (i)
End If


i is what's being inputted. it I switch Right to Left and M to A it works, but not the other way around.. and I understand why, but why not if it's Right?

The Users.txt contains:
aW.ExaM
aW.FluXeD

shadypalm88

Quote from: dodge on June 20, 2004, 09:51 PM
I'm making a safelist, and everytime it's call the bot inputs from a text file and puts the names in a hidden listbox, if the last letter is "M" or "S" (flags Master or SafeList) but I'm stuck on finding out if the last letter is "M"... this is what I had


If Right((LCase(i)), 1) = ("M") Then
               lstSafeList.AddItem (i)
End If


i is what's being inputted. it I switch Right to Left and M to A it works, but not the other way around.. and I understand why, but why not if it's Right?

The Users.txt contains:
aW.ExaM
aW.FluXeD

First of all, using a ListBox like that is slow and bad practice... but that's another topic.

You are converting i to lower case, but checking if the last letter is an upper-case M.  Easy thing to overlook.

dodge

what would you suggest? just inputting from the file everytime that command is executed? ie: /protect on )input safelist.txt?

hismajesty

In your ban processor, or where the ban command is, check the safelist.

shadypalm88

Quote from: dodge on June 21, 2004, 08:41 AM
what would you suggest? just inputting from the file everytime that command is executed? ie: /protect on )input safelist.txt?
I would suggest adding the safelist to an array or collection, and then checking that on things like your ban and kick commands, when people are banned, etc.

dodge