Attribute VB_Name = "modHabFunc"
Public Nums As String

Public Type ClientT
Lockposition As Boolean
Kick As Boolean
Publicnum As Integer
Publicname As String
Close As Integer
Hotelpos As String
Name As String
Rank As String
Mission As String
Badge As String
Sex As String
InRoom As Double
PosX As Double
PosY As Double
WishX As Double
WishY As Double
Sitheight As String
Consolemission As String
DestX As Double
Muted As Boolean
DestY As Double
Look As String
He As String
App As String
BadgeOn As Integer
Sit As Boolean
InBig As Boolean
Lay As Boolean
Wave As Boolean
Dance As Boolean
Dancetype As String
Hadd As Long
Carrying As String
Update As Boolean
Gesture As String
Talking As Boolean
TelMove As Boolean
Teled As Boolean
TelX As Double
TelY As Double
TelHe As String
HandPage As Long
Trading As Boolean
TradingWith As String
TradeAccept As Boolean
TradeItems As String
DoDrink As Boolean
NoDrink As Boolean
UseItem As Boolean
Num As Long
RollerUpdate As Boolean
ID As String
reportmessage As String
End Type

Public Client() As ClientT

Public Type BotT
Name As String
Mission As String
Num As Long
Publicnum As Integer
He As String
Look As String
Standartlook As String
PosX As Double
PosY As Double
DestX As Double
DestY As Double
Update As Boolean
Talking As Boolean
Figure As String
Otheraction As Boolean
InUse As Boolean
End Type

Public Bot() As BotT

Public Type PetT
RollerUpdate As Boolean
TalkVal As Integer
Sleep As Boolean
DrinkVal As Integer
Hadd As Long
EatVal As Integer
InRoom As Double
Alive As Long
SleepTimer As Integer
SleepDuration As Integer
NewAction As Boolean
Name As String
Gesture As String
PosX As Double
PosY As Double
DestX As Double
DestY As Double
NestX As Double
NestY As Double
Look As String
He As String
App As String
Sit As Boolean
Lay As Boolean
Action As Boolean
Actiontype As String
Update As Boolean
FindDrink As Boolean
FindFood As Boolean
DrinkX As Double
DrinkY As Double
DrinkID As Double
FoodX As Double
FoodY As Double
FoodID As Double
Eating As Boolean
Drinking As Boolean
DrinkTimer As Long
EatTimer As Long
FurniID As Long
FindPlay As Boolean
PlayVal As Integer
PlayX As Double
PlayY As Double
PlayID As Double
Playing As Boolean
DestNestLay As Boolean
End Type

Public PublicWalk(1 To 30, 0 To 80, 0 To 80) As String
Public PublicRot(1 To 30, 0 To 80, 0 To 80) As String
Public Pet() As PetT

Public Function Hab_CJ(info As String, Index As Integer)
Send Index, "DARAHIIIKHJIPAIQAdd-MM-yyyy" & Chr(2) & Chr(1)
Send Index, "@H[100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,176,177,178,180,185,190,195,200,205,206,207,210,215,220,225,230,235,240,245,250,255,260,265,266,267,270,275,280,281,285,290,295,300,305,500,505,510,515,520,525,530,535,540,545,550,555,565,570,575,580,585,590,595,596,600,605,610,615,620,625,626,627,630,635,640,645,650,655,660,665,667,669,670,675,680,685,690,695,696,700,705,710,715,720,725,730,735,740]" & Chr(1)
End Function

Public Function Hab_AtD(info As String, Index As Integer)
Dim Name As String
Dim Pass As String
Dim NameLengthString As String
Dim NameLength As Integer
Dim PassLengthString As String
Dim PassLength As Integer

info = Mid(info, 3)

NameLengthString = Mid(info, 1, 2)
NameLength = B64Length(NameLengthString)
Name = LCase(Mid(info, 3, NameLength))

PassLengthString = Mid(info, 3 + NameLength, 2)
PassLength = B64Length(PassLengthString)
Pass = Mid(info, 5 + NameLength, PassLength)

If FSO.FolderExists(DBP & "habbos\" & LCase(Name)) Then
RealPass = FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\pass.txt", ForReading).ReadAll
If Pass = RealPass Then

Client(Index).Name = FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\name.txt", ForReading).ReadAll
Client(Index).ID = FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\num.txt", ForReading).ReadAll
'' UPDATE / FIX ACCOUNT
For a = 1 To frmMain.SockI
If Client(a).Name = Client(Index).Name And a <> Index Then
    If Client(a).InRoom > 0 Or Client(a).Publicnum > 0 Then
        Hab_Kick a
    End If
    frmMain.socket(a).Close
End If
Next a
'' UPDATE / FIX ACCOUNT
'check if banned
If FSO.FileExists(DBP & "user_bans\" & Client(Index).Name & ".txt") Then
Till = FSO.OpenTextFile(DBP & "user_bans\" & Client(Index).Name & ".txt", ForReading).ReadAll
Reason = FSO.OpenTextFile(DBP & "user_bans\" & Client(Index).Name & ".reason", ForReading).ReadAll
HoursLeft = DateDiff("h", Till, Now())
If HoursLeft < 0 Then
Send Index, "@c" & Reason & Chr(1)
Exit Function
End If
End If
'check if banned

'check if ip banned
If FSO.FileExists(DBP & "ip_bans\" & frmMain.socket(Index).RemoteHostIP & ".txt") Then
Till = FSO.OpenTextFile(DBP & "ip_bans\" & frmMain.socket(Index).RemoteHostIP & ".txt", ForReading).ReadAll
Reason = FSO.OpenTextFile(DBP & "ip_bans\" & frmMain.socket(Index).RemoteHostIP & ".reason", ForReading).ReadAll
HoursLeft = DateDiff("h", Till, Now())
If HoursLeft < 0 Then
Send Index, "@c" & Reason & Chr(1)
Exit Function
End If
End If
'check if ip banned

OldDays = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForReading).ReadAll
HCUpDate = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcupdate.txt", ForReading).ReadAll
If OldDays <> "0" And Val(OldDays) - Val(DateDiff("d", HCUpDate, Now)) > 0 Then
    Send Index, "@H[100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,176,177,178,180,185,190,195,200,205,206,207,210,215,220,225,230,235,240,245,250,255,260,265,266,267,270,275,280,281,285,290,295,300,305,500,505,510,515,520,525,530,535,540,545,550,555,565,570,575,580,585,590,595,596,600,605,610,615,620,625,626,627,630,635,640,645,650,655,660,665,667,669,670,675,680,685,690,695,696,700,705,710,715,720,725,730,735,740,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873]" & Chr(1)
End If

For xyz = 5 To 10000
If InStr(Nums, "<" & xyz & ">") = 0 Then
Client(Index).Num = Val(xyz)
Exit For
End If
Next xyz

Nums = Nums & "<" & Client(Index).Num & ">"

Client(Index).Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll
Client(Index).Lockposition = False
Rechten = ReadINI("rank", "fuse_rights", DBP & "ranks\" & Client(Index).Rank & ".ini")

If Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForReading).ReadAll) > 0 Then
Rechten = Rechten & "fuse_use_club_outfitsfuse_use_club_badgefuse_use_special_room_layoutsfuse_room_queue_clubfuse_room_queue_defaultfuse_use_club_dancefuse_priority_accessfuse_habbo_chooserfuse_furni_chooserdefault"
End If

Send Index, "@B" & Rechten & Chr(1)

Films = Val(FSO.OpenTextFile(DBP & "habbos\" & Name & "\film.txt", ForReading).ReadAll)
Send Index, "@D" & VL64encode(Films) & Chr(1)

Send Index, "@C" & Chr(1)
Else
Send Index, "@alogin incorrect: Wrong password" & Chr(1)
End If
Else
Send Index, "@alogin incorrect: Wrong username" & Chr(1)
End If


End Function


Public Function Hab_Ath(info As String, ByVal Index As Integer)
Dim Appy As String
Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll
Appy = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\app.txt", ForReading).ReadAll
Sex = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\sex.txt", ForReading).ReadAll
Mission = Trim(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\mission.txt", ForReading).ReadAll)
Tickets = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\tickets.txt", ForReading).ReadAll
Film = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\film.txt", ForReading).ReadAll
DirectMail = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\directmail\count.txt", ForReading).ReadAll
credits = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\credits.txt", ForReading).ReadAll
Figure = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\figure.txt", ForReading).ReadAll
OldDays = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForReading).ReadAll
HCUpDate = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcupdate.txt", ForReading).ReadAll
If OldDays <> "0" And Val(OldDays) - Val(DateDiff("d", HCUpDate, Now)) <= 0 Then
    Appy = "1000118001270012900121001"
    FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\app.txt", ForWriting).Write Appy
End If
If ReadINI("config", "console", SettingIni) = "1" Then
    loadconsole (Index)
    Client(Index).Hotelpos = "I" & locale("hotel_view")
End If
Client(Index).App = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\app.txt", ForReading).ReadAll
Client(Index).Sex = Sex
Client(Index).Mission = Mission
Client(Index).App = Appy
Client(Index).Close = False
Client(Index).Publicnum = 0
Send Index, "@r" & Chr(1)
Send Index, "@E" & frmMain.socket(Index) & Chr(2) & Client(Index).Name & Chr(2) & Client(Index).App & Chr(2) & Client(Index).Sex & Chr(2) & Client(Index).Mission & Chr(2) & "Hch=s02/253,146,160" & Chr(2) & "HI" & Chr(1)
Send Index, "@F" & credits & ".0" & Chr(1)

'categories
Lijst = "H" & locale("no_categorie") & Chr(2) & "SL" & locale("categorie_1") & Chr(2) & "RL" & locale("categorie_2") & Chr(2) & "PR" & locale("categorie_3") & Chr(2) & "RQ" & locale("categorie_4") & Chr(2) & "SV" & locale("categorie_5") & Chr(2) & "Q]" & locale("categorie_6") & Chr(2) & "R]" & locale("categorie_7") & Chr(2) & "PL" & locale("categorie_8") & Chr(2) & "RN" & locale("categorie_9") & Chr(2) & "RR" & locale("categorie_10") & Chr(2)
Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll
If Val(ReadINI("categories", "SL", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, Chr(2) & "SL" & locale("categorie_1"), "")
If Val(ReadINI("categories", "RL", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, Chr(2) & "RL" & locale("categorie_2"), "")
If Val(ReadINI("categories", "PR", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, Chr(2) & "PR" & locale("categorie_3"), "")
If Val(ReadINI("categories", "RQ", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, Chr(2) & "RQ" & locale("categorie_4"), "")
If Val(ReadINI("categories", "SV", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, Chr(2) & "SV" & locale("categorie_5"), "")
If Val(ReadINI("categories", "Q]", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, Chr(2) & "Q]" & locale("categorie_6"), "")
If Val(ReadINI("categories", "R]", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, Chr(2) & "R]" & locale("categorie_7"), "")
If Val(ReadINI("categories", "PL", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, Chr(2) & "PL" & locale("categorie_8"), "")
If Val(ReadINI("categories", "RN", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, Chr(2) & "RN" & locale("categorie_9"), "")
If Val(ReadINI("categories", "RR", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, Chr(2) & "RR" & locale("categorie_10"), "")
If Val(ReadINI("categories", "SL", DBP & "room_categories\categories.ini")) = "2" And Rank <> "admin" And Rank <> "moderator" Then Lijst = Replace(Lijst, Chr(2) & "SL" & locale("categorie_1"), "")
If Val(ReadINI("categories", "RL", DBP & "room_categories\categories.ini")) = "2" And Rank <> "admin" And Rank <> "moderator" Then Lijst = Replace(Lijst, Chr(2) & "RL" & locale("categorie_2"), "")
If Val(ReadINI("categories", "PR", DBP & "room_categories\categories.ini")) = "2" And Rank <> "admin" And Rank <> "moderator" Then Lijst = Replace(Lijst, Chr(2) & "PR" & locale("categorie_3"), "")
If Val(ReadINI("categories", "RQ", DBP & "room_categories\categories.ini")) = "2" And Rank <> "admin" And Rank <> "moderator" Then Lijst = Replace(Lijst, Chr(2) & "RQ" & locale("categorie_4"), "")
If Val(ReadINI("categories", "SV", DBP & "room_categories\categories.ini")) = "2" And Rank <> "admin" And Rank <> "moderator" Then Lijst = Replace(Lijst, Chr(2) & "SV" & locale("categorie_5"), "")
If Val(ReadINI("categories", "Q]", DBP & "room_categories\categories.ini")) = "2" And Rank <> "admin" And Rank <> "moderator" Then Lijst = Replace(Lijst, Chr(2) & "Q]" & locale("categorie_6"), "")
If Val(ReadINI("categories", "R]", DBP & "room_categories\categories.ini")) = "2" And Rank <> "admin" And Rank <> "moderator" Then Lijst = Replace(Lijst, Chr(2) & "R]" & locale("categorie_7"), "")
If Val(ReadINI("categories", "PL", DBP & "room_categories\categories.ini")) = "2" And Rank <> "admin" And Rank <> "moderator" Then Lijst = Replace(Lijst, Chr(2) & "PL" & locale("categorie_8"), "")
If Val(ReadINI("categories", "RN", DBP & "room_categories\categories.ini")) = "2" And Rank <> "admin" And Rank <> "moderator" Then Lijst = Replace(Lijst, Chr(2) & "RN" & locale("categorie_9"), "")
If Val(ReadINI("categories", "RR", DBP & "room_categories\categories.ini")) = "2" And Rank <> "admin" And Rank <> "moderator" Then Lijst = Replace(Lijst, Chr(2) & "RR" & locale("categorie_10"), "")
LijstCount = 0
For a = 1 To Len(Lijst)
If Mid(Lijst, a, 1) = Chr(2) Then
    LijstCount = LijstCount + 1
End If
Next a
Send Index, "C]" & VL64encode(LijstCount) & Lijst & Chr(1)
'categories
End Function


Public Function Hab_Ac2(info As String, Index As Integer)
FurniID = Right(info, Len(info) - 2)

NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForReading).ReadAll
Lijst = Split(Lijst2, ";")
For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> FurniID Then NewLijst = NewLijst & ";" & Lijst(a)
Next a
NewLijst = Replace(NewLijst, ";;", ";")
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForWriting).Write NewLijst

FurniType = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\type.txt", ForReading).ReadAll
Custt = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll
Fname = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll
loca = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\loc.txt", ForReading).ReadAll, " ")
Innroom = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\inroom.txt", ForReading).ReadAll
htmp = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\shtmp.txt").ReadAll
Walkmp = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt").ReadAll

Doen = "O"

Fvar = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt", ForReading).ReadAll
'roller
If FurniType = "roller" Then
frmMain.LoadedRollers = Replace(frmMain.LoadedRollers, "<" & FurniID & ">", "")

FurniOP = ReadINI("furnies", loca(0) & "," & loca(1), DBP & "privaterooms\" & Innroom & "\rotation.txt")
If FurniOP <> "" Then
FurniTypeX = FSO.OpenTextFile(DBP & "furni\" & FurniOP & "\type.txt", ForReading).ReadAll
If FurniTypeX = "sit" Then Doen = "S"
If FurniTypeX = "bed" Then Doen = "L"
If FurniTypeX = "solid" Then Doen = "X"
If FurniTypeX = "door" Then
    If InStr(Fvar, "O") Then
    Doen = "D"
    Else
    Doen = "X"
    End If
End If
End If
End If
'roller

'pet part
If Fname = "nest" Then
Hpets2 = ""
splitP = Split(frmMain.Hpets, ";")
For b = 0 To UBound(splitP)
If splitP(b) <> "" Then
If Pet(splitP(b)).FurniID = FurniID Then
Unload frmMain.PetTimer(splitP(b))
Nums = Replace(Nums, "<" & splitP(b) & ">", "")
If Pet(splitP(b)).Actiontype = "pla" Then Pet(splitP(b)).Actiontype = ""
'save status
WriteINI "pet", "alive", Pet(splitP(b)).Alive, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "drinktimer", Pet(splitP(b)).DrinkTimer, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "eattimer", Pet(splitP(b)).EatTimer, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "sleep", Pet(splitP(b)).Sleep, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "sleeptimer", Pet(splitP(b)).SleepTimer, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "sleepduration", Pet(splitP(b)).SleepDuration, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "he", Pet(splitP(b)).He, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "look", Mid(Pet(splitP(b)).Look, 1, InStr(Pet(splitP(b)).Look, ",") - 1), DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "posx", Pet(splitP(b)).PosX, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "posy", Pet(splitP(b)).PosY, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "sit", Pet(splitP(b)).Sit, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "lay", Pet(splitP(b)).Lay, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "gesture", Pet(splitP(b)).Gesture, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "action", Pet(splitP(b)).Action, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "actiontype", Pet(splitP(b)).Actiontype, DBP & "furni\" & FurniID & "\status.txt"
'save status
Pet(splitP(b)).Name = ""
sendAll "@]" & splitP(b) & Chr(1), (Client(Index).InRoom)
Else
Hpets2 = Hpets2 & splitP(b) & ";"
End If
End If
Next b
frmMain.Hpets = Hpets2
End If
'pet part

Fx = Val(loca(0))
Fy = Val(loca(1))

Dim Custsplit() As String
Custsplit() = Split(Custt, "")
Dim ForX As Integer, ForY As Integer
If Val(loca(2)) = 0 Or Val(loca(2)) = 4 Then
BijX = Val(Custsplit(0))
BijY = Val(Custsplit(1))
Else
BijX = Val(Custsplit(1))
BijY = Val(Custsplit(0))
End If



Walksplit = Split(Walkmp, Chr(13))
    For ForX = Fx To Fx + BijX - 1
    For ForY = Fy To Fy + BijY - 1
    If (FurniType <> "rug" And Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R") Or FurniType = "roller" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & Doen & Mid(Walksplit(ForY), ForX + 2)
    FSO.CopyFile DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt", DBP & "privaterooms\" & Client(Index).InRoom & "\rotationb.txt", True
    TopID = ReadINI("furnies", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
    If TopID = FurniID Then
        StackHere = ReadINI("stacked", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
        If StackHere <> "" Then
            WriteINI "furnies", ForX & "," & ForY, StackHere, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
            WriteINI "stacked", ForX & "," & ForY, "", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
            If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
        Else
            WriteINI "furnies", ForX & "," & ForY, "", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
        End If
    Else
        FurniHere = ReadINI("stacked", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
        If FurniHere <> "" Then
            WriteINI "stacked", ForX & "," & ForY, "", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
            If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
        Else
            WriteINI "stacked", ForX & "," & ForY, "", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
        End If
    End If
    Next ForY
    Next ForX
Walkmp = Join(Walksplit, Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
'make space

NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForReading).ReadAll
Lijst = Split(Lijst2, ";")
For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> FurniID Then NewLijst = NewLijst & ";" & Lijst(a)
Next a
NewLijst = Replace(NewLijst, ";;", ";")
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForWriting).Write NewLijst


FSO.OpenTextFile(DBP & "furni\" & FurniID & "\inroom.txt", ForWriting).Write 0

furnitodelete = Right(info, Len(info) - 2)
sendAll "A^" & FurniID & Chr(1), (Client(Index).InRoom)
FSO.DeleteFolder DBP & "furni\" & FurniID, True

End Function

Public Function Hab_AtL(info As String, Index As Integer)
'Splitup = Split(FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\friendlist.txt", ForReading).ReadAll, ";")
'ConMiss = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\consolemission.txt", ForReading).ReadAll
'BuildList = ""
'Cnt = 0
'For q = 0 To UBound(Splitup)
'If Splitup(q) <> "" Then
'LastOn = FSO.OpenTextFile(DBP & "habbos\" & Splitup(q) & "\lastonline.txt", ForReading).ReadAll
'Naam = FSO.OpenTextFile(DBP & "habbos\" & Splitup(q) & "\name.txt", ForReading).ReadAll
'ConMis = FSO.OpenTextFile(DBP & "habbos\" & Splitup(q) & "\consolemission.txt", ForReading).ReadAll
'Cnt = Cnt + 1
'BuildList = BuildList & VL64encode(Cnt) & Naam & Chr(2) & ConMis & Chr(2) & "H" & Chr(2) & LastOn & Chr(2)
'End If
'Next q
'Send index, "@L" & ConMiss & Chr(2) & BuildList & Chr(1)
'Send index, "@M" & Chr(1)
End Function

Public Function Hab_AtZ(info As String, ByVal Index As Integer)
Badges = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\badges.txt", ForReading).ReadAll
Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll

If Len(ReadINI("rank", "badges", DBP & "ranks\" & Client(Index).Rank & ".ini")) > 3 Then
    Badges = Badges & ReadINI("rank", "badges", DBP & "ranks\" & Client(Index).Rank & ".ini")
End If

OldDays = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForReading).ReadAll
HCUpDate = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcupdate.txt", ForReading).ReadAll
Appy = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\app.txt", ForReading).ReadAll
ShowExpire = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\showexpire.txt", ForReading).ReadAll)
If OldDays <> "0" Then
If Val(OldDays) - Val(DateDiff("d", HCUpDate, Now)) <= 0 Then
newdays = "0"
Else
newdays = OldDays - DateDiff("d", HCUpDate, Now)
End If
For a = 1 To 24
    If Val(OldDays) > a * 31 And Val(newdays) <= a * 31 Then
            periods = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\periods.txt", ForReading).ReadAll)
            FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\periods.txt", ForWriting).Write periods + 1
            If periods + 1 <> "11" Then HClub Index, periods + 1
    End If
Next a
If newdays = "0" Then
    periods = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\periods.txt", ForReading).ReadAll)
    FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\periods.txt", ForWriting).Write periods + 1
End If
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForWriting).Write newdays
End If
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcupdate.txt", ForWriting).Write Now()
HCDays = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForReading).ReadAll
CurBadge = Trim(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\curbadge.txt", ForReading).ReadAll)
BadgeOn = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\badgeonoff.txt", ForReading).ReadAll)
periods = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\periods.txt", ForReading).ReadAll

If Val(HCDays) > 0 And Val(periods) < 11 Then Badges = Badges & ReadINI("HC", "hcbadge", SettingIni)
If Val(HCDays) > 0 And Val(periods) >= 11 Then Badges = Badges & ReadINI("HC", "hcbadge2", SettingIni)

Client(Index).Badge = CurBadge
Client(Index).BadgeOn = BadgeOn

Badge1 = "H"
If BadgeOn = "1" Then Badge1 = "I"

Badge2 = 0

BadgeCnt = 0
BadgeList = ""
Dim Badgen() As String
Badgen = Split(Badges, ";")
For a = 0 To UBound(Badgen())
If Badgen(a) <> "" Then
BadgeList = BadgeList & Badgen(a) & Chr(2)
If Badgen(a) = CurBadge Then Badge2 = BadgeCnt
BadgeCnt = BadgeCnt + 1
End If
DoEvents
Next a

If Replace(Badges, ";", "") <> "" Then
Send Index, "Ce" & VL64encode(BadgeCnt) & BadgeList & VL64encode(Badge2) & Badge1 & Chr(1)
Else
'Send index, "CeHH" & Chr(1)
End If

Dim TotalDays As Integer, PeriodsLeft As Integer, DaysLeft As Integer
TotalDays = Val(HCDays)
PeriodsLeft = Fix(TotalDays / 31)
DaysLeft = TotalDays - PeriodsLeft * 31

If PeriodsLeft > 0 And DaysLeft = 0 Then
DaysLeft = 31
PeriodsLeft = PeriodsLeft - 1
End If

Dim LaatZien As String
LaatZien = "H"

If Val(ShowExpire) > 0 Then
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\showexpire.txt", ForWriting).Write 0
End If

If Split(ReadINI("config", "welcome_message", SettingIni), ",")(0) = "1" Then
    Send Index, "BK" & Split(ReadINI("config", "welcome_message", SettingIni), ",", 2)(1) & Chr(1)
End If

Send Index, "@Gclub_habbo" & Chr(2) & VL64encode(DaysLeft) & VL64encode(periods) & VL64encode(PeriodsLeft) & LaatZien & Chr(1)
End Function

Public Function Hab_Bgolf(info As String, Index As Integer)

Dim Typr As String
Typr = Mid(info, 15)

Dim Cost As Integer, Days As Integer

If Typr = "I" Then
Cost = 25
Days = 31
End If

If Typr = "J" Then
Cost = 60
Days = 93
End If

If Typr = "K" Then
Cost = 105
Days = 186
End If

credits = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\credits.txt", ForReading).ReadAll)
HCDays = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForReading).ReadAll
periods = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\periods.txt", ForReading).ReadAll
If Val(credits) < Cost Then
Send Index, "@tt=552" & Chr(13) & "p=0" & Chr(1)
Else
If HCDays = "0" Then
    HClub Index, Val(periods)
End If
credits = credits - Cost
HCDays = Val(HCDays) + Days

FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\credits.txt", ForWriting).Write credits
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\transactions.txt", ForAppending, True).Write Format(Date, "dd-mm-yyyy") & Chr(9) & Format(Time, "hh:mm") & Chr(9) & "-" & Cost & Chr(9) & "0" & Chr(9) & Chr(9) & "club_habbo" & Chr(13)
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForWriting).Write HCDays

Badges = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\badges.txt", ForReading).ReadAll
Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll

If Len(ReadINI("rank", "badges", DBP & "ranks\" & Client(Index).Rank & ".ini")) > 3 Then
    Badges = Badges & ReadINI("rank", "badges", DBP & "ranks\" & Client(Index).Rank & ".ini")
End If

Badges = Replace(Badges, ";;", ";")

HCDays = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForReading).ReadAll
periods = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\periods.txt", ForReading).ReadAll
Appy = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\app.txt", ForReading).ReadAll
ShowExpire = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\showexpire.txt", ForReading).ReadAll)

CurBadge = Trim(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\curbadge.txt", ForReading).ReadAll)
BadgeOn = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\badgeonoff.txt", ForReading).ReadAll)

If Val(HCDays) > 0 And Val(periods) < 11 Then
Badges = Badges & ReadINI("HC", "hcbadge", SettingIni)
If CurBadge = "" Then
Client(Index).Badge = Split(ReadINI("HC", "hcbadge", SettingIni), ";")(1)
Client(Index).BadgeOn = 1
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\curbadge.txt", ForWriting).Write Split(ReadINI("HC", "hcbadge", SettingIni), ";")(1)
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\badgeonoff.txt", ForWriting).Write 1
End If
End If

If Val(HCDays) > 0 And Val(periods) >= 11 Then
Badges = Badges & ReadINI("HC", "hcbadge2", SettingIni)
If CurBadge = "" Then
Client(Index).Badge = Split(ReadINI("HC", "hcbadge2", SettingIni), ";")(1)
Client(Index).BadgeOn = 1
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\curbadge.txt", ForWriting).Write Split(ReadINI("HC", "hcbadge2", SettingIni), ";")(1)
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\badgeonoff.txt", ForWriting).Write 1
End If
End If



BadgeCnt = 0
BadgeList = ""
Dim Badgen() As String
Badgen = Split(Badges, ";")
For a = 0 To UBound(Badgen())
If Badgen(a) <> "" Then
BadgeList = BadgeList & Badgen(a) & Chr(2)
BadgeCnt = BadgeCnt + 1
End If
DoEvents
Next a

If Replace(Badges, ";", "") <> "" Then
Send Index, "Ce" & VL64encode(BadgeCnt) & BadgeList & "HI" & Chr(1)
Else
'Send index, "CeHH" & Chr(1)
End If


Rechten = ReadINI("rank", "fuse_rights", DBP & "ranks\" & Client(Index).Rank & ".ini")

If Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForReading).ReadAll) > 0 Then
Rechten = Rechten & "fuse_use_club_outfitsfuse_use_club_badgefuse_use_special_room_layoutsfuse_room_queue_clubfuse_room_queue_defaultfuse_use_club_dancefuse_priority_accessfuse_habbo_chooserfuse_furni_chooserdefault"
End If

Send Index, "@B" & Rechten & Chr(1)

Send Index, "@H[100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,176,177,178,180,185,190,195,200,205,206,207,210,215,220,225,230,235,240,245,250,255,260,265,266,267,270,275,280,281,285,290,295,300,305,500,505,510,515,520,525,530,535,540,545,550,555,565,570,575,580,585,590,595,596,600,605,610,615,620,625,626,627,630,635,640,645,650,655,660,665,667,669,670,675,680,685,690,695,696,700,705,710,715,720,725,730,735,740,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873]" & Chr(1)


Dim TotalDays As Integer, PeriodsLeft As Integer, DaysLeft As Integer
TotalDays = HCDays
PeriodsLeft = Fix(TotalDays / 31)
DaysLeft = TotalDays - PeriodsLeft * 31

If PeriodsLeft > 0 And DaysLeft = 0 Then
DaysLeft = 31
PeriodsLeft = PeriodsLeft - 1
End If

Dim LaatZien As String
LaatZien = "H"


Send Index, "@Gclub_habbo" & Chr(2) & VL64encode(DaysLeft) & VL64encode(periods) & VL64encode(PeriodsLeft) & LaatZien & Chr(1)

Send Index, "@F" & credits & ".0" & Chr(1)
End If

End Function

Public Function Hab_Ati(info As String, Index As Integer)

HCDays = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForReading).ReadAll

If Val(HCDays) > 0 Then
Send Index, "@H[100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,176,177,178,180,185,190,195,200,205,206,207,210,215,220,225,230,235,240,245,250,255,260,265,266,267,270,275,280,281,285,290,295,300,305,500,505,510,515,520,525,530,535,540,545,550,555,565,570,575,580,585,590,595,596,600,605,610,615,620,625,626,627,630,635,640,645,650,655,660,665,667,669,670,675,680,685,690,695,696,700,705,710,715,720,725,730,735,740,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873]" & Chr(1)
Else
Send Index, "@H[100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,176,177,178,180,185,190,195,200,205,206,207,210,215,220,225,230,235,240,245,250,255,260,265,266,267,270,275,280,281,285,290,295,300,305,500,505,510,515,520,525,530,535,540,545,550,555,565,570,575,580,585,590,595,596,600,605,610,615,620,625,626,627,630,635,640,645,650,655,660,665,667,669,670,675,680,685,690,695,696,700,705,710,715,720,725,730,735,740,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873]" & Chr(1)
End If

End Function

Public Function Hab_Atl2(info As String, Index As Integer)

Dim NewApp As String
Dim newsex As String
Dim lenmishn As Integer
Dim newmish As String
Dim FigureLengthString As String
Dim FigureLength As Integer

Dim TestLengthString As String
Dim TestLength As Integer


Appy = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\app.txt", ForReading).ReadAll
Sex = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\sex.txt", ForReading).ReadAll
Mission = Trim(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\mission.txt", ForReading).ReadAll)
Figure = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\figure.txt", ForReading).ReadAll
Tickets = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\tickets.txt", ForReading).ReadAll
Film = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\film.txt", ForReading).ReadAll
DirectMail = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\directmail\count.txt", ForReading).ReadAll

newsex = Sex
newmish = Mission

info = Mid(info, 3)

FigureLengthString = Mid(info, 3, 2)
FigureLength = B64Length(FigureLengthString)
NewApp = Mid(info, 5, FigureLength)
info = Mid(info, 5 + FigureLength)

redo:
If Mid(info, 1, 2) = "@E" Then
TestLengthString = Mid(info, 3, 2)
TestLength = B64Length(TestLengthString)
newsex = Mid(info, 5, TestLength)
info = Mid(info, 5 + TestLength)
GoTo redo
End If
If Mid(info, 1, 2) = "@F" Then
TestLengthString = Mid(info, 3, 2)
TestLength = B64Length(TestLengthString)
newmish = Mid(info, 5, TestLength)
info = Mid(info, 5 + TestLength)
GoTo redo
End If
newmish = Trim(newmish)
If newmish = "" Then newmish = " "
If ReadINI("config", "bobba_filter", SettingIni) = "1" Then newmish = Filter(newmish)
newmish = Replace(newmish, Chr(1), "")
newmish = Replace(newmish, Chr(2), "")

With Client(Index)
.Mission = newmish
.Sex = newsex
.App = NewApp
End With

FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\mission.txt", ForWriting).Write newmish
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\sex.txt", ForWriting).Write newsex
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\app.txt", ForWriting).Write NewApp

Send Index, "@E" & frmMain.socket(Index) & Chr(2) & Client(Index).Name & Chr(2) & Client(Index).App & Chr(2) & Client(Index).Sex & Chr(2) & Client(Index).Mission & Chr(2) & "Hch=s02/253,146,160" & Chr(2) & "HI" & Chr(1)

End Function


Public Function Hab_BA(info As String, Index As Integer)
Dim VoucherC As String
VoucherC = Mid(info, 5)


If FSO.FileExists(DBP & "vouchers\" & VoucherC & ".txt") = False Then
Send Index, "CU1" & Chr(1)
Else

credits = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\credits.txt", ForReading).ReadAll
credits = Val(credits) + Val(FSO.OpenTextFile(DBP & "vouchers\" & VoucherC & ".txt", ForReading).ReadAll)
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\transactions.txt", ForAppending, True).Write Format(Date, "dd-mm-yyyy") & Chr(9) & Format(Time, "hh:mm") & Chr(9) & FSO.OpenTextFile(DBP & "vouchers\" & VoucherC & ".txt", ForReading).ReadAll & Chr(9) & "0" & Chr(9) & Chr(9) & "refunds" & Chr(13)
FSO.DeleteFile DBP & "vouchers\" & VoucherC & ".txt"
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\credits.txt", ForWriting).Write credits


Send Index, "CT" & Chr(1)
Send Index, "@F" & credits & ".0" & Chr(1)
End If

End Function

Public Function Hab_Athaak(info As String, Index As Integer)

Dim RoomName As String
Dim RoomNumb As Integer
Dim ModelType As String
Dim StaticHtmp As String
Dim OpenType As String
Dim ShowName As Integer
Dim Doorloc
Dim MaxIn As Integer
RoomName = Split(info, "/")(2)
ModelType = Split(Split(info, "/")(3), "_")(1)
OpenType = Split(info, "/")(4)
ShowName = Split(info, "/")(5)

If Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rooms.txt", ForReading).ReadAll) >= Val(ReadINI("config", "maxroomsperuser", SettingIni)) Then
    Send Index, "BK" & Replace(locale("max_rooms"), "%maxrooms%", Val(ReadINI("config", "maxroomsperuser", SettingIni))) & Chr(1)
    Exit Function
End If

Doorloc = FSO.OpenTextFile(DBP & "roomlayouts\" & ModelType & "\door.txt", ForReading).ReadAll
StaticHtmp = FSO.OpenTextFile(DBP & "roomlayouts\" & ModelType & "\shtmp.txt", ForReading).ReadAll
Wlk = FSO.OpenTextFile(DBP & "roomlayouts\" & ModelType & "\walk.txt", ForReading).ReadAll
MaxIn = 25

If ReadINI("config", "bobba_filter", SettingIni) = "1" Then RoomName = Filter(RoomName)
RoomName = Replace(RoomName, Chr(1), "")
RoomName = Replace(RoomName, Chr(2), "")
RoomCount = FSO.OpenTextFile(DBP & "privaterooms\count.txt", ForReading).ReadAll
RoomNumer = Val(RoomCount) + 1
If VL64Decode(VL64encode(RoomNumer)) <> RoomNumer Then
reloop:
    RoomNumer = RoomNumer + 1
    If VL64Decode(VL64encode(RoomNumer)) <> RoomNumer Then GoTo reloop
End If
FSO.OpenTextFile(DBP & "privaterooms\count.txt", ForWriting).Write RoomNumer

FSO.CreateFolder (DBP & "privaterooms\" & RoomNumer)

FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\owner.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\shtmp.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\model.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\door.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\name.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\maxin.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\showname.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\opentype.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\description.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\pass.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\allrights.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\rights.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\furni.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\floor.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\paper.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\walk.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\rotation.txt")
FSO.CreateTextFile (DBP & "privaterooms\" & RoomNumer & "\category.txt")


FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\owner.txt", ForWriting).Write Client(Index).Name
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\shtmp.txt", ForWriting).Write StaticHtmp
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\model.txt", ForWriting).Write "model_" & ModelType
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\door.txt", ForWriting).Write Doorloc
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\name.txt", ForWriting).Write RoomName
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\maxin.txt", ForWriting).Write MaxIn
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\showname.txt", ForWriting).Write ShowName
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\opentype.txt", ForWriting).Write OpenType
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\pass.txt", ForWriting).Write " "
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\description.txt", ForWriting).Write " "
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\allrights.txt", ForWriting).Write 0
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\rights.txt", ForWriting).Write ";"
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\furni.txt", ForWriting).Write ";"
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\paper.txt", ForWriting).Write 0
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\floor.txt", ForWriting).Write 0
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\category.txt", ForWriting).Write "H"
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNumer & "\walk.txt", ForWriting).Write Wlk
If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rooms.txt", ForReading).AtEndOfStream = True Then FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rooms.txt", ForWriting).Write "0"
If IsNumeric(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rooms.txt", ForReading).ReadAll) = False Then FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rooms.txt", ForWriting).Write "0"
MyRooms = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rooms.txt", ForReading).ReadAll)
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rooms.txt", ForWriting).Write MyRooms + 1
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\roomlist.txt", ForAppending).Write "<" & RoomNumer & ">"

Send Index, "@{" & RoomNumer & Chr(13) & RoomName & Chr(1)

Hab_AtP "@P" & Client(Index).Name, Index

End Function

Public Function Hab_AtY(info As String, Index As Integer)

Dim Desc As String
Dim Password As String
Dim Allsuper As Integer
Dim MaxIn As Integer
Dim RoomNum As Double

If Mid(info, 3, 1) = "/" Then 'new room

RoomNum = Val(Mid(info, 4))

If InStr(info, "description") <> 0 Then Desc = Trim(Split(Split(info, "description=")(1), Chr(13))(0))
If InStr(info, "password") <> 0 Then Password = Trim(Split(Split(info, "password=")(1), Chr(13))(0))
If Desc = "" Then Desc = " "
If Password = "" Then Password = " "
If InStr(info, "allsuperuser") <> 0 Then Allsuper = Val(Split(info, "allsuperuser=")(1))
MaxIn = 25

Else 'old room

RoomNum = Val(Mid(info, 3))

If InStr(info, "description") <> 0 Then Desc = Split(Split(info, "description=")(1), Chr(13))(0)
If InStr(info, "password") <> 0 Then Password = Split(Split(info, "password=")(1), Chr(13))(0)
If Desc = "" Then Desc = " "
If Password = "" Then Password = " "
If InStr(info, "allsuperuser") <> 0 Then Allsuper = Val(Split(info, "allsuperuser=")(1))
If InStr(info, "maxvisitors") <> 0 Then MaxIn = Val(Split(info, "maxvisitors=")(1))
End If

If ReadINI("config", "bobba_filter", SettingIni) = "1" Then Desc = Filter(Desc)
Desc = Replace(Desc, Chr(1), "")
Desc = Replace(Desc, Chr(2), "")
If FSO.FolderExists(DBP & "privaterooms\" & RoomNum) = True And FSO.FileExists(DBP & "privaterooms\" & RoomNum & "\deleted.txt") = False Then
If FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\owner.txt").ReadAll = Client(Index).Name Then

FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\description.txt", ForWriting).Write Desc
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\pass.txt", ForWriting).Write Password
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\allrights.txt", ForWriting).Write Allsuper
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\maxin.txt", ForWriting).Write MaxIn


Dim a As Long
For a = 1 To frmMain.SockI
If Client(a).InRoom = RoomNum And frmMain.socket(a).State = sckConnected Then
Client(a).Update = True
Exit For
End If
Next a

Hab_AtP "@P" & Client(Index).Name, Index

End If
End If

End Function

Public Function Hab_AtX(info As String, Index As Integer)

Dim RoomNum As Long
RoomNum = Val(Mid(info, 3))

If FSO.FolderExists(DBP & "privaterooms\" & RoomNum) And FSO.FileExists(DBP & "privaterooms\" & RoomNum & "\deleted.txt") = False Then
If FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\owner.txt").ReadAll = Client(Index).Name Then

Dim RoomName As String
Dim OpenType As String
Dim ShowName As Integer
RoomName = Split(info, "/")(1)
OpenType = Split(info, "/")(2)

ShowName = Split(info, "/")(3)
If RoomName = "" Then RoomName = " "

FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\name.txt", ForWriting).Write RoomName
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\opentype.txt", ForWriting).Write OpenType
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\showname.txt", ForWriting).Write ShowName

Hab_AtP "@P" & Client(Index).Name, Index

End If
End If

End Function

Public Function Hab_BX(info As String, Index As Integer)
Dim RoomNum As Long
RoomNum = VL64Decode(Mid(info, 3))

If FSO.FolderExists(DBP & "privaterooms\" & RoomNum) = True And FSO.FileExists(DBP & "privaterooms\" & RoomNum & "\deleted.txt") = False Then
If LCase(FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\owner.txt").ReadAll) = LCase(Client(Index).Name) Then
Categorie = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\category.txt").ReadAll

Send Index, "C^" & VL64encode((RoomNum)) & Categorie & Chr(1)
End If
End If
End Function


Public Function Hab_Bhaak(info As String, Index As Integer)

Dim RoomNum As Long
RoomNum = VL64Decode(Mid(info, 3))


If FSO.FolderExists(DBP & "privaterooms\" & RoomNum) And FSO.FileExists(DBP & "privaterooms\" & RoomNum & "\deleted.txt") = False Then
If FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\owner.txt").ReadAll = Client(Index).Name Then

FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\rights.txt", ForWriting).Write ";"

Dim a As Long
For a = 1 To frmMain.SockI
If Client(a).InRoom = RoomNum And frmMain.socket(a).State = sckConnected Then
Client(a).Update = True
Exit For
End If
Next a

End If
End If

End Function

Public Function Hab_AtW(info As String, Index As Integer)
Dim NewRoomList As String
Dim RoomNum As Long
RoomNum = Val(Mid(info, 3))

If FSO.FolderExists(DBP & "privaterooms\" & RoomNum) And FSO.FileExists(DBP & "privaterooms\" & RoomNum & "\deleted.txt") = False Then
If FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\owner.txt").ReadAll = Client(Index).Name Then

FSO.CreateTextFile DBP & "privaterooms\" & RoomNum & "\deleted.txt"
MyRooms = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rooms.txt", ForReading).ReadAll)
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rooms.txt", ForWriting).Write MyRooms - 1
If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\roomlist.txt", ForReading).AtEndOfStream = False Then NewRoomList = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\roomlist.txt", ForReading).ReadAll Else NewRoomList = ""
NewRoomList = Replace(NewRoomList, "<" & RoomNum & ">", "")
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\roomlist.txt", ForWriting).Write NewRoomList
Hab_AtP "@P" & Client(Index).Name, Index

End If
End If

End Function


Public Function Hab_AtP(info As String, Index As Integer)
Dim BuildList As String
Dim OpenType As String
If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\roomlist.txt", ForReading).AtEndOfStream = True Then
    BuildList = ""
    GoTo NoRooms
End If
UsersRooms = Split(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\roomlist.txt", ForReading).ReadAll, "<")
For a = 0 To UBound(UsersRooms)
If UsersRooms(a) = "" Or UsersRooms(a) = ">" Then GoTo NextA
If FSO.FolderExists(DBP & "privaterooms\" & Split(UsersRooms(a), ">")(0)) And FSO.FileExists(DBP & "privaterooms\" & Split(UsersRooms(a), ">")(0) & "\deleted.txt") = False Then
If FSO.OpenTextFile(DBP & "privaterooms\" & Split(UsersRooms(a), ">")(0) & "\owner.txt").ReadAll = Client(Index).Name Then
Number = Split(UsersRooms(a), ">")(0)
RoomName = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\name.txt").ReadAll)
Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\owner.txt").ReadAll
Description = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\description.txt").ReadAll)
MaxIn = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\maxin.txt").ReadAll
OpenType = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\opentype.txt").ReadAll
ShowName = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\showname.txt").ReadAll
InRoom = 0

For b = 1 To frmMain.SockI
If Client(b).InRoom = Number Then
InRoom = InRoom + 1
End If
Next b

If ShowName = "0" And Owner <> Client(Index).Name And ReadINI("rank", "see_room_owner", DBP & "ranks\" & Client(Index).Rank & ".ini") <> "1" Then Owner = "-"

BuildList = BuildList & Number & Chr(9) & RoomName & Chr(9) & Owner & Chr(9) & OpenType & Chr(9) & "x" & Chr(9) & InRoom & Chr(9) & MaxIn & Chr(9) & "null" & Chr(9) & Description & Chr(9) & Chr(13)
End If
End If
NextA:
Next a
NoRooms:
If BuildList <> "" Then
Send Index, "@P" & BuildList & Chr(1)
Else
Send Index, "@y" & Client(Index).Name & Chr(1)
End If

End Function

Public Function Hab_AtU(info As String, Index As Integer)

Dim RoomNum As Long
RoomNum = Mid(info, 3)

If FSO.FolderExists(DBP & "privaterooms\" & RoomNum) And FSO.FileExists(DBP & "privaterooms\" & RoomNum & "\deleted.txt") = False Then

RoomName = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\name.txt").ReadAll)
Owner = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\owner.txt").ReadAll
Description = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\description.txt").ReadAll)
MaxIn = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\maxin.txt").ReadAll
OpenType = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\opentype.txt").ReadAll
ShowName = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\showname.txt").ReadAll
Password = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\pass.txt").ReadAll
Allright = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\allrights.txt").ReadAll
Model = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\model.txt").ReadAll
Categorie = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\category.txt").ReadAll


If ShowName = "0" And Owner <> Client(Index).Name And ReadINI("rank", "see_room_owner", DBP & "ranks\" & Client(Index).Rank & ".ini") <> "1" Then Owner = "-"

AllRecht = "H"
If Allright = 1 Then AllRecht = "I"

PassType = "H"
If OpenType = "password" Then PassType = "J"
If OpenType = "closed" Then PassType = "I"

Dim MaxInInRoom As Integer

MaxInInRoom = 25
If Model = "model_i" Then MaxInInRoom = 50
If Model = "model_j" Then MaxInInRoom = 50
If Model = "model_k" Then MaxInInRoom = 50
If Model = "model_l" Then MaxInInRoom = 50
If Model = "model_n" Then MaxInInRoom = 50
If Model = "model_o" Then MaxInInRoom = 50
If Model = "model_r" Then MaxInInRoom = 50

AllowTrade = 0
'categories
If FSO.FileExists(DBP & "room_categories\allowtrade_" & Categorie & ".txt") Then AllowTrade = 1
'categories


JaNee2 = "H"
Send Index, "@v" & AllRecht & PassType & VL64encode((RoomNum)) & Owner & Chr(2) & Model & Chr(2) & RoomName & Chr(2) & Description & Chr(2) & VL64encode(ShowName) & VL64encode(AllowTrade) & JaNee2 & VL64encode(Val(MaxIn)) & VL64encode(MaxInInRoom) & Chr(1)
'first I: H = no trade, I = trade
'2 = no or categoery
End If
End Function

Public Function Hab_BW(info As String, Index As Integer)
Lijst = "HPAH" & locale("guestrooms_title") & "[nFbNMAISLJ" & locale("categorie_1") & "QD[XKPAHRLJ" & locale("categorie_2") & "YDAZ~EPAHPRJ" & locale("categorie_3") & "RhZtEPAHRQJ" & locale("categorie_4") & "XLA[DFPAHSVJ" & locale("categorie_5") & "SOYsEPAHQ]J" & locale("categorie_6") & "SPY}EPAHR]J" & locale("categorie_7") & "REZyEPAHPLJ" & locale("categorie_8") & "R]X|EPAHRNJ" & locale("categorie_9") & "SP[EPAHRRJ" & locale("categorie_10") & "XjAZfFPAH"
If Val(ReadINI("categories", "SL", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "SLJ" & locale("categorie_1") & "QD[XKPAH", "")
If Val(ReadINI("categories", "RL", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "RLJ" & locale("categorie_2") & "YDAZ~EPAH", "")
If Val(ReadINI("categories", "PR", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "PRJ" & locale("categorie_3") & "RhZtEPAH", "")
If Val(ReadINI("categories", "RQ", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "RQJ" & locale("categorie_4") & "XLA[DFPAH", "")
If Val(ReadINI("categories", "SV", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "SVJ" & locale("categorie_5") & "SOYsEPAH", "")
If Val(ReadINI("categories", "Q]", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "Q]J" & locale("categorie_6") & "SPY}EPAH", "")
If Val(ReadINI("categories", "R]", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "R]J" & locale("categorie_7") & "REZyEPAH", "")
If Val(ReadINI("categories", "PL", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "PLJ" & locale("categorie_8") & "R]X|EPAH", "")
If Val(ReadINI("categories", "RN", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "RNJ" & locale("categorie_9") & "SP[EPAH", "")
If Val(ReadINI("categories", "RR", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "RRJ" & locale("categorie_10") & "XjAZfFPAH", "")
Send Index, "C\" & Lijst & Chr(1)
End Function

Public Function Hab_AtQ(info As String, Index As Integer)
Dim BuildList As String
Dim RoomsGehad As String
Dim NaamZien As String
Dim OpenType As String
Dim MaxRooms As Integer
MaxRooms = Val(ReadINI("config", "maxguestroomsinlist", SettingIni))
Dim CurRooms As Integer

Qry = Mid(info, 4, Len(info) - 4)

'owner
If FSO.FolderExists(DBP & "habbos\" & LCase(Qry)) = False Then GoTo ByString
If FSO.OpenTextFile(DBP & "habbos\" & LCase(Qry) & "\roomlist.txt", ForReading).AtEndOfStream = True Then
    BuildList = ""
    GoTo ByString
End If
UsersRooms = Split(FSO.OpenTextFile(DBP & "habbos\" & LCase(Qry) & "\roomlist.txt", ForReading).ReadAll, "<")
For a = 0 To UBound(UsersRooms)
If UsersRooms(a) = "" Or UsersRooms(a) = ">" Then GoTo NextA
If FSO.FolderExists(DBP & "privaterooms\" & Split(UsersRooms(a), ">")(0)) And FSO.FileExists(DBP & "privaterooms\" & Split(UsersRooms(a), ">")(0) & "\deleted.txt") = False Then
If LCase(FSO.OpenTextFile(DBP & "privaterooms\" & Split(UsersRooms(a), ">")(0) & "\owner.txt").ReadAll) = LCase(Qry) Then
Number = Split(UsersRooms(a), ">")(0)
RoomName = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\name.txt").ReadAll)
Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\owner.txt").ReadAll
Description = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\description.txt").ReadAll)
MaxIn = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\maxin.txt").ReadAll
OpenType = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\opentype.txt").ReadAll
ShowName = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\showname.txt").ReadAll
InRoom = 0

For b = 1 To frmMain.SockI
If Client(b).InRoom = Number Then
InRoom = InRoom + 1
End If
Next b

If ShowName = "0" And Owner <> Client(Index).Name And ReadINI("rank", "see_room_owner", DBP & "ranks\" & Client(Index).Rank & ".ini") <> "1" Then Owner = "-"

BuildList = BuildList & Number & Chr(9) & RoomName & Chr(9) & Owner & Chr(9) & OpenType & Chr(9) & "x" & Chr(9) & InRoom & Chr(9) & MaxIn & Chr(9) & "null" & Chr(9) & Description & Chr(9) & Chr(13)
CurRooms = CurRooms + 1
End If
End If
NextA:
Next a
'owner

'string
ByString:
For a = 1 To Val(FSO.OpenTextFile(DBP & "privaterooms\count.txt").ReadAll)
If CurRooms = MaxRooms Then Exit For
If FSO.FolderExists(DBP & "privaterooms\" & a) And FSO.FileExists(DBP & "privaterooms\" & a & "\deleted.txt") = False Then
If LCase(Left(FSO.OpenTextFile(DBP & "privaterooms\" & a & "\name.txt").ReadAll, Len(Qry))) = LCase(Qry) Then
Number = a
RoomName = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\name.txt").ReadAll)
Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\owner.txt").ReadAll
Description = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\description.txt").ReadAll)
MaxIn = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\maxin.txt").ReadAll
OpenType = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\opentype.txt").ReadAll
ShowName = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\showname.txt").ReadAll
InRoom = 0

For b = 1 To frmMain.SockI
If Client(b).InRoom = Number Then
InRoom = InRoom + 1
End If
Next b

If ShowName = "0" And Owner <> Client(Index).Name And ReadINI("rank", "see_room_owner", DBP & "ranks\" & Client(Index).Rank & ".ini") <> "1" Then Owner = "-"

BuildList = BuildList & Number & Chr(9) & RoomName & Chr(9) & Owner & Chr(9) & OpenType & Chr(9) & "x" & Chr(9) & InRoom & Chr(9) & MaxIn & Chr(9) & "null" & Chr(9) & Description & Chr(9) & Chr(13)
CurRooms = CurRooms + 1
End If
End If
Next a
'string
jumpstring:
If BuildList <> "" Then
Send Index, "@w" & BuildList & Chr(1)
Else
Send Index, "@z" & Chr(1)
End If

End Function

Public Function Hab_Ablokje(info As String, Index As Integer)
If FSO.FileExists(DBP & "habbos\" & LCase(Client(Index).Name) & "\transactions.txt") = True Then
If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\transactions.txt", ForReading).AtEndOfStream = False Then
    Dim Transactions As String
    Transactions = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\transactions.txt", ForReading).ReadAll
    Send Index, "CQ" & Transactions & Chr(1)
Else
    Send Index, "CQ" & Chr(1)
End If
Else
    Send Index, "CQ" & Chr(1)
End If
End Function

Public Function Hab_AtS(info As String, Index As Integer)
If Mid(info, 3, 1) = "H" Then
Dim MaxFavo As Integer
MaxFavo = Val(ReadINI("config", "maxfavouriterooms", SettingIni))
Dim RoomNum As Long
Dim RoomCount As Integer
RoomNum = VL64Decode(Mid(info, 4))

Dim Lijst2 As String
Dim Lijst() As String

Lijst2 = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\favourites.txt").ReadAll
Lijst = Split(Lijst2, ";")

For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And FSO.FolderExists(DBP & "privaterooms\" & Lijst(a)) And FSO.FileExists(DBP & "privaterooms\" & Lijst(a) & "\deleted.txt") = False Then RoomCount = RoomCount + 1
If Val(Lijst(a)) = RoomNum Then Exit Function
DoEvents
Next a

If RoomCount < MaxFavo Then

Lijst2 = Lijst2 & ";" & RoomNum
Lijst2 = Replace(Lijst2, ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\favourites.txt", ForWriting).Write Lijst2

Hab_AtR "@R@", Index

Else
Send Index, "BK" & Replace(locale("max_fav_rooms"), "%maxfavs%", MaxFavo) & Chr(1)
End If

End If
End Function

Public Function Hab_AtR(info As String, Index As Integer)

If Mid(info, 3, 1) = "@" Then

Dim BuildList As String
Dim RoomCount As Integer
Dim NaamZien As String
Dim OpenType As String

Lijst2 = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\favourites.txt").ReadAll
Lijst = Split(Lijst2, ";")

For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And FSO.FolderExists(DBP & "privaterooms\" & Lijst(a)) And FSO.FileExists(DBP & "privaterooms\" & Lijst(a) & "\deleted.txt") = False Then
RoomCount = RoomCount + 1

Number = Lijst(a)
RoomName = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\name.txt").ReadAll)
Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\owner.txt").ReadAll
Description = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\description.txt").ReadAll)
MaxIn = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\maxin.txt").ReadAll
OpenType = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\opentype.txt").ReadAll
ShowName = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\showname.txt").ReadAll
InRoom = 0

For b = 1 To frmMain.SockI
If Client(b).InRoom = Number Then
InRoom = InRoom + 1
End If
DoEvents
Next b

If ShowName = "0" And Owner <> Client(Index).Name And ReadINI("rank", "see_room_owner", DBP & "ranks\" & Client(Index).Rank & ".ini") <> "1" Then Owner = "-"

BuildList = BuildList & VL64encode(Number) & RoomName & Chr(2) & Owner & Chr(2) & OpenType & Chr(2) & VL64encode(InRoom) & VL64encode(MaxIn) & Description & Chr(2)

End If
DoEvents
Next a



Send Index, "@}HHJ" & Chr(2) & "HHH" & VL64encode(RoomCount) & BuildList & Chr(1)

End If
End Function

Public Function Hab_AtT(info As String, Index As Integer)

If Mid(info, 3, 1) = "H" Then


Dim RoomNum As Long
RoomNum = VL64Decode(Mid(info, 4))

Dim NewLijst As String
Dim Lijst2 As String
Dim Lijst() As String
NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\favourites.txt").ReadAll
Lijst = Split(Lijst2, ";")

For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And FSO.FolderExists(DBP & "privaterooms\" & Lijst(a)) And FSO.FileExists(DBP & "privaterooms\" & Lijst(a) & "\deleted.txt") = False And Val(Lijst(a)) <> RoomNum Then NewLijst = NewLijst & ";" & Lijst(a)
DoEvents
Next a

NewLijst = Replace(NewLijst, ";;", ";")

FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\favourites.txt", ForWriting).Write NewLijst

Hab_AtR "@R@", Index

End If
End Function

Public Function Hab_Bv(info As String, Index As Integer)
Send Index, "DB0" & Chr(1)
End Function

Public Function Hab_Atb(info As String, Index As Integer)
Client(Index).Sit = False
Client(Index).Lay = False
Client(Index).Wave = False
Client(Index).RollerUpdate = False
Client(Index).Talking = False
Client(Index).Trading = False
If Client(Index).TradingWith <> "" Then
Hab_AF "AF", Index
Client(Index).TradingWith = ""
End If
Client(Index).TelMove = False
Client(Index).Teled = False
Client(Index).DoDrink = False
Client(Index).TelX = 0
Client(Index).TelY = 0
Client(Index).TelHe = ""
Client(Index).Gesture = ""
Client(Index).PosX = 0
Client(Index).PosY = 0
Client(Index).Dance = False
Client(Index).Dancetype = ""
Client(Index).NoDrink = True
Client(Index).UseItem = False
Client(Index).Carrying = 0
frmMain.TimerVanish(Index).Enabled = False
frmMain.TimerDrink(Index).Enabled = False

If Client(Index).InRoom > 0 Then
sendAll "@]" & Client(Index).Num & Chr(1), (Client(Index).InRoom)
Client(Index).Hotelpos = "I" & locale("hotel_view")
'pet part
Kamer = Client(Index).InRoom
InRoom = 0

For b = 1 To frmMain.SockI
If Client(b).InRoom = Kamer Then
InRoom = InRoom + 1
End If
Next b

If InRoom = 1 Then

'rollers
splitP = Split(Replace(frmMain.LoadedRollers, ">", ""), "<")
For b = 0 To UBound(splitP)
If splitP(b) <> "" Then
FType = FSO.OpenTextFile(DBP & "furni\" & splitP(b) & "\type.txt", ForReading).ReadAll
FRoom = FSO.OpenTextFile(DBP & "furni\" & splitP(b) & "\inroom.txt", ForReading).ReadAll
'roller
If FType = "roller" And FRoom = Kamer Then
frmMain.LoadedRollers = Replace(frmMain.LoadedRollers, "<" & splitP(b) & ">", "")
End If
'roller
End If
DoEvents
Next b
'rollers

Hpets2 = ""
splitP = Split(frmMain.Hpets, ";")
For b = 0 To UBound(splitP)
If splitP(b) <> "" Then
If Pet(splitP(b)).InRoom = Kamer Then
Unload frmMain.PetTimer(splitP(b))
'save status
Nums = Replace(Nums, "<" & splitP(b) & ">", "")
If Pet(splitP(b)).Actiontype = "pla" Then Pet(splitP(b)).Actiontype = ""
WriteINI "pet", "alive", Pet(splitP(b)).Alive, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "drinktimer", Pet(splitP(b)).DrinkTimer, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "eattimer", Pet(splitP(b)).EatTimer, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "sleep", Pet(splitP(b)).Sleep, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "sleeptimer", Pet(splitP(b)).SleepTimer, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "sleepduration", Pet(splitP(b)).SleepDuration, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "he", Pet(splitP(b)).He, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "look", Mid(Pet(splitP(b)).Look, 1, InStr(Pet(splitP(b)).Look, ",") - 1), DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "posx", Pet(splitP(b)).PosX, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "posy", Pet(splitP(b)).PosY, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "sit", Pet(splitP(b)).Sit, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "lay", Pet(splitP(b)).Lay, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "gesture", Pet(splitP(b)).Gesture, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "action", Pet(splitP(b)).Action, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "actiontype", Pet(splitP(b)).Actiontype, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
'save status
Pet(splitP(b)).Name = ""
Else
Hpets2 = Hpets2 & splitP(b) & ";"
End If
End If
DoEvents
Next b

frmMain.Hpets = Hpets2
End If
'pet part

Client(Index).Muted = False
Client(Index).InRoom = 0
End If

If Client(Index).Publicnum > 0 Then
sendAllP "@]" & Client(Index).Num & Chr(1), (Client(Index).Publicnum)
Client(Index).Hotelpos = "I" & locale("hotel_view")
Client(Index).Publicname = ""
Client(Index).Publicnum = 0
End If

Send Index, "@S" & Chr(1)

If Mid(info, 3, 1) = "A" Then
    Publicroom = Mid(info, 4, 3)
    Select Case Publicroom
    
    Case "b}D"
    Client(Index).Publicnum = 1
    Client(Index).Publicname = locale("pub_name_1")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AEtheater 17654"
    
    Case "[M{"
    Client(Index).Publicnum = 2
    Client(Index).Publicname = locale("pub_name_2")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AEnewbie_lobby 15159"
    
    Case "b}E"
    Client(Index).Publicnum = 3
    Client(Index).Publicname = locale("pub_name_3")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AEtheater 17654"
    
    Case "b}F"
    Client(Index).Publicnum = 4
    Client(Index).Publicname = locale("pub_name_4")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AEtheater 17654"
    
    Case "b}G"
    Client(Index).Publicnum = 5
    Client(Index).Publicname = locale("pub_name_5")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AEpark_a 15190"
    
    Case "b}H"
    Client(Index).Publicnum = 6
    Client(Index).Publicname = locale("pub_name_6")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AEorient 151960"
    
    Case "b}I"
    Client(Index).Publicnum = 7
    Client(Index).Publicname = locale("pub_name_7")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AEhabburger 151530"
    
    Case "b}J"
    Client(Index).Publicnum = 8
    Client(Index).Publicname = locale("pub_name_8")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AEcr_kitchen 15164"
    
    Case "b}K"
    Client(Index).Publicnum = 9
    Client(Index).Publicname = locale("pub_name_9")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AEcinema_a 15161"
    
    Case "b}L"
    Client(Index).Publicnum = 10
    Client(Index).Publicname = locale("pub_name_10")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AElobby_a 15151"
    
    Case "b}M"
    Client(Index).Publicnum = 11
    Client(Index).Publicname = locale("pub_name_11")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AEpool_a 15188"
    
    Case "b}N"
    Client(Index).Publicnum = 13
    Client(Index).Publicname = locale("pub_name_13")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AErooftop 42431"
    
    Case "b}O"
    Client(Index).Publicnum = 15
    Client(Index).Publicname = locale("pub_name_15")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AEballroom 42422"
    
    Case "b}P"
    Client(Index).Publicnum = 16
    Client(Index).Publicname = locale("pub_name_16")
    Client(Index).Hotelpos = "I" & Client(Index).Publicname
    Send Index, "AEtearoom 42221"
    
    End Select
End If
End Function

Public Function Hab_Atgolf(info As String, Index As Integer)
If Client(Index).Publicnum > 0 Then
    If ReadINI("public-data", "hc_only", DBP & "pub\" & Client(Index).Publicnum & "\data.ini") = "1" And FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForReading).ReadAll = "0" And ReadINI("rank", "enter_any_room", DBP & "ranks\" & Client(Index).Rank & ".ini") <> "1" Then
        Send Index, "C`Kc" & Chr(2) & Chr(1)
        Client(Index).Publicname = ""
        Client(Index).Publicnum = 0
        Exit Function
    End If
    If Client(Index).Lockposition <> True Then
    PubDoor = Split(ReadINI("public-data", "door_location", DBP & "pub\" & Client(Index).Publicnum & "\data.ini"), " ")
    Client(Index).PosX = PubDoor(0)
    Client(Index).PosY = PubDoor(1)
    Client(Index).DestX = PubDoor(0)
    Client(Index).DestY = PubDoor(1)
    Client(Index).He = PubDoor(2)
    Client(Index).Look = ReadINI("public-data", "door_look", DBP & "pub\" & Client(Index).Publicnum & "\data.ini")
    Else
    Client(Index).Lockposition = False
    End If
    UsersPacket = ""
    For a = 1 To frmMain.SockI
        If frmMain.socket(a).State = sckConnected And Client(a).Publicnum = Client(Index).Publicnum And a <> Index Then
            UsersPacket = UsersPacket & "i:" & Client(a).Num & Chr(13) & "n:" & Client(a).Name & Chr(13) & "f:" & Client(a).App & Chr(13) & "l:" & Client(a).PosX & " " & Client(a).PosY & " " & Client(a).He & Chr(13) & "c:" & Client(a).Mission & Chr(13) & "s:" & Client(a).Sex & Chr(13) & "b:" & Client(a).Badge & Chr(13)
        End If
    Next a
    Botnumber = 0
    For a = 1 To frmMain.BotI
        If Bot(a).Publicnum = Client(Index).Publicnum Then
            UsersPacket = UsersPacket & "i:" & Bot(a).Num & Chr(13) & "a:-1" & Chr(13) & "n:" & Bot(a).Name & Chr(13) & "f:" & Bot(a).Figure & Chr(13) & "l:" & Bot(a).PosX & " " & Bot(a).PosY & " " & Bot(a).He & Chr(13) & "c:" & Bot(a).Mission & Chr(13) & "[bot]" & Chr(13)
            Botnumber = a
        End If
    Next a
    Dim PublicFurni() As String
    Dim PublicFurniList As String
    If FSO.FileExists(DBP & "pub\" & Client(Index).Publicnum & "\furniture.map") = True Then
        PublicFurni = Split(FSO.OpenTextFile(DBP & "pub\" & Client(Index).Publicnum & "\furniture.map", ForReading).ReadAll, vbCrLf)
        For d = 0 To UBound(PublicFurni)
            Dim licline() As String
            licline = Split(PublicFurni(d), " ")
            If Len(PublicFurni(d)) <> 0 Then
            If UBound(licline) = 6 Then
                If licline(6) = "X" Then
                    PublicWalk(Client(Index).Publicnum, licline(2), licline(3)) = "X"
                    walklist = walklist & " " & PublicWalk(Client(Index).Publicnum, licline(2), licline(3))
                Else
                    If licline(6) = "" Or licline(6) = " " Then licline(6) = "O"
                    If licline(6) = "sit" Then licline(6) = "S"
                    PublicWalk(Client(Index).Publicnum, licline(2), licline(3)) = licline(6)
                    PublicRot(Client(Index).Publicnum, licline(2), licline(3)) = licline(5) & "," & licline(5)
                    walklist = walklist & " " & PublicWalk(Client(Index).Publicnum, licline(2), licline(3))
                End If
                PublicFurniList = PublicFurniList & licline(0) & " " & licline(1) & " " & licline(2) & " " & licline(3) & " " & licline(4) & " " & licline(5) & Chr(13)
            Else
                If licline(7) = "X" Then
                    PublicWalk(Client(Index).Publicnum, licline(2), licline(3)) = "X"
                    walklist = walklist & " " & PublicWalk(Client(Index).Publicnum, licline(2), licline(3))
                Else
                    If licline(7) = "" Or licline(7) = " " Then licline(7) = "O"
                    If licline(7) = "sit" Then licline(7) = "S"
                    PublicWalk(Client(Index).Publicnum, licline(2), licline(3)) = licline(7)
                    PublicRot(Client(Index).Publicnum, licline(2), licline(3)) = licline(5) & "," & licline(5)
                    walklist = walklist & " " & PublicWalk(Client(Index).Publicnum, licline(2), licline(3))
                End If
                PublicFurniList = PublicFurniList & licline(0) & " " & licline(1) & " " & licline(2) & " " & licline(3) & " " & licline(4) & " " & licline(5) & " " & licline(6) & Chr(13)
            End If
            End If
        Next
    Else
        PublicFurniList = Chr(13)
    End If
    'MsgBox walklist
    Send Index, "@_" & FSO.OpenTextFile(DBP & "pub\" & Client(Index).Publicnum & "\heightmap.map", ForReading).ReadAll & Chr(1)
    Send Index, "@\" & UsersPacket & Chr(1)
    Send Index, "@^" & PublicFurniList & Chr(1)
    Send Index, "@`H" & Chr(1)
    For a = 1 To frmMain.SockI
        If frmMain.socket(a).State = sckConnected And Client(a).Publicnum = Client(Index).Publicnum Then
            frmMain.socket(a).SendData "@\" & "i:" & Client(Index).Num & Chr(13) & "n:" & Client(Index).Name & Chr(13) & "f:" & Client(Index).App & Chr(13) & "l:" & Client(Index).PosX & " " & Client(Index).PosY & " " & Client(Index).He & Chr(13) & "c:" & Client(Index).Mission & Chr(13) & "s:" & Client(Index).Sex & Chr(13) & "b:" & Client(Index).Badge & Chr(13) & Chr(1)
        End If
    Next a
    If Botnumber <> 0 Then Bot(Botnumber).Update = True
End If
End Function

Public Function Hab_Aty2(info As String, Index As Integer)

Dim RoomNum As Long, Givenpass As String
RoomNum = Val(Mid(info, 3))

If Client(Index).Teled = True Then RoomNum = Client(Index).InRoom

If InStr(info, "/") Then
Givenpass = Mid(info, InStr(info, "/") + 1)
End If

If FSO.FolderExists(DBP & "privaterooms\" & RoomNum) = False Then
    Hab_Kick Index
    Exit Function
End If
Rank = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\rank.txt", ForReading).ReadAll
Owner = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\owner.txt").ReadAll
Pass = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\pass.txt").ReadAll)
MaxIn = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\maxin.txt").ReadAll)
Model = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\model.txt").ReadAll)
rights = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\rights.txt").ReadAll
OpenType = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\opentype.txt").ReadAll)


InRoom = 0

For b = 1 To frmMain.SockI
If Client(b).InRoom = RoomNum Then
InRoom = InRoom + 1
End If
Next b
If InRoom < Val(MaxIn) Then
If FSO.FileExists(DBP & "privaterooms\" & RoomNum & "\adminlock.txt") = True And ReadINI("rank", "enter_any_room", DBP & "ranks\" & Client(Index).Rank & ".ini") <> "1" Then
    Send Index, "@R" & Chr(1)
    Send Index, "BK" & locale("room_locked_alert") & Chr(1)
    Exit Function
End If
If Pass <> " " And OpenType = "password" Then
If Pass = Givenpass Or Owner = Client(Index).Name Or ReadINI("rank", "enter_any_room", DBP & "ranks\" & Client(Index).Rank & ".ini") = "1" Or Client(Index).Teled = True Then
Else
Send Index, "@aIncorrect flat password" & Chr(1)
Exit Function
End If
End If

If OpenType = "closed" And Owner <> Client(Index).Name And Client(Index).Teled = False And ReadINI("rank", "enter_any_room", DBP & "ranks\" & Client(Index).Rank & ".ini") <> "1" Then
Send Index, "A[" & Chr(1)

For b = 1 To frmMain.SockI
If Client(b).InRoom = RoomNum Then

If ReadINI("rank", "rights_in_any_room", DBP & "ranks\" & Client(b).Rank & ".ini") = "1" Then Rechten = "ja"

If Owner = Client(b).Name Then Rechten = "ja"
If FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\allrights.txt").ReadAll = "1" Then
Rechten = "ja"
Else
Dim Splitt() As String
Splitt = Split(rights, ";")
For Q = 0 To UBound(Splitt())
If Splitt(Q) = Client(b).Name Then
Rechten = "ja"
Exit For
End If
Next Q
If Rechten = "ja" Then If frmMain.socket(b).State = sckConnected Then frmMain.socket(b).SendData "A[" & Client(Index).Name & Chr(1)
End If
End If
DoEvents
Next b
Exit Function
End If


Client(Index).Sit = False
Client(Index).Lay = False
Client(Index).Wave = False
Client(Index).RollerUpdate = False
Client(Index).Trading = False
If Client(Index).TradingWith <> "" Then
Hab_AF "AF", Index
Client(Index).TradingWith = ""
End If
Client(Index).Dance = False
Client(Index).Talking = False
Client(Index).TelMove = False
Client(Index).DoDrink = False
Client(Index).Gesture = ""
Client(Index).PosX = 0
Client(Index).PosY = 0
Client(Index).Dancetype = ""
Client(Index).NoDrink = True
Client(Index).UseItem = False
Client(Index).Carrying = 0
frmMain.TimerVanish(Index).Enabled = False
frmMain.TimerDrink(Index).Enabled = False

Lijst = "ijklmnopqr"
If InStr(Lijst, Mid(Model, 7)) Then
Client(Index).InBig = True
Else
Client(Index).InBig = False
End If

Client(Index).Muted = False
Client(Index).InRoom = RoomNum
Client(Index).Hotelpos = "IFloor1b"
Send Index, "@i" & Chr(1)
Else
Send Index, "C`I" & Chr(1) & "@R" & Chr(1)
End If
End Function


Public Function Hab_Atlol(info As String, Index As Integer)
Dim RoomNum As Long
RoomNum = Val(Mid(info, 3))

If Client(Index).Teled = True Then RoomNum = Client(Index).InRoom

Model = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\model.txt").ReadAll
Paper = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\paper.txt").ReadAll)
floor = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\floor.txt").ReadAll
Owner = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\owner.txt").ReadAll)
ShowName = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\showname.txt").ReadAll)


If Client(Index).InRoom = RoomNum Then
Send Index, "Bfhttp://www.habbohotel.co.uk/en.client.PrivateRoom.0" & Chr(1)
Send Index, "AE" & Model & " 15065" & Chr(1)
Send Index, "@nwallpaper/" & Paper & Chr(1)
Send Index, "@nfloor/" & floor & Chr(1)

rights = FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\rights.txt").ReadAll

If ReadINI("rank", "rights_in_any_room", DBP & "ranks\" & Client(Index).Rank & ".ini") = "1" Then Rechten = "ja"

If Owner = Client(Index).Name Then Rechten = "ja"
If FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\allrights.txt").ReadAll = "1" Then
Rechten = "ja"
Else
Dim Splitt() As String
Splitt = Split(rights, ";")
For Q = 0 To UBound(Splitt())
If Splitt(Q) = Client(Index).Name Then
Rechten = "ja"
Exit For
End If
DoEvents
Next Q
End If

If Rechten = "ja" Then Send Index, "@j" & Chr(1)

If Owner = Client(Index).Name Then Send Index, "@o" & Chr(1)
End If

End Function

Public Function Hab_Agolf(info As String, Index As Integer)
If Client(Index).InRoom > 0 Then
Send Index, "CP0" & Chr(1)

htmp = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\shtmp.txt").ReadAll

Send Index, "@_" & htmp & Chr(1)

Dim a As Long
For a = 1 To frmMain.SockI
If Client(a).InRoom = Client(Index).InRoom And Client(a).Num <> Client(Index).Num Then
DeBadge = ""
If Client(a).BadgeOn = "1" Then DeBadge = Client(a).Badge
Send Index, "@\i:" & Client(a).Num & Chr(13) & "n:" & Client(a).Name & Chr(13) & "f:" & Client(a).App & Chr(13) & "l:" & Client(a).PosX & " " & Client(a).PosY & " " & Client(a).He & Chr(13) & "c:" & Client(a).Mission & Chr(13) & "s:" & Client(a).Sex & Chr(13) & "b:" & DeBadge & Chr(1)
Client(a).Update = True
End If
Next a



Dim FurniCount As Integer
Dim PosterCount As Integer
Dim FurniList As String
Dim PosterList As String

furni = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt").ReadAll
Dim FurniLijst() As String
FurniLijst() = Split(furni, ";")
For a = 0 To UBound(FurniLijst)
If FurniLijst(a) <> "" Then

Iss = FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\is.txt").ReadAll
If Iss = "S" Then
FurniCount = FurniCount + 1
Fname = FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\name.txt", ForReading).ReadAll
Fx = Split(FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\loc.txt", ForReading).ReadAll, " ")(0)
Fy = Split(FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\loc.txt", ForReading).ReadAll, " ")(1)
Frr = Split(FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\loc.txt", ForReading).ReadAll, " ")(2)
Frhi = FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\height.txt", ForReading).ReadAll
Fw = Split(FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\cust.txt", ForReading).ReadAll, Chr(30))(0)
Frl = Split(FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\cust.txt", ForReading).ReadAll, Chr(30))(1)
FCol = Split(FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\cust.txt", ForReading).ReadAll, Chr(30))(2)
Fvar = FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\var.txt", ForReading).ReadAll
FType = FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\type.txt", ForReading).ReadAll

Frhi = Replace(Frhi, ",", ".")
If InStr(Frhi, ".") = 0 Then Frhi = Frhi & ".0"

FurniList = FurniList & FurniLijst(a) & Chr(2) & Fname & Chr(2) & VL64encode(Fx) & VL64encode(Fy) & VL64encode(Fw) & VL64encode(Frl) & VL64encode(Frr) & Frhi & Chr(2) & FCol & Chr(2) & Chr(2) & Fvar & Chr(2)
'roller
If FType = "roller" Then
If InStr(frmMain.LoadedRollers, "<" & FurniLijst(a) & ">") = 0 Then
frmMain.LoadedRollers = frmMain.LoadedRollers & "<" & FurniLijst(a) & ">"
End If
End If
'roller
'pet
If Fname = "nest" Then
PetData = Split(FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\petdata.txt", ForReading).ReadAll, "" & Chr(2) & "")
PetGender = FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\gender.txt", ForReading).ReadAll

For xyz = 5 To 10000
If InStr(Nums, "<" & xyz & ">") = 0 Then
idx = Val(xyz)
Nums = Nums & "<" & idx & ">"
Exit For
End If
DoEvents
Next xyz

If UBound(Pet) < idx Then
ReDim Preserve Pet(idx)
End If
If Pet(idx).Name = "" Then
Load frmMain.PetTimer(idx)
With Pet(idx)
.FurniID = Val(FurniLijst(a))
.NewAction = True
.RollerUpdate = False
.Alive = Val(ReadINI("pet", "alive", DBP & "furni\" & FurniLijst(a) & "\status.txt"))
.DrinkTimer = Val(ReadINI("pet", "drinktimer", DBP & "furni\" & FurniLijst(a) & "\status.txt"))
.EatTimer = Val(ReadINI("pet", "eattimer", DBP & "furni\" & FurniLijst(a) & "\status.txt"))
.Sleep = ReadINI("pet", "sleep", DBP & "furni\" & FurniLijst(a) & "\status.txt", False)
.Eating = False
.Drinking = False
.FindDrink = False
.FindFood = False
.SleepDuration = Val(ReadINI("pet", "sleepduration", DBP & "furni\" & FurniLijst(a) & "\status.txt"))
.SleepTimer = Val(ReadINI("pet", "sleeptimer", DBP & "furni\" & FurniLijst(a) & "\status.txt"))
.App = PetGender & " " & PetData(1) & " " & PetData(2)
.DestX = Val(ReadINI("pet", "posx", DBP & "furni\" & FurniLijst(a) & "\status.txt", (Fx)))
.DestY = Val(ReadINI("pet", "posy", DBP & "furni\" & FurniLijst(a) & "\status.txt", (Fy)))
.He = Val(ReadINI("pet", "he", DBP & "furni\" & FurniLijst(a) & "\status.txt", (Frhi)))
.InRoom = Client(Index).InRoom
.Look = Val(ReadINI("pet", "look", DBP & "furni\" & FurniLijst(a) & "\status.txt", (Frr))) & "," & Val(ReadINI("pet", "look", DBP & "furni\" & FurniLijst(a) & "\status.txt", (Frr)))
.Name = PetData(0)
.PosX = Val(ReadINI("pet", "posx", DBP & "furni\" & FurniLijst(a) & "\status.txt", (Fx)))
.PosY = Val(ReadINI("pet", "posy", DBP & "furni\" & FurniLijst(a) & "\status.txt", (Fy)))
.NestX = Fx
.NestY = Fy
.Action = ReadINI("pet", "sleep", DBP & "furni\" & FurniLijst(a) & "\status.txt", False)
.Sit = ReadINI("pet", "sit", DBP & "furni\" & FurniLijst(a) & "\status.txt", False)
.Lay = ReadINI("pet", "lay", DBP & "furni\" & FurniLijst(a) & "\status.txt", False)
.Actiontype = ReadINI("pet", "actiontype", DBP & "furni\" & FurniLijst(a) & "\status.txt")
.Gesture = ReadINI("pet", "gesture", DBP & "furni\" & FurniLijst(a) & "\status.txt")
.Update = True
.PlayVal = 0
.PlayX = 0
.PlayY = 0
.PlayID = 0
.Playing = False
End With
frmMain.Hpets = Replace(frmMain.Hpets & ";" & idx, ";;", ";")
End If
Send Index, "@\i:" & idx & Chr(13) & "n:" & idx & "" & PetData(0) & Chr(13) & "f:" & PetGender & " " & PetData(1) & " " & PetData(2) & Chr(13) & "l:" & Pet(idx).PosX & " " & Pet(idx).PosY & " " & Pet(idx).He & Chr(13) & "c:" & Chr(13) & Chr(1)
End If
'pet
ElseIf Iss = "I" Then
PosterCount = PosterCount + 1
Fname = FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\name.txt", ForReading).ReadAll
FLoc = FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\loc.txt", ForReading).ReadAll
FCust = FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\cust.txt", ForReading).ReadAll
Fvar = FSO.OpenTextFile(DBP & "furni\" & FurniLijst(a) & "\var.txt", ForReading).ReadAll
If Fvar = "I" Then FVar2 = "2" Else FVar2 = "1"
If Fname = "torch" Or Fname = "gothicfountain" Or Fname = "hc_wall_lamp" Then
PosterList2 = PosterList2 & FurniLijst(a) & Chr(9) & Fname & Chr(9) & " " & Chr(9) & FLoc & Chr(9) & FVar2 & Chr(13)
Else: PosterList = PosterList & FurniLijst(a) & Chr(9) & Fname & Chr(9) & " " & Chr(9) & FLoc & Chr(9) & FCust & Chr(13)
End If
End If

End If
DoEvents
Next a


Send Index, "@\" & Chr(1)
Send Index, "@^" & Chr(1)

Send Index, "@`" & VL64encode(FurniCount) & FurniList & Chr(1)
Send Index, "@m" & PosterList & PosterList2 & Chr(1)
End If
End Function

Public Function Hab_Atblokje(info As String, Index As Integer)
If Client(Index).Teled = False Then
Dim Door() As String
Deur = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\door.txt").ReadAll
Door = Split(Deur, ",")
Client(Index).PosX = Door(0)
Client(Index).PosY = Door(1)
Client(Index).DestX = Door(0)
Client(Index).DestY = Door(1)
Client(Index).He = Door(2)
DeBadge = ""
If Client(Index).BadgeOn = "1" Then DeBadge = Client(Index).Badge
sendAll "@\i:" & Client(Index).Num & Chr(13) & "n:" & Client(Index).Name & Chr(13) & "f:" & Client(Index).App & Chr(13) & "l:" & Client(Index).PosX & " " & Client(Index).PosY & " " & Client(Index).He & Chr(13) & "c:" & Client(Index).Mission & Chr(13) & "s:" & Client(Index).Sex & Chr(13) & "b:" & DeBadge & Chr(1), (Client(Index).InRoom)
Else
Deur = FSO.OpenTextFile(DBP & "furni\" & frmMain.TimerTeleport1(Index).Tag & "\loc.txt").ReadAll
Height = FSO.OpenTextFile(DBP & "furni\" & frmMain.TimerTeleport1(Index).Tag & "\height.txt").ReadAll
Door = Split(Deur, " ")
Client(Index).PosX = Door(0)
Client(Index).PosY = Door(1)
Client(Index).DestX = Door(0)
Client(Index).DestY = Door(1)
Client(Index).He = Height
DeBadge = ""
If Client(Index).BadgeOn = "1" Then DeBadge = Client(Index).Badge
sendAll "@\i:" & Client(Index).Num & Chr(13) & "n:" & Client(Index).Name & Chr(13) & "f:" & Client(Index).App & Chr(13) & "l:" & Client(Index).PosX & " " & Client(Index).PosY & " " & Client(Index).He & Chr(13) & "c:" & Client(Index).Mission & Chr(13) & "s:" & Client(Index).Sex & Chr(13) & "b:" & DeBadge & Chr(1), (Client(Index).InRoom)
frmMain.TimerTeleport1(Index).Interval = 500
frmMain.TimerTeleport1(Index).Enabled = True
'frmMain.DoTimer index
End If
For a = 1 To frmMain.SockI
    If Client(a).Name = Client(Index).Name And a <> Index Then
        Hab_Kick a
        frmMain.socket(a).Close
        If Client(a).Name <> "" Then Client(a).Name = ""
    End If
Next a
End Function

Public Function Hab_Aat(Index As Integer)
'If Client(Index).InPub <> "" Then
'    PubDoor = FSO.OpenTextFile(DBP & "pub\" & Client(Index).InPub & "\door.txt", ForReading).ReadAll
'    Client(Index).PosX = Split(PubDoor, " ")(0)
'    Client(Index).DestX = Split(PubDoor, " ")(0)
'    Client(Index).PosY = Split(PubDoor, " ")(1)
'    Client(Index).DestY = Split(PubDoor, " ")(1)
'    Client(Index).He = Split(PubDoor, " ")(2)
'    SendPub "@\i:" & Client(Index).Num & Chr(13) & "n:" & Client(Index).name & Chr(13) & "f:" & Client(Index).App & Chr(13) & "l:" & Client(Index).PosX & " " & Client(Index).PosY & " " & Client(Index).He & Chr(13) & "c:" & Client(Index).Mission & Chr(13) & "s:" & Client(Index).Sex & Chr(13) & "b:" & Client(Index).Badge & Chr(1), (Client(Index).InPub)
'    For a = 1 To frmMain.SockI
'        If frmMain.socket(a).State = sckConnected Then
'            If Client(a).InPub = Client(Index).InPub And a <> Index Then
'                Client(a).UpDate = True
'            End If
'        End If
'    Next a
'End If
If Client(Index).InRoom > 0 Then
For a = 1 To frmMain.SockI
    If frmMain.socket(a).State = sckConnected Then
        If Client(a).InRoom = Client(Index).InRoom And a <> Index Then
            Client(a).Update = True
        End If
    End If
Next a
End If
End Function

Public Function Hab_AO(info As String, Index As Integer)
Dim NaarY As Integer
Dim NaarX As Integer
Dim NuX As Integer
Dim NuY As Integer
If (Client(Index).PosX <> Client(Index).DestX) Or (Client(Index).PosY <> Client(Index).DestY) Or (Client(Index).Publicnum > 0 And Mid(info, 3) = "5 5") Then Exit Function
NaarX = Val(Split(Right(info, Len(info) - 2), " ")(0))
NaarY = Val(Split(Right(info, Len(info) - 2), " ")(1))
NuX = Client(Index).PosX
NuY = Client(Index).PosY
If NuX < NaarX Then
Client(Index).Look = "2,2"
End If
If NuX > NaarX Then
Client(Index).Look = "6,6"
End If
If NuY > NaarY Then
Client(Index).Look = "0,0"
End If
If NuY < NaarY Then
Client(Index).Look = "4,4"
End If
If NuX > NaarX And NuY > NaarY Then
Client(Index).Look = "7,7"
End If
If NuX < NaarX And NuY < NaarY Then
Client(Index).Look = "3,3"
End If
If NuX > NaarX And NuY < NaarY Then
Client(Index).Look = "5,5"
End If
If NuX < NaarX And NuY > NaarY Then
Client(Index).Look = "1,1"
End If
Client(Index).Update = True
End Function

Public Function Hab_AK(info As String, Index As Integer)
Client(Index).DestX = Val(Decode(Mid(info, 3, 2)))
Client(Index).DestY = Val(Decode(Mid(info, 5, 2)))
Client(Index).WishX = Client(Index).DestX
Client(Index).WishY = Client(Index).DestY
Client(Index).Update = True
End Function

Public Function Hab_Bdak(info As String, Index As Integer)
Dim a As Long

Badge = Mid(info, 5, 3)

Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll
HClf = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForReading).ReadAll)
HCpr = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\periods.txt", ForReading).ReadAll)
If HClf > 0 And InStr(ReadINI("HC", "hcbadge", SettingIni), Badge) Then GoTo ChangeBadge
If HClf > 0 And HCpr >= 11 And InStr(ReadINI("HC", "hcbadge2", SettingIni), Badge) Then GoTo ChangeBadge
If InStr(ReadINI("rank", "badges", DBP & "ranks\" & Client(Index).Rank & ".ini"), Badge) Then GoTo ChangeBadge
Badgeslist = Split(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\badges.txt", ForReading).ReadAll, ";")
For a = 0 To UBound(Badgeslist)
    If Badgeslist(a) <> "" And Badgeslist(a) = Badge Then
        GoTo ChangeBadge
    End If
Next
If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\badges.txt", ForReading).ReadAll = Badge Then GoTo ChangeBadge
Exit Function
ChangeBadge:
BadgeOnoff = VL64Decode(Mid(info, 8, 1))
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\curbadge.txt", ForWriting).Write Badge
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\badgeonoff.txt", ForWriting).Write BadgeOnoff

If BadgeOnoff = "1" Then BadgeSel = Badge Else BadgeSel = ""
Client(Index).Badge = BadgeSel
For a = 1 To frmMain.SockI
If ((Client(Index).InRoom > 0 And Client(a).InRoom = Client(Index).InRoom) Or (Client(Index).Publicnum > 0 And Client(a).Publicnum = Client(Index).Publicnum)) And Client(a).Num <> Client(Index).Num Then
 If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "Cd" & VL64encode(Client(Index).Num) & BadgeSel & Chr(2) & Chr(1)
End If
Next a

End Function

Public Function Hab_Ahaak(info As String, Index As Integer)
If Client(Index).Sit = True Or Client(Index).Lay = True Then Exit Function
If Len(info) > 2 Then
    dans = VL64Decode(Mid(info, 3))
    Select Case dans
    Case "1"
    Client(Index).Dancetype = "dance 1"
    Client(Index).Dance = True
    
    Case "2"
    Client(Index).Dancetype = "dance 4"
    Client(Index).Dance = True
    
    Case "3"
    Client(Index).Dancetype = "dance 3"
    Client(Index).Dance = True
    
    Case "4"
    Client(Index).Dancetype = "dance 2"
    Client(Index).Dance = True
    End Select
Else
    Client(Index).Dancetype = "dance"
    Client(Index).Dance = True
End If

Client(Index).Carrying = ""
Client(Index).Wave = False
Client(Index).Update = True
End Function

Public Function Hab_Adak(info As String, Index As Integer)

Client(Index).Wave = True
Client(Index).Dance = False
frmMain.TimerWave(Index).Enabled = True
Client(Index).Update = True
End Function

Public Function Hab_Astreep(info As String, Index As Integer)
Wie = Mid(info, 3)
If Client(Index).Name = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\owner.txt").ReadAll Then
Rechten = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\rights.txt").ReadAll
Rechten = Replace(Rechten & ";" & Wie, ";;", ";")
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\rights.txt", ForWriting).Write Rechten

Dim a As Long
For a = 1 To frmMain.SockI
If Client(a).Name = Wie And frmMain.socket(a).State = sckConnected Then
Client(a).Update = True
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@j" & Chr(1)
Exit For
End If
Next a

End If
End Function

Public Function Hab_Aa(info As String, Index As Integer)
Wie = Mid(info, 3)
If Client(Index).Name = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\owner.txt").ReadAll Then
Rechten = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\rights.txt").ReadAll
Rechten = Replace(Rechten & ";" & Wie, ";;", ";")


Dim NewLijst As String
Dim Lijst2 As String
Dim Lijst() As String
NewLijst = ";"
Lijst2 = Rechten
Lijst = Split(Lijst2, ";")

For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> Wie Then NewLijst = NewLijst & ";" & Lijst(a)
DoEvents
Next a

NewLijst = Replace(NewLijst, ";;", ";")

FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\rights.txt", ForWriting).Write NewLijst


For a = 1 To frmMain.SockI
If Client(a).Name = Wie And frmMain.socket(a).State = sckConnected Then
Client(a).Update = True
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@k" & Chr(1)
Exit For
End If
Next a

End If
End Function

Public Function Hab_Alaag(info As String, Index As Integer)
Wie = Mid(info, 3)

Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\owner.txt").ReadAll
rights = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\rights.txt").ReadAll

If LCase(Owner) = LCase(Client(Index).Name) Then Rechten = "ja"
If FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\allrights.txt").ReadAll = "1" Then
Rechten = "ja"
Else
Dim Splitt() As String
Splitt = Split(rights, ";")
For Q = 0 To UBound(Splitt())
If Splitt(Q) = Client(Index).Name Then
Rechten = "ja"
Exit For
End If
Next Q
End If

If ReadINI("rank", "rights_in_any_room", DBP & "ranks\" & Client(Index).Rank & ".ini") = "1" Then Rechten = "ja"

If Rechten = "ja" Then
For a = 1 To frmMain.SockI
If LCase(Client(a).Name) = LCase(Wie) Then
If Client(Index).Rank = "admin" Or Client(Index).Rank = "moderator" Then GoTo Kick
If RankHeight(Client(a).Rank, Client(Index).Rank) = True Then Exit Function
If LCase(Client(a).Name) = LCase(Owner) Then Exit Function
Kick:

sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(Index).Hotelpos = "I" & locale("hotel_view")
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@R" & Chr(1)

'pet part
Kamer = Client(a).InRoom
InRoom = 0

For b = 1 To frmMain.SockI
If Client(b).InRoom = Kamer Then
InRoom = InRoom + 1
End If
Next b

If InRoom = 1 Then

'rollers
splitP = Split(Replace(frmMain.LoadedRollers, ">", ""), "<")
For b = 0 To UBound(splitP)
If splitP(b) <> "" Then
FType = FSO.OpenTextFile(DBP & "furni\" & splitP(b) & "\type.txt", ForReading).ReadAll
FRoom = FSO.OpenTextFile(DBP & "furni\" & splitP(b) & "\inroom.txt", ForReading).ReadAll
'roller
If FType = "roller" And FRoom = Kamer Then
frmMain.LoadedRollers = Replace(frmMain.LoadedRollers, "<" & splitP(b) & ">", "")
End If
'roller
End If
Next b
'rollers

Hpets2 = ""
splitP = Split(frmMain.Hpets, ";")
For b = 0 To UBound(splitP)
If splitP(b) <> "" Then
If Pet(splitP(b)).InRoom = Kamer Then
Unload frmMain.PetTimer(splitP(b))
Nums = Replace(Nums, "<" & splitP(b) & ">", "")
If Pet(splitP(b)).Actiontype = "pla" Then Pet(splitP(b)).Actiontype = ""
'save status
WriteINI "pet", "alive", Pet(splitP(b)).Alive, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "drinktimer", Pet(splitP(b)).DrinkTimer, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "eattimer", Pet(splitP(b)).EatTimer, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "sleep", Pet(splitP(b)).Sleep, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "sleeptimer", Pet(splitP(b)).SleepTimer, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "sleepduration", Pet(splitP(b)).SleepDuration, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "he", Pet(splitP(b)).He, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "look", Mid(Pet(splitP(b)).Look, 1, InStr(Pet(splitP(b)).Look, ",") - 1), DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "posx", Pet(splitP(b)).PosX, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "posy", Pet(splitP(b)).PosY, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "sit", Pet(splitP(b)).Sit, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "lay", Pet(splitP(b)).Lay, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "gesture", Pet(splitP(b)).Gesture, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "action", Pet(splitP(b)).Action, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "actiontype", Pet(splitP(b)).Actiontype, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
'save status
Pet(splitP(b)).Name = ""
Else
Hpets2 = Hpets2 & splitP(b) & ";"
End If
End If
Next b

frmMain.Hpets = Hpets2
End If
'pet part

Client(a).Muted = False
Client(a).InRoom = 0

End If
Next a
End If

End Function

Public Function Hab_Kick(ByVal Index As Integer)
On Error Resume Next
Send Index, "@R" & Chr(1)
If Client(Index).InRoom > 0 Then
sendAll "@]" & Client(Index).Num & Chr(1), (Client(Index).InRoom)
Client(Index).Hotelpos = "I" & locale("hotel_view")
'pet part
Kamer = Client(Index).InRoom
InRoom = 0

For b = 1 To frmMain.SockI
If Client(b).InRoom = Kamer Then
InRoom = InRoom + 1
End If
Next b

If InRoom = 1 Then

'rollers
splitP = Split(Replace(frmMain.LoadedRollers, ">", ""), "<")
For b = 0 To UBound(splitP)
If splitP(b) <> "" Then
FType = FSO.OpenTextFile(DBP & "furni\" & splitP(b) & "\type.txt", ForReading).ReadAll
FRoom = FSO.OpenTextFile(DBP & "furni\" & splitP(b) & "\inroom.txt", ForReading).ReadAll
'roller
If FType = "roller" And FRoom = Kamer Then
frmMain.LoadedRollers = Replace(frmMain.LoadedRollers, "<" & splitP(b) & ">", "")
End If
'roller
End If
Next b
'rollers

Hpets2 = ""
splitP = Split(frmMain.Hpets, ";")
For b = 0 To UBound(splitP)
If splitP(b) <> "" Then
If Pet(splitP(b)).InRoom = Kamer Then
Unload frmMain.PetTimer(splitP(b))
Nums = Replace(Nums, "<" & splitP(b) & ">", "")
If Pet(splitP(b)).Actiontype = "pla" Then Pet(splitP(b)).Actiontype = ""
'save status
WriteINI "pet", "alive", Pet(splitP(b)).Alive, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "drinktimer", Pet(splitP(b)).DrinkTimer, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "eattimer", Pet(splitP(b)).EatTimer, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "sleep", Pet(splitP(b)).Sleep, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "sleeptimer", Pet(splitP(b)).SleepTimer, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "sleepduration", Pet(splitP(b)).SleepDuration, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "he", Pet(splitP(b)).He, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "look", Mid(Pet(splitP(b)).Look, 1, InStr(Pet(splitP(b)).Look, ",") - 1), DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "posx", Pet(splitP(b)).PosX, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "posy", Pet(splitP(b)).PosY, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "sit", Pet(splitP(b)).Sit, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "lay", Pet(splitP(b)).Lay, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "gesture", Pet(splitP(b)).Gesture, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "action", Pet(splitP(b)).Action, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
WriteINI "pet", "actiontype", Pet(splitP(b)).Actiontype, DBP & "furni\" & Pet(splitP(b)).FurniID & "\status.txt"
'save status
Pet(splitP(b)).Name = ""
Else
Hpets2 = Hpets2 & splitP(b) & ";"
End If
End If
Next b

frmMain.Hpets = Hpets2
End If
'pet part

Client(Index).InRoom = 0
Client(Index).Muted = False
End If

If Client(Index).Publicnum > 0 Then
sendAllP "@]" & Client(Index).Num & Chr(1), (Client(Index).Publicnum)
Client(Index).Hotelpos = "I" & locale("hotel_view")
Client(Index).Publicname = ""
Client(Index).Publicnum = 0
End If
End Function

Public Function Hab_As(info As String, Index As Integer)
If Client(Index).InRoom > 0 Then
    DoorC = Split(FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\door.txt", ForReading).ReadAll, ",")
    Client(Index).DestX = DoorC(0)
    Client(Index).DestY = DoorC(1)
    Client(Index).WishX = DoorC(0)
    Client(Index).WishY = DoorC(1)
    Client(Index).Kick = True
    Client(Index).Update = True
Else
    Client(Index).Kick = True
End If
End Function



Public Function Hab_AX(info As String, Index As Integer)
Wat = Mid(info, 3)

If Wat = "Dance" Then
Client(Index).Dance = False
End If

If Wat = "CarryItem" Then
Client(Index).NoDrink = True
Client(Index).UseItem = False
Client(Index).Carrying = 0
frmMain.TimerVanish(Index).Enabled = False
frmMain.TimerDrink(Index).Enabled = False
End If

Client(Index).Update = True
End Function

Public Function Hab_Atw2(info As String, Index As Integer)
Dim ToSay As String
Dim Saylen As String
Dim Saylenn As Integer
Saylen = Mid(info, 3, 2)
Saylenn = Decode(Saylen)
ToSay = Mid(info, 5, Saylenn)
ToSay = Replace(ToSay, Chr(1), " ")
ToSay = Replace(ToSay, Chr(2), " ")
ToSay = Replace(ToSay, Mid(vbCrLf, 1, 1), "")
ToSay = Replace(ToSay, Mid(vbCrLf, 2, 1), "")
If ReadINI("config", "bobba_filter", SettingIni) = "1" Then ToSay = Filter(ToSay)

Stuur = 1

'about (incase someone steals the server)
If InStr(ToSay, ":about") = 1 Then
Stuur = 0
Send Index, "BK" & "#  #  ####<br>#  #  #   #<br>#  #  ####<br>#  #      #<br> ##    ###<br># SERVER #<br>By: USA111 (REKORDI)<br>Version: " & App.Major & "." & App.Minor & "." & App.Revision & Chr(1)
End If
'about (incase someone steals the server)

'ADMIN MOD etc commands
Client(Index).Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll
'commands
If InStr(ToSay, ":commands") = 1 Then
Stuur = 0
Commands = Split(":kick name reason " & Chr(13) & ":alert name message " & Chr(13) & ":ban name reason " & Chr(13) & ":shutup name " & Chr(13) & ":unmute name " & Chr(13) & ":roomshutup " & Chr(13) & ":roomunmute " & Chr(13) & ":superban name reason " & Chr(13) & ":voucher code amount " & Chr(13) & ":whosonline " & Chr(13) & ":credits name amount " & Chr(13) & ":takecredits name amount " & Chr(13) & ":hotelalert message / :ha message " & Chr(13) & ":userdata " & Chr(13) & ":givebadge name badgecode " & Chr(13) & ":takebadge name badgecode " & Chr(13) & ":deleteroom id " & Chr(13) & ":unban name " & Chr(13) & ":closeroom id " & Chr(13) & ":openroom id " & Chr(13), Chr(13))
Speechcom = ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini")
Speechcmds = ""
For a = 0 To UBound(Commands)
    If Len(Commands(a)) > 1 Then
        If InStr(Speechcom, Replace(Split(Commands(a), " ")(0), ":", ",")) <> 0 Then
            Speechcmds = Speechcmds & Commands(a) & Chr(13)
        End If
    End If
Next a
If Speechcmds <> "" Then
    Send Index, "BKYour speechs:" & Chr(13) & Speechcmds & Chr(1)
Else
    Stuur = 1
End If
End If
'commands
Usercom = Split(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",")
For b = 1 To UBound(Usercom)
If InStr(ToSay, ":" & Usercom(b)) = 1 Then GoTo IGC
Next b
GoTo saynow
IGC:
'kick
If InStr(ToSay, ":kick") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",kick") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
End If
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And RankHeight(Client(Index).Rank, Client(a).Rank) = True Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@R" & Chr(1)
If Reden <> "" Then If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@amod_warn/" & Reden & Chr(1)
If Client(Index).InRoom > 0 Then
sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(a).Hotelpos = "I" & locale("hotel_view")
Client(a).InRoom = 0
Client(a).Muted = False
End If
If Client(Index).Publicnum > 0 Then
sendAllP "@]" & Client(a).Num & Chr(1), (Client(a).Publicnum)
Client(a).Hotelpos = "I" & locale("hotel_view")
Client(a).Publicname = ""
Client(a).Publicnum = 0
Client(a).Muted = False
End If
Stuur = 0
End If
Next a
'Printlog Client(index).name & " kickte (:kick x): " & Wie
End If
End If
'kick
'alert
If InStr(ToSay, ":alert") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",alert") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@amod_warn/" & Reden & Chr(1)
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " sendete Alert (:alert x) an " & Wie & " Inhalt: " & Reden
End If
End If
End If
'alert
'ban
If InStr(ToSay, ":ban") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",ban") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
BanDuration = 24
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True Then
If RankHeight(Client(Index).Rank, FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\rank.txt", ForReading).ReadAll) = True Then
FSO.OpenTextFile(DBP & "user_bans\" & LCase(Wie) & ".txt", ForWriting, True).Write DateAdd("h", Val(BanDuration), Now())
FSO.OpenTextFile(DBP & "user_bans\" & LCase(Wie) & ".reason", ForWriting, True).Write Reden
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then

If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@c" & Reden & Chr(1)
If Client(Index).InRoom > 0 Then
sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(a).Hotelpos = "H"
Client(a).InRoom = 0
End If
If Client(Index).Publicnum > 0 Then
sendAllP "@]" & Client(a).Num & Chr(1), (Client(a).Publicnum)
Client(a).Hotelpos = "H"
Client(a).Publicname = ""
Client(a).Publicnum = 0
End If
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " verbannte (:ban x) " & Wie & ", Grund: " & Reden
End If
End If
End If
End If
End If
'ban
'shutup
If InStr(ToSay, ":shutup") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",shutup") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected And RankHeight(Client(Index).Rank, Client(a).Rank) = True Then
Shutup:
Client(a).Muted = True
Stuur = 0
Exit For
End If
Next a
End If
End If
'shutup
'unmute
If InStr(ToSay, ":unmute") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",unmute") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
Client(a).Muted = False
Stuur = 0
Exit For
End If
Next a
End If
End If
'unmute
'roomshutup
If InStr(ToSay, ":roomshutup") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",roomshutup") Then
Stuur = 0
For a = 1 To frmMain.SockI
If ((Client(Index).InRoom > 0 And Client(Index).InRoom = Client(a).InRoom) Or (Client(Index).Publicnum > 0 And Client(Index).Publicnum = Client(a).Publicnum)) And RankHeight(Client(Index).Rank, Client(a).Rank) = True Then
Client(a).Muted = True
Stuur = 0
Exit For
End If
Next a
End If
'roomshutup
'roomunmute
If InStr(ToSay, ":roomunmute") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",roomunmute") Then
Stuur = 0
For a = 1 To frmMain.SockI
If (Client(Index).InRoom > 0 And Client(Index).InRoom = Client(a).InRoom) Or (Client(Index).Publicnum > 0 And Client(Index).Publicnum = Client(a).Publicnum) Then
Client(a).Muted = False
Stuur = 0
End If
Next a
End If
'roomunmute
'superban
If InStr(ToSay, ":superban") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",superban") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
BanDuration = 24 * 4167
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True Then
If RankHeight(Client(Index).Rank, FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\rank.txt", ForReading).ReadAll) = True Then
FSO.OpenTextFile(DBP & "user_bans\" & Wie & ".txt", ForWriting, True).Write DateAdd("h", Val(BanDuration), Now())
FSO.OpenTextFile(DBP & "user_bans\" & Wie & ".reason", ForWriting, True).Write Reden
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@c" & Reden & Chr(1)
If Client(a).InRoom > 0 Then
sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(a).InRoom = 0
End If
If Client(a).Publicnum > 0 Then
sendAllP "@]" & Client(a).Num & Chr(1), (Client(a).Publicnum)
Client(a).Publicnum = 0
Client(a).Publicname = ""
End If
Client(a).Hotelpos = "H"
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " bannte " & Wie & " für 2 Stunden, Grund: " & Reden
End If
End If
End If
End If
End If
'superban
'voucher
If InStr(ToSay, ":voucher") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",voucher") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
    FSO.OpenTextFile(DBP & "vouchers\" & Wie & ".txt", ForWriting, True).Write Reden
    Send Index, "BK" & locale("following_code_cmd_msg") & Chr(13) & locale("code") & " " & Wie & Chr(13) & locale("amount_code_msg") & " " & Reden & Chr(1)
    'Printlog Client(index).name & " erstellte einen Talercode mit " & Reden & " Talern"
End If
End If
End If
'voucher
'whosonline
If InStr(ToSay, ":whosonline") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",whosonline") Then
Stuur = 0
HabboList = ""
HabboList2 = ""
HabboCount = 0
BlockedIPs = ""
For a = 1 To frmMain.SockI
If frmMain.socket(a).State = sckConnected And Client(a).Name <> "" Then
    If InStr(BlockedIPs, frmMain.socket(a).RemoteHostIP) Then GoTo NextA
    If HabboCount <= 30 Then HabboList = HabboList & "<br>" & Client(a).Name & "  " & frmMain.socket(a).RemoteHostIP Else HabboList2 = HabboList2 & "<br>" & Client(a).Name & "  " & frmMain.socket(a).RemoteHostIP
    HabboCount = HabboCount + 1
    For b = 1 To frmMain.SockI
        If frmMain.socket(a).RemoteHostIP = frmMain.socket(b).RemoteHostIP And a <> b And frmMain.socket(b).State = sckConnected And Client(b).Name <> "" Then
            If HabboCount <= 30 Then HabboList = HabboList & "<br>" & Client(b).Name & "  " & frmMain.socket(b).RemoteHostIP Else HabboList2 = HabboList2 & "<br>" & Client(b).Name & "  " & frmMain.socket(b).RemoteHostIP
            HabboCount = HabboCount + 1
        End If
    Next b
    BlockedIPs = BlockedIPs & frmMain.socket(a).RemoteHostIP & ","
End If
NextA:
Next a

Send Index, "BK" & HabboCount & " users online:" & HabboList & Chr(1)
If HabboCount > 30 Then Send Index, "BK" & HabboCount & " users online:" & HabboList2 & Chr(1)
Stuur = 0
End If
'whosonline
'credits
If InStr(ToSay, ":credits") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",credits") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True Then
credits = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForReading).ReadAll)
credits = credits + Val(Reden)
FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForWriting).Write credits
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\transactions.txt", ForAppending, True).Write Format(Date, "dd-mm-yyyy") & Chr(9) & Format(Time, "hh:mm") & Chr(9) & Reden & Chr(9) & "0" & Chr(9) & Chr(9) & "web_internal" & Chr(13)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@F" & credits & ".0" & Chr(1)
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " gab " & Wie & " " & Reden & " Taler(:credits)"
End If
End If
End If
End If
'credits
'takecredits
If InStr(ToSay, ":takecredits") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",takecredits") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True Then
credits = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForReading).ReadAll)
credits = credits - Val(Reden)
If credits < 0 Then credits = 0
FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForWriting).Write credits
FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\transactions.txt", ForAppending, True).Write Format(Date, "dd-mm-yyyy") & Chr(9) & Format(Time, "hh:mm") & Chr(9) & "-" & Reden & Chr(9) & "0" & Chr(9) & Chr(9) & "web_internal" & Chr(13)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@F" & credits & ".0" & Chr(1)
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " gab " & Wie & " " & Reden & " Taler(:credits)"
End If
End If
End If
End If
'takecredits
'hotelalert
If InStr(ToSay, ":hotelalert") = 1 Or InStr(ToSay, ":ha") = 1 Then
If InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",hotelalert") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
For a = 1 To frmMain.SockI

If frmMain.socket(a).State = sckConnected Then If Client(a).Name <> "" Then If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "BK" & locale("hotel_alert") & ":<br>" & Wie & Chr(1)

Stuur = 0
Next a
'Printlog Client(index).name & " sendete Hotelalert: " & Wie
End If
End If
End If
'hotelalert
'userdata
If InStr(ToSay, ":userdata") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",userdata") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True And RankHeight(Client(Index).Rank, FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\rank.txt", ForReading).ReadAll) = True Then
    udName = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\name.txt", ForReading).ReadAll
    udBirth = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\birth.txt", ForReading).ReadAll
    udPass = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\pass.txt", ForReading).ReadAll
    udCredits = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForReading).ReadAll
    udRank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\rank.txt", ForReading).ReadAll
    udMissi = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\mission.txt", ForReading).ReadAll
    Send Index, "BK" & locale("userdata_daten_von") & " " & udName & ": <br>" & locale("userdata_birthdate") & " " & udBirth & "<br>" & locale("userdata_password") & " " & udPass & "<br>" & locale("userdata_rank") & " " & udRank & "<br>" & locale("userdata_credits") & " " & udCredits & "<br>" & locale("userdata_mission") & " " & udMissi & Chr(1)
Else
    Send Index, "BK" & locale("user_not_found") & Chr(1)
End If
End If
End If
'userdata
'givebadge
If InStr(ToSay, ":givebadge") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",givebadge") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
If Len(Reden) = 3 Then
For a = 1 To frmMain.SockI
    If LCase(Client(a).Name) = LCase(Wie) Then
        If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForReading).AtEndOfStream = True Then FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForWriting).Write ";"
        Badges = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForReading).ReadAll
        Badge = Split(Badges, ";")
        BdgList = ""
        For b = 0 To UBound(Badge)
            If Len(Badge(b)) = 3 Then
                BdgList = BdgList & ";" & Badge(b)
            End If
        Next b
        If Left(BdgList, 1) = ";" And Len(BdgList) > 1 Then BdgList = Mid(BdgList, 2)
        If InStr(BdgList, Reden) = 0 Then
        BdgList = BdgList & ";" & Reden
        End If
        FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForWriting).Write BdgList
    End If
Next a
'Printlog Client(index).name & " gab " & Wie & " den Badge: " & Reden
End If
End If
End If
End If
'givebadge
'takebadge
If InStr(ToSay, ":takebadge") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",takebadge") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
If Len(Reden) = 3 Then
For a = 1 To frmMain.SockI
    If LCase(Client(a).Name) = LCase(Wie) Then
        If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForReading).AtEndOfStream = True Then FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForWriting).Write ";"
        Badges = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForReading).ReadAll
        Badge = Split(Badges, ";")
        BdgList = ""
        For b = 0 To UBound(Badge)
            If Len(Badge(b)) = 3 Then
                BdgList = BdgList & ";" & Badge(b)
            End If
        Next b
        If InStr(BdgList, Reden) Then
            BdgList = Replace(BdgList, Reden, "")
        End If
        If Left(BdgList, 1) = ";" And Len(BdgList) > 1 Then BdgList = Mid(BdgList, 2)
        FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForWriting).Write BdgList
    End If
Next a
'Printlog Client(index).name & " nahm " & Wie & " den Badge: " & Reden
End If
End If
End If
End If
'takebadge
'deleteroom
If InStr(ToSay, ":deleteroom") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",deleteroom") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If FSO.FolderExists(DBP & "privaterooms\" & Wie) = True And FSO.FileExists(DBP & "privaterooms\" & Wie & "\deleted.txt") = False Then
    RoomOwner = LCase(FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\owner.txt", ForReading).ReadAll)
    If FSO.FolderExists(DBP & "habbos\" & RoomOwner) = True Then
        RoomList = FSO.OpenTextFile(DBP & "habbos\" & RoomOwner & "\roomlist.txt", ForReading).ReadAll
        RoomList = Replace(RoomList, "<" & Wie & ">", "")
        FSO.OpenTextFile(DBP & "habbos\" & RoomOwner & "\roomlist.txt", ForWriting).Write RoomList
        OwnCount = Val(FSO.OpenTextFile(DBP & "habbos\" & RoomOwner & "\rooms.txt", ForReading).ReadAll)
        FSO.OpenTextFile(DBP & "habbos\" & RoomOwner & "\rooms.txt", ForWriting).Write OwnCount - 1
        FSO.CreateTextFile DBP & "privaterooms\" & Wie & "\deleted.txt"
        'Printlog Client(index).name & " löschte den Raum " & Wie & " von: " & RoomOwner
    End If
End If
End If
End If
'deleteroom
'unban
If InStr(ToSay, ":unban") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",unban") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
    If FSO.FileExists(DBP & "user_bans\" & Wie & ".txt") = True Then FSO.DeleteFile (DBP & "user_bans\" & Wie & ".txt")
    If FSO.FileExists(DBP & "user_bans\" & Wie & ".reason") = True Then FSO.DeleteFile (DBP & "user_bans\" & Wie & ".reason")
    Send Index, "BK" & locale("user_unbanned") & Chr(1)
    'Printlog Client(index).name & " entbannte " & Wie
End If
End If
'unban
'closeroom
If InStr(ToSay, ":closeroom") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",closeroom") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
    If FSO.FolderExists(DBP & "privaterooms\" & Wie) Then
    If FSO.FileExists(DBP & "privaterooms\" & Wie & "\deleted.txt") = False And FSO.FileExists(DBP & "privaterooms\" & Wie & "\adminlock.txt") = False Then
        FSO.CreateTextFile (DBP & "privaterooms\" & Wie & "\adminlock.txt")
        FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\name.txt", ForWriting).Write locale("this_room_is_locked")
        FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\opentype.txt", ForWriting).Write "closed"
        Send Index, "BK" & locale("room_locked") & Chr(1)
        'Printlog Client(index).name & " schloss den Raum " & Wie
    End If
    End If
End If
End If
'closeroom
'openroom
If InStr(ToSay, ":openroom") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",openroom") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
    If FSO.FolderExists(DBP & "privaterooms\" & Wie) Then
    If FSO.FileExists(DBP & "privaterooms\" & Wie & "\deleted.txt") = False And FSO.FileExists(DBP & "privaterooms\" & Wie & "\adminlock.txt") = True Then
        FSO.DeleteFile (DBP & "privaterooms\" & Wie & "\adminlock.txt")
        FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\name.txt", ForWriting).Write "Room " & Wie
        FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\opentype.txt", ForWriting).Write "open"
        Send Index, "BK" & locale("room_unlocked") & Chr(1)
        'Printlog Client(index).name & " öffnete den Raum " & Wie
    End If
    End If
End If
End If
'openroom
'ADMIN MOD etc commands

saynow:
If Stuur = 1 Then
If Stuur = 1 And Client(Index).Muted = False Then
If Client(Index).InRoom > 0 Then sendAll "@Z" & VL64encode(Client(Index).Num) & ToSay & Chr(2) & Chr(1), (Client(Index).InRoom)
If Client(Index).Publicnum > 0 Then
    sendAllP "@Z" & VL64encode(Client(Index).Num) & ToSay & Chr(2) & Chr(1), (Client(Index).Publicnum)
    CheckBotsReaction Index, ToSay
End If
For a = 1 To frmMain.SockI
    If ((Client(Index).InRoom > 0 And Client(a).InRoom = Client(Index).InRoom) Or (Client(Index).Publicnum > 0 And Client(a).Publicnum = Client(Index).Publicnum)) And a <> Index Then
        NuX = Client(a).PosX
        NuY = Client(a).PosY
        NaarX = Client(Index).PosX
        NaarY = Client(Index).PosY
        If Right(Client(a).Look, 1) = "2" Then
            If NuX <= NaarX And NuY < NaarY Then
                Client(a).Look = "3,2"
            ElseIf NuX <= NaarX And NuY > NaarY Then
                Client(a).Look = "5,2"
            ElseIf NuX < NaarX And NuY = NaarY Then
                Client(a).Look = "2,2"
            End If
        ElseIf Right(Client(a).Look, 1) = "4" Then
            If NuX > NaarX And NuY <= NaarY Then
                Client(a).Look = "5,4"
            ElseIf NuX < NaarX And NuY <= NaarY Then
                Client(a).Look = "3,4"
            ElseIf NuX = NaarX And NuY < NaarY Then
                Client(a).Look = "4,4"
            End If
        ElseIf Right(Client(a).Look, 1) = "6" Then
            If NuX >= NaarX And NuY > NaarY Then
                Client(a).Look = "5,6"
            ElseIf NuX >= NaarX And NuY < NaarY Then
                Client(a).Look = "7,6"
            ElseIf NuX > NaarX And NuY = NaarY Then
                Client(a).Look = "6,6"
            End If
        ElseIf Right(Client(a).Look, 1) = "0" Then
            If NuX > NaarX And NuY >= NaarY Then
                Client(a).Look = "9,0"
            ElseIf NuX < NaarX And NuY >= NaarY Then
                Client(a).Look = "1,0"
            ElseIf NuX = NaarX And NuY > NaarY Then
                Client(a).Look = "0,0"
            End If
        Else
            GoTo nxta
        End If
        Client(a).Update = True
    End If
nxta:
Next a
End If

frmMain.TimerGesture(Index).Enabled = False
Client(Index).Gesture = ""

If InStr(ToSay, ":)") Or InStr(ToSay, ":D") Or InStr(ToSay, ":-)") Or InStr(ToSay, ";)") Then
Client(Index).Gesture = "sml"
frmMain.TimerGesture(Index).Enabled = True
End If
If InStr(ToSay, ":o") Or InStr(ToSay, ":O") Then
Client(Index).Gesture = "srp"
frmMain.TimerGesture(Index).Enabled = True
End If
If InStr(ToSay, ":(") Or InStr(ToSay, ":'(") Or InStr(ToSay, ":-(") Or InStr(ToSay, ":'-(") Then
Client(Index).Gesture = "sad"
frmMain.TimerGesture(Index).Enabled = True
End If
If InStr(ToSay, ">:(") Or InStr(ToSay, ">:-(") Or InStr(ToSay, ":-@") Or InStr(ToSay, ":@") Then
Client(Index).Gesture = "agr"
frmMain.TimerGesture(Index).Enabled = True
End If

Tijd = Len(ToSay) * 100
If Tijd < 500 Then Tijd = 500
Client(Index).Talking = True
frmMain.TimerTalk(Index).Interval = Tijd
frmMain.TimerTalk(Index).Enabled = True
Client(Index).Update = True
End If

If frmMain.chkChatlog.Value = 1 Then
    frmMain.chatLog.Text = frmMain.chatLog.Text + vbCrLf + "[" & Client(Index).Name & "] ›› " & ToSay
    frmMain.chatLog.SelStart = Len(frmMain.chatLog.Text)
End If
If frmMain.chkSaveChatLog.Value = 1 Then
    If FSO.FolderExists(App.Path & "\chatlogs") = False Then FSO.CreateFolder App.Path & "\chatlogs"
    If FSO.FileExists(App.Path & "\chatlogs\" & Date & ".log") = False Then
        FSO.CreateTextFile (App.Path & "\chatlogs\" & Date & ".log")
        FSO.OpenTextFile(App.Path & "\chatlogs\" & Date & ".log", ForWriting).Write "## " & Date & " ##" & vbCrLf
    End If
    FSO.OpenTextFile(App.Path & "\chatlogs\" & Date & ".log", ForAppending).Write Client(Index).Name & ": " & ToSay & vbCrLf
End If
End Function

Public Function Hab_Att2(info As String, Index As Integer)
Dim Saylen As String
Dim Saylenn As Integer
Saylen = Mid(info, 3, 2)
Saylenn = Decode(Saylen)
ToSay = Mid(info, 5, Saylenn)
ToSay = Replace(ToSay, Chr(1), " ")
ToSay = Replace(ToSay, Chr(2), " ")
ToSay = Replace(ToSay, Mid(vbCrLf, 1, 1), "")
ToSay = Replace(ToSay, Mid(vbCrLf, 2, 1), "")
If ReadINI("config", "bobba_filter", SettingIni) = "1" Then ToSay = Filter(ToSay)

Stuur = 1

'about (incase someone steals the server)
If InStr(ToSay, ":about") = 1 Then
Stuur = 0
Send Index, "BK" & "#  #  ####<br>#  #  #   #<br>#  #  ####<br>#  #      #<br> ##    ###<br># SERVER #<br>By: USA111 (REKORDI)<br>Version: " & App.Major & "." & App.Minor & "." & App.Revision & Chr(1)
End If
'about (incase someone steals the server)

'ADMIN MOD etc commands
Client(Index).Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll
'commands
If InStr(ToSay, ":commands") = 1 Then
Stuur = 0
Commands = Split(":kick name reason " & Chr(13) & ":alert name message " & Chr(13) & ":ban name reason " & Chr(13) & ":shutup name " & Chr(13) & ":unmute name " & Chr(13) & ":roomshutup " & Chr(13) & ":roomunmute " & Chr(13) & ":superban name reason " & Chr(13) & ":voucher code amount " & Chr(13) & ":whosonline " & Chr(13) & ":credits name amount " & Chr(13) & ":takecredits name amount " & Chr(13) & ":hotelalert message / :ha message " & Chr(13) & ":userdata " & Chr(13) & ":givebadge name badgecode " & Chr(13) & ":takebadge name badgecode " & Chr(13) & ":deleteroom id " & Chr(13) & ":unban name " & Chr(13) & ":closeroom id " & Chr(13) & ":openroom id " & Chr(13), Chr(13))
Speechcom = ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini")
Speechcmds = ""
For a = 0 To UBound(Commands)
    If Len(Commands(a)) > 1 Then
        If InStr(Speechcom, Replace(Split(Commands(a), " ")(0), ":", ",")) <> 0 Then
            Speechcmds = Speechcmds & Commands(a) & Chr(13)
        End If
    End If
Next a
If Speechcmds <> "" Then
    Send Index, "BKYour speechs:" & Chr(13) & Speechcmds & Chr(1)
Else
    Stuur = 1
End If
End If
'commands
Usercom = Split(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",")
For b = 1 To UBound(Usercom)
If InStr(ToSay, ":" & Usercom(b)) = 1 Then GoTo IGC
Next b
GoTo saynow
IGC:
'kick
If InStr(ToSay, ":kick") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",kick") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
End If
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And RankHeight(Client(Index).Rank, Client(a).Rank) = True Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@R" & Chr(1)
If Reden <> "" Then If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@amod_warn/" & Reden & Chr(1)
If Client(Index).InRoom > 0 Then
sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(a).Hotelpos = "I" & locale("hotel_view")
Client(a).InRoom = 0
Client(a).Muted = False
End If
If Client(Index).Publicnum > 0 Then
sendAllP "@]" & Client(a).Num & Chr(1), (Client(a).Publicnum)
Client(a).Hotelpos = "I" & locale("hotel_view")
Client(a).Publicname = ""
Client(a).Publicnum = 0
Client(a).Muted = False
End If
Stuur = 0
End If
Next a
'Printlog Client(index).name & " kickte (:kick x): " & Wie
End If
End If
'kick
'alert
If InStr(ToSay, ":alert") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",alert") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@amod_warn/" & Reden & Chr(1)
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " sendete Alert (:alert x) an " & Wie & " Inhalt: " & Reden
End If
End If
End If
'alert
'ban
If InStr(ToSay, ":ban") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",ban") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
BanDuration = 24
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True Then
If RankHeight(Client(Index).Rank, FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\rank.txt", ForReading).ReadAll) = True Then
FSO.OpenTextFile(DBP & "user_bans\" & LCase(Wie) & ".txt", ForWriting, True).Write DateAdd("h", Val(BanDuration), Now())
FSO.OpenTextFile(DBP & "user_bans\" & LCase(Wie) & ".reason", ForWriting, True).Write Reden
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then

If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@c" & Reden & Chr(1)
If Client(Index).InRoom > 0 Then
sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(a).Hotelpos = "H"
Client(a).InRoom = 0
End If
If Client(Index).Publicnum > 0 Then
sendAllP "@]" & Client(a).Num & Chr(1), (Client(a).Publicnum)
Client(a).Hotelpos = "H"
Client(a).Publicname = ""
Client(a).Publicnum = 0
End If
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " verbannte (:ban x) " & Wie & ", Grund: " & Reden
End If
End If
End If
End If
End If
'ban
'shutup
If InStr(ToSay, ":shutup") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",shutup") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected And RankHeight(Client(Index).Rank, Client(a).Rank) = True Then
Shutup:
Client(a).Muted = True
Stuur = 0
Exit For
End If
Next a
End If
End If
'shutup
'unmute
If InStr(ToSay, ":unmute") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",unmute") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
Client(a).Muted = False
Stuur = 0
Exit For
End If
Next a
End If
End If
'unmute
'roomshutup
If InStr(ToSay, ":roomshutup") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",roomshutup") Then
Stuur = 0
For a = 1 To frmMain.SockI
If ((Client(Index).InRoom > 0 And Client(Index).InRoom = Client(a).InRoom) Or (Client(Index).Publicnum > 0 And Client(Index).Publicnum = Client(a).Publicnum)) And RankHeight(Client(Index).Rank, Client(a).Rank) = True Then
Client(a).Muted = True
Stuur = 0
Exit For
End If
Next a
End If
'roomshutup
'roomunmute
If InStr(ToSay, ":roomunmute") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",roomunmute") Then
Stuur = 0
For a = 1 To frmMain.SockI
If (Client(Index).InRoom > 0 And Client(Index).InRoom = Client(a).InRoom) Or (Client(Index).Publicnum > 0 And Client(Index).Publicnum = Client(a).Publicnum) Then
Client(a).Muted = False
Stuur = 0
End If
Next a
End If
'roomunmute
'superban
If InStr(ToSay, ":superban") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",superban") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
BanDuration = 24 * 4167
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True Then
If RankHeight(Client(Index).Rank, FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\rank.txt", ForReading).ReadAll) = True Then
FSO.OpenTextFile(DBP & "user_bans\" & Wie & ".txt", ForWriting, True).Write DateAdd("h", Val(BanDuration), Now())
FSO.OpenTextFile(DBP & "user_bans\" & Wie & ".reason", ForWriting, True).Write Reden
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@c" & Reden & Chr(1)
If Client(a).InRoom > 0 Then
sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(a).InRoom = 0
End If
If Client(a).Publicnum > 0 Then
sendAllP "@]" & Client(a).Num & Chr(1), (Client(a).Publicnum)
Client(a).Publicnum = 0
Client(a).Publicname = ""
End If
Client(a).Hotelpos = "H"
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " bannte " & Wie & " für 2 Stunden, Grund: " & Reden
End If
End If
End If
End If
End If
'superban
'voucher
If InStr(ToSay, ":voucher") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",voucher") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
    FSO.OpenTextFile(DBP & "vouchers\" & Wie & ".txt", ForWriting, True).Write Reden
    Send Index, "BK" & locale("following_code_cmd_msg") & Chr(13) & locale("code") & " " & Wie & Chr(13) & locale("amount_code_msg") & " " & Reden & Chr(1)
    'Printlog Client(index).name & " erstellte einen Talercode mit " & Reden & " Talern"
End If
End If
End If
'voucher
'whosonline
If InStr(ToSay, ":whosonline") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",whosonline") Then
Stuur = 0
HabboList = ""
HabboList2 = ""
HabboCount = 0
BlockedIPs = ""
For a = 1 To frmMain.SockI
If frmMain.socket(a).State = sckConnected And Client(a).Name <> "" Then
    If InStr(BlockedIPs, frmMain.socket(a).RemoteHostIP) Then GoTo NextA
    If HabboCount <= 30 Then HabboList = HabboList & "<br>" & Client(a).Name & "  " & frmMain.socket(a).RemoteHostIP Else HabboList2 = HabboList2 & "<br>" & Client(a).Name & "  " & frmMain.socket(a).RemoteHostIP
    HabboCount = HabboCount + 1
    For b = 1 To frmMain.SockI
        If frmMain.socket(a).RemoteHostIP = frmMain.socket(b).RemoteHostIP And a <> b And frmMain.socket(b).State = sckConnected And Client(b).Name <> "" Then
            If HabboCount <= 30 Then HabboList = HabboList & "<br>" & Client(b).Name & "  " & frmMain.socket(b).RemoteHostIP Else HabboList2 = HabboList2 & "<br>" & Client(b).Name & "  " & frmMain.socket(b).RemoteHostIP
            HabboCount = HabboCount + 1
        End If
    Next b
    BlockedIPs = BlockedIPs & frmMain.socket(a).RemoteHostIP & ","
End If
NextA:
Next a

Send Index, "BK" & HabboCount & " users online:" & HabboList & Chr(1)
If HabboCount > 30 Then Send Index, "BK" & HabboCount & " users online:" & HabboList2 & Chr(1)
Stuur = 0
End If
'whosonline
'credits
If InStr(ToSay, ":credits") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",credits") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True Then
credits = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForReading).ReadAll)
credits = credits + Val(Reden)
FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForWriting).Write credits
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\transactions.txt", ForAppending, True).Write Format(Date, "dd-mm-yyyy") & Chr(9) & Format(Time, "hh:mm") & Chr(9) & Reden & Chr(9) & "0" & Chr(9) & Chr(9) & "web_internal" & Chr(13)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@F" & credits & ".0" & Chr(1)
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " gab " & Wie & " " & Reden & " Taler(:credits)"
End If
End If
End If
End If
'credits
'takecredits
If InStr(ToSay, ":takecredits") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",takecredits") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True Then
credits = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForReading).ReadAll)
credits = credits - Val(Reden)
If credits < 0 Then credits = 0
FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForWriting).Write credits
FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\transactions.txt", ForAppending, True).Write Format(Date, "dd-mm-yyyy") & Chr(9) & Format(Time, "hh:mm") & Chr(9) & "-" & Reden & Chr(9) & "0" & Chr(9) & Chr(9) & "web_internal" & Chr(13)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@F" & credits & ".0" & Chr(1)
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " gab " & Wie & " " & Reden & " Taler(:credits)"
End If
End If
End If
End If
'takecredits
'hotelalert
If InStr(ToSay, ":hotelalert") = 1 Or InStr(ToSay, ":ha") = 1 Then
If InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",hotelalert") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
For a = 1 To frmMain.SockI

If frmMain.socket(a).State = sckConnected Then If Client(a).Name <> "" Then If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "BK" & locale("hotel_alert") & ":<br>" & Wie & Chr(1)

Stuur = 0
Next a
'Printlog Client(index).name & " sendete Hotelalert: " & Wie
End If
End If
End If
'hotelalert
'userdata
If InStr(ToSay, ":userdata") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",userdata") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True And RankHeight(Client(Index).Rank, FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\rank.txt", ForReading).ReadAll) = True Then
    udName = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\name.txt", ForReading).ReadAll
    udBirth = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\birth.txt", ForReading).ReadAll
    udPass = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\pass.txt", ForReading).ReadAll
    udCredits = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForReading).ReadAll
    udRank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\rank.txt", ForReading).ReadAll
    udMissi = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\mission.txt", ForReading).ReadAll
    Send Index, "BK" & locale("userdata_daten_von") & " " & udName & ": <br>" & locale("userdata_birthdate") & " " & udBirth & "<br>" & locale("userdata_password") & " " & udPass & "<br>" & locale("userdata_rank") & " " & udRank & "<br>" & locale("userdata_credits") & " " & udCredits & "<br>" & locale("userdata_mission") & " " & udMissi & Chr(1)
Else
    Send Index, "BK" & locale("user_not_found") & Chr(1)
End If
End If
End If
'userdata
'givebadge
If InStr(ToSay, ":givebadge") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",givebadge") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
If Len(Reden) = 3 Then
For a = 1 To frmMain.SockI
    If LCase(Client(a).Name) = LCase(Wie) Then
        If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForReading).AtEndOfStream = True Then FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForWriting).Write ";"
        Badges = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForReading).ReadAll
        Badge = Split(Badges, ";")
        BdgList = ""
        For b = 0 To UBound(Badge)
            If Len(Badge(b)) = 3 Then
                BdgList = BdgList & ";" & Badge(b)
            End If
        Next b
        If Left(BdgList, 1) = ";" And Len(BdgList) > 1 Then BdgList = Mid(BdgList, 2)
        If InStr(BdgList, Reden) = 0 Then
        BdgList = BdgList & ";" & Reden
        End If
        FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForWriting).Write BdgList
    End If
Next a
'Printlog Client(index).name & " gab " & Wie & " den Badge: " & Reden
End If
End If
End If
End If
'givebadge
'takebadge
If InStr(ToSay, ":takebadge") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",takebadge") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
If Len(Reden) = 3 Then
For a = 1 To frmMain.SockI
    If LCase(Client(a).Name) = LCase(Wie) Then
        If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForReading).AtEndOfStream = True Then FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForWriting).Write ";"
        Badges = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForReading).ReadAll
        Badge = Split(Badges, ";")
        BdgList = ""
        For b = 0 To UBound(Badge)
            If Len(Badge(b)) = 3 Then
                BdgList = BdgList & ";" & Badge(b)
            End If
        Next b
        If InStr(BdgList, Reden) Then
            BdgList = Replace(BdgList, Reden, "")
        End If
        If Left(BdgList, 1) = ";" And Len(BdgList) > 1 Then BdgList = Mid(BdgList, 2)
        FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForWriting).Write BdgList
    End If
Next a
'Printlog Client(index).name & " nahm " & Wie & " den Badge: " & Reden
End If
End If
End If
End If
'takebadge
'deleteroom
If InStr(ToSay, ":deleteroom") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",deleteroom") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If FSO.FolderExists(DBP & "privaterooms\" & Wie) = True And FSO.FileExists(DBP & "privaterooms\" & Wie & "\deleted.txt") = False Then
    RoomOwner = LCase(FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\owner.txt", ForReading).ReadAll)
    If FSO.FolderExists(DBP & "habbos\" & RoomOwner) = True Then
        RoomList = FSO.OpenTextFile(DBP & "habbos\" & RoomOwner & "\roomlist.txt", ForReading).ReadAll
        RoomList = Replace(RoomList, "<" & Wie & ">", "")
        FSO.OpenTextFile(DBP & "habbos\" & RoomOwner & "\roomlist.txt", ForWriting).Write RoomList
        OwnCount = Val(FSO.OpenTextFile(DBP & "habbos\" & RoomOwner & "\rooms.txt", ForReading).ReadAll)
        FSO.OpenTextFile(DBP & "habbos\" & RoomOwner & "\rooms.txt", ForWriting).Write OwnCount - 1
        FSO.CreateTextFile DBP & "privaterooms\" & Wie & "\deleted.txt"
        'Printlog Client(index).name & " löschte den Raum " & Wie & " von: " & RoomOwner
    End If
End If
End If
End If
'deleteroom
'unban
If InStr(ToSay, ":unban") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",unban") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
    If FSO.FileExists(DBP & "user_bans\" & Wie & ".txt") = True Then FSO.DeleteFile (DBP & "user_bans\" & Wie & ".txt")
    If FSO.FileExists(DBP & "user_bans\" & Wie & ".reason") = True Then FSO.DeleteFile (DBP & "user_bans\" & Wie & ".reason")
    Send Index, "BK" & locale("user_unbanned") & Chr(1)
    'Printlog Client(index).name & " entbannte " & Wie
End If
End If
'unban
'closeroom
If InStr(ToSay, ":closeroom") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",closeroom") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
    If FSO.FolderExists(DBP & "privaterooms\" & Wie) Then
    If FSO.FileExists(DBP & "privaterooms\" & Wie & "\deleted.txt") = False And FSO.FileExists(DBP & "privaterooms\" & Wie & "\adminlock.txt") = False Then
        FSO.CreateTextFile (DBP & "privaterooms\" & Wie & "\adminlock.txt")
        FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\name.txt", ForWriting).Write locale("this_room_is_locked")
        FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\opentype.txt", ForWriting).Write "closed"
        Send Index, "BK" & locale("room_locked") & Chr(1)
        'Printlog Client(index).name & " schloss den Raum " & Wie
    End If
    End If
End If
End If
'closeroom
'openroom
If InStr(ToSay, ":openroom") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",openroom") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
    If FSO.FolderExists(DBP & "privaterooms\" & Wie) Then
    If FSO.FileExists(DBP & "privaterooms\" & Wie & "\deleted.txt") = False And FSO.FileExists(DBP & "privaterooms\" & Wie & "\adminlock.txt") = True Then
        FSO.DeleteFile (DBP & "privaterooms\" & Wie & "\adminlock.txt")
        FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\name.txt", ForWriting).Write "Room " & Wie
        FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\opentype.txt", ForWriting).Write "open"
        Send Index, "BK" & locale("room_unlocked") & Chr(1)
        'Printlog Client(index).name & " öffnete den Raum " & Wie
    End If
    End If
End If
End If
'openroom
'ADMIN MOD etc commands

saynow:
If Stuur = 1 Then
If Stuur = 1 And Client(Index).Muted = False Then
If Client(Index).InRoom > 0 Then sendAll "@X" & VL64encode(Client(Index).Num) & ToSay & Chr(2) & Chr(1), (Client(Index).InRoom)
If Client(Index).Publicnum > 0 Then
    sendAllP "@X" & VL64encode(Client(Index).Num) & ToSay & Chr(2) & Chr(1), (Client(Index).Publicnum)
    CheckBotsReaction Index, ToSay
End If
For a = 1 To frmMain.SockI
    If ((Client(Index).InRoom > 0 And Client(a).InRoom = Client(Index).InRoom) Or (Client(Index).Publicnum > 0 And Client(a).Publicnum = Client(Index).Publicnum)) And a <> Index Then
        NuX = Client(a).PosX
        NuY = Client(a).PosY
        NaarX = Client(Index).PosX
        NaarY = Client(Index).PosY
        If Right(Client(a).Look, 1) = "2" Then
            If NuX <= NaarX And NuY < NaarY Then
                Client(a).Look = "3,2"
            ElseIf NuX <= NaarX And NuY > NaarY Then
                Client(a).Look = "5,2"
            ElseIf NuX < NaarX And NuY = NaarY Then
                Client(a).Look = "2,2"
            End If
        ElseIf Right(Client(a).Look, 1) = "4" Then
            If NuX > NaarX And NuY <= NaarY Then
                Client(a).Look = "5,4"
            ElseIf NuX < NaarX And NuY <= NaarY Then
                Client(a).Look = "3,4"
            ElseIf NuX = NaarX And NuY < NaarY Then
                Client(a).Look = "4,4"
            End If
        ElseIf Right(Client(a).Look, 1) = "6" Then
            If NuX >= NaarX And NuY > NaarY Then
                Client(a).Look = "5,6"
            ElseIf NuX >= NaarX And NuY < NaarY Then
                Client(a).Look = "7,6"
            ElseIf NuX > NaarX And NuY = NaarY Then
                Client(a).Look = "6,6"
            End If
        ElseIf Right(Client(a).Look, 1) = "0" Then
            If NuX > NaarX And NuY >= NaarY Then
                Client(a).Look = "9,0"
            ElseIf NuX < NaarX And NuY >= NaarY Then
                Client(a).Look = "1,0"
            ElseIf NuX = NaarX And NuY > NaarY Then
                Client(a).Look = "0,0"
            End If
        Else
            GoTo nxtb
        End If
        Client(a).Update = True
    End If
nxtb:
Next a
End If

frmMain.TimerGesture(Index).Enabled = False
Client(Index).Gesture = ""

If InStr(ToSay, ":)") Or InStr(ToSay, ":D") Or InStr(ToSay, ":-)") Or InStr(ToSay, ";)") Then
Client(Index).Gesture = "sml"
frmMain.TimerGesture(Index).Enabled = True
End If
If InStr(ToSay, ":o") Or InStr(ToSay, ":O") Then
Client(Index).Gesture = "srp"
frmMain.TimerGesture(Index).Enabled = True
End If
If InStr(ToSay, ":(") Or InStr(ToSay, ":'(") Or InStr(ToSay, ":-(") Or InStr(ToSay, ":'-(") Then
Client(Index).Gesture = "sad"
frmMain.TimerGesture(Index).Enabled = True
End If
If InStr(ToSay, ">:(") Or InStr(ToSay, ">:-(") Or InStr(ToSay, ":-@") Or InStr(ToSay, ":@") Then
Client(Index).Gesture = "agr"
frmMain.TimerGesture(Index).Enabled = True
End If

Tijd = Len(ToSay) * 100
If Tijd < 500 Then Tijd = 500
Client(Index).Talking = True
frmMain.TimerTalk(Index).Interval = Tijd
frmMain.TimerTalk(Index).Enabled = True
Client(Index).Update = True
End If

If frmMain.chkChatlog.Value = 1 Then
    frmMain.chatLog.Text = frmMain.chatLog.Text + vbCrLf + "[" & Client(Index).Name & "] ›› " & ToSay
    frmMain.chatLog.SelStart = Len(frmMain.chatLog.Text)
End If
If frmMain.chkSaveChatLog.Value = 1 Then
    If FSO.FolderExists(App.Path & "\chatlogs") = False Then FSO.CreateFolder App.Path & "\chatlogs"
    If FSO.FileExists(App.Path & "\chatlogs\" & Date & ".log") = False Then
        FSO.CreateTextFile (App.Path & "\chatlogs\" & Date & ".log")
        FSO.OpenTextFile(App.Path & "\chatlogs\" & Date & ".log", ForWriting).Write "## " & Date & " ##" & vbCrLf
    End If
    FSO.OpenTextFile(App.Path & "\chatlogs\" & Date & ".log", ForAppending).Write Client(Index).Name & ": " & ToSay & vbCrLf
End If
End Function

Public Function Hab_Atx2(info As String, Index As Integer)
Dim Saylen As String
Dim Saylenn As Integer
Saylen = Mid(info, 3, 2)
Saylenn = Decode(Saylen)
ToSay = Mid(info, 5, Saylenn)
ToSay = Replace(ToSay, Chr(1), " ")
ToSay = Replace(ToSay, Chr(2), " ")
ToSay = Replace(ToSay, Mid(vbCrLf, 1, 1), "")
ToSay = Replace(ToSay, Mid(vbCrLf, 2, 1), "")
If ReadINI("config", "bobba_filter", SettingIni) = "1" Then ToSay = Filter(ToSay)

Stuur = 1

'about (incase someone steals the server)
If InStr(ToSay, ":about") = 1 Then
Stuur = 0
Send Index, "BK" & "#  #  ####<br>#  #  #   #<br>#  #  ####<br>#  #      #<br> ##    ###<br># SERVER #<br>By: USA111 (REKORDI)<br>Version: " & App.Major & "." & App.Minor & "." & App.Revision & Chr(1)
End If
'about (incase someone steals the server)

'ADMIN MOD etc commands
Client(Index).Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll
'commands
If InStr(ToSay, ":commands") = 1 Then
Stuur = 0
Commands = Split(":kick name reason " & Chr(13) & ":alert name message " & Chr(13) & ":ban name reason " & Chr(13) & ":shutup name " & Chr(13) & ":unmute name " & Chr(13) & ":roomshutup " & Chr(13) & ":roomunmute " & Chr(13) & ":superban name reason " & Chr(13) & ":voucher code amount " & Chr(13) & ":whosonline " & Chr(13) & ":credits name amount " & Chr(13) & ":takecredits name amount " & Chr(13) & ":hotelalert message / :ha message " & Chr(13) & ":userdata " & Chr(13) & ":givebadge name badgecode " & Chr(13) & ":takebadge name badgecode " & Chr(13) & ":deleteroom id " & Chr(13) & ":unban name " & Chr(13) & ":closeroom id " & Chr(13) & ":openroom id " & Chr(13), Chr(13))
Speechcom = ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini")
Speechcmds = ""
For a = 0 To UBound(Commands)
    If Len(Commands(a)) > 1 Then
        If InStr(Speechcom, Replace(Split(Commands(a), " ")(0), ":", ",")) <> 0 Then
            Speechcmds = Speechcmds & Commands(a) & Chr(13)
        End If
    End If
Next a
If Speechcmds <> "" Then
    Send Index, "BKYour speechs:" & Chr(13) & Speechcmds & Chr(1)
Else
    Stuur = 1
End If
End If
'commands
Usercom = Split(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",")
For b = 1 To UBound(Usercom)
If InStr(ToSay, ":" & Usercom(b)) = 1 Then GoTo IGC
Next b
GoTo saynow
IGC:
'kick
If InStr(ToSay, ":kick") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",kick") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
End If
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And RankHeight(Client(Index).Rank, Client(a).Rank) = True Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@R" & Chr(1)
If Reden <> "" Then If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@amod_warn/" & Reden & Chr(1)
If Client(Index).InRoom > 0 Then
sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(a).Hotelpos = "I" & locale("hotel_view")
Client(a).InRoom = 0
Client(a).Muted = False
End If
If Client(Index).Publicnum > 0 Then
sendAllP "@]" & Client(a).Num & Chr(1), (Client(a).Publicnum)
Client(a).Hotelpos = "I" & locale("hotel_view")
Client(a).Publicname = ""
Client(a).Publicnum = 0
Client(a).Muted = False
End If
Stuur = 0
End If
Next a
'Printlog Client(index).name & " kickte (:kick x): " & Wie
End If
End If
'kick
'alert
If InStr(ToSay, ":alert") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",alert") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@amod_warn/" & Reden & Chr(1)
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " sendete Alert (:alert x) an " & Wie & " Inhalt: " & Reden
End If
End If
End If
'alert
'ban
If InStr(ToSay, ":ban") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",ban") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
BanDuration = 24
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True Then
If RankHeight(Client(Index).Rank, FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\rank.txt", ForReading).ReadAll) = True Then
FSO.OpenTextFile(DBP & "user_bans\" & LCase(Wie) & ".txt", ForWriting, True).Write DateAdd("h", Val(BanDuration), Now())
FSO.OpenTextFile(DBP & "user_bans\" & LCase(Wie) & ".reason", ForWriting, True).Write Reden
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then

If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@c" & Reden & Chr(1)
If Client(Index).InRoom > 0 Then
sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(a).Hotelpos = "H"
Client(a).InRoom = 0
End If
If Client(Index).Publicnum > 0 Then
sendAllP "@]" & Client(a).Num & Chr(1), (Client(a).Publicnum)
Client(a).Hotelpos = "H"
Client(a).Publicname = ""
Client(a).Publicnum = 0
End If
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " verbannte (:ban x) " & Wie & ", Grund: " & Reden
End If
End If
End If
End If
End If
'ban
'shutup
If InStr(ToSay, ":shutup") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",shutup") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected And RankHeight(Client(Index).Rank, Client(a).Rank) = True Then
Shutup:
Client(a).Muted = True
Stuur = 0
Exit For
End If
Next a
End If
End If
'shutup
'unmute
If InStr(ToSay, ":unmute") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",unmute") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
Client(a).Muted = False
Stuur = 0
Exit For
End If
Next a
End If
End If
'unmute
'roomshutup
If InStr(ToSay, ":roomshutup") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",roomshutup") Then
Stuur = 0
For a = 1 To frmMain.SockI
If ((Client(Index).InRoom > 0 And Client(Index).InRoom = Client(a).InRoom) Or (Client(Index).Publicnum > 0 And Client(Index).Publicnum = Client(a).Publicnum)) And RankHeight(Client(Index).Rank, Client(a).Rank) = True Then
Client(a).Muted = True
Stuur = 0
Exit For
End If
Next a
End If
'roomshutup
'roomunmute
If InStr(ToSay, ":roomunmute") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",roomunmute") Then
Stuur = 0
For a = 1 To frmMain.SockI
If (Client(Index).InRoom > 0 And Client(Index).InRoom = Client(a).InRoom) Or (Client(Index).Publicnum > 0 And Client(Index).Publicnum = Client(a).Publicnum) Then
Client(a).Muted = False
Stuur = 0
End If
Next a
End If
'roomunmute
'superban
If InStr(ToSay, ":superban") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",superban") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
BanDuration = 24 * 4167
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True Then
If RankHeight(Client(Index).Rank, FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\rank.txt", ForReading).ReadAll) = True Then
FSO.OpenTextFile(DBP & "user_bans\" & Wie & ".txt", ForWriting, True).Write DateAdd("h", Val(BanDuration), Now())
FSO.OpenTextFile(DBP & "user_bans\" & Wie & ".reason", ForWriting, True).Write Reden
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@c" & Reden & Chr(1)
If Client(a).InRoom > 0 Then
sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(a).InRoom = 0
End If
If Client(a).Publicnum > 0 Then
sendAllP "@]" & Client(a).Num & Chr(1), (Client(a).Publicnum)
Client(a).Publicnum = 0
Client(a).Publicname = ""
End If
Client(a).Hotelpos = "H"
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " bannte " & Wie & " für 2 Stunden, Grund: " & Reden
End If
End If
End If
End If
End If
'superban
'voucher
If InStr(ToSay, ":voucher") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",voucher") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
    FSO.OpenTextFile(DBP & "vouchers\" & Wie & ".txt", ForWriting, True).Write Reden
    Send Index, "BK" & locale("following_code_cmd_msg") & Chr(13) & locale("code") & " " & Wie & Chr(13) & locale("amount_code_msg") & " " & Reden & Chr(1)
    'Printlog Client(index).name & " erstellte einen Talercode mit " & Reden & " Talern"
End If
End If
End If
'voucher
'whosonline
If InStr(ToSay, ":whosonline") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",whosonline") Then
Stuur = 0
HabboList = ""
HabboList2 = ""
HabboCount = 0
BlockedIPs = ""
For a = 1 To frmMain.SockI
If frmMain.socket(a).State = sckConnected And Client(a).Name <> "" Then
    If InStr(BlockedIPs, frmMain.socket(a).RemoteHostIP) Then GoTo NextA
    If HabboCount <= 30 Then HabboList = HabboList & "<br>" & Client(a).Name & "  " & frmMain.socket(a).RemoteHostIP Else HabboList2 = HabboList2 & "<br>" & Client(a).Name & "  " & frmMain.socket(a).RemoteHostIP
    HabboCount = HabboCount + 1
    For b = 1 To frmMain.SockI
        If frmMain.socket(a).RemoteHostIP = frmMain.socket(b).RemoteHostIP And a <> b And frmMain.socket(b).State = sckConnected And Client(b).Name <> "" Then
            If HabboCount <= 30 Then HabboList = HabboList & "<br>" & Client(b).Name & "  " & frmMain.socket(b).RemoteHostIP Else HabboList2 = HabboList2 & "<br>" & Client(b).Name & "  " & frmMain.socket(b).RemoteHostIP
            HabboCount = HabboCount + 1
        End If
    Next b
    BlockedIPs = BlockedIPs & frmMain.socket(a).RemoteHostIP & ","
End If
NextA:
Next a

Send Index, "BK" & HabboCount & " users online:" & HabboList & Chr(1)
If HabboCount > 30 Then Send Index, "BK" & HabboCount & " users online:" & HabboList2 & Chr(1)
Stuur = 0
End If
'whosonline
'credits
If InStr(ToSay, ":credits") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",credits") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True Then
credits = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForReading).ReadAll)
credits = credits + Val(Reden)
FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForWriting).Write credits
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\transactions.txt", ForAppending, True).Write Format(Date, "dd-mm-yyyy") & Chr(9) & Format(Time, "hh:mm") & Chr(9) & Reden & Chr(9) & "0" & Chr(9) & Chr(9) & "web_internal" & Chr(13)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@F" & credits & ".0" & Chr(1)
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " gab " & Wie & " " & Reden & " Taler(:credits)"
End If
End If
End If
End If
'credits
'takecredits
If InStr(ToSay, ":takecredits") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",takecredits") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True Then
credits = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForReading).ReadAll)
credits = credits - Val(Reden)
If credits < 0 Then credits = 0
FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForWriting).Write credits
FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\transactions.txt", ForAppending, True).Write Format(Date, "dd-mm-yyyy") & Chr(9) & Format(Time, "hh:mm") & Chr(9) & "-" & Reden & Chr(9) & "0" & Chr(9) & Chr(9) & "web_internal" & Chr(13)
For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@F" & credits & ".0" & Chr(1)
Stuur = 0
Exit For
End If
Next a
'Printlog Client(index).name & " gab " & Wie & " " & Reden & " Taler(:credits)"
End If
End If
End If
End If
'takecredits
'hotelalert
If InStr(ToSay, ":hotelalert") = 1 Or InStr(ToSay, ":ha") = 1 Then
If InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",hotelalert") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
For a = 1 To frmMain.SockI

If frmMain.socket(a).State = sckConnected Then If Client(a).Name <> "" Then If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "BK" & locale("hotel_alert") & ":<br>" & Wie & Chr(1)

Stuur = 0
Next a
'Printlog Client(index).name & " sendete Hotelalert: " & Wie
End If
End If
End If
'hotelalert
'userdata
If InStr(ToSay, ":userdata") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",userdata") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If FSO.FolderExists(DBP & "habbos\" & LCase(Wie)) = True And RankHeight(Client(Index).Rank, FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\rank.txt", ForReading).ReadAll) = True Then
    udName = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\name.txt", ForReading).ReadAll
    udBirth = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\birth.txt", ForReading).ReadAll
    udPass = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\pass.txt", ForReading).ReadAll
    udCredits = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\credits.txt", ForReading).ReadAll
    udRank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\rank.txt", ForReading).ReadAll
    udMissi = FSO.OpenTextFile(DBP & "habbos\" & LCase(Wie) & "\mission.txt", ForReading).ReadAll
    Send Index, "BK" & locale("userdata_daten_von") & " " & udName & ": <br>" & locale("userdata_birthdate") & " " & udBirth & "<br>" & locale("userdata_password") & " " & udPass & "<br>" & locale("userdata_rank") & " " & udRank & "<br>" & locale("userdata_credits") & " " & udCredits & "<br>" & locale("userdata_mission") & " " & udMissi & Chr(1)
Else
    Send Index, "BK" & locale("user_not_found") & Chr(1)
End If
End If
End If
'userdata
'givebadge
If InStr(ToSay, ":givebadge") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",givebadge") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
If Len(Reden) = 3 Then
For a = 1 To frmMain.SockI
    If LCase(Client(a).Name) = LCase(Wie) Then
        If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForReading).AtEndOfStream = True Then FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForWriting).Write ";"
        Badges = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForReading).ReadAll
        Badge = Split(Badges, ";")
        BdgList = ""
        For b = 0 To UBound(Badge)
            If Len(Badge(b)) = 3 Then
                BdgList = BdgList & ";" & Badge(b)
            End If
        Next b
        If Left(BdgList, 1) = ";" And Len(BdgList) > 1 Then BdgList = Mid(BdgList, 2)
        If InStr(BdgList, Reden) = 0 Then
        BdgList = BdgList & ";" & Reden
        End If
        FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForWriting).Write BdgList
    End If
Next a
'Printlog Client(index).name & " gab " & Wie & " den Badge: " & Reden
End If
End If
End If
End If
'givebadge
'takebadge
If InStr(ToSay, ":takebadge") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",takebadge") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If InStr(Wie, " ") Then
Reden = Mid(Wie, InStr(Wie, " ") + 1)
Wie = Mid(Wie, 1, InStr(Wie, " ") - 1)
If Len(Reden) = 3 Then
For a = 1 To frmMain.SockI
    If LCase(Client(a).Name) = LCase(Wie) Then
        If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForReading).AtEndOfStream = True Then FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForWriting).Write ";"
        Badges = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForReading).ReadAll
        Badge = Split(Badges, ";")
        BdgList = ""
        For b = 0 To UBound(Badge)
            If Len(Badge(b)) = 3 Then
                BdgList = BdgList & ";" & Badge(b)
            End If
        Next b
        If InStr(BdgList, Reden) Then
            BdgList = Replace(BdgList, Reden, "")
        End If
        If Left(BdgList, 1) = ";" And Len(BdgList) > 1 Then BdgList = Mid(BdgList, 2)
        FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\badges.txt", ForWriting).Write BdgList
    End If
Next a
'Printlog Client(index).name & " nahm " & Wie & " den Badge: " & Reden
End If
End If
End If
End If
'takebadge
'deleteroom
If InStr(ToSay, ":deleteroom") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",deleteroom") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
If FSO.FolderExists(DBP & "privaterooms\" & Wie) = True And FSO.FileExists(DBP & "privaterooms\" & Wie & "\deleted.txt") = False Then
    RoomOwner = LCase(FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\owner.txt", ForReading).ReadAll)
    If FSO.FolderExists(DBP & "habbos\" & RoomOwner) = True Then
        RoomList = FSO.OpenTextFile(DBP & "habbos\" & RoomOwner & "\roomlist.txt", ForReading).ReadAll
        RoomList = Replace(RoomList, "<" & Wie & ">", "")
        FSO.OpenTextFile(DBP & "habbos\" & RoomOwner & "\roomlist.txt", ForWriting).Write RoomList
        OwnCount = Val(FSO.OpenTextFile(DBP & "habbos\" & RoomOwner & "\rooms.txt", ForReading).ReadAll)
        FSO.OpenTextFile(DBP & "habbos\" & RoomOwner & "\rooms.txt", ForWriting).Write OwnCount - 1
        FSO.CreateTextFile DBP & "privaterooms\" & Wie & "\deleted.txt"
        'Printlog Client(index).name & " löschte den Raum " & Wie & " von: " & RoomOwner
    End If
End If
End If
End If
'deleteroom
'unban
If InStr(ToSay, ":unban") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",unban") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
    If FSO.FileExists(DBP & "user_bans\" & Wie & ".txt") = True Then FSO.DeleteFile (DBP & "user_bans\" & Wie & ".txt")
    If FSO.FileExists(DBP & "user_bans\" & Wie & ".reason") = True Then FSO.DeleteFile (DBP & "user_bans\" & Wie & ".reason")
    Send Index, "BK" & locale("user_unbanned") & Chr(1)
    'Printlog Client(index).name & " entbannte " & Wie
End If
End If
'unban
'closeroom
If InStr(ToSay, ":closeroom") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",closeroom") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
    If FSO.FolderExists(DBP & "privaterooms\" & Wie) Then
    If FSO.FileExists(DBP & "privaterooms\" & Wie & "\deleted.txt") = False And FSO.FileExists(DBP & "privaterooms\" & Wie & "\adminlock.txt") = False Then
        FSO.CreateTextFile (DBP & "privaterooms\" & Wie & "\adminlock.txt")
        FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\name.txt", ForWriting).Write locale("this_room_is_locked")
        FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\opentype.txt", ForWriting).Write "closed"
        Send Index, "BK" & locale("room_locked") & Chr(1)
        'Printlog Client(index).name & " schloss den Raum " & Wie
    End If
    End If
End If
End If
'closeroom
'openroom
If InStr(ToSay, ":openroom") = 1 And InStr(ReadINI("rank", "speech_cmd", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",openroom") Then
Stuur = 0
If InStr(ToSay, " ") Then
Wie = Mid(ToSay, InStr(ToSay, " ") + 1)
    If FSO.FolderExists(DBP & "privaterooms\" & Wie) Then
    If FSO.FileExists(DBP & "privaterooms\" & Wie & "\deleted.txt") = False And FSO.FileExists(DBP & "privaterooms\" & Wie & "\adminlock.txt") = True Then
        FSO.DeleteFile (DBP & "privaterooms\" & Wie & "\adminlock.txt")
        FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\name.txt", ForWriting).Write "Room " & Wie
        FSO.OpenTextFile(DBP & "privaterooms\" & Wie & "\opentype.txt", ForWriting).Write "open"
        Send Index, "BK" & locale("room_unlocked") & Chr(1)
        'Printlog Client(index).name & " öffnete den Raum " & Wie
    End If
    End If
End If
End If
'openroom
'ADMIN MOD etc commands

saynow:
Send Index, "@Y" & VL64encode(Client(Index).Num) & Mid(ToSay, InStr(ToSay, " ") + 1) & Chr(2) & Chr(1)
If Stuur = 1 Then
For a = 1 To frmMain.SockI
If LCase(Client(a).Name) = LCase(Mid(ToSay, 1, InStr(ToSay, " ") - 1)) And frmMain.socket(a).State = sckConnected Then
If Stuur = 1 And Client(Index).Muted = False Then
    frmMain.socket(a).SendData "@Y" & VL64encode(Client(Index).Num) & Mid(ToSay, InStr(ToSay, " ") + 1) & Chr(2) & Chr(1)
End If
Exit For
End If
Next a
End If

frmMain.TimerGesture(Index).Enabled = False
Client(Index).Gesture = ""

If InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ":)") Or InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ":D") Or InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ":-)") Then
Client(Index).Gesture = "sml"
frmMain.TimerGesture(Index).Enabled = True
End If
If InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ":o") Or InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ":O") Then
Client(Index).Gesture = "srp"
frmMain.TimerGesture(Index).Enabled = True
End If
If InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ":(") Or InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ":'(") Or InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ":-(") Or InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ":'-(") Then
Client(Index).Gesture = "sad"
frmMain.TimerGesture(Index).Enabled = True
End If
If InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ">:(") Or InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ">:-(") Or InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ":-@") Or InStr(Mid(ToSay, InStr(ToSay, " ") + 1), ":@") Then
Client(Index).Gesture = "agr"
frmMain.TimerGesture(Index).Enabled = True
End If

Tijd = Len(Mid(ToSay, InStr(ToSay, " ") + 1)) * 100
If Tijd < 500 Then Tijd = 500
Client(Index).Talking = True
frmMain.TimerTalk(Index).Interval = Tijd
frmMain.TimerTalk(Index).Enabled = True
Client(Index).Update = True

If frmMain.chkChatlog.Value = 1 Then
    frmMain.chatLog.Text = frmMain.chatLog.Text + vbCrLf + "[" & Client(Index).Name & "] ›› " & ToSay
    frmMain.chatLog.SelStart = Len(frmMain.chatLog.Text)
End If
If frmMain.chkSaveChatLog.Value = 1 Then
    If FSO.FolderExists(App.Path & "\chatlogs") = False Then FSO.CreateFolder App.Path & "\chatlogs"
    If FSO.FileExists(App.Path & "\chatlogs\" & Date & ".log") = False Then
        FSO.CreateTextFile (App.Path & "\chatlogs\" & Date & ".log")
        FSO.OpenTextFile(App.Path & "\chatlogs\" & Date & ".log", ForWriting).Write "## " & Date & " ##" & vbCrLf
    End If
    FSO.OpenTextFile(App.Path & "\chatlogs\" & Date & ".log", ForAppending).Write Client(Index).Name & ": " & ToSay & vbCrLf
End If
End Function

Public Function Hab_AA2(info As String, Index As Integer)
If Client(Index).InRoom = 0 Then Exit Function
    Dim Hand() As String
    Hand = Split(FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll, ";")
    HandI = ""
    Cnt = 0
    CurId = 0

    
    If info = "AAnew" Then
    Client(Index).HandPage = 0
    For w = 0 To UBound(Hand)
    If Hand(w) <> "" Then
    If Cnt < 9 Then
    Whatt = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\is.txt", ForReading).ReadAll
    Fname = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\name.txt", ForReading).ReadAll
    FCust = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\cust.txt", ForReading).ReadAll
    If InStr(FCust, "#") <> 0 And InStr(FCust, Chr(30) & Chr(30)) = 0 Then FCust = Mid(FCust, 1, 4) & Chr(30) & Mid(FCust, 5)
    HandI = HandI & "SI" & Chr(30) & Hand(w) & Chr(30) & CurId & Chr(30) & Whatt & Chr(30) & Hand(w) & Chr(30) & Fname & Chr(30) & FCust & "/"
    Cnt = Cnt + 1
    CurId = CurId + 1
    End If
    End If
    Next w
    End If
    
    If info = "AAnext" Then
    Client(Index).HandPage = Client(Index).HandPage + 1
    MoetEerst = Client(Index).HandPage * 9
    For w = 0 To UBound(Hand)
    If Hand(w) <> "" Then
    If MoetEerst = 0 Then
    If Cnt < 9 Then
    Whatt = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\is.txt", ForReading).ReadAll
    Fname = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\name.txt", ForReading).ReadAll
    FCust = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\cust.txt", ForReading).ReadAll
    If InStr(FCust, "#") <> 0 And InStr(FCust, Chr(30) & Chr(30)) = 0 Then FCust = Mid(FCust, 1, 4) & Chr(30) & Mid(FCust, 5)
    HandI = HandI & "SI" & Chr(30) & Hand(w) & Chr(30) & CurId & Chr(30) & Whatt & Chr(30) & Hand(w) & Chr(30) & Fname & Chr(30) & FCust & "/"
    Cnt = Cnt + 1
    CurId = CurId + 1
    End If
    Else
    CurId = CurId + 1
    MoetEerst = MoetEerst - 1
    End If
    End If
    Next w
    End If
    
    If info = "AAprev" Then
    Client(Index).HandPage = Client(Index).HandPage - 1
    If Client(Index).HandPage < 0 Then Client(Index).HandPage = 0
    MoetEerst = Client(Index).HandPage * 9
    For w = 0 To UBound(Hand)
    If Hand(w) <> "" Then
    If MoetEerst = 0 Then
    If Cnt < 9 Then
    Whatt = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\is.txt", ForReading).ReadAll
    Fname = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\name.txt", ForReading).ReadAll
    FCust = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\cust.txt", ForReading).ReadAll
    If InStr(FCust, "#") <> 0 And InStr(FCust, Chr(30) & Chr(30)) = 0 Then FCust = Mid(FCust, 1, 4) & Chr(30) & Mid(FCust, 5)
    HandI = HandI & "SI" & Chr(30) & Hand(w) & Chr(30) & CurId & Chr(30) & Whatt & Chr(30) & Hand(w) & Chr(30) & Fname & Chr(30) & FCust & "/"
    Cnt = Cnt + 1
    CurId = CurId + 1
    End If
    Else
    CurId = CurId + 1
    MoetEerst = MoetEerst - 1
    End If
    End If
    Next w
    End If
    
    If info = "AAupdate" Then
    
    HandTest = Replace(FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll, ";;", ";")
    If Left(HandTest, 1) = ";" Then HandTest = Mid(HandTest, 2)
    If Right(HandTest, 1) = ";" Then HandTest = Mid(HandTest, 1, Len(HandTest) - 1)

    testu = Split(HandTest, ";")

    Handen = Int((UBound(testu) + 1) / 9)

    If (UBound(testu) + 1) - (Handen * 9) > 0 Then Handen = Handen + 1
    
    
    
    If Client(Index).HandPage > Handen - 1 Then Client(Index).HandPage = Handen - 1
    
    

If Client(Index).HandPage < 0 Then Client(Index).HandPage = 0

    MoetEerst = Client(Index).HandPage * 9
    For w = 0 To UBound(Hand)
    If Hand(w) <> "" Then
    If MoetEerst = 0 Then
    If Cnt < 9 Then
    Whatt = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\is.txt", ForReading).ReadAll
    Fname = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\name.txt", ForReading).ReadAll
    FCust = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\cust.txt", ForReading).ReadAll
    If InStr(FCust, "#") <> 0 And InStr(FCust, Chr(30) & Chr(30)) = 0 Then FCust = Mid(FCust, 1, 4) & Chr(30) & Mid(FCust, 5)
    HandI = HandI & "SI" & Chr(30) & Hand(w) & Chr(30) & CurId & Chr(30) & Whatt & Chr(30) & Hand(w) & Chr(30) & Fname & Chr(30) & FCust & "/"
    Cnt = Cnt + 1
    CurId = CurId + 1
    End If
    Else
    CurId = CurId + 1
    MoetEerst = MoetEerst - 1
    End If
    End If
    Next w
    End If
    
        If info = "AAlast" Then
    
    HandTest = Replace(FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll, ";;", ";")
    If Left(HandTest, 1) = ";" Then HandTest = Mid(HandTest, 2)
    If Right(HandTest, 1) = ";" Then HandTest = Mid(HandTest, 1, Len(HandTest) - 1)

    testu = Split(HandTest, ";")

    Handen = Int((UBound(testu) + 1) / 9)

    If (UBound(testu) + 1) - (Handen * 9) > 0 Then Handen = Handen + 1
    
    
    
    Client(Index).HandPage = Handen - 1



    MoetEerst = Client(Index).HandPage * 9
    For w = 0 To UBound(Hand)
    If Hand(w) <> "" Then
    If MoetEerst = 0 Then
    If Cnt < 10 Then
    Whatt = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\is.txt", ForReading).ReadAll
    Fname = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\name.txt", ForReading).ReadAll
    FCust = FSO.OpenTextFile(DBP & "furni\" & Hand(w) & "\cust.txt", ForReading).ReadAll
    If InStr(FCust, "#") <> 0 And InStr(FCust, Chr(30) & Chr(30)) = 0 Then FCust = Mid(FCust, 1, 4) & Chr(30) & Mid(FCust, 5)
    HandI = HandI & "SI" & Chr(30) & Hand(w) & Chr(30) & CurId & Chr(30) & Whatt & Chr(30) & Hand(w) & Chr(30) & Fname & Chr(30) & FCust & "/"
    Cnt = Cnt + 1
    CurId = CurId + 1
    End If
    Else
    CurId = CurId + 1
    MoetEerst = MoetEerst - 1
    End If
    End If
    Next w
    End If
    

    
    Furnis = 0
    For Q = 0 To UBound(Hand)
    If Hand(Q) <> "" Then Furnis = Furnis + 1
    Next Q



    Send Index, "BL" & HandI & Chr(13) & Furnis & Chr(1)
End Function

Public Function Hab_AB(info As String, Index As Integer)

Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\owner.txt").ReadAll

Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll


If Owner = Client(Index).Name Or Rank = "moderator" Or Rank = "admin" Then

Dim NewLijst As String
Dim Lijst2 As String
Dim Lijst() As String

Dim Wat() As String
Wat = Split(info, "/")

If Wat(0) = "ABwallpaper" Then
NewF = FSO.OpenTextFile(DBP & "furni\" & Wat(1) & "\cust.txt", ForReading).ReadAll
sendAll "@nwallpaper/" & NewF & Chr(1), (Client(Index).InRoom)
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\paper.txt", ForWriting).Write NewF


NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll
Lijst = Split(Lijst2, ";")

For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> Wat(1) Then NewLijst = NewLijst & ";" & Lijst(a)
Next a

NewLijst = Replace(NewLijst, ";;", ";")

FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForWriting).Write NewLijst

Hab_AA2 "AAupdate", Index

End If

If Wat(0) = "ABfloor" Then
NewF = FSO.OpenTextFile(DBP & "furni\" & Wat(1) & "\cust.txt", ForReading).ReadAll
sendAll "@nfloor/" & NewF & Chr(1), (Client(Index).InRoom)
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\floor.txt", ForWriting).Write NewF


NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll
Lijst = Split(Lijst2, ";")

For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> Wat(1) Then NewLijst = NewLijst & ";" & Lijst(a)
Next a

NewLijst = Replace(NewLijst, ";;", ";")

FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForWriting).Write NewLijst

Hab_AA2 "AAupdate", Index
End If

End If
End Function

Public Function Hab_AZ(info As String, Index As Integer) 'put down furni

Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\owner.txt").ReadAll
rights = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\rights.txt").ReadAll

If Owner = Client(Index).Name Then Rechten = "ja"
If FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\allrights.txt").ReadAll = "1" Then
Rechten = "ja"
Else
Dim Splitt() As String
Splitt = Split(rights, ";")
For Q = 0 To UBound(Splitt())
If LCase(Splitt(Q)) = LCase(Client(Index).Name) Then
Rechten = "ja"
Exit For
End If
Next Q
End If

If ReadINI("rank", "rights_in_any_room", DBP & "ranks\" & Client(Index).Rank & ".ini") = "1" Then Rechten = "ja"

If Rechten = "ja" Then
Dim FurniData() As String
FurniData() = Split(Mid(info, 3), " ")

FurniID = FurniData(0)
If FSO.OpenTextFile(DBP & "furni\" & FurniID & "\type.txt", ForReading).ReadAll = "roller" Then
Dim RollersInRoom As String
RoomFurni = Split(FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForReading).ReadAll, ";")
RollersInRoom = 0
For a = 0 To UBound(RoomFurni)
    If RoomFurni(a) <> "" Then
        If FSO.OpenTextFile(DBP & "furni\" & RoomFurni(a) & "\type.txt", ForReading).ReadAll = "roller" Then
            RollersInRoom = RollersInRoom + 1
        End If
    End If
Next a
If Val(RollersInRoom) >= Val(ReadINI("config", "maxrollersinroom", SettingIni)) Then
    max_alert = Replace(locale("too_many_rollers_in_room_alert"), "%max%", ReadINI("config", "maxrollersinroom", SettingIni))
    Send Index, "BK" & max_alert & Chr(1)
    Hab_AA2 "AAupdate", Index
    Exit Function
End If
ElseIf FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll = "nest" Then
Dim PetsInRoom As String
RoomFurni = Split(FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForReading).ReadAll, ";")
PetsInRoom = 0
For a = 0 To UBound(RoomFurni)
    If RoomFurni(a) <> "" Then
        If FSO.OpenTextFile(DBP & "furni\" & RoomFurni(a) & "\name.txt", ForReading).ReadAll = "nest" Then
            PetsInRoom = PetsInRoom + 1
        End If
    End If
Next a
If Val(PetsInRoom) >= Val(ReadINI("config", "maxpetsinroom", SettingIni)) Then
    Send Index, "BK" & locale("too_many_pets_in_room_alert") & Chr(1)
    Hab_AA2 "AAupdate", Index
    Exit Function
End If
End If

If FSO.OpenTextFile(DBP & "furni\" & FurniID & "\is.txt", ForReading).ReadAll = "I" Then
Fname = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading, True).ReadAll
If InStr(Fname, "post.it") = 1 Then
Count = Val(FSO.OpenTextFile(DBP & "furni\count.txt", ForReading, True).ReadAll) + 1
FSO.OpenTextFile(DBP & "furni\count.txt", ForWriting).Write Count
FSO.CreateFolder DBP & "furni\" & Count
FSO.CreateTextFile DBP & "furni\" & Count & "\cust.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\inroom.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\is.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\loc.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\name.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\type.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\var.txt"
FSO.OpenTextFile(DBP & "furni\" & Count & "\cust.txt", ForWriting).Write "FFFF33"
FSO.OpenTextFile(DBP & "furni\" & Count & "\inroom.txt", ForWriting).Write 1
FSO.OpenTextFile(DBP & "furni\" & Count & "\is.txt", ForWriting).Write "I"
FSO.OpenTextFile(DBP & "furni\" & Count & "\loc.txt", ForWriting).Write FurniData(1) & " " & FurniData(2) & " " & FurniData(3)
FSO.OpenTextFile(DBP & "furni\" & Count & "\name.txt", ForWriting).Write Fname
FSO.OpenTextFile(DBP & "furni\" & Count & "\var.txt", ForWriting).Write " "
FSO.OpenTextFile(DBP & "furni\" & Count & "\type.txt", ForWriting).Write "poster"
Stickies = Val(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading, True).ReadAll) - 1
FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForWriting).Write Stickies
If Stickies = 0 Then
NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll
Lijst = Split(Lijst2, ";")
For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> FurniID Then NewLijst = NewLijst & ";" & Lijst(a)
Next a
NewLijst = Replace(NewLijst, ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForWriting).Write NewLijst
End If

kamerFurni = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForReading).ReadAll
kamerFurni = Replace(kamerFurni & ";" & Count, ";;", ";")
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForWriting).Write kamerFurni

Fname = FSO.OpenTextFile(DBP & "furni\" & Count & "\name.txt", ForReading).ReadAll
Custt = FSO.OpenTextFile(DBP & "furni\" & Count & "\cust.txt", ForReading).ReadAll
sendAll "Ac" & Count & Chr(1), (Client(Index).InRoom)
sendAll "AS" & Count & Chr(9) & Fname & Chr(9) & " " & Chr(9) & FurniData(1) & " " & FurniData(2) & " " & FurniData(3) & Chr(9) & Custt & Chr(1), (Client(Index).InRoom)
Hab_AA2 "AAupdate", Index

Else
FSO.OpenTextFile(DBP & "furni\" & FurniID & "\loc.txt", ForWriting).Write FurniData(1) & " " & FurniData(2) & " " & FurniData(3)

NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll
Lijst = Split(Lijst2, ";")
For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> FurniID Then NewLijst = NewLijst & ";" & Lijst(a)
Next a
NewLijst = Replace(NewLijst, ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForWriting).Write NewLijst

kamerFurni = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForReading).ReadAll
kamerFurni = Replace(kamerFurni & ";" & FurniID, ";;", ";")
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForWriting).Write kamerFurni

Fname = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll
Custt = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll
sendAll "Ac" & FurniID & Chr(1), (Client(Index).InRoom)
sendAll "AS" & FurniID & Chr(9) & Fname & Chr(9) & " " & Chr(9) & FurniData(1) & " " & FurniData(2) & " " & FurniData(3) & Chr(9) & Custt & Chr(1), (Client(Index).InRoom)
Hab_AA2 "AAupdate", Index
End If
Else
Fx = FurniData(1)
Fy = FurniData(2)
Trf = FurniData(3)
Fot = FurniData(4)
Fif = FurniData(5)

'check if furni has space
Custt = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll
Fname = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll
htmp = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\shtmp.txt").ReadAll
Walkmp = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt").ReadAll

HasSpace = 1
StartHeight = Mid(Split(htmp, Chr(13))(Fy), Fx + 1, 1)

'If FurniData(5) = "1" Then FurniData(3) = 0
'If FurniData(5) = "3" Then FurniData(3) = 2
'If FurniData(5) = "5" Then FurniData(3) = 4
'If FurniData(5) = "7" Then FurniData(3) = 6

Fif = FurniData(5)

Dim Custsplit() As String
Custsplit() = Split(Custt, "")
Dim ForX As Integer, ForY As Integer
If Val(FurniData(5)) = 0 Or Val(FurniData(5)) = 4 Then
BijX = Val(Custsplit(0))
BijY = Val(Custsplit(1))
Else
BijX = Val(Custsplit(1))
BijY = Val(Custsplit(0))
End If


FurniType = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\type.txt", ForReading).ReadAll
Var = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt", ForReading).ReadAll
Name = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll
extpermanent = False
    For ForX = Fx To Fx + BijX - 1
    For ForY = Fy To Fy + BijY - 1
For b = 1 To frmMain.SockI
If Client(b).InRoom = Client(Index).InRoom Then
If Client(b).PosX = ForX And Client(b).PosY = ForY Then
HasSpace = 0
If FurniType = "bed" Then
    If BijX = Val(Custsplit(1)) Then
    If ForX = Fx Then
HasSpace = 1
    End If
    Else
    If ForY = Fy Then
HasSpace = 1
    End If
    End If
End If
If FurniType = "sit" Then HasSpace = 1
If FurniType = "door" And InStr(Var, "O") Then HasSpace = 1
If FurniType = "rug" And Name <> "nest" Then HasSpace = 1
End If
End If
Next b
splitP = Split(frmMain.Hpets, ";")
For b = 0 To UBound(splitP)
If splitP(b) <> "" Then
If Pet(splitP(b)).InRoom = Client(Index).InRoom Then
If Pet(splitP(b)).PosX = ForX And Pet(splitP(b)).PosY = ForY Then
HasSpace = 0
If FurniType = "bed" Then
    If BijX = Val(Custsplit(1)) Then
    If ForX = Fx Then
HasSpace = 1
    End If
    Else
    If ForY = Fy Then
HasSpace = 1
    End If
    End If
End If
If FurniType = "sit" Then HasSpace = 1
If FurniType = "rug" And Name <> "nest" Then HasSpace = 1
If FurniType = "door" And InStr(Var, "O") Then HasSpace = 1
End If
End If
End If
Next b
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "O" Then HasSpace = 0
    If Mid(Split(htmp, Chr(13))(ForY), ForX + 1, 1) <> StartHeight Then HasSpace = 0
    'roller
    If HasSpace = 0 Then
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) = "R" And Custsplit(0) = 1 And Custsplit(1) = 1 And FurniType <> "roller" And ReadINI("furnies", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt") = "" Then
    HasSpace = 1
    StartHeight = StartHeight + 0.4
    End If
    End If
    'roller
    'Stacking
    If FSO.OpenTextFile(DBP & "furni\" & FurniID & "\type.txt", ForReading).ReadAll = "solid" Then
    If ReadINI("furnies", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt") <> "" And Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then
    If extpermanent = True Then GoTo Ext
    If ReadINI("stacked", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt") <> FurniID And ReadINI("stacked", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt") <> FurniID And ReadINI("stacked", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt") <> "" Then
    extpermanent = True
    GoTo Ext
    End If
    FurniOP = ReadINI("furnies", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
    If FSO.FileExists(DBP & "furni\" & FurniOP & "\stack.txt") = True Then
        If FurniOP <> FurniID Then
        HasSpace = 1
        Stacked = 1
        OPF = FurniOP
        Else
        StartHeight = StartHeight + Val(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\height.txt", ForReading).ReadAll)
        Stacked = 0
        End If
    End If
    End If
    End If
Ext:
    'Stacking
    Next ForY
    Next ForX
    If Stacked = 1 Then
        StackHeight = FSO.OpenTextFile(DBP & "furni\" & OPF & "\stack.txt", ForReading).ReadAll
        StartHeight = StartHeight + Val(StackHeight) + Val(FSO.OpenTextFile(DBP & "furni\" & OPF & "\height.txt", ForReading).ReadAll)
    End If
'check if furni has space

If HasSpace = 1 Then
Height = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\height.txt", ForReading).ReadAll
Offset = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\sitheight.txt", ForReading).ReadAll

Dim Walksplit() As String
'chair etc
If FurniType = "sit" Then
Walksplit() = Split(Walkmp, Chr(13))
    For ForX = Fx To Fx + BijX - 1
    For ForY = Fy To Fy + BijY - 1
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "S" & Mid(Walksplit(ForY), ForX + 2)
    WriteINI "rotation", ForX & "," & ForY, FurniData(5) & "," & FurniData(5), DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    WriteINI "offset", ForX & "," & ForY, Offset, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    Next ForY
    Next ForX
Walkmp = Join(Walksplit(), Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
End If
'chair etc
'bed etc
If FurniType = "bed" Then
Walksplit() = Split(Walkmp, Chr(13))
    For ForX = Fx To Fx + BijX - 1
    For ForY = Fy To Fy + BijY - 1
    If BijX = Val(Custsplit(1)) Then
    If ForX = Fx Then
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "L" & Mid(Walksplit(ForY), ForX + 2)
    Else
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
    End If
    Else
    If ForY = Fy Then
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "L" & Mid(Walksplit(ForY), ForX + 2)
    Else
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
    End If
    End If
    WriteINI "rotation", ForX & "," & ForY, FurniData(5) & "," & FurniData(5), DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    WriteINI "offset", ForX & "," & ForY, Offset, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    Next ForY
    Next ForX
Walkmp = Join(Walksplit(), Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
End If
'bed etc
'sold things
If FurniType = "solid" Then
Walksplit() = Split(Walkmp, Chr(13))
    For ForX = Fx To Fx + BijX - 1
    For ForY = Fy To Fy + BijY - 1
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
    If Stacked = 1 Then
        OldTop = ReadINI("furnies", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
        WriteINI "stacked", ForX & "," & ForY, OldTop, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
        WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    Else
        WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    End If
    Next ForY
    Next ForX
Walkmp = Join(Walksplit(), Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
End If
'solid things
'rugs etc
If FurniType = "rug" Then
Walksplit() = Split(Walkmp, Chr(13))
    For ForX = Fx To Fx + BijX - 1
    For ForY = Fy To Fy + BijY - 1
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "O" & Mid(Walksplit(ForY), ForX + 2)
    WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    Next ForY
    Next ForX
Walkmp = Join(Walksplit(), Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
End If
'rugs etc
'rollers
If FurniType = "roller" Then
Walksplit() = Split(Walkmp, Chr(13))
    For ForX = Fx To Fx + BijX - 1
    For ForY = Fy To Fy + BijY - 1
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "R" & Mid(Walksplit(ForY), ForX + 2)
    Next ForY
    Next ForX
Walkmp = Join(Walksplit(), Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
End If
'rollers
'doors
If FurniType = "door" Then
Walksplit() = Split(Walkmp, Chr(13))
    For ForX = Fx To Fx + BijX - 1
    For ForY = Fy To Fy + BijY - 1
    If InStr(Var, "O") Then
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "D" & Mid(Walksplit(ForY), ForX + 2)
    Else
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
    End If
    WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    Next ForY
    Next ForX
Walkmp = Join(Walksplit(), Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
End If
'doors

StartHeight = Replace(StartHeight, ",", ".")
If InStr(StartHeight, ".") = 0 Then StartHeight = StartHeight & ".0"

FSO.OpenTextFile(DBP & "furni\" & FurniID & "\loc.txt", ForWriting).Write Fx & " " & Fy & " " & FurniData(5)
FSO.OpenTextFile(DBP & "furni\" & FurniID & "\height.txt", ForWriting).Write StartHeight
FSO.OpenTextFile(DBP & "furni\" & FurniID & "\inroom.txt", ForWriting).Write Client(Index).InRoom

NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll
Lijst = Split(Lijst2, ";")
For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> FurniID Then NewLijst = NewLijst & ";" & Lijst(a)
Next a
NewLijst = Replace(NewLijst, ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForWriting).Write NewLijst

kamerFurni = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForReading).ReadAll
kamerFurni = Replace(kamerFurni & ";" & FurniID, ";;", ";")
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForWriting).Write kamerFurni
Custt = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll
FType = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\type.txt", ForReading).ReadAll
FCol = Split(Custt, Chr(30))(2)

'roller
If FType = "roller" Then
If InStr(frmMain.LoadedRollers, "<" & FurniID & ">") = 0 Then
frmMain.LoadedRollers = frmMain.LoadedRollers & "<" & FurniID & ">"
End If
End If
'roller
'pet
If Name = "nest" Then
PetData = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\petdata.txt", ForReading).ReadAll, "" & Chr(2) & "")
PetGender = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\gender.txt", ForReading).ReadAll

For xyz = 5 To 10000
If InStr(Nums, "<" & xyz & ">") = 0 Then
idx = Val(xyz)
Nums = Nums & "<" & idx & ">"
Exit For
End If
Next xyz

If UBound(Pet) < idx Then
ReDim Preserve Pet(idx)
End If
If Pet(idx).Name = "" Then
Load frmMain.PetTimer(idx)
With Pet(idx)
.FurniID = FurniID
.NewAction = True
.RollerUpdate = False
.Alive = Val(ReadINI("pet", "alive", DBP & "furni\" & FurniID & "\status.txt"))
.DrinkTimer = Val(ReadINI("pet", "drinktimer", DBP & "furni\" & FurniID & "\status.txt"))
.EatTimer = Val(ReadINI("pet", "eattimer", DBP & "furni\" & FurniID & "\status.txt"))
.Eating = False
.Drinking = False
.Sleep = ReadINI("pet", "sleep", DBP & "furni\" & FurniID & "\status.txt", False)
.SleepDuration = Val(ReadINI("pet", "sleepduration", DBP & "furni\" & FurniID & "\status.txt"))
.SleepTimer = Val(ReadINI("pet", "sleeptimer", DBP & "furni\" & FurniID & "\status.txt"))
.FindDrink = False
.FindFood = False
.App = PetGender & " " & PetData(1) & " " & PetData(2)
.DestX = Fx
.DestY = Fy
.He = StartHeight
.InRoom = Client(Index).InRoom
.Look = FurniData(5) & "," & FurniData(5)
.Name = PetData(0)
.PosX = Fx
.PosY = Fy
.NestX = Fx
.NestY = Fy
.Action = ReadINI("pet", "sleep", DBP & "furni\" & FurniID & "\status.txt", False)
.Sit = ReadINI("pet", "sit", DBP & "furni\" & FurniID & "\status.txt", False)
.Lay = ReadINI("pet", "lay", DBP & "furni\" & FurniID & "\status.txt", False)
.Actiontype = ReadINI("pet", "actiontype", DBP & "furni\" & FurniID & "\status.txt")
.Gesture = ReadINI("pet", "gesture", DBP & "furni\" & FurniID & "\status.txt")
.Update = True
.PlayVal = 0
.PlayX = 0
.PlayY = 0
.PlayID = 0
.Playing = False
End With
End If
frmMain.Hpets = Replace(frmMain.Hpets & ";" & idx, ";;", ";")
sendAll "@\i:" & idx & Chr(13) & "n:" & idx & "" & PetData(0) & Chr(13) & "f:" & PetGender & " " & PetData(1) & " " & PetData(2) & Chr(13) & "l:" & Pet(idx).PosX & " " & Pet(idx).PosY & " " & Pet(idx).He & Chr(13) & "c:" & Chr(13) & Chr(1), (Client(Index).InRoom)
End If
'pet


sendAll "A]" & FurniID & Chr(2) & Name & Chr(2) & VL64encode(Fx) & VL64encode(Fy) & VL64encode(Trf) & VL64encode(Fot) & VL64encode(Fif) & StartHeight & Chr(2) & FCol & ",0,0" & Chr(2) & Chr(2) & Var & Chr(2) & Chr(1), (Client(Index).InRoom)

Hab_AA2 "AAupdate", Index

Else
Hab_AA2 "AAupdate", Index
End If

End If
Else
Hab_AA2 "AAupdate", Index
End If

End Function

Public Function Hab_AC(info As String, Index As Integer) 'pick up furni
Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\owner.txt").ReadAll

Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll


If Owner = Client(Index).Name Or Rank = "admin" Or Rank = "moderator" Then
If Mid(info, 1, 11) = "ACnew item " Then
FurniID = Mid(info, 12)
sendAll "AT" & FurniID & Chr(1), (Client(Index).InRoom)
NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForReading).ReadAll
Lijst = Split(Lijst2, ";")
For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> FurniID Then NewLijst = NewLijst & ";" & Lijst(a)
Next a
NewLijst = Replace(NewLijst, ";;", ";")
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForWriting).Write NewLijst

kamerFurni = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll
kamerFurni = Replace(kamerFurni & ";" & FurniID, ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForWriting).Write kamerFurni
Hab_AA2 "AAupdate", Index
Else
FurniID = Mid(info, 13)
sendAll "A^" & FurniID & Chr(1), (Client(Index).InRoom)

'make space
FurniType = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\type.txt", ForReading).ReadAll
Custt = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll
Fname = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll
loca = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\loc.txt", ForReading).ReadAll, " ")
Innroom = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\inroom.txt", ForReading).ReadAll
htmp = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\shtmp.txt").ReadAll
Walkmp = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt").ReadAll

Doen = "O"

Fvar = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt", ForReading).ReadAll
'roller
If FurniType = "roller" Then
frmMain.LoadedRollers = Replace(frmMain.LoadedRollers, "<" & FurniID & ">", "")

FurniOP = ReadINI("furnies", loca(0) & "," & loca(1), DBP & "privaterooms\" & Innroom & "\rotation.txt")
If FurniOP <> "" Then
FurniTypeX = FSO.OpenTextFile(DBP & "furni\" & FurniOP & "\type.txt", ForReading).ReadAll
If FurniTypeX = "sit" Then Doen = "S"
If FurniTypeX = "bed" Then Doen = "L"
If FurniTypeX = "solid" Then Doen = "X"
If FurniTypeX = "door" Then
    If InStr(Fvar, "O") Then
    Doen = "D"
    Else
    Doen = "X"
    End If
End If
End If
End If
'roller

'pet part
If Fname = "nest" Then
Hpets2 = ""
splitP = Split(frmMain.Hpets, ";")
For b = 0 To UBound(splitP)
If splitP(b) <> "" Then
If Pet(splitP(b)).FurniID = FurniID Then
Unload frmMain.PetTimer(splitP(b))
Nums = Replace(Nums, "<" & splitP(b) & ">", "")
If Pet(splitP(b)).Actiontype = "pla" Then Pet(splitP(b)).Actiontype = ""
'save status
WriteINI "pet", "alive", Pet(splitP(b)).Alive, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "drinktimer", Pet(splitP(b)).DrinkTimer, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "eattimer", Pet(splitP(b)).EatTimer, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "sleep", Pet(splitP(b)).Sleep, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "sleeptimer", Pet(splitP(b)).SleepTimer, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "sleepduration", Pet(splitP(b)).SleepDuration, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "he", Pet(splitP(b)).He, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "look", Mid(Pet(splitP(b)).Look, 1, InStr(Pet(splitP(b)).Look, ",") - 1), DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "posx", Pet(splitP(b)).PosX, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "posy", Pet(splitP(b)).PosY, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "sit", Pet(splitP(b)).Sit, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "lay", Pet(splitP(b)).Lay, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "gesture", Pet(splitP(b)).Gesture, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "action", Pet(splitP(b)).Action, DBP & "furni\" & FurniID & "\status.txt"
WriteINI "pet", "actiontype", Pet(splitP(b)).Actiontype, DBP & "furni\" & FurniID & "\status.txt"
'save status
Pet(splitP(b)).Name = ""
sendAll "@]" & splitP(b) & Chr(1), (Client(Index).InRoom)
Else
Hpets2 = Hpets2 & splitP(b) & ";"
End If
End If
Next b
frmMain.Hpets = Hpets2
End If
'pet part

Fx = Val(loca(0))
Fy = Val(loca(1))

Dim Custsplit() As String
Custsplit() = Split(Custt, "")
Dim ForX As Integer, ForY As Integer
If Val(loca(2)) = 0 Or Val(loca(2)) = 4 Then
BijX = Val(Custsplit(0))
BijY = Val(Custsplit(1))
Else
BijX = Val(Custsplit(1))
BijY = Val(Custsplit(0))
End If



Walksplit = Split(Walkmp, Chr(13))
    For ForX = Fx To Fx + BijX - 1
    For ForY = Fy To Fy + BijY - 1
    If (FurniType <> "rug" And Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R") Or FurniType = "roller" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & Doen & Mid(Walksplit(ForY), ForX + 2)
    FSO.CopyFile DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt", DBP & "privaterooms\" & Client(Index).InRoom & "\rotationb.txt", True
    TopID = ReadINI("furnies", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
    If TopID = FurniID Then
        StackHere = ReadINI("stacked", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
        If StackHere <> "" Then
            WriteINI "furnies", ForX & "," & ForY, StackHere, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
            WriteINI "stacked", ForX & "," & ForY, "", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
            If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
        Else
            WriteINI "furnies", ForX & "," & ForY, "", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
        End If
    Else
        FurniHere = ReadINI("stacked", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
        If FurniHere <> "" Then
            WriteINI "stacked", ForX & "," & ForY, "", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
            If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
        Else
            WriteINI "stacked", ForX & "," & ForY, "", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
        End If
    End If
    Next ForY
    Next ForX
Walkmp = Join(Walksplit, Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
'make space

NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForReading).ReadAll
Lijst = Split(Lijst2, ";")
For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> FurniID Then NewLijst = NewLijst & ";" & Lijst(a)
Next a
NewLijst = Replace(NewLijst, ";;", ";")
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForWriting).Write NewLijst

kamerFurni = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll
kamerFurni = Replace(kamerFurni & ";" & FurniID, ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForWriting).Write kamerFurni

FSO.OpenTextFile(DBP & "furni\" & FurniID & "\inroom.txt", ForWriting).Write 0

Hab_AA2 "AAlast", Index

End If
End If
If Owner <> Client(Index).Name Then
    'Printlog "## " & Client(index).name & " nahm " & FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll & " aus dem Raum (" & Client(index).InRoom & ") von " & Owner & " auf"
End If
End Function

Public Function Hab_AI(info As String, Index As Integer) 'move/rotate furni
Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\owner.txt").ReadAll
rights = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\rights.txt").ReadAll
Stacked = 0
If Owner = Client(Index).Name Then Rechten = "ja"
If FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\allrights.txt").ReadAll = "1" Then
Rechten = "ja"
Else
Dim Splitt() As String
Splitt = Split(rights, ";")
For Q = 0 To UBound(Splitt())
If Splitt(Q) = Client(Index).Name Then
Rechten = "ja"
Exit For
End If
Next Q
End If

If ReadINI("rank", "rights_in_any_room", DBP & "ranks\" & Client(Index).Rank & ".ini") = "1" Then Rechten = "ja"

If Rechten = "ja" Then
Dim Splitup() As String
Splitup() = Split(info, " ")
FurniID = Mid(Splitup(0), 3)

NewX = Val(Splitup(1))
NewY = Val(Splitup(2))
NewRot = Val(Splitup(3))

'make space
Custt = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll
Innroom = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\inroom.txt", ForReading).ReadAll
loca = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\loc.txt", ForReading).ReadAll, " ")
htmp = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\shtmp.txt").ReadAll
Walkmp = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt").ReadAll
FurniType = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\type.txt", ForReading).ReadAll

Doen = "O"

Fx = Val(loca(0))
Fy = Val(loca(1))

If Fx <> NewX Or Fy <> NewY Then
Fvar = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt", ForReading).ReadAll
'roller
If FurniType = "roller" Then
FurniOP = ReadINI("furnies", loca(0) & "," & loca(1), DBP & "privaterooms\" & Innroom & "\rotation.txt")
If FurniOP <> "" Then
FurniTypeX = FSO.OpenTextFile(DBP & "furni\" & FurniOP & "\type.txt", ForReading).ReadAll
If FurniTypeX = "sit" Then Doen = "S"
If FurniTypeX = "bed" Then Doen = "L"
If FurniTypeX = "solid" Then Doen = "X"
If FurniTypeX = "door" Then
    If InStr(Fvar, "O") Then
    Doen = "D"
    Else
    Doen = "X"
    End If
End If
End If
End If
'roller
End If

Dim Custsplit() As String
Custsplit() = Split(Custt, "")
Dim ForX As Integer, ForY As Integer
If Val(loca(2)) = 0 Or Val(loca(2)) = 4 Then
BijX = Val(Custsplit(0))
BijY = Val(Custsplit(1))
Else
BijX = Val(Custsplit(1))
BijY = Val(Custsplit(0))
End If
Walksplit = Split(Walkmp, Chr(13))
    For ForX = Fx To Fx + BijX - 1
    For ForY = Fy To Fy + BijY - 1
    If (FurniType <> "rug" And Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R") Or FurniType = "roller" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & Doen & Mid(Walksplit(ForY), ForX + 2)
    FSO.CopyFile DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt", DBP & "privaterooms\" & Client(Index).InRoom & "\rotationb.txt", True
    TopID = ReadINI("furnies", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
    If TopID = FurniID Then
        StackHere = ReadINI("stacked", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
        If StackHere <> "" Then
            WriteINI "furnies", ForX & "," & ForY, StackHere, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
            WriteINI "stacked", ForX & "," & ForY, "", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
            If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
        Else
            WriteINI "furnies", ForX & "," & ForY, "", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
        End If
    Else
        FurniHere = ReadINI("stacked", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
        If FurniHere <> "" Then
            WriteINI "stacked", ForX & "," & ForY, "", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
            If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
        Else
            WriteINI "stacked", ForX & "," & ForY, "", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
        End If
    End If
    Next ForY
    Next ForX
Walkmp = Join(Walksplit, Chr(13))
'make space

'check if furni has space
htmp = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\shtmp.txt").ReadAll
Var = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt", ForReading).ReadAll
Name = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll

HasSpace = 1
StartHeight = Mid(Split(htmp, Chr(13))(NewY), NewX + 1, 1)

Custsplit() = Split(Custt, "")



If NewRot = 0 Or NewRot = 4 Then
BijX = Val(Custsplit(0))
BijY = Val(Custsplit(1))
Else
BijX = Val(Custsplit(1))
BijY = Val(Custsplit(0))
End If
extpermanent = False
    For ForX = NewX To NewX + BijX - 1
    For ForY = NewY To NewY + BijY - 1
    For b = 1 To frmMain.SockI
If Client(b).InRoom = Client(Index).InRoom Then
If Client(b).PosX = ForX And Client(b).PosY = ForY Then
HasSpace = 0
If FurniType = "bed" Then
    If BijX = Val(Custsplit(1)) Then
    If ForX = NewX Then
HasSpace = 1
    End If
    Else
    If ForY = NewY Then
HasSpace = 1
    End If
    End If
End If
If FurniType = "sit" Then HasSpace = 1
If FurniType = "roller" And Val(NewX) = Val(Fx) And Val(NewY) = Val(Fy) Then HasSpace = 1
If FurniType = "door" And InStr(Var, "O") Then HasSpace = 1
If FurniType = "rug" And Name <> "nest" Then HasSpace = 1
End If
End If
Next b
splitP = Split(frmMain.Hpets, ";")
For b = 0 To UBound(splitP)
If splitP(b) <> "" Then
If Pet(splitP(b)).InRoom = Client(Index).InRoom Then
If Pet(splitP(b)).PosX = ForX And Pet(splitP(b)).PosY = ForY Then
HasSpace = 0
If FurniType = "bed" Then
    If BijX = Val(Custsplit(1)) Then
    If ForX = NewX Then
HasSpace = 1
    End If
    Else
    If ForY = NewY Then
HasSpace = 1
    End If
    End If
End If
If FurniType = "sit" Then HasSpace = 1
If FurniType = "roller" And Val(NewX) = Val(Fx) And Val(NewY) = Val(Fy) Then HasSpace = 1
If FurniType = "rug" And Name <> "nest" Then HasSpace = 1
If FurniType = "door" And InStr(Var, "O") Then HasSpace = 1
End If
End If
End If
Next b
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "O" Then HasSpace = 0
    If Mid(Split(htmp, Chr(13))(ForY), ForX + 1, 1) <> StartHeight Then HasSpace = 0
    'roller
    If HasSpace = 0 Then
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) = "R" And Custsplit(0) = 1 And Custsplit(1) = 1 And FurniType <> "roller" And ReadINI("furnies", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt") = "" Then
    HasSpace = 1
    StartHeight = StartHeight + 0.4
    End If
    End If
    'roller
    'Stacking
    If FSO.OpenTextFile(DBP & "furni\" & FurniID & "\type.txt", ForReading).ReadAll = "solid" Then
    If ReadINI("furnies", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt") <> "" And Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then
    If extpermanent = True Then GoTo Ext
    If ReadINI("stacked", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt") <> FurniID And ReadINI("stacked", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt") <> FurniID And ReadINI("stacked", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt") <> "" Then
    extpermanent = True
    GoTo Ext
    End If
    FurniOP = ReadINI("furnies", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
    If FSO.FileExists(DBP & "furni\" & FurniOP & "\stack.txt") = True Then
        If FurniOP <> FurniID Then
        HasSpace = 1
        Stacked = 1
        OPF = FurniOP
        Else
        StartHeight = StartHeight + Val(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\height.txt", ForReading).ReadAll)
        Stacked = 0
        End If
    End If
    End If
    End If
Ext:
    'Stacking
    Next ForY
    Next ForX
    If Stacked = 1 Then
        StackHeight = FSO.OpenTextFile(DBP & "furni\" & OPF & "\stack.txt", ForReading).ReadAll
        StartHeight = StartHeight + Val(StackHeight) + Val(FSO.OpenTextFile(DBP & "furni\" & OPF & "\height.txt", ForReading).ReadAll)
    End If
'check if furni has space

If HasSpace = 1 Then

Height = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\height.txt", ForReading).ReadAll
Offset = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\sitheight.txt", ForReading).ReadAll

'chair etc
If FurniType = "sit" Then
Walksplit = Split(Walkmp, Chr(13))
    For ForX = NewX To NewX + BijX - 1
    For ForY = NewY To NewY + BijY - 1
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "S" & Mid(Walksplit(ForY), ForX + 2)
    WriteINI "rotation", ForX & "," & ForY, NewRot & "," & NewRot, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    WriteINI "offset", ForX & "," & ForY, Offset, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    Next ForY
    Next ForX
Walkmp = Join(Walksplit, Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
End If
'chair etc
'bed etc
If FurniType = "bed" Then
Walksplit = Split(Walkmp, Chr(13))
    For ForX = NewX To NewX + BijX - 1
    For ForY = NewY To NewY + BijY - 1
    If BijX = Val(Custsplit(1)) Then
    If ForX = NewX Then
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "L" & Mid(Walksplit(ForY), ForX + 2)
    Else
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
    End If
    Else
    If ForY = NewY Then
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "L" & Mid(Walksplit(ForY), ForX + 2)
    Else
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
    End If
    End If
    WriteINI "rotation", ForX & "," & ForY, NewRot & "," & NewRot, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    WriteINI "offset", ForX & "," & ForY, Offset, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    Next ForY
    Next ForX
Walkmp = Join(Walksplit, Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
End If
'bed etc
'sold things
If FurniType = "solid" Then
Walksplit = Split(Walkmp, Chr(13))
    For ForX = NewX To NewX + BijX - 1
    For ForY = NewY To NewY + BijY - 1
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
    If Stacked = 1 Then
        OldTop = ReadINI("furnies", ForX & "," & ForY, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt")
        WriteINI "stacked", ForX & "," & ForY, OldTop, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
        WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    Else
        WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    End If
    Next ForY
    Next ForX
Walkmp = Join(Walksplit, Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
End If
'solid things
'rugs etc
If FurniType = "rug" Then
Walksplit = Split(Walkmp, Chr(13))
    For ForX = NewX To NewX + BijX - 1
    For ForY = NewY To NewY + BijY - 1
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "O" & Mid(Walksplit(ForY), ForX + 2)
    WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    Next ForY
    Next ForX
Walkmp = Join(Walksplit, Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
End If
'rugs etc
'rollers
If FurniType = "roller" Then
Walksplit = Split(Walkmp, Chr(13))
    For ForX = NewX To NewX + BijX - 1
    For ForY = NewY To NewY + BijY - 1
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "R" & Mid(Walksplit(ForY), ForX + 2)
    Next ForY
    Next ForX
Walkmp = Join(Walksplit, Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
End If
'rollers
'doors
If FurniType = "door" Then
Walksplit = Split(Walkmp, Chr(13))
    For ForX = NewX To NewX + BijX - 1
    For ForY = NewY To NewY + BijY - 1
    If InStr(Var, "O") Then
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "D" & Mid(Walksplit(ForY), ForX + 2)
    Else
    If Mid(Split(Walkmp, Chr(13))(ForY), ForX + 1, 1) <> "R" Then Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
    End If
    WriteINI "furnies", ForX & "," & ForY, FurniID, DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt"
    Next ForY
    Next ForX
Walkmp = Join(Walksplit, Chr(13))
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\walk.txt", ForWriting).Write Walkmp
End If
'doors

If FSO.FileExists(DBP & "privaterooms\" & Client(Index).InRoom & "\rotationb.txt") = True Then FSO.DeleteFile DBP & "privaterooms\" & Client(Index).InRoom & "\rotationb.txt"

StartHeight = Replace(StartHeight, ",", ".")
If InStr(StartHeight, ".") = 0 Then StartHeight = StartHeight & ".0"

FSO.OpenTextFile(DBP & "furni\" & FurniID & "\loc.txt", ForWriting).Write NewX & " " & NewY & " " & NewRot
FSO.OpenTextFile(DBP & "furni\" & FurniID & "\height.txt", ForWriting).Write StartHeight



Fname = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll

'pet part
If Fname = "nest" Then
splitP = Split(frmMain.Hpets, ";")
For b = 0 To UBound(splitP)
If splitP(b) <> "" Then
If Pet(splitP(b)).FurniID = FurniID Then
Pet(splitP(b)).NestX = NewX
Pet(splitP(b)).NestY = NewY
End If
End If
Next b
End If
'pet part

FCol = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll, Chr(30))(2)
Var = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt", ForReading).ReadAll

sendAll "A_" & FurniID & Chr(2) & Fname & Chr(2) & VL64encode(NewX) & VL64encode(NewY) & VL64encode(Custsplit(0)) & VL64encode(Custsplit(1)) & VL64encode(NewRot) & StartHeight & Chr(2) & FCol & Chr(2) & Chr(2) & Var & Chr(2) & Chr(1), (Client(Index).InRoom)

For a = 1 To frmMain.SockI
If Client(a).InRoom = Client(Index).InRoom Then
Client(a).Update = True
End If
Next a

Else
If FSO.FileExists(DBP & "privaterooms\" & Client(Index).InRoom & "\rotationb.txt") = True Then FSO.CopyFile DBP & "privaterooms\" & Client(Index).InRoom & "\rotationb.txt", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt", True
Fname = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll
FCol = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll, Chr(30))(2)
Var = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt", ForReading).ReadAll
Height = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\height.txt", ForReading).ReadAll
loca = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\loc.txt", ForReading).ReadAll, " ")
Custsplit = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll, "")

Height = Replace(Height, ",", ".")
If InStr(Height, ".") = 0 Then Height = Height & ".0"

Send Index, "A_" & FurniID & Chr(2) & Fname & Chr(2) & VL64encode(loca(0)) & VL64encode(loca(1)) & VL64encode(Custsplit(0)) & VL64encode(Custsplit(1)) & VL64encode(loca(2)) & Height & Chr(2) & FCol & Chr(2) & Chr(2) & Var & Chr(2) & Chr(1)
End If

Else
If FSO.FileExists(DBP & "privaterooms\" & Client(Index).InRoom & "\rotationb.txt") = True Then FSO.CopyFile DBP & "privaterooms\" & Client(Index).InRoom & "\rotationb.txt", DBP & "privaterooms\" & Client(Index).InRoom & "\rotation.txt", True
Splitup = Split(info, " ")
FurniID = Mid(Splitup(0), 3)
Fname = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll
FCol = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll, Chr(30))(2)
Var = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt", ForReading).ReadAll
Height = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\height.txt", ForReading).ReadAll
loca = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\loc.txt", ForReading).ReadAll, " ")
Custsplit = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll, "")

Height = Replace(Height, ",", ".")
If InStr(Height, ".") = 0 Then Height = Height & ".0"

Send Index, "A_" & FurniID & Chr(2) & Fname & Chr(2) & VL64encode(loca(0)) & VL64encode(loca(1)) & VL64encode(Custsplit(0)) & VL64encode(Custsplit(1)) & VL64encode(loca(2)) & Height & Chr(2) & FCol & Chr(2) & Chr(2) & Var & Chr(2) & Chr(1)
End If
End Function


Public Function Hab_AJ(info As String, Index As Integer)

Dim StuurNiet As Boolean


ErVoor = "H"

    Dim NewWd As String
    Dim ToUID As String
    Dim ToVar As String
    Lengte1 = Decode(Mid(info, 3, 2))
    ToUID = Mid(info, 5, Lengte1)
    Lengte2 = Decode(Mid(info, 5 + Lengte1, 2))
    ToVar = Mid(info, 7 + Lengte1, Lengte2)

Rank = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\rank.txt", ForReading).ReadAll
InRoom = FSO.OpenTextFile(DBP & "furni\" & ToUID & "\inroom.txt").ReadAll
Owner = FSO.OpenTextFile(DBP & "privaterooms\" & InRoom & "\owner.txt").ReadAll
rights = FSO.OpenTextFile(DBP & "privaterooms\" & InRoom & "\rights.txt").ReadAll

If Owner = Client(Index).Name Then Rechten = "ja"
If ReadINI("rank", "rights_in_any_room", DBP & "ranks\" & Client(Index).Rank & ".ini") = "1" Then Rechten = "ja"
If FSO.OpenTextFile(DBP & "privaterooms\" & InRoom & "\allrights.txt").ReadAll = "1" Then
Rechten = "ja"
Else
Dim Splitt() As String
Splitt = Split(rights, ";")
For Q = 0 To UBound(Splitt())
If Splitt(Q) = Client(Index).Name Then
Rechten = "ja"
Exit For
End If
Next Q
End If



MoetNaast = 0
MoetRechten = 0


    Fname = FSO.OpenTextFile(DBP & "furni\" & ToUID & "\name.txt").ReadAll
    If Fname = "hockey_score" Then MoetNaast = 1
    If Fname = "hockey_light" Then MoetNaast = 1
    FType = FSO.OpenTextFile(DBP & "furni\" & ToUID & "\type.txt").ReadAll
    If FType = "door" Then MoetRechten = 1
    
    If MoetNaast = 1 Then
    Fpos = Split(FSO.OpenTextFile(DBP & "furni\" & ToUID & "\loc.txt").ReadAll, " ")
    Fx = Val(Fpos(0))
    Fy = Val(Fpos(1))
    If Int(Math.Sqr(((Fx - Client(Index).PosX) ^ 2) + ((Fy - Client(Index).PosY) ^ 2))) > 1 Then Exit Function
    End If
    
    If MoetRechten = 1 Then
    If Rechten = "" Then Exit Function
    End If
    
If InStr(Fname, "waterbowl") = 1 Then ErVoor = ""

If InStr(Fname, "waterbowl") = 1 Then ToVar = VL64encode(ToVar)
    FSO.OpenTextFile(DBP & "furni\" & ToUID & "\var.txt", ForWriting).Write ErVoor & ToVar
If InStr(Fname, "waterbowl") = 1 Then ToVar = VL64Decode(ToVar)
    Types = FSO.OpenTextFile(DBP & "furni\" & ToUID & "\type.txt", ForReading).ReadAll
    
    If Types = "door" Then
    Walkmp = FSO.OpenTextFile(DBP & "privaterooms\" & InRoom & "\walk.txt").ReadAll
    Custt = FSO.OpenTextFile(DBP & "furni\" & ToUID & "\cust.txt").ReadAll
    loca = Split(FSO.OpenTextFile(DBP & "furni\" & ToUID & "\loc.txt").ReadAll, " ")
    
    Custsplit = Split(Custt, "")


If loca(2) = 0 Or loca(2) = 4 Then
BijX = Val(Custsplit(0))
BijY = Val(Custsplit(1))
Else
BijX = Val(Custsplit(1))
BijY = Val(Custsplit(0))
End If
HasSpace = 1
'check if theres nopt an habbo in the door
    For ForX = loca(0) To loca(0) + BijX - 1
    For ForY = loca(1) To loca(1) + BijY - 1
For b = 1 To frmMain.SockI
If Client(b).InRoom = InRoom Then
If Client(b).PosX = ForX And Client(b).PosY = ForY Then HasSpace = 0
End If
Next b
splitP = Split(frmMain.Hpets, ";")
For b = 0 To UBound(splitP)
If splitP(b) <> "" Then
If Pet(splitP(b)).InRoom = InRoom Then
If Pet(splitP(b)).PosX = ForX And Pet(splitP(b)).PosY = ForY Then Exit Function
End If
End If
Next b
    Next ForY
    Next ForX

'check if theres nopt an habbo in the door
If HasSpace = 1 Then
    Walksplit = Split(Walkmp, Chr(13))
    For ForX = loca(0) To loca(0) + BijX - 1
    For ForY = loca(1) To loca(1) + BijY - 1
    If InStr(ToVar, "O") Then
    Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "D" & Mid(Walksplit(ForY), ForX + 2)
    Else
    Walksplit(ForY) = Mid(Walksplit(ForY), 1, ForX) & "X" & Mid(Walksplit(ForY), ForX + 2)
    End If
    Next ForY
    Next ForX

    Walkmp = Join(Walksplit, Chr(13))
    FSO.OpenTextFile(DBP & "privaterooms\" & InRoom & "\walk.txt", ForWriting).Write Walkmp
    Else
    StuurNiet = True
    ToVar = "O"
    FSO.OpenTextFile(DBP & "furni\" & ToUID & "\var.txt", ForWriting).Write ErVoor & ToVar
    End If
    End If
    
    If StuurNiet = False Then sendAll "AX" & ToUID & Chr(2) & ToVar & Chr(2) & Chr(1), (InRoom)

End Function

Public Function Hab_AM(info As String, Index As Integer)
DiceID = Mid(info, 3)
FSO.OpenTextFile(DBP & "furni\" & DiceID & "\var.txt", ForWriting).Write "H0"
sendAll "AZ" & DiceID & Chr(20) & 232119846 & Chr(1), (Client(Index).InRoom)
End Function

Public Function Hab_AL(info As String, Index As Integer)
Dim DiceID As String
DiceID = Mid(info, 3)
sendAll "AZ" & DiceID & Chr(1), (Client(Index).InRoom)
For a = 1 To 50
    If InStr(frmMain.dices, "<" & a & ">") = 0 Then
        Load frmMain.TimerDice(a)
        frmMain.dices = frmMain.dices & "<" & a & ">"
        frmMain.TimerDice(a).Tag = DiceID & "." & Client(Index).InRoom
        frmMain.TimerDice(a).Enabled = True
        Exit For
    End If
Next a
Exit Function
errrep:
MsgBox Err.Desc
End Function

Public Function Hab_AN(info As String, Index As Integer)
FurniID = Mid(info, 3)
Fname = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll
If InStr(Fname, "present") Then
Hab_AC "ACnew stuff " & FurniID, Index
NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll
Lijst = Split(Lijst2, ";")
For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> FurniID Then NewLijst = NewLijst & ";" & Lijst(a)
Next a
NewLijst = Replace(NewLijst, ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForWriting).Write NewLijst

Present = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\inbox.txt", ForReading).ReadAll, ";")
InboxID = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\inboxid.txt", ForReading).ReadAll

For Q = UBound(Present) To 0 Step -1
If Present(Q) <> "" Then
kamerFurni = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll
kamerFurni = Replace(kamerFurni & ";" & Present(Q), ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForWriting).Write kamerFurni



Fname = FSO.OpenTextFile(DBP & "furni\" & Present(Q) & "\name.txt", ForReading).ReadAll
FCust = FSO.OpenTextFile(DBP & "furni\" & Present(Q) & "\cust.txt", ForReading).ReadAll

End If
Next Q

Hab_AA2 "AAlast", Index



Send Index, "BA" & Fname & Chr(13) & InboxID & Chr(13) & FCust & Chr(1)
End If
End Function

Public Function Hab_AQ(info As String, Index As Integer)
FurniID = Mid(info, 3)
FLoc = Split(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\loc.txt", ForReading).ReadAll, " ")
FH = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\height.txt", ForReading).ReadAll
Hab_AO "AO" & Val(FLoc(0)) & " " & Val(FLoc(1)), Index
Client(Index).TelX = Val(FLoc(0))
Client(Index).TelY = Val(FLoc(1))
Client(Index).TelHe = Val(FH)
Client(Index).TelHe = Replace(Client(Index).TelHe, ",", ".")
If InStr(Client(Index).TelHe, ".") = 0 Then Client(Index).TelHe = Client(Index).TelHe & ".0"
Client(Index).TelMove = True
Client(Index).Update = True
End Function

Public Function Hab_AtSlash(info As String, Index As Integer)
FurniID = Mid(info, 3)
FDest = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\destination.txt", ForReading).ReadAll
Fname = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll
FRoom = FSO.OpenTextFile(DBP & "furni\" & FDest & "\inroom.txt", ForReading).ReadAll
If FRoom = Client(Index).InRoom Then
sendAll "AY" & FurniID & "/" & Client(Index).Name & "/" & Fname & Chr(1) & "AY" & FurniID & "/" & Client(Index).Name & "/" & Fname & Chr(1), (Client(Index).InRoom)
frmMain.TimerTeleport1(Index).Tag = FDest
frmMain.TimerTeleport1(Index).Interval = 2000
frmMain.TimerTeleport1(Index).Enabled = True
ElseIf FRoom > 0 Then
frmMain.TimerTeleport1(Index).Tag = FDest
Send Index, "@~" & VL64encode(Client(Index).InRoom) & VL64encode(FRoom) & Chr(1)
End If
End Function

Public Function Hab_AR(info As String, Index As Integer)
FurniID = Mid(info, 3)
sendAll "AY" & FurniID & "/" & Client(Index).Name & "/" & Fname & Chr(1) & "AY" & FurniID & "/" & Client(Index).Name & "/" & Fname & Chr(1), (Client(Index).InRoom)
End Function

Public Function Hab_Atv(info As String, Index As Integer)
RoomNum = Val(Mid(info, 3))

frmMain.TimerTeleport1(Index).Enabled = False
sendAll "@]" & Client(Index).Num & Chr(1), (Client(Index).InRoom)
Client(Index).Hotelpos = "I" & locale("hotel_view")
Client(Index).Teled = True
Client(Index).InRoom = RoomNum
Send Index, "@S" & Chr(1)
End Function

Public Function Hab_AS2(info As String, Index As Integer)
FurniID = Mid(info, 3)
cust = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt").ReadAll
Var = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt").ReadAll
Var = Replace(Var, Chr(1), "")
Send Index, "@p" & FurniID & Chr(9) & cust & " " & Var & Chr(1)
End Function

Public Function Hab_AT(info As String, Index As Integer)

Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\owner.txt").ReadAll
rights = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\rights.txt").ReadAll

If Owner = Client(Index).Name Then Rechten = "ja"
If FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\allrights.txt").ReadAll = "1" Then
Rechten = "ja"
Else
Dim Splitt() As String
Splitt = Split(rights, ";")
For Q = 0 To UBound(Splitt())
If Splitt(Q) = Client(Index).Name Then
Rechten = "ja"
Exit For
End If
Next Q
End If

If ReadINI("rank", "rights_in_any_room", DBP & "ranks\" & Client(Index).Rank & ".ini") = "1" Then Rechten = "ja"

If Rechten = "ja" Then
FurniID = Mid(info, 3)
FurniID = Mid(FurniID, 1, InStr(FurniID, "/") - 1)
cust = Mid(info, InStr(info, "/") + 1)
Varr = Trim(Mid(cust, InStr(cust, " ") + 1))
If ReadINI("config", "bobba_filter", SettingIni) = "1" Then Varr = Filter(Varr)
If Varr = "" Then Varr = " "
Varr = Replace(Varr, Chr(1), "")
If InStr(cust, " ") = 0 Then cust = cust & " "
FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForWriting).Write Mid(cust, 1, InStr(cust, " ") - 1)
FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt", ForWriting).Write Varr
Fname = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll
loca = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\loc.txt", ForReading).ReadAll
Var = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt", ForReading).ReadAll
sendAll "AU" & FurniID & Chr(9) & Fname & Chr(9) & " " & loca & Chr(9) & Mid(cust, 1, InStr(cust, " ") - 1) & Chr(1), (Client(Index).InRoom)
Else
FurniID = Mid(info, 3)
FurniID = Mid(FurniID, 1, InStr(FurniID, "/") - 1)
cust = Mid(info, InStr(info, "/") + 1)
Varr = Trim(Mid(cust, InStr(cust, " ") + 1))
If ReadINI("config", "bobba_filter", SettingIni) = "1" Then Varr = Filter(Varr)
Varr = Replace(Varr, Chr(1), "")
Fname = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll
loca = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\loc.txt", ForReading).ReadAll
cust = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\cust.txt", ForReading).ReadAll
Var = FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt", ForReading).ReadAll
If Left(Varr, Len(Var)) = Var Or Var = "" Or Var = " " Then
    FSO.OpenTextFile(DBP & "furni\" & FurniID & "\var.txt", ForWriting).Write Varr
    sendAll "AU" & FurniID & Chr(9) & Fname & Chr(9) & " " & loca & Chr(9) & Mid(cust, 1, InStr(cust, " ") - 1) & Chr(1), (Client(Index).InRoom)
Else
    Send Index, "AU" & FurniID & Chr(9) & Fname & Chr(9) & " " & loca & Chr(9) & cust & Chr(1)
End If
End If
End Function

Public Function Hab_AU(info As String, Index As Integer)

Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\owner.txt").ReadAll

Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll


If Owner = Client(Index).Name Or Rank = "moderator" Or Rank = "admin" Then
FurniID = Mid(info, 3)
FSO.OpenTextFile(DBP & "furni\" & FurniID & "\inroom.txt", ForWriting).Write 0

NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForReading).ReadAll
Lijst = Split(Lijst2, ";")
For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> FurniID Then NewLijst = NewLijst & ";" & Lijst(a)
Next a
NewLijst = Replace(NewLijst, ";;", ";")
FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\furni.txt", ForWriting).Write NewLijst

sendAll "AT" & FurniID & Chr(1), (Client(Index).InRoom)
End If
End Function

Public Function Hab_AG(info As String, Index As Integer)
Wie = Val(Mid(info, 3))

Dim a As Long
For a = 1 To frmMain.SockI
If Client(a).InRoom = Client(Index).InRoom And Client(a).Num = Wie And Client(a).Trading = False And frmMain.socket(a).State = sckConnected Then
 If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "Al" & Client(Index).Name & Chr(9) & "false" & Chr(9) & Chr(13) & Client(a).Name & Chr(9) & "false" & Chr(9) & Chr(13) & Chr(1)
Send Index, "Al" & Client(Index).Name & Chr(9) & "false" & Chr(9) & Chr(13) & Client(a).Name & Chr(9) & "false" & Chr(9) & Chr(13) & Chr(1)
Client(a).Trading = True
Client(a).TradeAccept = False
Client(a).TradeItems = ""
Client(a).TradingWith = Client(Index).Name
Client(a).Update = True
Client(Index).Trading = True
Client(Index).TradeAccept = False
Client(Index).TradeItems = ""
Client(Index).Update = True
Client(Index).TradingWith = Client(a).Name
Exit For
End If
Next a
End Function


Public Function Hab_AF(info As String, Index As Integer)
Dim a As Long
For a = 1 To frmMain.SockI
If Client(a).Name = Client(Index).TradingWith And frmMain.socket(a).State = sckConnected Then
Client(a).Trading = False
Client(a).TradingWith = ""
Client(a).Update = True

furnies = Split(Client(a).TradeItems, ";")
For Q = 0 To UBound(furnies)
If furnies(Q) <> "" Then
kamerFurni = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\hand.txt", ForReading).ReadAll
kamerFurni = Replace(kamerFurni & ";" & furnies(Q), ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(a).Name) & "\hand.txt", ForWriting).Write kamerFurni
End If
Next Q

Client(Index).Trading = False
Client(Index).TradingWith = ""
Client(Index).Update = True

furnies = Split(Client(Index).TradeItems, ";")
For Q = 0 To UBound(furnies)
If furnies(Q) <> "" Then
kamerFurni = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll
kamerFurni = Replace(kamerFurni & ";" & furnies(Q), ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForWriting).Write kamerFurni
End If
Next Q

Send Index, "An" & Chr(1)
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "An" & Chr(1)


Exit For
End If
Next a
End Function


Public Function Hab_AE(info As String, Index As Integer)
If Client(Index).Trading = True Then
Client(Index).TradeAccept = True
Dim a As Long
For a = 1 To frmMain.SockI
If Client(a).Name = Client(Index).TradingWith And frmMain.socket(a).State = sckConnected Then
t1 = "false"
T2 = "false"
If Client(a).TradeAccept = True Then T2 = "true"
If Client(Index).TradeAccept = True Then t1 = "true"

'list 1
List1 = ""
FurniCount = 0
furnies = Split(Client(Index).TradeItems, ";")
For Q = 0 To UBound(furnies)
If furnies(Q) <> "" Then
FurniCount = FurniCount + 1
    Whatt = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\is.txt", ForReading).ReadAll
    Fname = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\name.txt", ForReading).ReadAll
    FCust = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\cust.txt", ForReading).ReadAll
    List1 = List1 & "SI" & Chr(30) & furnies(Q) & Chr(30) & FurniCount & Chr(30) & Whatt & Chr(30) & furnies(Q) & Chr(30) & Fname & Chr(30) & FCust & "/"
End If
Next Q
'list 1

'list 2
List2 = ""
FurniCount = 0
furnies = Split(Client(a).TradeItems, ";")
For Q = 0 To UBound(furnies)
If furnies(Q) <> "" Then
FurniCount = FurniCount + 1
    Whatt = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\is.txt", ForReading).ReadAll
    Fname = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\name.txt", ForReading).ReadAll
    FCust = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\cust.txt", ForReading).ReadAll
    List2 = List2 & "SI" & Chr(30) & furnies(Q) & Chr(30) & FurniCount & Chr(30) & Whatt & Chr(30) & furnies(Q) & Chr(30) & Fname & Chr(30) & FCust & "/"
End If
Next Q
'list 2

 If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "Al" & Client(Index).Name & Chr(9) & t1 & Chr(9) & List1 & Chr(13) & Client(a).Name & Chr(9) & T2 & Chr(9) & List2 & Chr(13) & Chr(1)
Send Index, "Al" & Client(Index).Name & Chr(9) & t1 & Chr(9) & List1 & Chr(13) & Client(a).Name & Chr(9) & T2 & Chr(9) & List2 & Chr(13) & Chr(1)

If t1 = "true" And T2 = "true" Then
Lijst1 = Client(Index).TradeItems
Lijst2 = Client(a).TradeItems
Client(a).TradeItems = Lijst1
Client(Index).TradeItems = Lijst2
Hab_AF "AF", Index
End If

Exit For
End If
Next a
End If
End Function

Public Function Hab_AD(info As String, Index As Integer)
If Client(Index).Trading = True Then
Client(Index).TradeAccept = False
Dim a As Long
For a = 1 To frmMain.SockI
If Client(a).Name = Client(Index).TradingWith And frmMain.socket(a).State = sckConnected Then
t1 = "false"
T2 = "false"
If Client(a).TradeAccept = True Then T2 = "true"
If Client(Index).TradeAccept = True Then t1 = "true"

'list 1
List1 = ""
FurniCount = 0
furnies = Split(Client(Index).TradeItems, ";")
For Q = 0 To UBound(furnies)
If furnies(Q) <> "" Then
FurniCount = FurniCount + 1
    Whatt = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\is.txt", ForReading).ReadAll
    Fname = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\name.txt", ForReading).ReadAll
    FCust = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\cust.txt", ForReading).ReadAll
    List1 = List1 & "SI" & Chr(30) & furnies(Q) & Chr(30) & FurniCount & Chr(30) & Whatt & Chr(30) & furnies(Q) & Chr(30) & Fname & Chr(30) & FCust & "/"
End If
Next Q
'list 1

'list 2
List2 = ""
FurniCount = 0
furnies = Split(Client(a).TradeItems, ";")
For Q = 0 To UBound(furnies)
If furnies(Q) <> "" Then
FurniCount = FurniCount + 1
    Whatt = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\is.txt", ForReading).ReadAll
    Fname = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\name.txt", ForReading).ReadAll
    FCust = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\cust.txt", ForReading).ReadAll
    List2 = List2 & "SI" & Chr(30) & furnies(Q) & Chr(30) & FurniCount & Chr(30) & Whatt & Chr(30) & furnies(Q) & Chr(30) & Fname & Chr(30) & FCust & "/"
End If
Next Q
'list 2

 If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "Al" & Client(Index).Name & Chr(9) & t1 & Chr(9) & List1 & Chr(13) & Client(a).Name & Chr(9) & T2 & Chr(9) & List2 & Chr(13) & Chr(1)
Send Index, "Al" & Client(Index).Name & Chr(9) & t1 & Chr(9) & List1 & Chr(13) & Client(a).Name & Chr(9) & T2 & Chr(9) & List2 & Chr(13) & Chr(1)
Exit For
End If
Next a
End If
End Function

Public Function Hab_AH(info As String, Index As Integer)
If Client(Index).Trading = True Then
FurniID = Mid(info, 3)
If InStr(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll, "present_gen") <> 0 Or InStr(FSO.OpenTextFile(DBP & "furni\" & FurniID & "\name.txt", ForReading).ReadAll, "nest") <> 0 Then
    Send Index, "BK" & locale("not_tradeable") & Chr(1)
    Hab_AA2 "AAupdate", Index
    Exit Function
End If
NewLijst = ";"
Lijst2 = FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForReading).ReadAll
Lijst = Split(Lijst2, ";")
For a = 0 To UBound(Lijst)
If Lijst(a) <> "" And Lijst(a) <> FurniID Then NewLijst = NewLijst & ";" & Lijst(a)
Next a
NewLijst = Replace(NewLijst, ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\hand.txt", ForWriting).Write NewLijst

Client(Index).TradeItems = Replace(Client(Index).TradeItems & ";" & FurniID, ";;", ";")


For a = 1 To frmMain.SockI
If Client(a).Name = Client(Index).TradingWith And frmMain.socket(a).State = sckConnected Then
t1 = "false"
T2 = "false"
If Client(a).TradeAccept = True Then T2 = "true"
If Client(Index).TradeAccept = True Then t1 = "true"

'list 1
List1 = ""
FurniCount = 0
furnies = Split(Client(Index).TradeItems, ";")
For Q = 0 To UBound(furnies)
If furnies(Q) <> "" Then
FurniCount = FurniCount + 1
    Whatt = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\is.txt", ForReading).ReadAll
    Fname = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\name.txt", ForReading).ReadAll
    FCust = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\cust.txt", ForReading).ReadAll
    List1 = List1 & "SI" & Chr(30) & furnies(Q) & Chr(30) & FurniCount & Chr(30) & Whatt & Chr(30) & furnies(Q) & Chr(30) & Fname & Chr(30) & FCust & "/"
End If
Next Q
'list 1

'list 2
List2 = ""
FurniCount = 0
furnies = Split(Client(a).TradeItems, ";")
For Q = 0 To UBound(furnies)
If furnies(Q) <> "" Then
FurniCount = FurniCount + 1
    Whatt = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\is.txt", ForReading).ReadAll
    Fname = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\name.txt", ForReading).ReadAll
    FCust = FSO.OpenTextFile(DBP & "furni\" & furnies(Q) & "\cust.txt", ForReading).ReadAll
    List2 = List2 & "SI" & Chr(30) & furnies(Q) & Chr(30) & FurniCount & Chr(30) & Whatt & Chr(30) & furnies(Q) & Chr(30) & Fname & Chr(30) & FCust & "/"
End If
Next Q
'list 2

If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "Al" & Client(Index).Name & Chr(9) & t1 & Chr(9) & List1 & Chr(13) & Client(a).Name & Chr(9) & T2 & Chr(9) & List2 & Chr(13) & Chr(1)
Send Index, "Al" & Client(Index).Name & Chr(9) & t1 & Chr(9) & List1 & Chr(13) & Client(a).Name & Chr(9) & T2 & Chr(9) & List2 & Chr(13) & Chr(1)
Exit For
End If
Next a
End If
End Function

Public Function Hab_AP(ByVal info As String, ByVal Index As Integer)
WWhat = Mid(info, 3)
Client(Index).Dance = False
Client(Index).NoDrink = False
Client(Index).UseItem = False
Client(Index).Carrying = WWhat
Client(Index).Update = True
Client(Index).DoDrink = False
frmMain.TimerVanish(Index).Enabled = False
frmMain.TimerDrink(Index).Enabled = False
frmMain.TimerVanish(Index).Tag = 0
frmMain.TimerVanish(Index).Enabled = True
frmMain.TimerDrink(Index).Enabled = True
End Function

Public Function Hab_AW(info As String, Index As Integer)
WWhat = Mid(info, 3)
Client(Index).NoDrink = True
Client(Index).UseItem = False
Client(Index).Carrying = WWhat
Client(Index).Update = True
End Function

Public Function Hab_AY(info As String, Index As Integer) 'Use Item "AY"
WWhat = Mid(info, 3)
IJtem = Split(WWhat, Chr(9))(0)
Intval = Val(Split(WWhat, Chr(9))(1))
Client(Index).NoDrink = True
Client(Index).UseItem = True
frmMain.UseTimer(Index).Interval = Intval
frmMain.UseTimer(Index).Enabled = True
Client(Index).Carrying = WWhat
Client(Index).Update = True
End Function

Public Function Hab_Ae2(info As String, Index As Integer) 'Get Catalogue Pages "Ae"
Pages = FSO.OpenTextFile(DBP & "catalogue\pages.txt", ForReading).ReadAll
If ReadINI("rank", "admin_catalogue", DBP & "ranks\" & Client(Index).Rank & ".ini") = "1" Then
    Pages = Pages & ";" & FSO.OpenTextFile(DBP & "catalogue\admin_extra.txt", ForReading).ReadAll
End If
Pages = Split(Pages, ";")
List = ""
For Q = 0 To UBound(Pages)
If Pages(Q) <> "" Then
List = List & Pages(Q) & Chr(9) & Pages(Q) & Chr(13)
End If
Next Q
Send Index, "A~" & List & Chr(1)
End Function

Public Function Hab_Af2(info As String, Index As Integer) 'Catalogue Page "Af"
Pagina = Split(info, "/")(1)
Pagina = FSO.OpenTextFile(DBP & "catalogue\" & Pagina & "\page.txt", ForReading).ReadAll
Send Index, "A" & Chr(127) & Pagina
End Function

Public Function Hab_Atq2(info As String, Index As Integer) 'Get Date "@q"
Send Index, "Bc" & Format(Day(Now), "00") & "-" & Format(Month(Now), "00") & "-" & Year(Now) & Chr(1)
End Function

Public Function Hab_Ad2(info As String, Index As Integer) 'Buy Something "@D"
If Split(info, Chr(13))(5) <> "0" Then 'Check if its a present check if the user exists
    If FSO.FolderExists(DBP & "habbos\" & LCase(Split(info, Chr(13))(6))) = False Then
        Send Index, "BK" & Replace(locale("no_user_for_gift"), "%user%", Split(info, Chr(13))(6)) & Chr(1)
        Exit Function
    End If
End If

buyid = Split(info, Chr(13))(3)
credits = Val(FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\credits.txt", ForReading).ReadAll)

furni = Split(buyid, " ")(0)


If (furni <> "poster" And InStr(furni, "deal") = 0) Then furni = Split(buyid, " ")(1)

If InStr(furni, "deal") = 0 Then
FullF = Split(buyid, " ")(0) & " " & Split(buyid, " ")(1)
Else
FullF = Split(buyid, " ")(0)
End If

Cato = Split(info, Chr(13))(1)
Pagina = FSO.OpenTextFile(DBP & "catalogue\" & Cato & "\page.txt", ForReading).ReadAll
Splitup = Split(Pagina, Chr(13))
For Q = 0 To UBound(Splitup)
If InStr(Splitup(Q), "p:") = 1 Then

If InStr(Split(Splitup(Q), Chr(9))(8), FullF) Then
Cost = Val(Split(Splitup(Q), Chr(9))(2))
Exit For
End If
End If
Next Q

If Cost < 1 Then Exit Function
If credits >= Cost Then
FurniesHand = ""
NewCredits = credits - Cost
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\credits.txt", ForWriting).Write NewCredits
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\transactions.txt", ForAppending, True).Write Format(Date, "dd-mm-yyyy") & Chr(9) & Format(Time, "hh:mm") & Chr(9) & "-" & Cost & Chr(9) & "0" & Chr(9) & Chr(9) & "stuff_store" & Chr(13)
Send Index, "@F" & NewCredits & ".0" & Chr(1)
If InStr(furni, "ovi") = 1 Then
Tel1 = Val(FSO.OpenTextFile(DBP & "furni\count.txt", ForReading, True).ReadAll) + 1
Tel2 = Tel1 + 1
FSO.OpenTextFile(DBP & "furni\count.txt", ForWriting).Write Tel2
FSO.CopyFolder DBP & "buy_furni\" & furni, DBP & "furni\" & Tel1
FSO.CopyFolder DBP & "buy_furni\" & furni, DBP & "furni\" & Tel2
FSO.CreateTextFile DBP & "furni\" & Tel1 & "\destination.txt"
FSO.OpenTextFile(DBP & "furni\" & Tel1 & "\destination.txt", ForWriting).Write Tel2
FSO.CreateTextFile DBP & "furni\" & Tel2 & "\destination.txt"
FSO.OpenTextFile(DBP & "furni\" & Tel2 & "\destination.txt", ForWriting).Write Tel1
FurniesHand = Tel1 & ";" & Tel2 & ";"
ElseIf InStr(furni, "deal") = 1 Then
DealNr = Mid(furni, 5)
'deal01
If DealNr = "01" Then
Items = "TUS;TUS;TUS;PYS"
End If
'deal01
'deal02
If DealNr = "02" Then
Items = "OSB;PYN;TUN;TUN"
End If
'deal02
'deal03
If DealNr = "03" Then
Items = "PMP;mmchair;mmchair;BV7"
End If
'deal03
'deal04
If DealNr = "04" Then
Items = "LTP;PL4;RTV"
End If
'deal04
'deal05
If DealNr = "05" Then
Items = "E9P;E9P;E9P;E9P;E9P;E9P;"
End If
'deal05
'deal06
If DealNr = "06" Then
Items = "JAA;JAA;JAA;PPA"
End If
'deal06
'deal07
If DealNr = "07" Then
Items = "E7P;E7P;E7P;E7P;A7P"
End If
'deal07
'deal08
If DealNr = "08" Then
Items = "OSB;PPS;BMB;aurinko;"
End If
'deal08
'deal09
If DealNr = "09" Then
Items = "poster 1002;ANANAS;PUU;PUU"
End If
'deal09
'deal10
If DealNr = "10" Then
Items = "poster 1001;ANANAS;PUU;PUU"
End If
'deal10
'deal97
If DealNr = "97" Then
Items = "petfood1;petfood1;petfood1;petfood1;petfood1;petfood1"
End If
'deal97
'deal98
If DealNr = "98" Then
Items = "petfood2;petfood2;petfood2;petfood2;petfood2;petfood2"
End If
'deal98
'deal99
If DealNr = "99" Then
Items = "petfood3;petfood3;petfood3;petfood3;petfood3;petfood3"
End If
'deal99
'deal104
If DealNr = "104" Then
Items = "queue_red;queue_red;queue_red"
End If
'deal104
'deal105
If DealNr = "105" Then
Items = "queue_red;queue_red;queue_red;queue_red;queue_red"
End If
'deal105
'deal106
If DealNr = "106" Then
Items = "queue_blue;queue_blue;queue_blue"
End If
'deal106
'deal107
If DealNr = "107" Then
Items = "queue_blue;queue_blue;queue_blue;queue_blue;queue_blue"
End If
'deal107
'deal114
If DealNr = "114" Then
Items = "queue_green;queue_green;queue_green"
End If
'deal114
'deal115
If DealNr = "115" Then
Items = "queue_green;queue_green;queue_green;queue_green;queue_green"
End If
'deal115
'deal118
If DealNr = "118" Then
Items = "queue_navy;queue_navy;queue_navy"
End If
'deal118
'deal119
If DealNr = "119" Then
Items = "queue_navy;queue_navy;queue_navy;queue_navy;queue_navy"
End If
'deal119
'deal108
If DealNr = "108" Then
Items = "queue_purple;queue_purple;queue_purple"
End If
'deal108
'deal109
If DealNr = "109" Then
Items = "queue_purple;queue_purple;queue_purple;queue_purple;queue_purple"
End If
'deal109
'deal0111
If DealNr = "0111" Then
Items = "hc_rllr;hc_rllr;hc_rllr;hc_rllr;hc_rllr"
End If
'deal0111
'deal96
If DealNr = "96" Then
Items = "petfood4;petfood4;petfood4;petfood4;petfood4;petfood4"
End If
'deal96
Lijst = Split(Items, ";")
For Q = 0 To UBound(Lijst)
If Lijst(Q) <> "" Then
furni = Split(Lijst(Q), " ")(0)
Count = Val(FSO.OpenTextFile(DBP & "furni\count.txt", ForReading, True).ReadAll) + 1
If VL64Decode(VL64encode(Count)) <> Count Then
reloop1:
    Count = Count + 1
    If VL64Decode(VL64encode(Count)) <> Count Then GoTo reloop1
End If
FSO.OpenTextFile(DBP & "furni\count.txt", ForWriting).Write Count
FSO.CopyFolder DBP & "buy_furni\" & furni, DBP & "furni\" & Count
        If furni = "poster" Then
        FSO.OpenTextFile(DBP & "furni\" & Count & "\cust.txt", ForWriting).Write Split(Lijst(Q), " ")(1)
        End If
FurniesHand = FurniesHand & Count & ";"
End If
Next Q
Else
If ReadINI("config", "bobba_filter", SettingIni) = "1" Then Gravur = Filter(Split(info, Chr(13))(4)) Else Gravur = Split(info, Chr(13))(4)
Gravur = Replace(Gravur, Chr(1), "")
Count = Val(FSO.OpenTextFile(DBP & "furni\count.txt", ForReading, True).ReadAll) + 1
If VL64Decode(VL64encode(Count)) <> Count Then
reloop2:
    Count = Count + 1
    If VL64Decode(VL64encode(Count)) <> Count Then GoTo reloop2
End If
FSO.OpenTextFile(DBP & "furni\count.txt", ForWriting).Write Count
FSO.CopyFolder DBP & "buy_furni\" & furni, DBP & "furni\" & Count
        If furni = "l" Or furni = "t" Then
        FSO.OpenTextFile(DBP & "furni\" & Count & "\cust.txt", ForWriting).Write Split(info, Chr(13))(4)
        ElseIf furni = "poster" Then
        FSO.OpenTextFile(DBP & "furni\" & Count & "\cust.txt", ForWriting).Write Split(buyid, " ")(1)
        ElseIf InStr(furni, "prizetrophy") = 1 Then
        FSO.OpenTextFile(DBP & "furni\" & Count & "\var.txt", ForWriting).Write "H" & Client(Index).Name & Chr(9) & Format(Day(Now), "00") & "-" & Format(Month(Now), "00") & "-" & Year(Now) & Chr(9) & Gravur
        ElseIf furni = "pet0" Or furni = "pet1" Or furni = "pet2" Then
        FSO.OpenTextFile(DBP & "furni\" & Count & "\petdata.txt", ForWriting).Write Split(info, Chr(13))(4)
        Randomize Timer
        Nature = Int(Rnd * 8)
        Do
        Nature2 = Int(Rnd * 8)
        Loop Until Nature2 <> Nature
        FSO.OpenTextFile(DBP & "furni\" & Count & "\nature.txt", ForWriting).Write Nature & Nature2
        FSO.OpenTextFile(DBP & "furni\" & Count & "\born.txt", ForWriting).Write Now()
        End If
FurniesHand = Count & ";"
End If
If Split(info, Chr(13))(5) = "0" Then
kamerFurni = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hand.txt", ForReading).ReadAll
kamerFurni = Replace(kamerFurni & ";" & FurniesHand & ";", ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hand.txt", ForWriting).Write kamerFurni
Hab_AA2 "AAlast", Index
Else
NaarNaam = LCase(Split(info, Chr(13))(6))
If FSO.FolderExists(DBP & "habbos\" & NaarNaam) = False Then
NaarNaam = Client(Index).Name
Send Index, "BKThere is no Habbo with that name. The present is delivered to your hand." & Chr(1)
End If

Bericht = LCase(Split(info, Chr(13))(7))
If ReadINI("config", "bobba_filter", SettingIni) = "1" Then Bericht = Filter(Bericht)
Bericht = Replace(Bericht, Chr(1), "")

Randomize Timer
getal = Int(7 * Rnd)

If getal = 0 Then getal = ""
Fname = "present_gen" & getal

Count = Val(FSO.OpenTextFile(DBP & "furni\count.txt", ForReading, True).ReadAll) + 1
FSO.OpenTextFile(DBP & "furni\count.txt", ForWriting).Write Count
FSO.CreateFolder DBP & "furni\" & Count
FSO.CreateTextFile DBP & "furni\" & Count & "\cust.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\inroom.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\is.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\loc.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\name.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\type.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\var.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\sitheight.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\height.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\inbox.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\inboxid.txt"
FSO.CreateTextFile DBP & "furni\" & Count & "\stack.txt"
FSO.OpenTextFile(DBP & "furni\" & Count & "\cust.txt", ForWriting).Write "110,0,0"
FSO.OpenTextFile(DBP & "furni\" & Count & "\inroom.txt", ForWriting).Write "0"
FSO.OpenTextFile(DBP & "furni\" & Count & "\is.txt", ForWriting).Write "S"
FSO.OpenTextFile(DBP & "furni\" & Count & "\loc.txt", ForWriting).Write "0 0 0"
FSO.OpenTextFile(DBP & "furni\" & Count & "\name.txt", ForWriting).Write Fname
FSO.OpenTextFile(DBP & "furni\" & Count & "\var.txt", ForWriting).Write "H!" & Bericht
FSO.OpenTextFile(DBP & "furni\" & Count & "\type.txt", ForWriting).Write "solid"
FSO.OpenTextFile(DBP & "furni\" & Count & "\sitheight.txt", ForWriting).Write "0"
FSO.OpenTextFile(DBP & "furni\" & Count & "\height.txt", ForWriting).Write "0"
FSO.OpenTextFile(DBP & "furni\" & Count & "\inboxid.txt", ForWriting).Write FullF
FSO.OpenTextFile(DBP & "furni\" & Count & "\inbox.txt", ForWriting).Write FurniesHand
FSO.OpenTextFile(DBP & "furni\" & Count & "\stack.txt", ForWriting).Write "1"

kamerFurni = FSO.OpenTextFile(DBP & "habbos\" & LCase(NaarNaam) & "\hand.txt", ForReading).ReadAll
kamerFurni = Replace(kamerFurni & ";" & Count & ";", ";;", ";")
FSO.OpenTextFile(DBP & "habbos\" & LCase(NaarNaam) & "\hand.txt", ForWriting).Write kamerFurni

For a = 1 To frmMain.SockI
If LCase(Client(a).Name) = LCase(NaarNaam) And frmMain.socket(a).State = sckConnected Then
Hab_AA2 "AAlast", (a)
Exit For
End If
Next a

End If
End If
End Function

Public Function Hab_BY(info As String, Index As Integer) 'Change Roomcategorie

Dim CatNumLength As Integer

Dim RoomNum As Long
Dim Category As String
CatNumLength = 2
If Right(info, 1) = "H" Or Right(info, 1) = "I" Or Right(info, 1) = "J" Or Right(info, 1) = "K" Then CatNumLength = 1

Category = Right(info, CatNumLength)
RoomNum = Val(VL64Decode(Mid(Mid(info, 3), 1, Len(Mid(info, 3)) - CatNumLength)))

If FSO.FolderExists(DBP & "privaterooms\" & RoomNum) And FSO.FileExists(DBP & "privaterooms\" & RoomNum & "\deleted.txt") = False Then
If FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\owner.txt").ReadAll = Client(Index).Name Then
FSO.OpenTextFile(DBP & "privaterooms\" & RoomNum & "\category.txt", ForWriting).Write Category
End If
End If
End Function

Public Function Hab_Atj(info As String, Index As Integer) 'Check Name
Dim Naam As String
If Right(info, 1) = "I" Then
NaamLen = B64Length(Mid(info, 3, 2))
Naam = Mid(info, 5, NaamLen)
If CheckBadWords(Naam) = 1 Then
    Send Index, "@dK" & Chr(1)
    Exit Function
End If
Send Index, "@dH" & Chr(1)
Else
NaamLen = B64Length(Mid(info, 3, 2))
Naam = Mid(info, 5, NaamLen)
If LCase(Left(Naam, 3)) = "mod" Then
    Send Index, "@dK" & Chr(1)
    Exit Function
End If
If CheckBadWords(Naam) = 1 Then
    Send Index, "@dK" & Chr(1)
    Exit Function
End If
If FSO.FolderExists(DBP & "habbos\" & Naam) Or FSO.FolderExists(DBP & "habbos\" & "mod-" & Naam) Then
Send Index, "@dPA" & Chr(1)
Else
Send Index, "@dH" & Chr(1)
End If
End If
End Function

Public Function Hab_CK(info As String, Index As Integer) 'Check Password
Password = Mid(info, 7 + B64Length(Mid(info, 3, 2)), B64Length(Mid(info, 5 + B64Length(Mid(info, 3, 2)), 2)))
If Len(Password) > 5 And Len(Password) < 10 Then
If InStr(Password, "0") <> 0 Or InStr(Password, "1") <> 0 Or InStr(Password, "2") <> 0 Or InStr(Password, "3") <> 0 Or InStr(Password, "4") <> 0 Or InStr(Password, "5") <> 0 Or InStr(Password, "6") <> 0 Or InStr(Password, "7") <> 0 Or InStr(Password, "8") <> 0 Or InStr(Password, "9") <> 0 Then GoTo Password_OK
End If
Send Index, "DZI" & Chr(1)
Exit Function
Password_OK:
Send Index, "DZH" & Chr(1)
End Function

Public Function Hab_Bat(info As String, Index As Integer)

PetNaam = Val(Mid(info, 5))

Natures = FSO.OpenTextFile(DBP & "furni\" & Pet(PetNaam).FurniID & "\nature.txt", ForReading).ReadAll
Born = FSO.OpenTextFile(DBP & "furni\" & Pet(PetNaam).FurniID & "\born.txt", ForReading).ReadAll

Leeftijd = DateDiff("d", Born, Now())

Nature1 = VL64encode(Mid(Natures, 1, 1))
Nature2 = VL64encode(Mid(Natures, 2, 1))

If Pet(PetNaam).EatTimer <= 600 Then EetStatus = "PA"
If Pet(PetNaam).EatTimer > 600 Then EetStatus = "I"
If Pet(PetNaam).EatTimer > 1200 Then EetStatus = "H"

If Pet(PetNaam).DrinkTimer <= 600 Then DrinkStatus = "K"
If Pet(PetNaam).DrinkTimer > 600 Then DrinkStatus = "J"
If Pet(PetNaam).DrinkTimer > 1200 Then DrinkStatus = "H"

If Pet(PetNaam).EatTimer <= 300 And Pet(PetNaam).DrinkTimer <= 300 Then BlijHeid = "QA"
If (Pet(PetNaam).EatTimer <= 600 And Pet(PetNaam).DrinkTimer <= 600) Or (Pet(PetNaam).EatTimer <= 600 And Pet(PetNaam).DrinkTimer <= 600) Then BlijHeid = "PA"
If (Pet(PetNaam).EatTimer <= 600 And Pet(PetNaam).DrinkTimer > 600) Or (Pet(PetNaam).EatTimer > 600 And Pet(PetNaam).DrinkTimer <= 600) Then BlijHeid = "K"
If Pet(PetNaam).EatTimer > 600 And Pet(PetNaam).DrinkTimer > 600 Then BlijHeid = "J"
If Pet(PetNaam).EatTimer > 600 And Pet(PetNaam).DrinkTimer <= 300 Then BlijHeid = "J"
If (Pet(PetNaam).EatTimer > 1200 And Pet(PetNaam).DrinkTimer > 600) Or (Pet(PetNaam).EatTimer > 600 And Pet(PetNaam).DrinkTimer > 1200) Then BlijHeid = "I"
If Pet(PetNaam).EatTimer > 1200 And Pet(PetNaam).DrinkTimer > 1200 Then BlijHeid = "H"

Send Index, "CR" & VL64encode(PetNaam) & VL64encode(Leeftijd) & EetStatus & DrinkStatus & BlijHeid & Nature1 & Nature2 & Chr(1)
End Function

Public Function Hab_Ab2(info As String, Index As Integer) 'Doorbell Yes/No

Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\owner.txt").ReadAll
rights = FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\rights.txt").ReadAll

If Owner = Client(Index).Name Then Rechten = "ja"
If FSO.OpenTextFile(DBP & "privaterooms\" & Client(Index).InRoom & "\allrights.txt").ReadAll = "1" Then
Rechten = "ja"
Else
Dim Splitt() As String
Splitt = Split(rights, ";")
For Q = 0 To UBound(Splitt())
If Splitt(Q) = Client(Index).Name Then
Rechten = "ja"
Exit For
End If
Next Q
End If

If ReadINI("rank", "rights_in_any_room", DBP & "ranks\" & Client(Index).Rank & ".ini") = "1" Then Rechten = "ja"

If Rechten = "ja" Then
Wie = Mid(info, 5)
JaNee = Right(Wie, 1)
Wie = Mid(Wie, 1, Len(Wie) - 1)

For b = 1 To frmMain.SockI
If Client(b).Name = Wie Then
If JaNee <> "@" Then
Client(b).InRoom = Client(Index).InRoom
If frmMain.socket(b).State = sckConnected Then frmMain.socket(b).SendData "@i" & Chr(1)
Exit For
Else
If frmMain.socket(b).State = sckConnected Then frmMain.socket(b).SendData "BC" & Chr(1)
Exit For
End If
End If
Next b

End If
End Function

Public Function Hab_BV2(info As String, Index As Integer) 'Guestroom Categories "Bv"
Dim c As Integer
Cata = Mid(info, 3)
If Cata = "HPAI" Then
Lijst = "HPAH" & locale("guestrooms_title") & "[nFbNMAISLJ" & locale("categorie_1") & "QD[XKPAHRLJ" & locale("categorie_2") & "YDAZ~EPAHPRJ" & locale("categorie_3") & "RhZtEPAHRQJ" & locale("categorie_4") & "XLA[DFPAHSVJ" & locale("categorie_5") & "SOYsEPAHQ]J" & locale("categorie_6") & "SPY}EPAHR]J" & locale("categorie_7") & "REZyEPAHPLJ" & locale("categorie_8") & "R]X|EPAHRNJ" & locale("categorie_9") & "SP[EPAHRRJ" & locale("categorie_10") & "XjAZfFPAH"
If Val(ReadINI("categories", "SL", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "SLJ" & locale("categorie_1") & "QD[XKPAH", "")
If Val(ReadINI("categories", "RL", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "RLJ" & locale("categorie_2") & "YDAZ~EPAH", "")
If Val(ReadINI("categories", "PR", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "PRJ" & locale("categorie_3") & "RhZtEPAH", "")
If Val(ReadINI("categories", "RQ", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "RQJ" & locale("categorie_4") & "XLA[DFPAH", "")
If Val(ReadINI("categories", "SV", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "SVJ" & locale("categorie_5") & "SOYsEPAH", "")
If Val(ReadINI("categories", "Q]", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "Q]J" & locale("categorie_6") & "SPY}EPAH", "")
If Val(ReadINI("categories", "R]", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "R]J" & locale("categorie_7") & "REZyEPAH", "")
If Val(ReadINI("categories", "PL", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "PLJ" & locale("categorie_8") & "R]X|EPAH", "")
If Val(ReadINI("categories", "RN", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "RNJ" & locale("categorie_9") & "SP[EPAH", "")
If Val(ReadINI("categories", "RR", DBP & "room_categories\categories.ini")) = "0" Then Lijst = Replace(Lijst, "RRJ" & locale("categorie_10") & "XjAZfFPAH", "")
Send Index, "C\" & Lijst & Chr(1)
Exit Function
ElseIf Cata = "HKI" Then
Dim pve(1 To 16) As String
For a = 1 To frmMain.SockI
If IsNumeric(Client(a).Publicnum) = True And Client(a).Publicnum > 0 Then
If pve(Client(a).Publicnum) = "" Then pve(Client(a).Publicnum) = 0
pve(Client(a).Publicnum) = pve(Client(a).Publicnum) + 1
End If
Next a
For b = 1 To 16
If pve(b) = "" Then pve(b) = 0
Next b
pve(11) = Val(pve(11)) + Val(pve(12))
pve(13) = Val(pve(13)) + Val(pve(14))
PubPack = "C\HKH" & locale("pub_title") & "S][^GIRKI" & locale("pub_name_2") & "" & Chr(2) & VL64encode(pve(2)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\2\data.ini")) & "Kwelcome_lounge" & Chr(2) & "[M{Hhh_room_nlobby" & Chr(2) & "HIRdI" & locale("pub_name_1") & "" & VL64encode(pve(1)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\1\data.ini")) & "Ktheatredromeb}DAHhh_room_theater" & Chr(2) & "HIReI" & locale("pub_name_3") & "" & VL64encode(pve(3)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\3\data.ini")) & "Ktheatredrome_axeb}EAHhh_room_theater_axe" & Chr(2) & "HIRfI" & locale("pub_name_4") & "" & VL64encode(pve(4)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\4\data.ini")) & "Ktheatredrome_easterb}FAHhh_room_theater_easter" & Chr(2) & "HIRgI" & locale("pub_name_5") & "" & VL64encode(pve(5)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\5\data.ini")) & "Kparkb}GAHhh_room_park_de,hh_room_park"
PubPack = PubPack & Chr(2) & "HIRhI" & locale("pub_name_6") & "" & VL64encode(pve(6)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\6\data.ini")) & "Korientb}HAHhh_room_orient" & Chr(2) & "HIRiI" & locale("pub_name_7") & "" & VL64encode(pve(7)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\7\data.ini")) & "Khabburger'sb}IAHhh_room_habburger" & Chr(2) & "HIRjI" & locale("pub_name_8") & "" & VL64encode(pve(8)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\8\data.ini")) & "Khotel_kitchenb}JAHhh_room_kitchen" & Chr(2) & "HIRkI" & locale("pub_name_9") & "" & VL64encode(pve(9)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\9\data.ini")) & "Khabbo_cinemab}KAHhh_room_cinema" & Chr(2) & "HIRlI" & locale("pub_name_10") & "" & VL64encode(pve(10)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\10\data.ini")) & "Kmain_lobbyb}LAHhh_room_lobby"
PubPack = PubPack & Chr(2) & "HIRmI" & locale("pub_name_11") & "" & VL64encode(pve(11)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\11\data.ini")) & "Khabbo_lidob}MAHhh_room_pool,hh_people_pool" & Chr(2) & "HIRnI" & locale("pub_name_13") & "" & VL64encode(pve(13)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\13\data.ini")) & "Krooftopb}NAHhh_room_rooftop" & Chr(2) & "HIRoI" & locale("pub_name_15") & "" & VL64encode(pve(15)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\15\data.ini")) & "Kballroomb}OAHhh_room_ballroom" & Chr(2) & "HIRpI" & locale("pub_name_16") & "" & VL64encode(pve(16)) & VL64encode(ReadINI("public-data", "max_inside", DBP & "pub\16\data.ini")) & "Ktearoomb}PAHhh_room_tearoomHI"
Send Index, PubPack
Exit Function
ElseIf Cata = "HSLI" Then
Category = "SL"
CategoryID = Mid(Cata, 1, Len(Cata) - 1) & "J" & locale("categorie_1")
ElseIf Cata = "HRLI" Then
Category = "RL"
CategoryID = Mid(Cata, 1, Len(Cata) - 1) & "J" & locale("categorie_2")
ElseIf Cata = "HPRI" Then
Category = "PR"
CategoryID = Mid(Cata, 1, Len(Cata) - 1) & "J" & locale("categorie_3")
ElseIf Cata = "HRQI" Then
Category = "RQ"
CategoryID = Mid(Cata, 1, Len(Cata) - 1) & "J" & locale("categorie_4")
ElseIf Cata = "HSVI" Then
Category = "SV"
CategoryID = Mid(Cata, 1, Len(Cata) - 1) & "J" & locale("categorie_5")
ElseIf Cata = "HQ]I" Then
Category = "Q]"
CategoryID = Mid(Cata, 1, Len(Cata) - 1) & "J" & locale("categorie_6")
ElseIf Cata = "HR]I" Then
Category = "R]"
CategoryID = Mid(Cata, 1, Len(Cata) - 1) & "J" & locale("categorie_7")
ElseIf Cata = "HPLI" Then
Category = "PL"
CategoryID = Mid(Cata, 1, Len(Cata) - 1) & "J" & locale("categorie_8")
ElseIf Cata = "HRNI" Then
Category = "RN"
CategoryID = Mid(Cata, 1, Len(Cata) - 1) & "J" & locale("categorie_9")
ElseIf Cata = "HRRI" Then
Category = "RR"
CategoryID = Mid(Cata, 1, Len(Cata) - 1) & "J" & locale("categorie_10")
End If

BuildList = ""
RoomCount = 0
Rooms = 0

Load frmMain.ListRooms(Index)

For a = 1 To Val(FSO.OpenTextFile(DBP & "privaterooms\count.txt", ForReading).ReadAll)
If FSO.FolderExists(DBP & "privaterooms\" & a) And FSO.FileExists(DBP & "privaterooms\" & a & "\deleted.txt") = False Then
If FSO.OpenTextFile(DBP & "privaterooms\" & a & "\category.txt", ForReading).ReadAll = Category Then
Number = a

InRoom = 0

For b = 1 To frmMain.SockI
If Client(b).InRoom = Number Then
InRoom = InRoom + 1
End If
Next b
    frmMain.ListRooms(Index).AddItem InRoom & " " & Number
End If
End If
Rooms = Rooms + 1
Next a

RCA = 0
For a = frmMain.ListRooms(Index).ListCount - 1 To 0 Step -1
RCA = RCA + 1

If RCA <= Val(ReadINI("config", "maxguestroomsinlist", SettingIni)) Then
RoomCount = RoomCount + 1
Number = Val(Split(frmMain.ListRooms(Index).List(a), " ")(1))
RoomName = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\name.txt").ReadAll)
Owner = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\owner.txt").ReadAll
Description = Trim(FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\description.txt").ReadAll)
MaxIn = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\maxin.txt").ReadAll
OpenType = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\opentype.txt").ReadAll
ShowName = FSO.OpenTextFile(DBP & "privaterooms\" & Number & "\showname.txt").ReadAll
InRoom = 0

For b = 1 To frmMain.SockI
If Client(b).InRoom = Number Then
InRoom = InRoom + 1
End If
Next b

If ShowName = "0" And Owner <> Client(Index).Name And ReadINI("rank", "see_room_owner", DBP & "ranks\" & Client(Index).Rank & ".ini") <> "1" Then Owner = "-"

BuildList = BuildList & VL64encode(Number) & RoomName & Chr(2) & Owner & Chr(2) & OpenType & Chr(2) & VL64encode(InRoom) & VL64encode(MaxIn) & Description & Chr(2)
End If
Next a

Unload frmMain.ListRooms(Index)

If RoomCount > 0 Then
Send Index, "C\" & CategoryID & Chr(2) & "I" & VL64encode(15 * RoomCount) & "PA" & VL64encode(RoomCount) & BuildList & Chr(1)
Else
Send Index, "C\" & CategoryID & Chr(2) & "IHPAH" & Chr(1)
End If
End Function

Public Function Hab_CH(info As String, Index As Integer) 'Mod Tool "CH"

Functionn = Mid(info, 3, 2)

Select Case Functionn

Case "HI" 'kick user
If InStr(ReadINI("rank", "mod_tool", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",kick") Then
NewInfo = Mid(info, 5)
Msglength = B64Length(Mid(NewInfo, 1, 2))
Msg = Mid(NewInfo, 3, Msglength)
NewInfo = Mid(NewInfo, 3 + Msglength)
Xtralength = B64Length(Mid(NewInfo, 1, 2))
Xtra = Mid(NewInfo, 3, Xtralength)
NewInfo = Mid(NewInfo, 3 + Xtralength)
Namlength = B64Length(Mid(NewInfo, 1, 2))
Nam = Mid(NewInfo, 3, Namlength)

For a = 1 To frmMain.SockI
If LCase(Nam) = LCase(Client(a).Name) And RankHeight(Client(Index).Rank, Client(a).Rank) = True Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@R" & Chr(1)
If Msg <> "" And frmMain.socket(a).State = sckConnected Then If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@amod_warn/" & Msg & Chr(1)
If Client(Index).InRoom > 0 Then
sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(a).InRoom = 0
End If
If Client(Index).Publicnum > 0 Then
sendAllP "@]" & Client(a).Num & Chr(1), (Client(a).Publicnum)
Client(a).Publicnum = 0
Client(a).Publicname = ""
End If
Client(a).Muted = False
Client(a).Hotelpos = "I" & locale("hotel_view")
End If
Next a
End If
'Printlog Client(index).name & " kickte " & Nam & " Grund: " & Msg

Case "HH" 'alert user
If InStr(ReadINI("rank", "mod_tool", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",alert") Then
NewInfo = Mid(info, 5)
Msglength = B64Length(Mid(NewInfo, 1, 2))
Msg = Mid(NewInfo, 3, Msglength)
NewInfo = Mid(NewInfo, 3 + Msglength)
Xtralength = B64Length(Mid(NewInfo, 1, 2))
Xtra = Mid(NewInfo, 3, Xtralength)
NewInfo = Mid(NewInfo, 3 + Xtralength)
Namlength = B64Length(Mid(NewInfo, 1, 2))
Nam = Mid(NewInfo, 3, Namlength)

For a = 1 To frmMain.SockI
If LCase(Nam) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "B!" & Msg & Chr(1)
Exit For
End If
Next a
End If
'Printlog Client(index).name & " sendete Alert an " & Nam & ": " & Msg

Case "HJ" 'ban user
If InStr(ReadINI("rank", "mod_tool", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",ban") Then
NewInfo = Mid(info, 5)
Msglength = B64Length(Mid(NewInfo, 1, 2))
Msg = Mid(NewInfo, 3, Msglength)
NewInfo = Mid(NewInfo, 3 + Msglength)
Xtralength = B64Length(Mid(NewInfo, 1, 2))
Xtra = Mid(NewInfo, 3, Xtralength)
NewInfo = Mid(NewInfo, 3 + Xtralength)
Namlength = B64Length(Mid(NewInfo, 1, 2))
Nam = Mid(NewInfo, 3, Namlength)
NewInfo = Mid(NewInfo, 3 + Namlength)

BanComputer = Right(NewInfo, 1)
NewInfo = Mid(NewInfo, 1, Len(NewInfo) - 1)

BanIP = Right(NewInfo, 1)
NewInfo = Mid(NewInfo, 1, Len(NewInfo) - 1)

BanDuration = VL64Decode(NewInfo)

If FSO.FolderExists(DBP & "habbos\" & LCase(Nam)) = False Then Exit Function
If RankHeight(Client(Index).Rank, FSO.OpenTextFile(DBP & "habbos\" & LCase(Nam) & "\rank.txt", ForReading).ReadAll) = True Then
FSO.OpenTextFile(DBP & "user_bans\" & LCase(Nam) & ".txt", ForWriting, True).Write DateAdd("h", Val(BanDuration), Now())
FSO.OpenTextFile(DBP & "user_bans\" & LCase(Nam) & ".reason", ForWriting, True).Write Msg

For a = 1 To frmMain.SockI
If LCase(Nam) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If BanComputer = "I" Or BanIP = "I" Then
FSO.OpenTextFile(DBP & "ip_bans\" & frmMain.socket(a).RemoteHostIP & ".txt", ForWriting, True).Write DateAdd("h", Val(BanDuration), Now())
FSO.OpenTextFile(DBP & "ip_bans\" & frmMain.socket(a).RemoteHostIP & ".reason", ForWriting, True).Write Msg
End If
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@c" & Msg & Chr(1)
If Client(a).InRoom > 0 Then
sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(a).InRoom = 0
End If
If Client(a).Publicnum > 0 Then
sendAllP "@]" & Client(a).Num & Chr(1), (Client(a).Publicnum)
Client(a).Publicnum = 0
Client(a).Publicname = ""
End If
Client(a).Hotelpos = "H"
Exit For
End If
Next a
End If
End If
'Printlog Client(index).name & " verbannte " & Nam & ", Grund: " & Msg

Case "IH" 'alert room
If InStr(ReadINI("rank", "mod_tool", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",roomalert") Then
NewInfo = Mid(info, 5)
Msglength = B64Length(Mid(NewInfo, 1, 2))
Msg = Mid(NewInfo, 3, Msglength)
NewInfo = Mid(NewInfo, 3 + Msglength)
Xtralength = B64Length(Mid(NewInfo, 1, 2))
Xtra = Mid(NewInfo, 3, Xtralength)
For a = 1 To frmMain.SockI
If (Client(Index).InRoom > 0 And Client(Index).InRoom = Client(a).InRoom) Or (Client(Index).Publicnum > 0 And Client(Index).Publicnum = Client(a).Publicnum) Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@amod_warn/" & Msg & Chr(1)
End If
Next a
End If
'Printlog Client(index).name & " sendete Raumalert: " & Msg

Case "II" 'kick room
If InStr(ReadINI("rank", "mod_tool", DBP & "ranks\" & Client(Index).Rank & ".ini"), ",roomkick") Then
NewInfo = Mid(info, 5)
Msglength = B64Length(Mid(NewInfo, 1, 2))
Msg = Mid(NewInfo, 3, Msglength)
NewInfo = Mid(NewInfo, 3 + Msglength)
Xtralength = B64Length(Mid(NewInfo, 1, 2))
Xtra = Mid(NewInfo, 3, Xtralength)
For a = 1 To frmMain.SockI
If Client(Index).Name <> Client(a).Name And Client(a).InRoom = Client(Index).InRoom And RankHeight(Client(Index).Rank, Client(a).Rank) = True Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@R" & Chr(1)
If Msg <> "" And frmMain.socket(a).State = sckConnected Then If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "@amod_warn/" & Msg & Chr(1)
If Client(Index).InRoom > 0 Then
sendAll "@]" & Client(a).Num & Chr(1), (Client(a).InRoom)
Client(a).InRoom = 0
End If
If Client(Index).Publicnum > 0 Then
sendAllP "@]" & Client(a).Num & Chr(1), (Client(Index).Publicnum)
Client(a).Publicnum = 0
Client(a).Publicname = ""
End If
Client(a).Hotelpos = "I" & locale("hotel_view")
Client(a).Muted = False
End If
Next a
End If
'Printlog Client(index).name & " machte Raumkick, MSG: " & Msg

End Select

End Function

Public Function Hab_AV(info As String, Index As Integer) 'Send CFH "AV"
On Error Resume Next
BerichtLen = B64Length(Mid(info, 3, 2))
Bericht = Mid(info, 5, BerichtLen)
Typee = Mid(info, 5 + BerichtLen)
Kamer = VL64encode(Client(Index).InRoom)
frmMain.CFHs = Val(frmMain.CFHs) + 1
Load frmMain.CFH(frmMain.CFHs)
frmMain.CFH(frmMain.CFHs).Text = "BT" & VL64encode(frmMain.CFHs) & Chr(2) & Typee & locale("cfh_time") & " " & Format(Date, "dd-mm-yyyy") & " " & Format(Time, "hh:mm") & Chr(2) & Client(Index).Name & Chr(2) & Bericht & Chr(2) & Kamer & Chr(2) & locale("message") & ":" & Chr(2) & "I" & Chr(2) & Kamer & Chr(1)
For a = 1 To frmMain.SockI
If Client(a).Rank <> "" Then
If ReadINI("rank", "recrieve_cfh", DBP & "ranks\" & Client(a).Rank & ".ini") = "1" Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData frmMain.CFH(frmMain.CFHs).Text
End If
End If
Next a
End Function

Public Function Hab_Atp2(info As String, Index As Integer) 'Call for Helps "@p"
On Error Resume Next
If ReadINI("rank", "recrieve_cfh", DBP & "ranks\" & Client(Index).Rank & ".ini") = "1" Then
IdeeLen = B64Length(Mid(info, 3, 2))
Idee = Mid(info, 5, IdeeLen)
If InStr(frmMain.PickedUpCalls, "<" & Idee & "=") = 0 Then
frmMain.PickedUpCalls = frmMain.PickedUpCalls & "<" & Idee & "=" & Client(Index).Name & ">"
For a = 1 To frmMain.SockI
If Client(a).Rank <> "" Then
If ReadINI("rank", "recrieve_cfh", DBP & "ranks\" & Client(a).Rank & ".ini") = "1" Then
Idee2 = VL64Decode(Idee)
NewData = Split(frmMain.CFH(Idee2), Chr(2))
NewData(1) = Mid(NewData(1), 1, 1) & locale("picked_up_on") & " " & Format(Date, "dd-mm-yyyy") & " " & Format(Time, "hh:mm")
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData Join(NewData, Chr(2))
'Unload frmMain.CFH(Idee2)
End If
End If
Next a
Else
Bij = Mid(frmMain.PickedUpCalls, InStr(frmMain.PickedUpCalls, "<" & Idee & "="))
Bij = Mid(Bij, InStr(Bij, "=") + 1)
Bij = Mid(Bij, 1, InStr(Bij, ">") - 1)
Send Index, "BK" & locale("already_picked_up_by") & " " & Bij & Chr(1)
End If
End If
End Function

Public Function Hab_CF(info As String, Index As Integer) 'Send Callforhelp "CF"
On Error Resume Next
If ReadINI("rank", "recrieve_cfh", DBP & "ranks\" & Client(Index).Rank & ".ini") = "1" Then
IdeeLen = B64Length(Mid(info, 3, 2))
Idee = Mid(info, 5, IdeeLen)
NewType = Mid(info, 5 + IdeeLen, 1)
If InStr(frmMain.PickedUpCalls, "<" & Idee & "=") = 0 Then
For a = 1 To frmMain.SockI
If Client(a).Rank <> "" Then
If ReadINI("rank", "recrieve_cfh", DBP & "ranks\" & Client(a).Rank & ".ini") = "1" Then
Idee2 = VL64Decode(Idee)
NewData = Split(frmMain.CFH(Idee2), Chr(2))
NewData(1) = NewType & locale("cfh_time") & " " & Format(Date, "dd-mm-yyyy") & " " & Format(Time, "hh:mm")
frmMain.CFH(Idee2).Text = Join(NewData, Chr(2))
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData frmMain.CFH(Idee2).Text
End If
End If
Next a
Else
Bij = Mid(frmMain.PickedUpCalls, InStr(frmMain.PickedUpCalls, "<" & Idee & "="))
Bij = Mid(Bij, InStr(Bij, "=") + 1)
Bij = Mid(Bij, 1, InStr(Bij, ">") - 1)
Send Index, "BK" & locale("already_picked_up_by") & " " & Bij & Chr(1)
End If
End If
End Function

Public Function Hab_CG(info As String, Index As Integer) 'Call for help "CG"
On Error Resume Next
If ReadINI("rank", "recrieve_cfh", DBP & "ranks\" & Client(Index).Rank & ".ini") = "1" Then
IdeeLen = B64Length(Mid(info, 3, 2))
Idee = Mid(info, 5, IdeeLen)
NewInfo = Mid(info, 5 + IdeeLen)
MsgLen = B64Length(Mid(NewInfo, 1, 2))
Msg = Mid(NewInfo, 3, MsgLen)

Wie = Split(frmMain.CFH(VL64Decode(Idee)).Text, Chr(2))(2)

For a = 1 To frmMain.SockI
If LCase(Wie) = LCase(Client(a).Name) And frmMain.socket(a).State = sckConnected Then
If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData "DR" & Msg & Chr(2) & Chr(1)
Exit For
End If
Next a
End If
End Function

Public Function Hab_Atk(info As String, Index As Integer) 'Create User "@k"
NewInfo = Mid(info, 5)
Name = Mid(NewInfo, 3, B64Length(Mid(NewInfo, 1, 2)))
NewInfo = Mid(NewInfo, 3 + B64Length(Mid(NewInfo, 1, 2)) + 2)
Appp = Mid(NewInfo, 3, B64Length(Mid(NewInfo, 1, 2)))
NewInfo = Mid(NewInfo, 3 + B64Length(Mid(NewInfo, 1, 2)) + 2)
Sex = Mid(NewInfo, 3, B64Length(Mid(NewInfo, 1, 2)))
NewInfo = Mid(NewInfo, 3 + B64Length(Mid(NewInfo, 1, 2)) + 6)
Mail = Mid(NewInfo, 3, B64Length(Mid(NewInfo, 1, 2)))
NewInfo = Mid(NewInfo, 3 + B64Length(Mid(NewInfo, 1, 2)) + 2)
DOB = Mid(NewInfo, 3, B64Length(Mid(NewInfo, 1, 2)))
NewInfo = Mid(NewInfo, 3 + B64Length(Mid(NewInfo, 1, 2)) + 11)
Pass = Mid(NewInfo, 3, B64Length(Mid(NewInfo, 1, 2)))

FSO.CopyFolder DBP & "new_habbo", DBP & "habbos\" & LCase(Name)
OldNum = FSO.OpenTextFile(DBP & "habbos\count.txt", ForReading).ReadAll
FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\name.txt", ForWriting, True).Write Name
FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\pass.txt", ForWriting, True).Write Pass
FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\app.txt", ForWriting, True).Write Appp
FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\birth.txt", ForWriting, True).Write DOB
FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\sex.txt", ForWriting, True).Write Sex
FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\email.txt", ForWriting, True).Write Mail
FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\hcupdate.txt", ForWriting, True).Write Now()
FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\habbobirth.txt", ForWriting, True).Write Now()
If VL64Decode(VL64encode(OldNum + 1)) <> OldNum + 1 Then
reloop:
    OldNum = OldNum + 1
    If VL64Decode(VL64encode(OldNum + 1)) <> OldNum + 1 Then GoTo reloop
End If
FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\num.txt", ForWriting, True).Write OldNum + 1
FSO.OpenTextFile(DBP & "habbos\count.txt", ForWriting).Write FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\num.txt", ForReading).ReadAll
If FSO.FileExists(DBP & "habbos\" & LCase(Name) & "\directmail\welcome.message") = True Then
    WlkMsgv = FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\directmail\welcome.message", ForReading).ReadAll
    FSO.OpenTextFile(DBP & "habbos\" & LCase(Name) & "\directmail\welcome.message", ForWriting).Write Replace(WlkMsgv, "%username%", Name)
End If
Client(Index).Name = Name

'check if banned
If FSO.FileExists(DBP & "user_bans\" & Client(Index).Name & ".txt") Then
Till = FSO.OpenTextFile(DBP & "user_bans\" & Client(Index).Name & ".txt", ForReading).ReadAll
Reason = FSO.OpenTextFile(DBP & "user_bans\" & Client(Index).Name & ".reason", ForReading).ReadAll
HoursLeft = DateDiff("h", Till, Now())
If HoursLeft < 0 Then
Send Index, "@c" & Reason & Chr(1)
Exit Function
End If
End If
'check if banned

'check if ip banned
If FSO.FileExists(DBP & "ip_bans\" & frmMain.socket(Index).RemoteHostIP & ".txt") Then
Till = FSO.OpenTextFile(DBP & "ip_bans\" & frmMain.socket(Index).RemoteHostIP & ".txt", ForReading).ReadAll
Reason = FSO.OpenTextFile(DBP & "ip_bans\" & frmMain.socket(Index).RemoteHostIP & ".reason", ForReading).ReadAll
HoursLeft = DateDiff("h", Till, Now())
If HoursLeft < 0 Then
Send Index, "@c" & Reason & Chr(1)
Exit Function
End If
End If
'check if ip banned

For xyz = 5 To 10000
If InStr(Nums, "<" & xyz & ">") = 0 Then
Client(Index).Num = Val(xyz)
Exit For
End If
Next xyz

Nums = Nums & "<" & Client(Index).Num & ">"

Client(Index).Rank = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\rank.txt", ForReading).ReadAll

Rechten = ReadINI("rank", "fuse_rights", DBP & "ranks\" & Client(Index).Rank & ".ini")

If Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\hcdays.txt", ForReading).ReadAll) > 0 Then
Rechten = Rechten & "fuse_use_club_outfitsfuse_use_club_badgefuse_use_special_room_layoutsfuse_room_queue_clubfuse_room_queue_defaultfuse_use_club_dancefuse_priority_accessfuse_habbo_chooserfuse_furni_chooserdefault"
End If

Send Index, "@B" & Rechten & Chr(1)

Films = Val(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\film.txt", ForReading).ReadAll)
Send Index, "@D" & VL64encode(Films) & Chr(1)

Send Index, "@C" & Chr(1)
End Function

Public Function Hab_Bu(info As String, Index As Integer) 'Change Password "BU"

Gived_Password = Mid(info, 7, B64Length(Mid(info, 5, 2)))
Gived_Birthdate = Mid(info, 11 + Len(Gived_Password), B64Length(Mid(info, 9 + Len(Gived_Password), 2)))
Gived_ToChange = Mid(info, 11 + Len(Gived_Password) + Len(Gived_Birthdate), 2)
Gived_ChangeInfo = Mid(info, 15 + Len(Gived_Password) + Len(Gived_Birthdate), B64Length(Mid(info, 13 + Len(Gived_Password) + Len(Gived_Birthdate), 2)))
Real_Password = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\pass.txt", ForReading).ReadAll
Real_Birthdate = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\birth.txt", ForReading).ReadAll
If Gived_Password = Real_Password Then
    If Gived_Birthdate = Real_Birthdate Then
        If Gived_ToChange = "@C" Then
            FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\pass.txt", ForWriting).Write Gived_ChangeInfo
        ElseIf Gived_ToChange = "@G" Then
            FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\email.txt", ForWriting).Write Gived_ChangeInfo
        End If
        Send Index, "Bi0" & Chr(1)
    Else
        Send Index, "Bi2" & Chr(1)
    End If
Else
    Send Index, "Bi1" & Chr(1)
End If

End Function

Public Function Hab_Atd2(info As String, Index As Integer) 'Change console Mission "@d"
Newmission = Mid(info, 5, B64Length(Mid(info, 3, 2)))
If ReadINI("config", "bobba_filter", SettingIni) = "1" Then Newmission = Filter(Newmission)
Newmission = Replace(Newmission, Chr(1), "")
Newmission = Trim(Newmission)
If Newmission = "" Then Newmission = " "
FSO.OpenTextFile(DBP & "habbos\" & Client(Index).Name & "\consolemission.txt", ForWriting).Write Newmission
Send Index, "BS" & Newmission & Chr(2) & Chr(1)
End Function

Public Function Hab_Ati2(info As String, Index As Integer) 'Search Console "@i"
Searchuser = Mid(info, 5, B64Length(Mid(info, 3, 2)))
If FSO.FolderExists(DBP & "habbos\" & LCase(Searchuser)) = True Then
    Searchname = FSO.OpenTextFile(DBP & "habbos\" & LCase(Searchuser) & "\name.txt", ForReading).ReadAll
    SearchApp = FSO.OpenTextFile(DBP & "habbos\" & LCase(Searchuser) & "\app.txt", ForReading).ReadAll
    If FSO.OpenTextFile(DBP & "habbos\" & LCase(Searchuser) & "\consolemission.txt", ForReading).AtEndOfStream = True Then
        SearchConm = ""
    Else
        SearchConm = FSO.OpenTextFile(DBP & "habbos\" & LCase(Searchuser) & "\consolemission.txt", ForReading).ReadAll
    End If
    If LCase(FSO.OpenTextFile(DBP & "habbos\" & LCase(Searchuser) & "\sex.txt", ForReading).ReadAll) = "m" Then
        SearchGender = "I"
    Else
        SearchGender = "H"
    End If
    If FSO.OpenTextFile(DBP & "habbos\" & LCase(Searchuser) & "\lastonline.txt", ForReading).AtEndOfStream = False Then FSO.OpenTextFile(DBP & "habbos\" & LCase(Searchuser) & "\lastonline.txt", ForWriting).Write Format(Date, "dd-mm-yyyy") & " " & Format(Time, "hh:mm")
    SearchLastOn = FSO.OpenTextFile(DBP & "habbos\" & LCase(Searchuser) & "\lastonline.txt", ForReading).ReadAll
    Gett = 0
    For a = 1 To frmMain.SockI
        If LCase(Client(a).Name) = LCase(Searchuser) And frmMain.socket(a).State = sckConnected Then
            UserPosition = Client(a).Hotelpos
            Gett = 1
        Exit For
        End If
    Next a
    If Gett = 0 Then
        UserPosition = "H"
    End If
    Send Index, "B@MESSENGER" & Chr(2) & VL64encode(UserID(Searchuser)) & Searchname & Chr(2) & SearchGender & SearchConm & Chr(2) & UserPosition & Chr(2) & SearchLastOn & Chr(2) & SearchApp & Chr(2) & Chr(1)
Else
    Send Index, "B@MESSENGER" & Chr(2) & "H" & Chr(1)
End If
End Function

Public Function Hab_Ato(info As String, Index As Integer) 'Update Console "@O"
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\lastonline.txt", ForWriting, True).Write Format(Date, "dd-mm-yyyy") & " " & Format(Time, "hh:mm")
GetFriendStats Index
End Function

Public Function Hab_Atg(info As String, Index As Integer) 'Ask Friend "@g"
TheirName = Right(info, B64Length(Mid(info, 3, 2)))
If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\friendlist.txt", ForReading).AtEndOfStream = False Then If InStr(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\friendlist.txt", ForReading).ReadAll, "<" & LCase(TheirName) & ">") Then Exit Function
If FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\friendlist.txt", ForReading).AtEndOfStream = False Then If InStr(FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\friendlist.txt", ForReading).ReadAll, "<" & LCase(Client(Index).Name) & ">") Then Exit Function
If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\inquiries.txt", ForReading).AtEndOfStream = False Then If InStr(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\inquiries.txt", ForReading).ReadAll, "<" & LCase(TheirName) & ">") Then Exit Function
If FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\inquiries.txt", ForReading).AtEndOfStream = False Then If InStr(FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\inquiries.txt", ForReading).ReadAll, "<" & LCase(Client(Index).Name) & ">") Then Exit Function
FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\inquiries.txt", ForAppending).Write "<" & LCase(Client(Index).Name) & ">"
For a = 1 To frmMain.SockI
    If frmMain.socket(a).State = sckConnected And LCase(Client(a).Name) = LCase(TheirName) Then
        frmMain.socket(a).SendData "BD" & VL64encode(UserID(Client(Index).Name)) & Client(Index).Name & Chr(2) & Chr(1)
        Exit Function
    End If
Next a
End Function

Public Function Hab_Ate(info As String, Index As Integer) 'Accept Friend "@e"
TheirID = VL64Decode(Right(info, Len(info) - 2))
TheirName = unUserID(TheirID)
If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\inquiries.txt", ForReading).AtEndOfStream = False Then
    If InStr(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\inquiries.txt", ForReading).ReadAll, "<" & LCase(TheirName) & ">") Then
        NewList = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\inquiries.txt", ForReading).ReadAll
        NewList = Replace(NewList, "<" & LCase(TheirName) & ">", "")
        FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\inquiries.txt", ForWriting).Write NewList
    End If
End If
If FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\inquiries.txt", ForReading).AtEndOfStream = False Then
    If InStr(FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\inquiries.txt", ForReading).ReadAll, "<" & LCase(Client(Index).Name) & ">") Then
        NewList = FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\inquiries.txt", ForReading).ReadAll
        NewList = Replace(NewList, "<" & LCase(Client(Index).Name) & ">", "")
        FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\inquiries.txt", ForWriting).Write NewList
    End If
End If
FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\friendlist.txt", ForAppending).Write "<" & LCase(Client(Index).Name) & ">"
FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\friendlist.txt", ForAppending).Write "<" & LCase(TheirName) & ">"
If GetID(TheirName) <> 0 Then
    UserSock = GetID(TheirName)
    UserPosition = Client(UserSock).Hotelpos
Else
    UserPosition = "H"
End If
If LCase(FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\sex.txt", ForReading).ReadAll) = "m" Then
    TGender = "I"
Else
    TGender = "H"
End If
If FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\consolemission.txt", ForReading).AtEndOfStream = True Then
    cmiss = ""
Else
    cmiss = Trim(FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\consolemission.txt", ForReading).ReadAll)
End If
Send Index, "BI" & VL64encode(UserID(TheirName)) & FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\name.txt", ForReading).ReadAll & Chr(2) & TGender & cmiss & Chr(2) & UserPosition & Chr(2) & FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\lastonline.txt", ForReading).ReadAll & Chr(2) & FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\app.txt", ForReading).ReadAll & Chr(2) & Chr(1)
UserPosition = Client(Index).Hotelpos
If UserSock <> 0 Then
    UserSock = GetID(TheirName)
    If LCase(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\sex.txt", ForReading).ReadAll) = "m" Then
        TGender = "I"
    Else
        TGender = "H"
    End If
    If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\consolemission.txt", ForReading).AtEndOfStream = True Then
        cmiss = ""
    Else
        cmiss = Trim(FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\consolemission.txt", ForReading).ReadAll)
    End If
    frmMain.socket(UserSock).SendData "BI" & VL64encode(UserID(Client(Index).Name)) & Client(Index).Name & Chr(2) & TGender & cmiss & Chr(2) & UserPosition & Chr(2) & FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\lastonline.txt", ForReading).ReadAll & Chr(2) & Client(Index).App & Chr(2) & Chr(1)
End If
Exit Function
End Function

Public Function Hab_Atf(info As String, Index As Integer)
If Mid(info, 3, 1) = "I" Then
    TheirID = VL64Decode(Right(info, Len(info) - 3))
    TheirName = unUserID(TheirID)
    If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\inquiries.txt", ForReading).AtEndOfStream = False Then
        NewList = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\inquiries.txt", ForReading).ReadAll
        NewList = Replace(NewList, "<" & LCase(TheirName) & ">", "")
        FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\inquiries.txt", ForWriting).Write NewList
    End If
    If FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\inquiries.txt", ForReading).AtEndOfStream = False Then
        NewList = FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\inquiries.txt", ForReading).ReadAll
        NewList = Replace(NewList, "<" & LCase(Client(Index).Name) & ">", "")
        FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\inquiries.txt", ForWriting).Write NewList
    End If
Else
    FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\inquiries.txt", ForWriting).Write ""
End If
End Function

Public Function Hab_Ath2(info As String, Index As Integer)
TheirID = VL64Decode(Right(info, Len(info) - 3))
TheirName = unUserID(TheirID)
If FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\friendlist.txt", ForReading).AtEndOfStream = False Then
    NewList = FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\friendlist.txt", ForReading).ReadAll
    NewList = Replace(NewList, "<" & LCase(TheirName) & ">", "")
    FSO.OpenTextFile(DBP & "habbos\" & LCase(Client(Index).Name) & "\friendlist.txt", ForWriting).Write NewList
End If
If FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\friendlist.txt", ForReading).AtEndOfStream = False Then
    NewList = FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\friendlist.txt", ForReading).ReadAll
    NewList = Replace(NewList, "<" & LCase(Client(Index).Name) & ">", "")
    FSO.OpenTextFile(DBP & "habbos\" & LCase(TheirName) & "\friendlist.txt", ForWriting).Write NewList
End If
idp = UserID(TheirName)
idh = UserID(Client(Index).Name)
Send Index, "BJI" & VL64encode(idp) & Chr(1)
Dim a As Integer
For a = 1 To frmMain.SockI
    If LCase(Client(a).Name) = LCase(TheirName) And frmMain.socket(a).State = sckConnected Then
        frmMain.socket(a).SendData "BJI" & VL64encode(idh) & Chr(1)
        Exit Function
    End If
Next a
Dim MesFile As File
For Each MesFile In FSO.GetFolder(DBP & "habbos\" & LCase(Client(Index).Name) & "\directmail\").Files
    If Right(MesFile.Path, 3) <> "txt" And Len(MesFile.OpenAsTextStream(ForReading).ReadAll) >= Len(TheirName) Then
        If LCase(Left(MesFile.OpenAsTextStream(ForReading).ReadAll, Len(TheirName))) = LCase(TheirName) Then
            Client(Index).reportmessage = MesFile.OpenAsTextStream(ForReading).ReadAll
            FSO.DeleteFile (MesFile)
        End If
    End If
    DoEvents
Next
For Each MesFile In FSO.GetFolder(DBP & "habbos\" & LCase(TheirName) & "\directmail\").Files
    If Right(MesFile.Path, 3) <> "txt" And Len(MesFile.OpenAsTextStream(ForReading).ReadAll) >= Len(Client(Index).Name) Then
        If LCase(Left(MesFile.OpenAsTextStream(ForReading).ReadAll, Len(Client(Index).Name))) = LCase(Client(Index).Name) Then
            FSO.DeleteFile (MesFile)
        End If
    End If
    DoEvents
Next
End Function

Public Function Hab_Ci(info As String, Index As Integer)
If Client(Index).reportmessage <> "" Then
    RepFrom = Split(Client(Index).reportmessage, Chr(1))(0)
    RepDate = Split(Client(Index).reportmessage, Chr(2))(1)
    RepMesg = Replace(Split(Client(Index).reportmessage, Chr(2))(2), Chr(13), " ")
    RepMesg = Replace(RepMesg, Chr(10), "")
    Kamer = VL64encode(Client(Index).InRoom)
    If Kamer = 0 And Client(Index).Publicnum > 0 Then Kamer = Client(Index).Publicname
    frmMain.CFHs = Val(frmMain.CFHs) + 1
    Load frmMain.CFH(frmMain.CFHs)
    frmMain.CFH(frmMain.CFHs).Text = "BT" & VL64encode(frmMain.CFHs) & Chr(2) & "I" & locale("cfh_time") & " " & Format(Date, "dd-mm-yyyy") & " " & Format(Time, "hh:mm") & Chr(2) & Client(Index).Name & Chr(2) & locale("rp_from") & ": " & RepFrom & Chr(13) & locale("rp_message") & ": " & RepMesg & Chr(2) & Kamer & Chr(2) & locale("reported_message") & ":" & Chr(2) & "I" & Chr(2) & Kamer & Chr(1)
    For a = 1 To frmMain.SockI
    If ReadINI("rank", "recrieve_cfh", DBP & "ranks\" & Client(a).Rank & ".ini") = "1" Then
    If frmMain.socket(a).State = sckConnected Then frmMain.socket(a).SendData frmMain.CFH(frmMain.CFHs).Text
    End If
    Next a
End If
End Function

Public Function Hab_Ata(info As String, Index As Integer)
Dim MsMsg As String
Dim MsUsr As String
Dim MsUser As String
Dim MsNme As String
info = Split(info, "@a")(1)
UserIDs = VL64Decode(Mid(info, 1, 1))
If UserIDs = "Er" Then
    UserIDs = VL64Decode(Mid(info, 1, 2))
    Exta = 2
Else
    Exta = 1
End If
'fix IDS
MsUsr = Mid(info, 1 + Exta)
UserList = ""
start = 1
For b = 1 To UserIDs
    For v = 2 To 4
        If VL64Decode(Mid(MsUsr, start, v)) <> "Er" Then
            If FSO.FolderExists(DBP & "habbos\" & LCase(unUserID(VL64Decode(Mid(MsUsr, start, v))))) = True Then
            UserList = UserList & "<" & VL64Decode(Mid(MsUsr, start, v)) & ">"
            start = start + v
            Exit For
            End If
        End If
        DoEvents
    Next v
Next b
MsMsg = Mid(MsUsr, start + 2)
If ReadINI("config", "bobba_filter", SettingIni) = "1" Then MsMsg = Filter(MsMsg)
MsMsg = Replace(MsMsg, Chr(1), "")
'fix IDS
If InStr(UserList, ">") <> 0 Then
    SendList = ""
    UserIDs = Split(UserList, ">")
    For h = 0 To UBound(UserIDs)
        If UserIDs(h) <> "" Then
            MsUser = Replace(UserIDs(h), "<", "")
            MsUser = unUserID(MsUser)
            MsNme = Client(Index).Name
            If InStr(SendList, UserIDs(h) & ">") = 0 Then
                SaveMessage MsMsg, MsUser, MsNme
                SendList = SendList & "<" & MsUser & ">"
            End If
        End If
        DoEvents
    Next h
End If
Exit Function
errde:
MsgBox Err.Description
End Function

Public Function Hab_Atquo(info As String, Index As Integer)
If FSO.FileExists(DBP & "habbos\" & LCase(Client(Index).Name) & "\directmail\welcome.message") = True Then
    FSO.DeleteFile (DBP & "habbos\" & LCase(Client(Index).Name) & "\directmail\welcome.message")
    Exit Function
End If
MsgID = VL64Decode(Mid(info, 3))
If FSO.FileExists(DBP & "habbos\" & LCase(Client(Index).Name) & "\directmail\" & MsgID & ".message") = True Then
    FSO.DeleteFile DBP & "habbos\" & LCase(Client(Index).Name) & "\directmail\" & MsgID & ".message"
    Exit Function
End If
Dim Msf As File
For Each Msf In FSO.GetFolder(DBP & "habbos\" & LCase(Client(Index).Name) & "\directmail").Files
    If Right(Msf.Path, 3) <> "txt" Then
        FSO.DeleteFile Msf.Path
        Exit Function
    End If
Next
End Function
