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

Need A Bit More Help plz


adamsharp
 Share

Recommended Posts

urmm im trying to make it so it says my name when i send the Message to the map but it doesnt work please debug my code for me.

```
Case "/roll"
    Dim D1
    D1 = Rand(1,10)
    If D1 = 1 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 1 Out Of 10", BLUE)
Exit Sub
    ElseIf D1 = 2 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 2 Out Of 10", BLUE)
Exit Sub
ElseIf D1 = 3 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 3 Out Of 10", BLUE)
Exit Sub
ElseIf D1 = 4 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 4 Out Of 10", BLUE)
Exit Sub
ElseIf D1 = 5 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 5 Out Of 10", BLUE)
Exit Sub
ElseIf D1 = 6 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 6 Out Of 10", BLUE)
Exit Sub
ElseIf D1 = 7 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 7 Out Of 10", BLUE)
Exit Sub
ElseIf D1 = 8 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 8 Out Of 10", BLUE)
Exit Sub
ElseIf D1 = 9 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 9 Out Of 10", BLUE)
Exit Sub
ElseIf D1 = 10 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 10 Out Of 10", BLUE)
Exit Sub
    End If
Exit Sub

```Thanks
Link to comment
Share on other sites

NO Owen, Functions do not belong in the quotations, they belong outside of them, and as for the "Exit Sub" solution in this person's other post, complete bolocks…

Hate to tell you adamsharp but you're calling mapmsg incorrectly...
```
Public Sub MapMsg(ByVal MapNum As Long, ByVal Msg As String, ByVal Color As Byte)
```
So using index for mapmsg like you are here… is going to cause the script to not operate on the map the user is on...
```
Case "/roll"
    Dim D1
    D1 = Rand(1,10)
    If D1 = 1 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 1 Out Of 10", BLUE)

    ElseIf D1 = 2 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 2 Out Of 10", BLUE)

ElseIf D1 = 3 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 3 Out Of 10", BLUE)

ElseIf D1 = 4 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 4 Out Of 10", BLUE)

ElseIf D1 = 5 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 5 Out Of 10", BLUE)

ElseIf D1 = 6 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 6 Out Of 10", BLUE)

ElseIf D1 = 7 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 7 Out Of 10", BLUE)

ElseIf D1 = 8 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 8 Out Of 10", BLUE)

ElseIf D1 = 9 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 9 Out Of 10", BLUE)

ElseIf D1 = 10 Then
    Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 10 Out Of 10", BLUE)
End If
Exit Sub

```
Here's a fixed version…
```
Case "/roll"
    Dim D1
    D1 = Rand(1,10)
    If D1 = 1 Then
Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 1 Out Of 10", BLUE)

    ElseIf D1 = 2 Then
Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 2 Out Of 10", BLUE)

ElseIf D1 = 3 Then
Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 3 Out Of 10", BLUE)

ElseIf D1 = 4 Then
Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 4 Out Of 10", BLUE)

ElseIf D1 = 5 Then
Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 5 Out Of 10", BLUE)

ElseIf D1 = 6 Then
Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 6 Out Of 10", BLUE)

ElseIf D1 = 7 Then
Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 7 Out Of 10", BLUE)

ElseIf D1 = 8 Then
Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 8 Out Of 10", BLUE)

ElseIf D1 = 9 Then
Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 9 Out Of 10", BLUE)

ElseIf D1 = 10 Then
Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 10 Out Of 10", BLUE)
End If
Exit Sub
```
and really, you can simplify this script alot by just doing this
```
Case "/roll"
    Dim D1
    D1 = Rand(1,10)
    Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled " & D1 & " Out Of 10", BLUE)
Exit Sub
```
Link to comment
Share on other sites

@Bobosk:

> NO Owen, Functions do not belong in the quotations, they belong outside of them, and as for the "Exit Sub" solution in this person's other post, complete bolocks…
>
> Hate to tell you adamsharp but you're calling mapmsg incorrectly...
> ```
> Public Sub MapMsg(ByVal MapNum As Long, ByVal Msg As String, ByVal Color As Byte)
> ```
> So using index for mapmsg like you are here… is going to cause the script to not operate on the map the user is on...
> ```
> Case "/roll"
>     Dim D1
>     D1 = Rand(1,10)
>     If D1 = 1 Then
>     Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 1 Out Of 10", BLUE)
>
>     ElseIf D1 = 2 Then
>     Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 2 Out Of 10", BLUE)
>
> ElseIf D1 = 3 Then
>     Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 3 Out Of 10", BLUE)
>
> ElseIf D1 = 4 Then
>     Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 4 Out Of 10", BLUE)
>
> ElseIf D1 = 5 Then
>     Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 5 Out Of 10", BLUE)
>
> ElseIf D1 = 6 Then
>     Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 6 Out Of 10", BLUE)
>
> ElseIf D1 = 7 Then
>     Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 7 Out Of 10", BLUE)
>
> ElseIf D1 = 8 Then
>     Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 8 Out Of 10", BLUE)
>
> ElseIf D1 = 9 Then
>     Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 9 Out Of 10", BLUE)
>
> ElseIf D1 = 10 Then
>     Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 10 Out Of 10", BLUE)
> End If
> Exit Sub
>
> ```
> Here's a fixed version…
> ```
> Case "/roll"
>     Dim D1
>     D1 = Rand(1,10)
>     If D1 = 1 Then
> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 1 Out Of 10", BLUE)
>
>     ElseIf D1 = 2 Then
> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 2 Out Of 10", BLUE)
>
> ElseIf D1 = 3 Then
> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 3 Out Of 10", BLUE)
>
> ElseIf D1 = 4 Then
> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 4 Out Of 10", BLUE)
>
> ElseIf D1 = 5 Then
> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 5 Out Of 10", BLUE)
>
> ElseIf D1 = 6 Then
> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 6 Out Of 10", BLUE)
>
> ElseIf D1 = 7 Then
> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 7 Out Of 10", BLUE)
>
> ElseIf D1 = 8 Then
> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 8 Out Of 10", BLUE)
>
> ElseIf D1 = 9 Then
> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 9 Out Of 10", BLUE)
>
> ElseIf D1 = 10 Then
> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 10 Out Of 10", BLUE)
> End If
> Exit Sub
> ```
> and really, you can simplify this script alot by just doing this
> ```
> Case "/roll"
>     Dim D1
>     D1 = Rand(1,10)
>     Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled " & D1 & " Out Of 10", BLUE)
> Exit Sub
> ```

]
Thanks But Dont Hate Me For Getting My FIRST Own Bit Of Scripting Wrong Please.
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...