Sub OnAttack(index)Dim PXDim PYDim PMDim checkDim itemcheckDim numDim valPX = GetPlayerX(index)PY = GetPlayerY(index)PM = GetPlayerMap(index)check = 1itemcheck = 1Do while check <= 9999Do while itemcheck <= 24If Int(PX + 1) = GetVar(App.Path & "Chest.ini", check, X) And PY = GetVar(App.Path & "Chest.ini", check, Y) And PM = GetVar(App.Path & "Chest.ini", check, MAP) ThenCall PlayerMsg(index, "You opened the chest.", 12)num = GetVar(App.Path & "Chest.ini", check, "num")val = GetVar(App.Path & "Chest.ini", check, "val")If num = 0 ThenCall PlayerMsg(index, "There is nothing in the chest.", 12)Exit SubElseif GetPlayerInvNum(index, itemcheck) = 0 thenCall SetPlayerInvNum(index, itemcheck, num)Call SetPlayerInvVal(index, itemcheck, val)Call PlayerMsg(index, "You founded an item.", 12)ElseCall PlayerMsg(index, "There is nothing in the chest.", 12)Exit subEnd IfEnd IfIf Int(PX - 1) = GetVar(App.Path & "Chest.ini", check, X) And PY = GetVar(App.Path & "Chest.ini", check, Y) And PM = GetVar(App.Path & "Chest.ini", check, MAP) ThenCall PlayerMsg(index, "You opened the chest.", 12)num = GetVar(App.Path & "Chest.ini", check, "num")val = GetVar(App.Path & "Chest.ini", check, "val")If num = 0 ThenCall PlayerMsg(index, "There is nothing in the chest.", 12)Exit SubElseif GetPlayerInvNum(index, itemcheck) = 0 thenCall SetPlayerInvNum(index, itemcheck, num)Call SetPlayerInvVal(index, itemcheck, val)Call PlayerMsg(index, "You founded an item.", 12)ElseCall PlayerMsg(index, "There is nothing in the chest.", 12)Exit subEnd IfEnd IfIf Int(PY + 1) = GetVar(App.Path & "Chest.ini", check, X) And PY = GetVar(App.Path & "Chest.ini", check, Y) And PM = GetVar(App.Path & "Chest.ini", check, MAP) ThenCall PlayerMsg(index, "You opened the chest.", 12)num = GetVar(App.Path & "Chest.ini", check, "num")val = GetVar(App.Path & "Chest.ini", check, "val")If num = 0 ThenCall PlayerMsg(index, "There is nothing in the chest.", 12)Exit SubElseif GetPlayerInvNum(index, itemcheck) = 0 thenCall SetPlayerInvNum(index, itemcheck, num)Call SetPlayerInvVal(index, itemcheck, val)Call PlayerMsg(index, "You founded an item.", 12)ElseCall PlayerMsg(index, "There is nothing in the chest.", 12)Exit subEnd IfEnd IfIf Int(PX + 1) = GetVar(App.Path & "Chest.ini", check, X) And PY = GetVar(App.Path & "Chest.ini", check, Y) And PM = GetVar(App.Path & "Chest.ini", check, MAP) ThenCall PlayerMsg(index, "You opened the chest.", 12)num = GetVar(App.Path & "Chest.ini", check, "num")val = GetVar(App.Path & "Chest.ini", check, "val")If num = 0 ThenCall PlayerMsg(index, "There is nothing in the chest.", 12)Exit SubElseif GetPlayerInvNum(index, itemcheck) = 0 thenCall SetPlayerInvNum(index, itemcheck, num)Call SetPlayerInvVal(index, itemcheck, val)Call PlayerMsg(index, "You founded an item.", 12)ElseCall PlayerMsg(index, "There is nothing in the chest.", 12)Exit subEnd IfElseExit SubEnd IfLoopLoopEnd Sub
[1]MAP=X=Y=num=val=[2]MAP=X=Y=num=val=