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

Ah this is a putvar question


escfoe2
 Share

Recommended Posts

:huh:  I'm in need of help but its very simple I just don't know how or if there is a way to do what I need!  What I am trying to do is add + 1 to a variable in a .ini file.  Here is the trying example.  Call PutVar("Scripts\Rank\" & GetPlayerName(Index) & ".ini", "Player Rank", "num_npc_kls", !@#$)  I want !@#$ to just be bumped up + 1! Is there a way??  :icon_crap:
Link to comment
Share on other sites

I'm telling you right now, you'd crash your main if you added this:
```
Call PutVar("Scripts\Rank\" & GetPlayerName(Index) & ".ini", "Player Rank", "num_npc_kls", [email]!@#$[/email])

```Since the "email" tag isn't supported in VBScripting.

Anyway, I'm going to assume you have a number in that rank, and you want the number to be raised by one.

This is actually pretty easy; you just need to get the value, convert it to a number, add 1 to that number, and put it back, like so:
```
Dim Number
Number = Int(GetVar("Scripts\Rank\" & GetPlayerName(Index) & ".ini", "Player Rank", "num_npc_kls"))
Number = Number + 1
Call PutVar("Scripts\Rank\" & GetPlayerName(Index) & ".ini", "Player Rank", "num_npc_kls", Number)

```
That _should_ work.

Also, try to be abit less sloppy with formatting in your posts; think of it this way; would the CEO of Nintendo, ask for help on something code-related, like that (using email tags, and making the size really big, etc)?
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...