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

I need help as a begginer coder.


adamsharp
 Share

Recommended Posts

can someone please debug this script for me plz?

```
Case "/dice1"
    Dim D1
    D1 = Rand(1,5)
    If D1 = 1 Then
    Call PlayerMsg(Index, "You Rolled 1 Out Of 5", BLUE)
        Call GiveCurrency(index, 1, 100)
    Else
    If D1 = 2 Then
    Call PlayerMsg(Index, "You Rolled 2 Out Of 5", BLUE)
Else
    If D1 = 3 Then
    Call PlayerMsg(Index, "You Rolled 3 Out Of 5", BLUE)
Else
    If D1 = 4 Then
    Call PlayerMsg(Index, "You Rolled 4 Out Of 5", BLUE)
Else
    If D1 = 5 Then
    Call PlayerMsg(Index, "You Rolled 5 Out Of 5", BLUE)
    End If
Exit Sub

```
Thanks.
Link to comment
Share on other sites

each one should exit sub once it is done, otherwise it does not know what to do.
Also it should be ElseIf
There for:
```
Case "/dice1"
    Dim D1
    D1 = Rand(1,5)
    If D1 = 1 Then
    Call PlayerMsg(Index, "You Rolled 1 Out Of 5", BLUE)
        Call GiveCurrency(index, 1, 100)
    Else
    If D1 = 2 Then
    Call PlayerMsg(Index, "You Rolled 2 Out Of 5", BLUE)
Else
    If D1 = 3 Then
    Call PlayerMsg(Index, "You Rolled 3 Out Of 5", BLUE)
Else
    If D1 = 4 Then
    Call PlayerMsg(Index, "You Rolled 4 Out Of 5", BLUE)
Else
    If D1 = 5 Then
    Call PlayerMsg(Index, "You Rolled 5 Out Of 5", BLUE)
    End If
Exit Sub

```should be
```
Case "/dice1"
    Dim D1
    D1 = Rand(1,5)
    If D1 = 1 Then
    Call PlayerMsg(Index, "You Rolled 1 Out Of 5", BLUE)
        Call GiveCurrency(index, 1, 100)
Exit Sub
    ElseIf D1 = 2 Then
    Call PlayerMsg(Index, "You Rolled 2 Out Of 5", BLUE)
Exit Sub
ElseIf D1 = 3 Then
    Call PlayerMsg(Index, "You Rolled 3 Out Of 5", BLUE)
Exit Sub
ElseIf D1 = 4 Then
    Call PlayerMsg(Index, "You Rolled 4 Out Of 5", BLUE)
Exit Sub
Else
    Call PlayerMsg(Index, "You Rolled 5 Out Of 5", BLUE)
    End If
Exit Sub

```
Link to comment
Share on other sites

```
Case "/dice1"
    Dim D1
    D1 = Rand(1,5)
    If D1 = 1 Then
    Call PlayerMsg(Index, "You Rolled 1 Out Of 5", BLUE)
        Call GiveCurrency(index, 1, 100)
    Else If D1 = 2 Then
    Call PlayerMsg(Index, "You Rolled 2 Out Of 5", BLUE)
Else If D1 = 3 Then
    Call PlayerMsg(Index, "You Rolled 3 Out Of 5", BLUE)
Else If D1 = 4 Then
    Call PlayerMsg(Index, "You Rolled 4 Out Of 5", BLUE)
Else If D1 = 5 Then
    Call PlayerMsg(Index, "You Rolled 5 Out Of 5", BLUE)
    End If
Exit Sub
```Really nice one you did.
I just edited some minor minor synax errors.
I made a really looking script once, the first like i though you copied mine. xD

Edit: I got body slamd.
I though it was space bettwen Else and If, but yah.
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...