Jump to content
  • 0

Infistar and profileNamespace SetVariable


MatthewK

Question

4 answers to this question

Recommended Posts

  • 0

Anyone know why this works: 

	allMyKeys = profileNamespace getVariable ["VehicleKeys",[]];
	allMyKeys = allMyKeys + [_keySelected];
	profileNamespace setVariable ["VehicleKeys",allMyKeys];

But this doesn't work:

ZedKills = profileNamespace getVariable ["ZedKillsTotal",0];
_zedKillss = player getVariable["zombieKills", 0];
ZedKills = ZedKills + _zedKillss;
profileNamespace setVariable ["ZedKillsTotal",ZedKills];

The first block of code works for admin and normal users, it saves the variable and loads it fine.

The second block of code works for admins fine, but only loads the variable for normal players (not save it).

AllMyKeys is an array of the users keys, in case anyone is going to ask. I've tied it to the Find my vehicle script, so that only players who have keys saved in this private "keycode list" can locate their vehicles and open it without a key in their inventory. It works fine, for all users. But that zedkills total count is puzzling, as it only seem to work for admins :(

 

 

Link to comment
Share on other sites

  • 0
3 hours ago, raymix said:

Have you tried different naming convention for variables? 

Should I also mention that you can edit profileNamespace file outside of game?

Yes, I tried different naming conventions , but nothing works . 

HA! Yeah, I know. I'm using profilenamespaces until I can teach myself how to store information in the database. :)

 

Link to comment
Share on other sites

  • 0
7 hours ago, MatthewK said:

Yes, I tried different naming conventions , but nothing works . 

HA! Yeah, I know. I'm using profilenamespaces until I can teach myself how to store information in the database. :)

 

Well, aren't zed kills done server side? It could be that it's working for you, but variable being overwritten periodically?

What I would suggest for you is to set up a local test server and remove yourself from admins, then install one of debug consoles and disable signature check on server. Don't forget to remove all BE filters, they will only be in your way.
This will allow you to play around with variables in a live game as a client, good way to learn stuff. Otherwise you'll be restarting server after every change and that's painful.
That's how I started initially, later when I got more comfortable with code I even wrote my own compiler for A3 that allows me to compile and run whole SQF files on live MP server :)
Point is - don't limit yourself while learning. Debug console is definitely a way to go.

A good way to learn database saving using this setup would be: create your own PV handle server side that will take input you send to it and call a function with it.
This way you can have single PV and single function for both sending and receiving data. Take it slow and don't be afraid to ask questions here.

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
  • Advertisement
  • Discord

×
×
  • Create New...