Jump to content
Sign in to follow this  
firefly2442

Arma2MySQL

Recommended Posts

That looks ok. Does Arma2NETExplorer work?

I'm confused why the System.IO.FileNotFound exception is showing up in the RPT but not in the log files. That doesn't make sense to me. Can you try deleting the logs and re-running everything? Also, can you post your Database text file (remove the password first).

Share this post


Link to post
Share on other sites

Hello guys sorry if this may be a bit off topic but ive got a problem that just doesnt go away, ive been sitting here for over 4 hours to fix this so if anyone is able to help its very welcomed :)

Anyways what ive had problems with is that im trying to set up a server for the DAP S.T.A.L.K.E.R mod, everything went fine untill i noticed stats do not save from logging off and back in aswell as if you close the server so i thought about making a MySQL database for it since ive done it before with dayz epoch but for some reason it just wont work and i get no feedback from the database so i dont even know if the server establishes a connection and its the tables that are wrong or if it just cant connect at all!

Share this post


Link to post
Share on other sites

I would check the log files for both Arma2NET and Arma2NETMySQL to see what's happening. That will paint a more clear picture to see if it's able to connect to the server or not.

Hello guys sorry if this may be a bit off topic but ive got a problem that just doesnt go away, ive been sitting here for over 4 hours to fix this so if anyone is able to help its very welcomed :)

Anyways what ive had problems with is that im trying to set up a server for the DAP S.T.A.L.K.E.R mod, everything went fine untill i noticed stats do not save from logging off and back in aswell as if you close the server so i thought about making a MySQL database for it since ive done it before with dayz epoch but for some reason it just wont work and i get no feedback from the database so i dont even know if the server establishes a connection and its the tables that are wrong or if it just cant connect at all!

Share this post


Link to post
Share on other sites

Alright man ill check the log files once ive got some spare time and get back to ya :)

Share this post


Link to post
Share on other sites

I hope you guys can help me with this one. I can finally get the plugin to work if I either call a query directly from init.sqf or call another script from init.sqf, but I can't seem to get a query to run from another sqf script. Here's what I have in my init.sqf.

if (isServer) then {

_friends = "Arma2Net.Unmanaged" callExtension "Arma2NETMySQLCommand ['dayz_overpoch_server_1', 'SELECT PlayerName, FriendUID FROM friend_data LIMIT 3']";

[] execVM "ArmaNetTest.sqf"; <----points to the test script with the query.

};

Both of those generate an event in the logs and shows the correct returned result set, but when I try and run the same query from another script, nothing happens. I don't see anything in the any of the server logs.

Thanks in advance.

Share this post


Link to post
Share on other sites

Is the part that's not working inside an isServer check? The start point of the mission is init.sqf, if the script that isn't working is not called from init.sqf or somewhere along the line, it won't get run. Put debug print statements in to see where it's getting. https://community.bistudio.com/wiki/diag_log

I hope you guys can help me with this one. I can finally get the plugin to work if I either call a query directly from init.sqf or call another script from init.sqf, but I can't seem to get a query to run from another sqf script. Here's what I have in my init.sqf.

if (isServer) then {

_friends = "Arma2Net.Unmanaged" callExtension "Arma2NETMySQLCommand ['dayz_overpoch_server_1', 'SELECT PlayerName, FriendUID FROM friend_data LIMIT 3']";

[] execVM "ArmaNetTest.sqf"; <----points to the test script with the query.

};

Both of those generate an event in the logs and shows the correct returned result set, but when I try and run the same query from another script, nothing happens. I don't see anything in the any of the server logs.

Thanks in advance.

Share this post


Link to post
Share on other sites

I have tried it inside an isServer, but it didn't work. I've used systemChat to print variables as it goes through the script and the variables come back null. I'm not clear on what you mean by it has to be called from inti.sqf. Are you saying the arm2netmysql plugin will only work if directly called from init.sqf? If so, I'm not sure how useful this would be then.

Is the part that's not working inside an isServer check? The start point of the mission is init.sqf, if the script that isn't working is not called from init.sqf or somewhere along the line, it won't get run. Put debug print statements in to see where it's getting. https://community.bistudio.com/wiki/diag_log

Share this post


Link to post
Share on other sites

No, I meant that you need to call the script somehow. The init.sqf is the starting point. If you have it working in the init but not working somewhere else, I'm guessing it's an SQF scripting issue. Can you post the log files from Arma2NETMySQL?

I have tried it inside an isServer, but it didn't work. I've used systemChat to print variables as it goes through the script and the variables come back null. I'm not clear on what you mean by it has to be called from inti.sqf. Are you saying the arm2netmysql plugin will only work if directly called from init.sqf? If so, I'm not sure how useful this would be then.

Share this post


Link to post
Share on other sites

It may make more sense if I post show the sequence of what I'm trying to do.

I'm calling a script in the init.sqf that runs a query and I also run the query directly out of the init.sqf. They run fine and show in the arma2net logs.

In the fn_selfActions.sqf script, this section will call a script called plotpole.sqf if someone is targeting a plotpole they own.

if (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ" && (getPlayerUID player) in _allowed && (speed player <= 1)) then {

if (s_player_plotpole_dialog < 0) then {

s_player_plotpole_dialog = player addAction ["Manage", "custom\plotpole.sqf", [_cursorTarget, _owner], 5, false];

};

} else {

player removeAction s_player_plotpole_dialog;

s_player_plotpole_dialog = -1;

The plotpole.sqf file then calls the PlotPoleLoadLists script which is where I'm having the issues.

private ["_plotpole", "_owner"];

CurrentPlotpole = (_this select 3) select 0;

_owner = (_this select 3) select 1;

createdialog "PlotPoleManager";

if (0 > 2) then { //_owner != getPlayerUID player

ctrlEnable [4503, false];

ctrlEnable [4504, false];

};

call PlotPoleLoadLists;

call PlotPoleMaintainInfo;

private ["_owner","_nearby","_vars","_friends" ];

lbClear 4500;

lbClear 4501;

_nearby = player nearEntities ["CAManBase", 10];

PlotPoleNearbyList = [];

{

if (_x != player and _x isKindOf "Man" and !(_x isKindOf "zZombie_base")) then {

PlotPoleNearbyList set [count PlotPoleNearbyList, [name _x, getPlayerUID _x]];

lbAdd [4500, format["%1", name _x]];

};

} forEach _nearby;

_owner = [player, (getPlayerUID player)];

systemChat("Owner: " + (str _owner));

_friends = "Arma2Net.Unmanaged" callExtension "Arma2NETMySQLCommand ['dayz_overpoch_server_1', 'SELECT PlayerName, FriendUID FROM friend_data LIMIT 10']";

systemChat ("Friends: " + (str _friends));

_friends = call compile format["%1", _friends];

systemChat ("Friends: " + (str _friends));

{

systemChat ("For Each: " + (str _x select 0));

lbAdd [4501, format["%1", (_x select 0)]];

} forEach _friends;

Here's the arma2net logs

08/14/2014 19:18:20 Arma2NET 2.3.0.0 running on CLR 4.0.30319.1

08/14/2014 19:18:20 Loaded into process arma2oaserver

08/14/2014 19:18:20 Loading add-ins

08/14/2014 19:18:20 Domain Name Version Publisher Description

08/14/2014 19:18:20 DefaultDomain Arma2NETMySQL 0.1.0.0 firefly2442 Runs MySQL procedure commands.

08/14/2014 19:18:20 DefaultDomain Arma2NETMySQLCommand0.1.0.0 firefly2442 Runs raw MySQL/SQLite commands

08/14/2014 19:18:20 DefaultDomain Arma2NETMySQLCommandAsync0.1.0.0 firefly2442 Runs asynchronous raw MySQL/SQLite commands

08/14/2014 19:18:20 DefaultDomain ClrVersion 2.0.0.0 Scott_NZ Retrieves the version of the Common Language Runtime.

08/14/2014 19:18:20 DefaultDomain CompareVersion 2.0.0.0 Scott_NZ Compares two version strings and returns an integer indicating how they compare.

08/14/2014 19:18:20 DefaultDomain Version 2.0.0.0 Scott_NZ Returns the version of Arma2NET.

08/14/2014 19:18:20 DefaultDomain GetClipboardText 1.0.0.0 Scott_NZ Gets the clipboard text value.

08/14/2014 19:18:20 DefaultDomain SetClipboardText 1.0.0.0 Scott_NZ Sets the clipboard to a text value.

08/14/2014 19:18:20 DefaultDomain CommandLine 2.0.0.0 Scott_NZ Returns the command line used to start the application.

08/14/2014 19:18:20 DefaultDomain DateTime 2.0.0.0 Scott_NZ Returns the current date and time.

08/14/2014 19:18:20 Arma2NET initialized in 00:00:00.0546466

08/14/2014 19:18:21 function: Arma2NETMySQLCommand ['dayz_overpoch_server_1', 'SELECT PlayerName, FriendUID FROM friend_data LIMIT 3']

08/14/2014 19:18:21 maxResultSize: 10239

08/14/2014 19:18:21 Result size: 38

08/14/2014 19:18:21 Result: [[["xxxxxx", "1234566789"]]]

08/14/2014 19:18:22 function: Arma2NETMySQLCommand ['dayz_overpoch_server_1', 'SELECT PlayerName, FriendUID FROM friend_data LIMIT 3']

08/14/2014 19:18:22 maxResultSize: 10239

08/14/2014 19:18:22 Result size: 38

08/14/2014 19:18:22 Result: [[["xxxxxx", "123456789"]]]

As you can see the two that are run from the init.sqf run, but there's nothing from the one in PlotPoleLoadLists.sqf.

No, I meant that you need to call the script somehow. The init.sqf is the starting point. If you have it working in the init but not working somewhere else, I'm guessing it's an SQF scripting issue. Can you post the log files from Arma2NETMySQL?

Share this post


Link to post
Share on other sites

I'm not 100% sure but I think I have an idea as to what the problem is. It's tough to tell with this code formatting. The player cannot run the database calls, they have to be run on the server since this is server-side only. If you want the player to do something or trigger a database call, you'll need to call it on the server and then pass the information to the client. Look at the example mission, in particular the server_events.sqf file to see how that can work. https://github.com/firefly2442/Arma2NetMySQLPlugin-Arma3-ExampleMission

Share this post


Link to post
Share on other sites

How would you do this without the CBA addons? The CBA addons are taking me down a rabbit hole I don't want to follow. It's causing all kinds of issues with Infistar and version issues.

I'm not 100% sure but I think I have an idea as to what the problem is. It's tough to tell with this code formatting. The player cannot run the database calls, they have to be run on the server since this is server-side only. If you want the player to do something or trigger a database call, you'll need to call it on the server and then pass the information to the client. Look at the example mission, in particular the server_events.sqf file to see how that can work. https://github.com/firefly2442/Arma2NetMySQLPlugin-Arma3-ExampleMission
Edited by CMDRTACO

Share this post


Link to post
Share on other sites

Hmm, I'm not quite sure how to do it without CBA. Perhaps start a thread in the Arma 3 scripting section and ask people what the alternatives would be? Sorry, I'm just not that familiar with everything that's in stock Arma. Maybe event handlers? https://community.bistudio.com/wiki/addEventHandler

How would you do this without the CBA addons? The CBA addons are taking me down a rabbit hole I don't want to follow. It's causing all kinds of issues with Infistar and version issues.

Share this post


Link to post
Share on other sites

Hey guys.

I'm having some trouble using Arma2Net with my stored procedure.

I really looked for an answer via google for more than two hours but now i decided to post here...

Maybe I should have created a new thread for this... If so, please anyone move this post to a new thread.

What I was trying is using a stored procedure I created before in the database I am using. So I found an example of doing so on this homepage (I tried to post a link, here but since I just registered I am not allowed to do so...), but when it comes to the execution of my code Arma2Net throws an exception. (Of course I made sure my stored procedure really works - it's all fine when executing it with my MySQL client.)

This is my code...

_strCreate = format ["[objUID=%1,instanceNr=%2,class='%3',dmg=%4,charID=%5,world='%6',inv='%7',hits='%8',code=%9]", 
                           _uid, dayz_instance,      _class,
                              0,       _charID, _worldspace,
                             [],            [],       _fuel
                       ];
_create = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQL ['%1', 'insertBaseBuildingObject', '%2']", mydatabase, _strCreate];
diag_log format ["Debug BB-Create ... %1",_create];

And here is what I get in the Arma2Net logfile...

Info: 23:22:31 - Received - Database: overpoch_test Procedure: insertBaseBuildingObject Parameters: objUID=6513412343451243,instanceNr=11,class=Plastic_Pole_EP1_DZ,dmg=0,charID=676235463242456,world=[342.237,[4640.63,9870.5,0]],inv=[],hits=[],code=3333
Info: 23:22:31 - Parsing parameters...
Warning: 23:22:31 - Couldn't parse procedure, split didn't work.

Can anyone tell what is wrong here?

I have found some could that gave me a hint that my parameters could not be seperated correctly so that Arma2Net could have interpreted the hole string of parameters as one single parameter. The result would be that the further seperation with '=' would bring up an array with more than 2 entries (10 in my case) so that Arma2Net gives that warning.

Any help would be appreciated.

Best regards

Balthorius

Share this post


Link to post
Share on other sites

Hmm, it might have to do with the "world" parameter. It looks like it's a nested array or something. It could be failing to parse that. Try using "[]" or an empty string for that parameter and see what happens. Also, do you have any other stored procedures working through Arma2MySQL?

Hey guys.

I'm having some trouble using Arma2Net with my stored procedure.

I really looked for an answer via google for more than two hours but now i decided to post here...

Maybe I should have created a new thread for this... If so, please anyone move this post to a new thread.

What I was trying is using a stored procedure I created before in the database I am using. So I found an example of doing so on this homepage (I tried to post a link, here but since I just registered I am not allowed to do so...), but when it comes to the execution of my code Arma2Net throws an exception. (Of course I made sure my stored procedure really works - it's all fine when executing it with my MySQL client.)

This is my code...

_strCreate = format ["[objUID=%1,instanceNr=%2,class='%3',dmg=%4,charID=%5,world='%6',inv='%7',hits='%8',code=%9]", 
                           _uid, dayz_instance,      _class,
                              0,       _charID, _worldspace,
                             [],            [],       _fuel
                       ];
_create = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQL ['%1', 'insertBaseBuildingObject', '%2']", mydatabase, _strCreate];
diag_log format ["Debug BB-Create ... %1",_create];

And here is what I get in the Arma2Net logfile...

Info: 23:22:31 - Received - Database: overpoch_test Procedure: insertBaseBuildingObject Parameters: objUID=6513412343451243,instanceNr=11,class=Plastic_Pole_EP1_DZ,dmg=0,charID=676235463242456,world=[342.237,[4640.63,9870.5,0]],inv=[],hits=[],code=3333
Info: 23:22:31 - Parsing parameters...
Warning: 23:22:31 - Couldn't parse procedure, split didn't work.

Can anyone tell what is wrong here?

I have found some could that gave me a hint that my parameters could not be seperated correctly so that Arma2Net could have interpreted the hole string of parameters as one single parameter. The result would be that the further seperation with '=' would bring up an array with more than 2 entries (10 in my case) so that Arma2Net gives that warning.

Any help would be appreciated.

Best regards

Balthorius

Share this post


Link to post
Share on other sites

The problem is not caused by the nested array. I replaced it with a string and the error still occurs

Info: 22:30:29 - Received - Database: panadur_1 Procedure: test Parameters: INSERT INTO object_DATA (ObjectUID, Instance, Classname, Damage, CharacterID, Worldspace, Inventory, Hitpoints, Fuel) VALUES (1152381130955152, 11, 'LockboxStorageLocked', 0, '76561198013238061', 'leer', 'leer', 'leer', 3333);

Info: 22:30:29 - Parsing parameters...

Warning: 22:30:29 - Couldn't parse procedure, split didn't work.

For Info. Balthorius and me are working on the same code.

Share this post


Link to post
Share on other sites

Try one last thing for me. Change this:

_strCreate = format ["[objUID=%1,instanceNr=%2,class='%3',dmg=%4,charID=%5,world='%6',inv='%7',hits='%8',code=%9]", 
                           _uid, dayz_instance,      _class,
                              0,       _charID, _worldspace,
                             [],            [],       _fuel
                       ];

To this:

_strCreate = format ["[ObjectUID=%1,Instance=%2,Classname=%3,Damage=%4,CharacterID=%5,Worldspace=%6,Inventory=%7,Hitpoints=%8,Fuel=%9]", 
                           _uid, dayz_instance,      _class,
                              0,       _charID, _worldspace,
                             [],            [],       _fuel
                       ];

I removed some single quotes and change the parameter names to match those of the stored procedure. IIRC, the parameter names need to match.

Share this post


Link to post
Share on other sites

I am using Arma2Net on a dayz Overpoch server. So far everything was working fine...or so i thought it was actually. I am using it to publish buildings that players build, and also to upgrade them. The publish function (the 1st insert of the object in the db) works fine...but the upgrade one doesnt....and although its basically the same command, and i see the mysql entry in the logs...its not getting executed.

My main function is :

vgserver_hiveWrite = {
private["_mykey","_mydata"];
_mykey = _this;
_mydata = format["Arma2NETMySQLCommand ['dayzdb',""%1""]",_mykey];
SQL_RESULT = "Arma2Net.Unmanaged" callExtension _mydata;
};

and i use this like this:

server_publishVehicle.sqf

_key = format["insert into object_data (ObjectUID, Instance, Classname, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Damage, Datestamp) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9', CURRENT_TIMESTAMP)",_uid,dayZ_instance,_class,_characterID,_worldspace,'[]',_array,_fuel,_damage];
//diag_log ("HIVE: WRITE: "+ str(_key)); 
_key call vgserver_hiveWrite;

This works fine...it inserts the object in the db 100% of the time. The arma2net log shows it:

10/17/2014 14:42:14 function: Arma2NETMySQLCommand ['dayzdb',"insert into object_data (ObjectUID, Instance, Classname, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Damage, Datestamp) values ('60326137931352','13','CinderWallHalf_DZ','11111111111111111','[352.22,[6032.56,1379.29,-0.00756836]]','[]','[]','0','0',CURRENT_TIMESTAMP)"]
10/17/2014 14:42:14 maxResultSize: 10239
10/17/2014 14:42:14 Result size: 4
10/17/2014 14:42:14 Result: [[]]

Now if a player upgrades an object server_swapObject.sqf is called. That file basically grabs the requested object's details from a publicvariable, deletes the object in question, writes the upgraded entry in the database and spawns the new object in game. For example object 'CinderWallHalf_DZ' is upgraded to 'CinderWall_DZ' (....hence the 1st object deletion)

But in this file...although the insert sql is similar

server_swapObject.sqf

_keySwap = format["insert into object_data (ObjectUID, Instance, Classname, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Damage, Datestamp) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9', CURRENT_TIMESTAMP)",_uid,dayZ_instance,_class,_charID,_worldspace,'[]','[]',0,0];
//diag_log ("HIVE: WRITE Server SWAP_OBJECT: "+ str(_keySwap)); 
_keySwap call vgserver_hiveWrite;

and i can see it in the arma2netmysql log file:

10/17/2014 14:43:34 function: Arma2NETMySQLCommand ['dayzdb',"insert into object_data (ObjectUID, Instance, Classname, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Damage, Datestamp) values ('60326137931352','13','CinderWall_DZ','11111111111111111','[352.22,[6032.56,1379.29,-0.00756836]]','[]','[]','0','0', CURRENT_TIMESTAMP)"]
10/17/2014 14:43:34 maxResultSize: 10239
10/17/2014 14:43:34 Result size: 4
10/17/2014 14:43:34 Result: [[]]

it does NOT get executed in the db. If i copy/paste the above query in phpmyadmin and execute it...it imports just fine. So its not a problem of bad syntax or something.

It just doesnt execute...and i dont know why !?

Should i put a sleep somewhere or something ?

Why do i see it in the arma2net log ? That means it executed right ?

(1st file, works fine) server_publishVehicle.sqf: http://pastebin.com/ikQrTNZp

(2nd file, not w/fine) server_swapObject.sqf : http://pastebin.com/YrSMeywJ

Any ideas?

-Thanks

Edited by Sandbird

Share this post


Link to post
Share on other sites

Does the deletion work? One thing I can think of is perhaps the ObjectUID (which I assume is a primary key) already exists if the entry doesn't get deleted. Then if you try to add it, it may silently fail? What else.... have you thought about using an update statement instead? Since all the other information is the same you could reduce the deletion and insertion down to just update. https://dev.mysql.com/doc/refman/5.0/en/update.html

One thing I would suggest is this. In the diag_log statements that output the SQL command, make them both unique to the file so you can be absolutely sure which one is being executed. Perhaps the swapObject is not being called like you think it is? That's all I can think of at the moment. Try those and let us know what you get. Good luck. :)

Share this post


Link to post
Share on other sites

yeah the deletion works. So you think the deletion 'delays' for some reason, so the query doesnt get executed huh...hmm good idea.

Update is a bit risky. The deletion probably is the key here....Cause things marked for deletion probably do other stuff as well. I have to check it out first before i resort to ignoring it.

Yeah, the diag_logs are unique..i know that the file is getting executed thats a 100%, and its called when it has to as well.

I was wondering, is there a way (with my current vgserver_hiveWrite) to a loop for x times of executing the sql until i get a result back or something ?

The original hive.dll can get a result on queries....If its a PASS then continue...else try again for X times.

How easy is it to do the same with arma2net ?

Thanks again for 'unstucking' me firefly :)

Share this post


Link to post
Share on other sites
yeah the deletion works. So you think the deletion 'delays' for some reason, so the query doesnt get executed huh...hmm good idea.

Update is a bit risky. The deletion probably is the key here....Cause things marked for deletion probably do other stuff as well. I have to check it out first before i resort to ignoring it.

Yeah, the diag_logs are unique..i know that the file is getting executed thats a 100%, and its called when it has to as well.

I was wondering, is there a way (with my current vgserver_hiveWrite) to a loop for x times of executing the sql until i get a result back or something ?

The original hive.dll can get a result on queries....If its a PASS then continue...else try again for X times.

How easy is it to do the same with arma2net ?

Thanks again for 'unstucking' me firefly :)

Yes, there's the asynchronous method. This is actually less taxing on the server because it doesn't block until the result is returned. See here: http://arma2netmysqlplugin.readthedocs.org/en/latest/#straight-mysql-queries

Share this post


Link to post
Share on other sites

Hello i need some help if anyone can this is my problem i can get the query to work correct but the result is coming out like this [[["15"]]]

i need it too just show 15

this is my code

_playerLosts = format ["SELECT playerLosts FROM `player_stats` WHERE playerUID = ''%1''", _playerID];
_playerLostsResult = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQLCommand ['serverdb', '%1']", _playerLosts];

like i said it results the correct answer but it also shows the brackets but i do not want that.

thanks!

Share this post


Link to post
Share on other sites

After all that do

_playerLostsResult = _playerLostsResult select 0 select 0 select 0;

Share this post


Link to post
Share on other sites
After all that do

_playerLostsResult = _playerLostsResult select 0 select 0 select 0;

hmmm i get this error

Error in expression playerLostsResult = _playerLostsResult select 0 select 0 select 0;

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×