Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Need help with a script


DreadX13
 Share

Recommended Posts

i got a mining fishing script followed the tut, the mining works great. But i cant seem to get the fishing to work. This is what i have in my main file.
Sub GoMining(index, item, maxlevel, name)
  Dim m
  Dim level
  level = maxlevel + 1
      If GetPlayerlevel(index) < maxlevel Then
        m = Int(Rnd * Int(level - GetPlayerLevel(index)))
        If m = 1 Then
            Call PlayerMsg(index, GetPlayerName(index) & " found " & name & " amongst the rocks.", 2)
            Call ReplaceOneInvItem(index, 0, item)
        Else
            Call PlayerMsg(index, GetPlayerName(index) & " found nothing interesting!", 12)
        End If
      Else
        Call PlayerMsg(index, GetPlayerName(index) & " found " & name & " amongst the rocks.", 2)
        Call ReplaceOneInvItem(index, 0, item)
      End If
End Sub
Sub ReplaceOneInvItem(index, olditem, newitem)
Dim n
n = 1
Do
  If GetPlayerInvItemNum(index, n) = olditem Then
      Call SetPlayerInvItemNum(index, n, newitem)
      Call SendInventoryUpdate(index, n)
      Exit Do
  End If
  n = n + 1
Loop Until n > 24
End Sub

Sub GoFishing(index, item, maxlevel, name)
  Dim c
  Dim level
  level = maxlevel + 1
      If GetPlayerlevel(index) < maxlevel Then
        c = Int(Rnd * Int(level - GetPlayerLevel(index)))
        If c = 1 Then
            Call PlayerMsg(index, GetPlayerName(index) & " caught a " & name, 2)
            Call ReplaceOneInvItem(index, 0, item)
        Else
            Call PlayerMsg(index, GetPlayerName(index) & " found nothing!", 12)
        End If
      Else
        Call PlayerMsg(index, GetPlayerName(index) & " caught a " & name, 2)
        Call ReplaceOneInvItem(index, 0, item)
      End If
End Sub

' Executes when a player steps onto a scripted tile.
Sub ScriptedTile(Index, Script)
Select Case Script
Case 0
Call PlayerMsg(Index, "This scripted tile has no apparent use.", WHITE)
Exit Sub
Case 1
  dim weapon
  weapon = GetPlayerWeaponSlot(index)
  If weapon = 0 Then
      Call PlayerMsg(index, "You don't have a Pickaxe equiped", 15)
      ElseIf GetPlayerInvItemNum(index, weapon) = 60 Then
      Call GoMining(index, 59, 500, "Gold")
      Else
      Call PlayerMsg(index, "You don't have a Pickaxe equiped", 15)
  End If

Case 2
  dim weapon
  weapon = GetPlayerWeaponSlot(index)
  If weapon = 0 Then
      Call PlayerMsg(index, "You don't have a Fishing Rod equiped", 15)
      ElseIf GetPlayerInvItemNum(index, weapon) = 62 Then
      Call GoFishing(index, 61, 500, Fish)
      Else
      Call PlayerMsg(index, "You don't have a Fishing Rod equiped", 15)
  End If

Case Else
Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub

End Select
End Sub

When I look at it it looks good to me but i need a pros opion. What did i do wrong and how can i fix it.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...