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

Whats wrong with cases 0 & 1 in this script?


Nubbs
 Share

Recommended Posts

ok so cases "0" and "1" dont work at all, but cases "2" and "3" work fine what am i doing wrong? EE 2.7

```
' Executes when a player steps onto a scripted tile.
Sub ScriptedTile(Index, Script)
Select Case Script
Case 0
  If GetPlayerClass(Index) = 0 Then
        If int(GetPlayerSprite(Index)) <> 9 Then
          Call PutVar("scripts\" & trim(GetPlayerName(index)) & ".ini", "TRANSFORMS", "player_sprite", GetPlayerSprite(index))
          Call SetPlayerSprite(Index, 9)
          Call PlayerMsg(index, "You started patrolling.", 2)
          Call SendPlayerData(index)
        End If 
      End If

      Case 1
  Dim Sprite
        Sprite = int(GetVar("scripts\" & trim(GetPlayerName(index)) & ".ini", "TRANSFORMS", "player_sprite"))

        If int(GetPlayerSprite(Index)) = 9 Then
              Call SetPlayerSprite(Index, Sprite)
              Call PlayerMsg(index, "Feels good to be off the clock huh?", 2)
              Call SendPlayerData(index)
        Else
              Call PlayerMsg(Index, "This is definatly NOT where you parked your car! RAWR", 12)
        End If

        Case 2
  If GetPlayerClass(Index) = 1 Then
        If int(GetPlayerSprite(Index)) <> 10 Then
          Call PutVar("scripts\" & trim(GetPlayerName(index)) & ".ini", "TRANSFORMS", "player_sprite", GetPlayerSprite(index))
          Call SetPlayerSprite(Index, 10)
          Call PlayerMsg(index, "You started rollin'.", 2)
          Call SendPlayerData(index)
        End If 
      End If

  Case 3
        If int(GetPlayerSprite(Index)) = 10 Then
              Call SetPlayerSprite(Index, Sprite)
              Call PlayerMsg(index, "Feels good to be off the streets huh?", 2)
              Call SendPlayerData(index)
        Else
              Call PlayerMsg(Index, "This is definatly NOT where you parked your thug car! RAWR", 12)
        End If     

End Select
End Sub
```
Link to comment
Share on other sites

it should be the other way around, you havent defined Sprite  in the third case.

I cant really see any errors at the moment.

Edit :

And you had an appostraphy in the playermessage of case 2.

```
'.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.
Sub ScriptedTile(Index, Script)
' Executes when a player steps onto a scripted tile.
'.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.
Dim Sprite

Sprite = int(GetVar("scripts\" & trim(GetPlayerName(index)) & ".ini", "TRANSFORMS", "player_sprite"))

Select Case Script
Case 0
  If GetPlayerClass(Index) = 0 Then
        If int(GetPlayerSprite(Index)) <> 9 Then
          Call PutVar("scripts\" & trim(GetPlayerName(index)) & ".ini", "TRANSFORMS", "player_sprite", GetPlayerSprite(index))
          Call SetPlayerSprite(Index, 9)
          Call PlayerMsg(index, "You started patrolling.", 2)
          Call SendPlayerData(index)
        End If 
      End If

      Case 1

      If int(GetPlayerSprite(Index)) = 9 Then
              Call SetPlayerSprite(Index, Int(Sprite))
              Call PlayerMsg(index, "Feels good to be off the clock huh?", 2)
              Call SendPlayerData(index)
        Else
              Call PlayerMsg(Index, "This is definatly NOT where you parked your car! RAWR", 12)
        End If

        Case 2
  If GetPlayerClass(Index) = 1 Then
        If int(GetPlayerSprite(Index)) <> 10 Then
          Call PutVar("scripts\" & trim(GetPlayerName(index)) & ".ini", "TRANSFORMS", "player_sprite", GetPlayerSprite(index))
          Call SetPlayerSprite(Index, 10)
          Call PlayerMsg(index, "You started rollin.", 2)
          Call SendPlayerData(index)
        End If 
      End If

  Case 3
        If int(GetPlayerSprite(Index)) = 10 Then
              Call SetPlayerSprite(Index, Int(Sprite))
              Call PlayerMsg(index, "Feels good to be off the streets huh?", 2)
              Call SendPlayerData(index)
        Else
              Call PlayerMsg(Index, "This is definatly NOT where you parked your thug car! RAWR", 12)
        End If     

End Select
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...