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

Mining problems


adamsharp
 Share

Recommended Posts

okay so if the sub wrong or the case and please correct it for me
```
Sub Brmi(Index)
Dim R
R = Rand(1,5)
  If CanTake(Index, 200, 1) Then
  Call PlayerMsg(Index,"Attempting to mine...", 0)
      If R = 1 Then
      Call PlayerMsg(Index,"Mine successful. Found A Bronze Ore.", 0)
      Call GiveItem(Index, 201, 1)
End If
  If CanTake(Index, 200, 1) Then
  Call PlayerMsg(Index,"Attempting to mine...", 0)
If R = 2 Then
      Call PlayerMsg(Index,"Mine successful. Found A Bronze Ore.", 0)
      Call GiveItem(Index, 201, 1)
End If
  If CanTake(Index, 200, 1) Then
  Call PlayerMsg(Index,"Attempting to mine...", 0)
If R = 3 Then
      Call PlayerMsg(Index,"Mine successful. Found 2 Bronze Ores!", 0)
      Call GiveItem(Index, 201, 2)
End If
If CanTake(Index, 200, 1) Then
  Call PlayerMsg(Index,"Attempting to mine...", 0)
If R = 4 Then
Call PlayerMsg(Index,"Failed To Mine Pickaxe Damaged.", 0)
End If
If CanTake(Index, 200, 1) Then
  Call PlayerMsg(Index,"Attempting to mine...", 0)
If R = 5 Then
Call PlayerMsg(Index,"Failed To Mine Pickaxe Damaged.", 0)
End If
      Else
      Call PlayerMsg(Index,"You don't have a pickaxe", 0)
End If
End Sub

```and the case
```
Case 3
Call Brmi(Index)
Exit Sub

```
Link to comment
Share on other sites

Of course not. Here:

```
Sub Brmi(Index)
Dim R
R = Rand(1,5)
  If CanTake(Index, 200, 1) Then
  Call PlayerMsg(Index,"Attempting to mine...", 0)
      If R = 1 Then
        Call PlayerMsg(Index,"Mine successful! Found a bronze ore.", 0)
        Call GiveItem(Index, 201, 1)
      ElseIf R = 2 Then
        Call PlayerMsg(Index,"Mine successful! Found a bronze ore.", 0)
        Call GiveItem(Index, 201, 1)
      ElseIf R = 3 Then
        Call PlayerMsg(Index,"Mine successful! Found 2 bronze ores!", 0)
        Call GiveItem(Index, 201, 2)
      ElseIf R = 4 Then
        Call PlayerMsg(Index,"Failed to mine, pickaxe damaged!", 0)
      ElseIf R = 5 Then
        Call PlayerMsg(Index,"Failed to mine, pickaxe damaged!", 0)
      End If
  Else
      Call PlayerMsg(Index,"You don't have a pickaxe!", 0)
End If
End Sub

```
I fixed your player messages aswell ;)
Link to comment
Share on other sites

can someone please tell me how to add a skill to this?

```
Sub Brmi(Index)
Dim R
R = Rand(1,5)
  If CanTake(Index, 200, 1) Then
  Call PlayerMsg(Index,"Attempting to mine...", 0)
      If R = 1 Then
        Call PlayerMsg(Index,"Mine successful! Found a bronze ore.", 0)
        Call GiveItem(Index, 201, 1)
      ElseIf R = 2 Then
        Call PlayerMsg(Index,"Mine successful! Found a bronze ore.", 0)
        Call GiveItem(Index, 201, 1)
      ElseIf R = 3 Then
        Call PlayerMsg(Index,"Mine successful! Found 2 bronze ores!", 0)
        Call GiveItem(Index, 201, 2)
      ElseIf R = 4 Then
        Call PlayerMsg(Index,"Failed to mine, pickaxe damaged!", 0)
      ElseIf R = 5 Then
        Call PlayerMsg(Index,"Failed to mine, pickaxe damaged!", 0)
      End If
  Else
      Call PlayerMsg(Index,"You don't have a pickaxe!", 0)
End If
End Sub

```so like you cant mine it at mining skill level of 1?
Link to comment
Share on other sites

havnt tested so back up your main before you do it

you would need to have variables

like

```
Sub Brmi(Index)
Dim R
R = Rand(1,5)
  If CanTake(Index, 200, 1) Then
  If GetVar("skills.ini", "MINING", GetPlayerName(index)) => 1 then
  Call PlayerMsg(Index,"Attempting to mine...", 0)
      If R = 1 Then
        Call PlayerMsg(Index,"Mine successful! Found a bronze ore.", 0)
        Call GiveItem(Index, 201, 1)
      ElseIf R = 2 Then
        Call PlayerMsg(Index,"Mine successful! Found a bronze ore.", 0)
        Call GiveItem(Index, 201, 1)
      ElseIf R = 3 Then
        Call PlayerMsg(Index,"Mine successful! Found 2 bronze ores!", 0)
        Call GiveItem(Index, 201, 2)
      ElseIf R = 4 Then
        Call PlayerMsg(Index,"Failed to mine, pickaxe damaged!", 0)
      ElseIf R = 5 Then
        Call PlayerMsg(Index,"Failed to mine, pickaxe damaged!", 0)
      End If
  Else
  Call Playermsg(index, "You must have a mining skill of level 1 to mine here.", RED)
  End If
  Else
      Call PlayerMsg(Index,"You don't have a pickaxe!", 0)
End If
End Sub

```
At the bottom of the main.txt then add…

```
Sub MiningExp(index, EXP)
Dim oldexp

oldexp = getvar("skills.ini", "MINING", GetPlayerName(Index))
Call PutVar("skills.ini", "MININGEXP", GetPlayerName(index), OldExp + Exp)

If GetVar("skills.ini", "MININGEXP", GetPlayerName(index)) => 100 Then
Call PutVar("skills.ini", "MININGEXP", GetPlayerName(index), 0)
Call PutVar("skills.ini", "MINING", GetPlayerName(index), GetVar("skills.ini", "MINING", GetPlayerName(index)) + 1)
End If

End Sub

```
and in OnNewChar(index) add

```
Call PutVar("skills.ini", "MININGEXP", GetPlayerName(index), 0)
Call PutVar("skills.ini", "MINING", GetPlayerName(index), 0)

```

havnt tested so back up your main before you do it
Link to comment
Share on other sites

Debugg This For Me Please!
```
Sub Brmi(Index)
Dim R
R = Rand(1,5)
If GetVar("skills.ini", "MINING", GetPlayerName(index)) => 1 then
  If CanTake(Index, 200, 1) Then
  Call PlayerMsg(Index,"Attempting to mine...", 10)
      If R = 1 Then
        Call PlayerMsg(Index,"Mine successful! Found a bronze ore.", 10)
        Call GiveItem(Index, 201, 1)
End If
      If R = 2 Then
        Call PlayerMsg(Index,"Mine successful! Found a bronze ore.", 10)
        Call GiveItem(Index, 201, 1)
End If
      If R = 3 Then
        Call PlayerMsg(Index,"Mine successful! Found 2 bronze ores!", 10)
        Call GiveItem(Index, 201, 2)
End If
      If R = 4 Then                                         
        Call PlayerMsg(Index,"Failed to mine, pickaxe damaged!", 12)
End If
      If R = 5 Then
        Call PlayerMsg(Index,"Failed to mine, pickaxe damaged!", 12)
      End If
  Else
      Call PlayerMsg(Index,"You don't have a pickaxe!", 12)
End If
End Sub

SubMiningExp(index, EXP) 
Dim oldexp 

oldexp = getvar("skills.ini", "MINING", GetPlayerName(Index)) 
Call PutVar("skills.ini", "MININGEXP", GetPlayerName(index), OldExp + Exp) 

If GetVar("skills.ini", "MININGEXP", GetPlayerName(index)) => 100 Then 
Call PutVar("skills.ini", "MININGEXP", GetPlayerName(index), 0) 
Call PutVar("skills.ini", "MINING", GetPlayerName(index), GetVar("skills.ini", "MINING", GetPlayerName(index)) + 1) 
End If 

End Sub

```
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...