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

Errors with Int(GetVar)


Akselj
 Share

Recommended Posts

Hi,
I get an error with this small piece of code I use at JoinGame;

```
Dim BookPrice
Dim BookItemNum
BookPrice = Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BookPrice"))
BookItemNum = Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BookItemNum"))
If GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","Borrowing") = "Yes" Then
If Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime")) > 0 Then
Call PutVar(Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime"))-1))
Call PlayerMsg(Index, "You have " & Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime")) " borrowing time left.", BRIGHTBLUE)
End If
If Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime")) = 0 Then
If CanTake(Index, 4, BookPrice) = True Then
Call TakeItem(Index, 4, BookPrice)
Call PlayerMsg(Index, "You have been charged for not returning your book in the set time.", BRIGHTRED)
Else
Call PlayerMsg(Index, "You have been jailed for not returning your book in the set time, and not being able to pay.", BRIGHTRED)
Call PlayerMsg(Index, "You will get out of jail next time you log in.", BRIGHTRED)
Call PlayerMsg(Index, "You are blacklisted and can not borrow books from the library in a while.", BRIGHTRED)
Call PlayerMsg(Index, "Your book will be taken.", BRIGHTRED)
Call PlayerWarp(Index, 1, 0, 0)
Call TakeItem(Index, BookItemNum, 0)
Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library", "Blacklist", 5)
Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library", "Jailed", "Yes")
End If
End If
End If

```
Anyone knows what the error might be?
Link to comment
Share on other sites

@DarkMazer:

> This line:
> Call PutVar(Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime"))-1))
> Syntax is wrong.  You only have the file path and header for the GetVar, and forgot it for the PutVar.

What? I do have everything, I checked all my Get and Put Var's….. Explain what you mean.
Link to comment
Share on other sites

Hes right, your PutVar does this, PutVar(GetVar(Whatever), "HEADER", "THINGY", "Other Thingy")

Red being missing.  Now I know what you really want,

PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime", Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime"))-1)

:D
Link to comment
Share on other sites

```
Dim BookPrice
Dim BookItemNum
Dim BorrowingTime
BookPrice = Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BookPrice") & "")
BookItemNum = Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BookItemNum") & "")
BorrowingTime = Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime") & "")
  If GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","Borrowing") = "Yes" Then
      If BorrowingTime > 0 Then
        BorrowingTime = BorrowingTime - 1
        Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime", BorrowingTime)
        Call PlayerMsg(Index, "You have " & BorrowingTime & " borrowing time left.", BRIGHTBLUE)
      End If
      If BorrowingTime < 0 Then
        If CanTake(Index, 4, BookPrice) = True Then
            Call TakeItem(Index, 4, BookPrice)
            Call PlayerMsg(Index, "You have been charged for not returning your book in the set time.", BRIGHTRED)
        Else
            Call PlayerMsg(Index, "You have been jailed for not returning your book in the set time, and not being able to pay.", BRIGHTRED)
            Call PlayerMsg(Index, "You will get out of jail next time you log in.", BRIGHTRED)
            Call PlayerMsg(Index, "You are blacklisted and can not borrow books from the library in a while.", BRIGHTRED)
            Call PlayerMsg(Index, "Your book will be taken.", BRIGHTRED)
            Call PlayerWarp(Index, 1, 0, 0)
            Call TakeItem(Index, BookItemNum, 0)
            Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library", "Blacklist", 5)
            Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library", "Jailed", "Yes")
        End If
      End If
  End If
```If that doesn't work, then there's probably some bug in the .ini file itself or the code that puts values into it.
Link to comment
Share on other sites

lmao dude, how many times do i have to SAY THIS!!!
you dont need int, here is how it should look:
```
Dim BookPrice
Dim BookItemNum
Dim BorrowingTime
BookPrice = GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BookPrice")
BookItemNum = GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BookItemNum")
BorrowingTime = GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime")
  If GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","Borrowing") = "Yes" Then
      If BorrowingTime > 0 Then
        BorrowingTime = BorrowingTime - 1
        Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime", BorrowingTime)
        Call PlayerMsg(Index, "You have " & BorrowingTime & " borrowing time left.", BRIGHTBLUE)
      End If
      If BorrowingTime < 0 Then
        If CanTake(Index, 4, BookPrice) = True Then
            Call TakeItem(Index, 4, BookPrice)
            Call PlayerMsg(Index, "You have been charged for not returning your book in the set time.", BRIGHTRED)
        Else
            Call PlayerMsg(Index, "You have been jailed for not returning your book in the set time, and not being able to pay.", BRIGHTRED)
            Call PlayerMsg(Index, "You will get out of jail next time you log in.", BRIGHTRED)
            Call PlayerMsg(Index, "You are blacklisted and can not borrow books from the library in a while.", BRIGHTRED)
            Call PlayerMsg(Index, "Your book will be taken.", BRIGHTRED)
            Call PlayerWarp(Index, 1, 0, 0)
            Call TakeItem(Index, BookItemNum, 0)
            Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library", "Blacklist", 5)
            Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library", "Jailed", "Yes")
        End If
      End If
  End If
```
Link to comment
Share on other sites

Did you try what I put?  Because your PutVar is looking for a file and GetVar is there instead, so the putvar is writing a file in your server folder probably called anywhere from 1 ~ 10 (TAKE A LOOK :O)

This would fix it
PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime", Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime"))-1)
Link to comment
Share on other sites

No that won't fix it I tried.
Anyways, with •RЧĐIИØPHØR•'s script it still does not work; it gets past the script and does the normal JoinGame but doesn't do a shit to me… Yes, I set up the .INI correctly.
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...