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

Need help from Admiral Refuge


Merchant
 Share

Recommended Posts

@Merchant:

> I want to make each code only usable once.  So when I see in the .ini the value is 1, ill set it to 0 and change the code.

It's already only usable once, and you reset them all via reloading the server.

But you can also manually edit them individually if you want, doesn't matter; just open that ini, and if you see a "1", set it to "0", then change the code for that certain one within the Case.
Link to comment
Share on other sites

@Merchant:

> I want to make it so that the script doesn't automatically set them to 0 on server load.

Then just take it out of serverload; put it in a hotkey or something, e.g.:
Case 1
  If GetPlayerAccess(Index) >=4 Then
      For i = 0 To 3
        Call PutVar("ItemCodes.ini", "CODES", "Code" & i, 0)
      Next
  End If
  Exit Sub

Then, you press "Page Up" or whatever case 1 is, in the hotscript sub, and it will load/reload the inis.
Link to comment
Share on other sites

  • 2 weeks later...
```
Select Case TextSay(0)   

Case "/code"
            Dim Code
            Code = TextSay(1)
            Select Case Code

            Case "12345"
              If GetVar("ItemCodes.ini, "CODES", "Code0") = 0 Then
                    Call GiveCurrency(Index, 2, 500)
                    Call PutVar("ItemCodes.ini", "CODES'", "Code0", 1)
              Else
                    Call PlayerMsg(Index, "I'm sorry,that code has already been used!", RED)
              End If

            Case "01493"
              If GetVar("ItemCodes.ini, "CODES", "Code1") = 0 Then
                    Call GiveCurrency(Index, 2, 500)
                    Call PutVar("ItemCodes.ini", "CODES'", "Code1", 1)
              Else
                    Call PlayerMsg(Index, "I'm sorry,that code has already been used!", RED)
              End If

            Case "90210"
              If GetVar("ItemCodes.ini, "CODES", "Code2") = 0 Then
                  Call GiveCurrency(Index, 2, 500)
                    Call PutVar("ItemCodes.ini", "CODES'", "Code2", 1)
      Else
                          Call PlayerMsg(Index, "I'm sorry,that code has already been used!", RED)
                    End If

                Case Else
              Call PlayerMsg(Index, "That is not a valid code!", BRIGHTRED)

        End Select
        Exit Sub

Case "/testscripts"
Call TestMain(Index)
Exit Sub

Case "/help"
Call PlayerMsg(Index, "Social Commands:", WHITE)
Call PlayerMsg(Index, "'msghere = Broadcast Message", WHITE)
Call PlayerMsg(Index, "-msghere = Emote Message", WHITE)
Call PlayerMsg(Index, "!namehere msghere = Player Message", WHITE)
Call PlayerMsg(Index, "Available Commands: /help, /info, /who, /fps, /inv, /stats, /train, /party, /join, /leave, /refresh", WHITE)
Exit Sub

Case "/calladmins"
If GetPlayerAccess(Index) = 0 Then
Call AdminMsg(GetPlayerName(Index) & " needs your help!", BRIGHTGREEN)
Else
Call PlayerMsg(Index, "You are an admin! You cannot call for help!", BRIGHTGREEN)
End If
Exit Sub

Case "/admin"
If GetPlayerAccess(Index) > 0 Then
Call PlayerMsg(Index, "Social Commands:", WHITE)
Call PlayerMsg(Index, """msghere = Global Admin Message", WHITE)
Call PlayerMsg(Index, "=msghere = Private Admin Message", WHITE)
Call PlayerMsg(Index, "Available Commands: /admin, /loc, /mapeditor, /warpmeto, /warptome, /warpto, /setsprite, /mapreport, /kick, /ban, /edititem, /respawn, /editnpc, /motd, /editshop, /ban, /editspell", WHITE)
End If
Exit Sub

Case "/warpmeto"
If GetPlayerAccess(Index) > 0 Then
PlayerID = FindPlayer(TextSay(1))

If PlayerID > 0 Then
Call PlayerWarp(Index, GetPlayerMap(PlayerID), GetPlayerX(PlayerID), GetPlayerY(PlayerID))
Call PlayerMsg(Index, "You have been warped to " & GetPlayerName(PlayerID) & ".", BROWN)
Else
Call PlayerMsg(Index, "Player is not online.", WHITE)
End If
End If
Exit Sub

Case "/warptome"
If GetPlayerAccess(Index) > 0 Then
PlayerID = FindPlayer(TextSay(1))

If PlayerID > 0 Then
Call PlayerWarp(PlayerID, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index))
Call PlayerMsg(PlayerID, "You have been warped to " & GetPlayerName(Index) & ".", BROWN)
Else
Call PlayerMsg(Index, "Player is not online.", WHITE)
End If
End If
Exit Sub

Case "/warpto"
If GetPlayerAccess(Index) > 0 Then
MapNum = TextSay(1)

If MapNum > 0 And MapNum <= MAX_MAPS Then
Call PlayerWarp(Index, MapNum, GetPlayerX(Index), GetPlayerY(Index))
Call PlayerMsg(Index, "You have been warped to map #" & MapNum & ".", BRIGHTBLUE)
Else
Call PlayerMsg(Index, "Invalid map number.", BRIGHTRED)
End If
End If
Exit Sub

End Select

Call PlayerMsg(Index, "That is not a valid command.", BRIGHTRED)
End Sub
```
Link to comment
Share on other sites

Please use code tags next time, as just pasting it looses formatting as well as stretches the forums.

Anyway, try this:
```
  Select Case TextSay(0) 

      Case "/code"
              Dim Code
              Code = TextSay(1)
              Select Case Code

              Case "12345"
                If GetVar("ItemCodes.ini", "CODES", "Code0") = 0 Then
                        Call GiveCurrency(Index, 2, 500)
                        Call PutVar("ItemCodes.ini", "CODES'", "Code0", 1)
                  Else
                        Call PlayerMsg(Index, "I'm sorry,that code has already been used!", RED)
                  End If

              Case "01493"
                  If GetVar("ItemCodes.ini", "CODES", "Code1") = 0 Then
                        Call GiveCurrency(Index, 2, 500)
                        Call PutVar("ItemCodes.ini", "CODES'", "Code1", 1)
                  Else
                      Call PlayerMsg(Index, "I'm sorry,that code has already been used!", RED)
                  End If

              Case "90210"
                  If GetVar("ItemCodes.ini", "CODES", "Code2") = 0 Then
                          Call GiveCurrency(Index, 2, 500)
                        Call PutVar("ItemCodes.ini", "CODES'", "Code2", 1)
            Else
                              Call PlayerMsg(Index, "I'm sorry,that code has already been used!", RED)
                        End If

                  Case Else
                    Call PlayerMsg(Index, "That is not a valid code!", BRIGHTRED)

          End Select
          Exit Sub

      Case "/testscripts"
        Call TestMain(Index)
        Exit Sub

      Case "/help"
        Call PlayerMsg(Index, "Social Commands:", WHITE)
        Call PlayerMsg(Index, "'msghere = Broadcast Message", WHITE)
        Call PlayerMsg(Index, "-msghere = Emote Message", WHITE)
        Call PlayerMsg(Index, "!namehere msghere = Player Message", WHITE)
        Call PlayerMsg(Index, "Available Commands: /help, /info, /who, /fps, /inv, /stats, /train, /party, /join, /leave, /refresh", WHITE)
        Exit Sub 

      Case "/calladmins"
        If GetPlayerAccess(Index) = 0 Then
            Call AdminMsg(GetPlayerName(Index) & " needs your help!", BRIGHTGREEN)
        Else
            Call PlayerMsg(Index, "You are an admin! You cannot call for help!", BRIGHTGREEN)
        End If
        Exit Sub 

      Case "/admin"
        If GetPlayerAccess(Index) > 0 Then
            Call PlayerMsg(Index, "Social Commands:", WHITE)
            Call PlayerMsg(Index, """msghere = Global Admin Message", WHITE)
            Call PlayerMsg(Index, "=msghere = Private Admin Message", WHITE)
            Call PlayerMsg(Index, "Available Commands: /admin, /loc, /mapeditor, /warpmeto, /warptome, /warpto, /setsprite, /mapreport, /kick, /ban, /edititem, /respawn, /editnpc, /motd, /editshop, /ban, /editspell", WHITE)
        End If
        Exit Sub

      Case "/warpmeto"
        If GetPlayerAccess(Index) > 0 Then
            PlayerID = FindPlayer(TextSay(1))

            If PlayerID > 0 Then
              Call PlayerWarp(Index, GetPlayerMap(PlayerID), GetPlayerX(PlayerID), GetPlayerY(PlayerID))
              Call PlayerMsg(Index, "You have been warped to " & GetPlayerName(PlayerID) & ".", BROWN)
            Else
              Call PlayerMsg(Index, "Player is not online.", WHITE)
            End If
        End If
        Exit Sub

      Case "/warptome"
        If GetPlayerAccess(Index) > 0 Then
            PlayerID = FindPlayer(TextSay(1))

            If PlayerID > 0 Then
              Call PlayerWarp(PlayerID, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index))
              Call PlayerMsg(PlayerID, "You have been warped to " & GetPlayerName(Index) & ".", BROWN)
            Else
              Call PlayerMsg(Index, "Player is not online.", WHITE)
            End If
        End If
        Exit Sub

      Case "/warpto"
        If GetPlayerAccess(Index) > 0 Then
            MapNum = TextSay(1)

            If MapNum > 0 And MapNum <= MAX_MAPS Then
              Call PlayerWarp(Index, MapNum, GetPlayerX(Index), GetPlayerY(Index))
              Call PlayerMsg(Index, "You have been warped to map #" & MapNum & ".", BRIGHTBLUE)
            Else
              Call PlayerMsg(Index, "Invalid map number.", BRIGHTRED)
            End If
        End If
        Exit Sub

  End Select

  Call PlayerMsg(Index, "That is not a valid command.", BRIGHTRED)
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...