Jump to content
Liliannismo33

Execute a script in life_server from mpmission & Change value of column in DB

Recommended Posts

Hello,

I would like to run a script that is in the life_server from the mpmission. I found this, but nothing seems to happen:

[] remoteExec ["DB_fnc_changeacceptrules",RSERV];

I would also like in this script, this one once execute changes the value of the column "accept_rules" that I create from 0 to 1.

params [
  ["_player",ObjNull,[ObjNull]],
];
private _pid = getPlayerUID _player;

private _query = format ["UPDATE players SET accept_rules='1' WHERE pid='%1'",_pid];

[_query,1] call DB_fnc_asyncCall; 

I have add the file of my script in the config.cpp of the life_server as well as in the file where all the functions SERVER, CLIENT, ANYONE, HC are located. (I do not remember the name of the file anymore)


Thank you for your help.

Share this post


Link to post
Share on other sites

1. Did you add DB_fnc_changeacceptrules to the cfgremoteexec.hpp

2. In your remoteExec you are sending nothing to the life_server but saying _player is equal to the first thing sent. So try this:

[player

] remoteExec ["DB_fnc_changeacceptrules",RSERV];

Share this post


Link to post
Share on other sites
28 minutes ago, Liliannismo33 said:

Yes, i have add in CfgRemoteExec.hpp

F(DB_fnc_changerulesaccept,SERVER)

And 

[player] remoteExec ["DB_fnc_changeacceptrules",RSERV];

dosen't work :/

Post your config.cpp

Share this post


Link to post
Share on other sites
10 hours ago, Liliannismo33 said:

Do you have errors tho.

 0:25:47 Error in expression <params [
["_player",ObjNull,[ObjNull]],
];
private _pid = getPlayerUID _player;
>
 0:25:47   Error position: <];
private _pid = getPlayerUID _player;
>
 0:25:47   Error Missing [
 0:25:47 File \life_server\Functions\MySQL\fn_changerulesaccept.sqf [DB_fnc_changerulesaccept], line 11
 0:25:47 Error in expression <params [
["_player",ObjNull,[ObjNull]],
];
private _pid = getPlayerUID _player;
>
 0:25:47   Error position: <];
private _pid = getPlayerUID _player;
>
 0:25:47   Error Missing [
 0:25:47 File \life_server\Functions\MySQL\fn_changerulesaccept.sqf [DB_fnc_changerulesaccept], line 11

and

0:25:47 Warning Message: Script \life_server\Functions\Systems\fn_logIt.sqf not found

and

 0:27:01 Error in expression <s]"
hint "Script";
 
[player] remoteExec ["DB_fnc_changeacceptrules",RS>
 0:27:01   Error position: < ["DB_fnc_changeacceptrules",RS>
 0:27:01   Error Invalid number in expression
 0:27:01 File core\functions\fn_executedialogrules.sqf [life_fnc_executedialogrules], line 3
 0:27:01 Error in expression <s]"
hint "Script";
 
[player] remoteExec ["DB_fnc_changeacceptrules",RS>
 0:27:01   Error position: < ["DB_fnc_changeacceptrules",RS>
 0:27:01   Error Invalid number in expression
 0:27:01 File core\functions\fn_executedialogrules.sqf [life_fnc_executedialogrules], line 3

 

To fix the first error, update your fn_changerulesaccept.sqf

params [
  ["_player",ObjNull,[ObjNull]]
];
private _pid = getPlayerUID _player;

private _query = format ["UPDATE players SET accept_rules='1' WHERE pid='%1'",_pid];

[_query,1] call DB_fnc_asyncCall; 

 

and i cant help you for the other ones cuz i cant see them.

 

Share this post


Link to post
Share on other sites

For the first error, it's good :) Thanks you

And the third, my file have just :

[player] remoteExec ["DB_fnc_changeacceptrules",2 ];

And the second, i think it's normal. The file dosen't exist too in the framework of Altis Life

Share this post


Link to post
Share on other sites
45 minutes ago, Liliannismo33 said:

For the first error, it's good :) Thanks you

And the third, my file have just :

[player] remoteExec ["DB_fnc_changeacceptrules",2 ];

And the second, i think it's normal. The file dosen't exist too in the framework of Altis Life

OK so the logs you posted says you had more than what you posted. It had a hint among other things. The reason it didn't work was probably because you forgot to include the script macros at the top of the file and RSERV is defined in the script macros. And what framework version are you running? Is it from the offical github or did you get it from someone/somewhere else?

Share this post


Link to post
Share on other sites

A French DEV helped me and explain that to me, so I #include "..\.. \script_macros.hpp" at the beginning of my file and change to put RSERV on the RemoteExec, but nothing in fact.

So he found me an alternative with the local save on the player's profile, but I still have to try it.

i run in 5.0 and i use this : https://github.com/AsYetUntitled/Framework

Edited by Liliannismo33

Share this post


Link to post
Share on other sites
10 hours ago, Liliannismo33 said:

A French DEV helped me and explain that to me, so I #include "..\.. \script_macros.hpp" at the beginning of my file and change to put RSERV on the RemoteExec, but nothing in fact.

So he found me an alternative with the local save on the player's profile, but I still have to try it.

i run in 5.0 and i use this : https://github.com/AsYetUntitled/Framework

post your most recent rpt logs

Share this post


Link to post
Share on other sites

It's functional, the script starts well. I think it was because of SpyGlass. But I have another question. I want to change a given in the DB in a column that I create by "1" when the script is run. How can I do ?

 

diag_log "Essai";
#include "..\..\script_macros.hpp"
diag_log "Essai2";

private ["_uid","_query"];
_uid = [_this,0,"",[""]] call BIS_fnc_param;
diag_log "Essai3";
_query = format ["UPDATE players SET accept_rules='1' WHERE pid='%1'",_uid];
diag_log "Essai4";
[_query,1] call DB_fnc_asyncCall;
diag_log "Essai5";

The "diag_log" serve me to check if all starts well and it is the case and no error in RPT log

https://pastebin.com/bvP96yJh

 

Share this post


Link to post
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

×