Jump to content
  • 0

Send Value from client to server


elbabar

Question

Hi, 

i'm beginner in arma script (try to be better and my english is not beautiful), I try to use addPublicVariableEventHandler on server side for refresh and send value from client.

in my pbo server side : 

 

Spoiler

onPlayerConnected
{
  
  _data   =   [_uid]  call BAB_fnc_levelgetstat; //this function get value in redis 

  missionNamespace setVariable ["LEVEL_UserInfo", _data];
  _owner publicVariableclient "LEVEL_UserInfo";

}; // This part is ok

 

 

"LVLshowDB" addPublicVariableEventHandler {
  // [str serverTime,["Z_fnc_showDB","work"]] call BAB_fnc_leveladdstat; -> i use for debug for see if LVLshowDB work ...
    _arr = _this select 1;
    _player = _arr select 0;
    _uid = getPlayerUID _player;
    _owner = owner _player;
    // fonction de mise à jour de la dbb


    _data   =   [_uid]  call BAB_fnc_levelgetstat;

 missionNamespace setVariable ["LEVEL_UserInfo", _data];
    _owner publicVariable "LEVEL_UserInfo";
   
};

 

on client i do 

Spoiler

LVLShowDB = true; publicVariableServer "LVLShowDB"; or missionNamespace setVariable ["LVLShowDB", true];publicVariable "LVLShowDB"; 

-> no add in redis database, if i modify the redis database manually, use this handler for refresh LEVEL_UserInfo's value, that's not work ... What I have to do for this work ? 

 

Thx

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
1 hour ago, elbabar said:

Hi, 

i'm beginner in arma script (try to be better and my english is not beautiful), I try to use addPublicVariableEventHandler on server side for refresh and send value from client.

in my pbo server side : 

 

  Hide contents

onPlayerConnected
{
  
  _data   =   [_uid]  call BAB_fnc_levelgetstat; //this function get value in redis 

  missionNamespace setVariable ["LEVEL_UserInfo", _data];
  _owner publicVariableclient "LEVEL_UserInfo";

}; // This part is ok

 

 

"LVLshowDB" addPublicVariableEventHandler {
  // [str serverTime,["Z_fnc_showDB","work"]] call BAB_fnc_leveladdstat; -> i use for debug for see if LVLshowDB work ...
    _arr = _this select 1;
    _player = _arr select 0;
    _uid = getPlayerUID _player;
    _owner = owner _player;
    // fonction de mise à jour de la dbb


    _data   =   [_uid]  call BAB_fnc_levelgetstat;

 missionNamespace setVariable ["LEVEL_UserInfo", _data];
    _owner publicVariable "LEVEL_UserInfo";
   
};

 

on client i do 

  Hide contents

LVLShowDB = true; publicVariableServer "LVLShowDB"; or missionNamespace setVariable ["LVLShowDB", true];publicVariable "LVLShowDB"; 

-> no add in redis database, if i modify the redis database manually, use this handler for refresh LEVEL_UserInfo's value, that's not work ... What I have to do for this work ? 

 

Thx

 

Check out the link below for an introduction to public variables.

https://community.bistudio.com/wiki/addPublicVariableEventHandler

 

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

×
×
  • Create New...