Jump to content
Sign in to follow this  
firefly2442

Arma2MySQL

Recommended Posts

I can't get it right now because I just figured that I uninstalled all of the database related stuff because I kind of gave up on it. I just remember getting that error whenever trying out the sample mission.

Share this post


Link to post
Share on other sites

You have to post the complete log, because some lines point at what caused the error.

Share this post


Link to post
Share on other sites

Can you post the log files for Arma2NetMySQL that shows the: "Exception Info: System.IO.FileNotFoundException". This should tell what the issue is. I'm guessing it's looking for a specific version of the dependencies.

So I hunted down the version of mysql connector required took a bit of Google searching but found it. But now whenever I execute the code it just crash's my the server. Not sure if this is related to the 2.3 version but don't know of what version fix's the dll dependency issues and where to place what dll's need to go into what folders if there is a dll dependancy issue within arma2net itself.

This is what I am getting :

Application: arma2oaserver.exe

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Info: System.IO.FileNotFoundException

Stack:

at <Module>.Arma2Net.Unmanaged.InvokeFunctionImpl(SByte*, Int32, SByte*)

at <Module>.Arma2Net.Unmanaged.InvokeFunction(SByte*, Int32, SByte*)

Code looks like the following :

_queryvalue = format ["[%1,%2]", _uid, _variable_value];

"Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQL ['arma2game', 'updateb', '%1']", _queryvalue];

I have also tried the following :

_result = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQL ['arma2game', 'updateb', '%1']", _queryvalue];

_result

I can call the stored procedure from the mysql cli without issues so I know it isn't example :

mysql> call updateb(1,300);

Query OK, 1 row affected (0.00 sec)

But I am not even getting that far as soon as the code is executed on the server side it causes a crash like above mentioned .

Thanks,

Nohau

Share this post


Link to post
Share on other sites

When I got the "System.IO.FileNotFoundException" it ended up being several assemblies being blocked by Windows probably after download/unpack.

Going through the Properties of each Arma2Net related assembly in Windows Explorer, and unblocking them (option is at the bottom if it is available), solved it.

Share this post


Link to post
Share on other sites

So there was no log files being generated at the time as well the Arma2Net explorer was working without any issues which I thought I was in the clear of it being blocked dlls .. But after causing my server to crash 4 times I started trying to dig deeper and found that all the arma2net and arma2netmysqlplugin(s) where being blocked even the database.txt file .

Like stated the explorer worked fine but it was only in game where I seen the issue and the log files where not being generated the only thing I had to go off of was the event log error that generated.

I do have it working now though.

Thanks,

Nohau

Share this post


Link to post
Share on other sites

This may be totally dumb to ask, but how do I compare wether a string is empty?

//Remove the shells
_sqlcall = call compile _sqlcall;
_sqlcall = _sqlcall select 0;
_sqlcall = _sqlcall select 0;
_sqlcall = _sqlcall select 0;

if (isNull _sqlcall) then 
{
_empty = "yes"
}
else 
{
_empty = "no"

};

hintc format ["Call result: %1\n Empty? %2", _sqlcall,_empty];

_sqlcall returns [[[]]] which it is supposed to do when it tries to find an entry that does not exist. I want to check wether the above variable (which returns nothing) is empty in ARMA2. The above statement wont work. I used call compile so it returns "any" ingame which is a variable with no value (is it?)

In the above code both variables return "any"

Share this post


Link to post
Share on other sites

I am missing something like maybe a escape char or something when trying to accomplish a procedure I am getting the following :

Info: 07:22:50 - Received - Database: arma2game Procedure: updateb Parameters: '1234','[50,48,48,48,48,48]'

Info: 07:22:50 - Parsing parameters...

Warning: 07:22:50 - Couldn't parse procedure, split didn't work.

But in mysql this call works :

mysql> call updateb('1234','[50,48,48,48,48,48]');

Query OK, 1 row affected (0.02 sec)

*************************** 1. row ********************

uid: 1234

bankaccount: [50,48,48,48,48,48]

1 row in set (0.00 sec)

Thanks,

Nohau

Share this post


Link to post
Share on other sites
This may be totally dumb to ask, but how do I compare wether a string is empty?

//Remove the shells
_sqlcall = call compile _sqlcall;
_sqlcall = _sqlcall select 0;
_sqlcall = _sqlcall select 0;
_sqlcall = _sqlcall select 0;

if (isNull _sqlcall) then 
{
_empty = "yes"
}
else 
{
_empty = "no"

};

hintc format ["Call result: %1\n Empty? %2", _sqlcall,_empty];

_sqlcall returns [[[]]] which it is supposed to do when it tries to find an entry that does not exist. I want to check wether the above variable (which returns nothing) is empty in ARMA2. The above statement wont work. I used call compile so it returns "any" ingame which is a variable with no value (is it?)

In the above code both variables return "any"

You could try :

if (_sqlcall == "") then
{
    ......
};

Share this post


Link to post
Share on other sites

That did not work. I am looking for the basic "if entry does not exist, do something"

---------- Post added at 03:34 PM ---------- Previous post was at 03:26 PM ----------

Found it!

isnil "_sqlcall"

Share this post


Link to post
Share on other sites

You can't pass commas as data currently. We need those to split up the data so if you pass data with commas, it can't run the split. Try a different character, like a "\", then split and reset the data on the Arma2 side when you get it back.

I am missing something like maybe a escape char or something when trying to accomplish a procedure I am getting the following :

But in mysql this call works :

Thanks,

Nohau

Share this post


Link to post
Share on other sites

Waiting for a finished release of CBA before porting the example mission over to the Arma 3 Alpha.

Share this post


Link to post
Share on other sites

Awesome - i had just spend the last few weeks getting this running on arma 2 with personalised scripts - Nice work Firefly2442 :)

Share this post


Link to post
Share on other sites

Okey, so I've been going over all this 24 pages now.

There are no where a good setup for those who are trying to make they'r own mysql connection.

I've pritty much gone over all example missions regarding ArmA2NET, haven't find anything about how I open/request a connection to the database. Does it do that automaticly?

Anyways, I've tried everything, some how my little simple command doesn't work at all, I don't get anything in any of my logs, I don't even get a log file from @Arma2NET at all.

This is my startup parameter for my server (Well there is alot more to it so it can find correct path's and all that)

"%_ARMA2OAPATH%\Expansion\beta\arma2oaserver.exe" "-mod=%_ARMA2PATH%;EXPANSION;ca" "-mod=Expansion\beta;Expansion\beta\Expansion" -mod=@Arma2NET;@CBA;@CBA_A2;@CBA_OA;@ERP -arma2netdev -config=server.cfg

I've tried to recive a simple value from the database just to figure out how I make this, but nothing happens I don't even get a respons from the databse.

I've checked the Database.txt as well place it in my ArmA 2 OA directory as well, doesn't help me there.

What have I done wrong?

_uid = getPlayerUID vehicle player;
_query = format ["SELECT Score FROM Users WHERE uid='%1'", _uid];
_result = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQL ['a4935417_life', '%1']", _query];
CodeValue = _result;

This is such times I get so pissed I almost killing my PC ^^

I've been working and working with ArmA2NET to get it to work for almost 2 weeks not, took me 1 and a half week to get the damn compiling for the dll file to work, now a simple command doesn't work :S

Please, help me some one!

-Sincerely

Staffan

Share this post


Link to post
Share on other sites

Your startup looks correct. The -arma2netdev is not needed anymore, you just need @Arma2NET. The connection to the database is opened and connected based on the Databases.txt file information. This happens when the call extension occurs. The fact that you're not getting log files for Arma2NET is not good. That should definitely be logging. Did you try watching the video here?

https://www.dropbox.com/sh/ngix8aunt9nnwj7/ZHt1agEeM0

It may help you. Also look at the example mission:

https://github.com/firefly2442/Arma2NetMySQLPlugin-ExampleMission

Specifically, this file should help:

https://github.com/firefly2442/Arma2NetMySQLPlugin-ExampleMission/blob/master/as_loadouts/server_events.sqf

Okey, so I've been going over all this 24 pages now.

There are no where a good setup for those who are trying to make they'r own mysql connection.

I've pritty much gone over all example missions regarding ArmA2NET, haven't find anything about how I open/request a connection to the database. Does it do that automaticly?

Anyways, I've tried everything, some how my little simple command doesn't work at all, I don't get anything in any of my logs, I don't even get a log file from @Arma2NET at all.

This is my startup parameter for my server (Well there is alot more to it so it can find correct path's and all that)

"%_ARMA2OAPATH%\Expansion\beta\arma2oaserver.exe" "-mod=%_ARMA2PATH%;EXPANSION;ca" "-mod=Expansion\beta;Expansion\beta\Expansion" -mod=@Arma2NET;@CBA;@CBA_A2;@CBA_OA;@ERP -arma2netdev -config=server.cfg

I've tried to recive a simple value from the database just to figure out how I make this, but nothing happens I don't even get a respons from the databse.

I've checked the Database.txt as well place it in my ArmA 2 OA directory as well, doesn't help me there.

What have I done wrong?

_uid = getPlayerUID vehicle player;
_query = format ["SELECT Score FROM Users WHERE uid='%1'", _uid];
_result = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQL ['a4935417_life', '%1']", _query];
CodeValue = _result;

This is such times I get so pissed I almost killing my PC ^^

I've been working and working with ArmA2NET to get it to work for almost 2 weeks not, took me 1 and a half week to get the damn compiling for the dll file to work, now a simple command doesn't work :S

Please, help me some one!

-Sincerely

Staffan

Share this post


Link to post
Share on other sites
Your startup looks correct. The -arma2netdev is not needed anymore, you just need @Arma2NET. The connection to the database is opened and connected based on the Databases.txt file information. This happens when the call extension occurs. The fact that you're not getting log files for Arma2NET is not good. That should definitely be logging. Did you try watching the video here?

https://www.dropbox.com/sh/ngix8aunt9nnwj7/ZHt1agEeM0

It may help you. Also look at the example mission:

https://github.com/firefly2442/Arma2NetMySQLPlugin-ExampleMission

Specifically, this file should help:

https://github.com/firefly2442/Arma2NetMySQLPlugin-ExampleMission/blob/master/as_loadouts/server_events.sqf

Thank you firefly2442!

I don't get how I missed the video, anyways I the log and all that to work now and now it's just to fix the server.

I'll be back with more info if I can't make it to work.

Thanks alot, Sincerely Staffan.

Update:

Okey so I just tested it out a few times, just took one of the server_events from the example and rewrote the parts I wanted. Anyways I've tried it a few times but it doesn't really do anything, I get one error though with I can't really seem to understand ^^ check the script a few times but doesn't find the issue

No errors at all.

Value1 = 0; [b]//Setting Value to start value[/b]
Value2 = 0; [b]//Setting Value to start value[/b]
_parameters = getPlayerUID vehicle player;
["get_Handic", [_parameters, _parameters]] call CBA_fnc_globalEvent; [b]// UID on both just for now[/b]

One error: _query = format ["SELECT Handic FROM Users>

19:41:07 Error position: <_query = format ["SELECT Handic FROM Users>

19:41:07 Error Missing ;

19:41:07 File mpmissions\__cur_mp.takistan\init\events.sqf, line 7

["get_Handic", {
_unit = _this select 0;
_parameters = _this select 1;
_query = format ["SELECT Handic FROM Users WHERE uid = '%1'", _parameters]; [b]// Line 7[/b]
_dbloadouts = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQLCommand ['dbname', '%1']", _query];
_uid = getPlayerUID vehicle player;
Value1= _dbloadouts;
Value2= _dbloadouts;
}
] call CBA_fnc_addEventHandler;

No clue at all how to fix it, any suggestions?

-Sincerely

Staffan

Edited by Staffan
UPDATE

Share this post


Link to post
Share on other sites

Hmm, it looks pretty good to me. I don't see any missing semicolons anywhere. Do you have this stuff at the top for CBA?

#define DEBUG_MODE_FULL
#include "\x\cba\addons\main\script_macros.hpp"
#include "definitions.sqf"
disableSerialization;

Share this post


Link to post
Share on other sites
Hmm, it looks pretty good to me. I don't see any missing semicolons anywhere. Do you have this stuff at the top for CBA?

#define DEBUG_MODE_FULL
#include "\x\cba\addons\main\script_macros.hpp"
#include "definitions.sqf"
disableSerialization;

Negative, is it needed?

UPDATE:

I just added that as well, also I just noticed that there is nothing in the ArmA2NET logs or MySQL logs, looks like it's not running, the logs that where inside came from the Arma2NetExplorer.exe when I where inside.

I can't understand why it's not running with the server since the server is clearly using @ArmA2NET in the mod line...

-Sincerely

Staffan

UPDATE2:

I just tried a test mission from some where without mysql just to see if ArmA2NET loads, which it does.

I think I'm mission something in my mission, a part that I've not even been thinking about or you.

Now the question is what...

-Sincerely,

Staffan

Edited by Staffan
Updated

Share this post


Link to post
Share on other sites

I believe it's needed yes.

Hmm, did you set it up to save in your AppData folder or root Arma2 folder?

Share this post


Link to post
Share on other sites
I believe it's needed yes.

Hmm, did you set it up to save in your AppData folder or root Arma2 folder?

Hmm, okey I admit I just proved that I'm a fool ^^.

Some how I copied a wrong @ArmA2NET and not the one I got from here where the mysql plugin where compiled, never noticed it until now when you mentioned this.

Looks like everything is worknig fine now, thanks alot for the help!

-Sincerely

Staffan

Edited by Staffan

Share this post


Link to post
Share on other sites
Hmm, okey I admit I just proved that I'm a fool ^^.

Some how I copied a wrong @ArmA2NET and not the one I got from here where the mysql plugin where compiled, never noticed it until now when you mentioned this.

Looks like everything is worknig fine now, thanks alot for the help!

-Sincerely

Staffan

Sorry for bump but now I've got everything to load properly besides scripting wise, when it returns the value and are going to place in inside the server it says any in the array nothing else.

When printing everything to the server log I recive all this.

17:14:20 "SELECT bank FROM users WHERE uid = '*******'"
17:14:20 "[[["55556"]]]"
17:14:20 "Handic: [["55556"]]"

The question is why all [[ ]] those comes, might be because I get "any" in the array.

Any ideas?

From server_events.sqf

_unit = _this select 0;
	_parameters = _this select 1;
	_query = format ["SELECT Handic FROM users WHERE uid = '81027206'", _parameters];
	diag_log format ["%1", _query];
	_dbloadouts = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQLCommand ['Handic', '%1']", _query];
	diag_log format ["%1", _dbloadouts];

	_dbloadouts = call compile _dbloadouts;
	_dbloadouts = _dbloadouts select 0;
	diag_log format ["Handic: %1", _dbloadouts];
	Value1                = _dbloadouts;

Share this post


Link to post
Share on other sites

Can't belive I missed that, I where looking in there to see how you took out just the value.

Anyways I got that fixed now and thanks alot for the help!

Share this post


Link to post
Share on other sites

Hej Firefly,

I've been trying to figure this out for a while now why the value loading form the database to an Variable Array gives "any" or "scalar", could you possible help me out?

I have tried and tried everything, I have no clue what I've done wrong and why it's not working, tried pritty much everything....

#define DEBUG_MODE_FULL [b]//This one is from your script (No Change)[/b]
#include "\x\cba\addons\main\script_macros.hpp" [b]//This one is from your script (No Change)[/b]
#include "definitions.sqf" [b]//This one is from your script (No Change)[/b]
disableSerialization; [b]//This one is from your script (No Change)[/b]

_unit = player;

if (isNull _unit || !isPlayer _unit) then {
diag_log format ["Error: unit is null or not a player"];
initText = "<br/><t color='#ff0000' size='1.0' shadow='1' shadowColor='#000000' align='center'>ERROR</t><br/><br/>Something went wrong.<br/>Please reconnect and try again.<br/><br/>";
hint parseText (initText);
};

_uid = getPlayerUID vehicle player;
_query = format ["SELECT test FROM users WHERE uid = '%1'", _uid];
_dbloadouts = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQLCommand ['db', '%1']", _query]; [b]//This returns [[["952"]]] from the database (952 is the ammount in the database)[/b]
_dbloadouts = call compile _dbloadouts;[b] //This what I understands removes one of each [ ] that returns from teh database[/b]
_dbloadouts = _dbloadouts select 0; [b]//This removes are from your script[/b]

_myValue = (_dbloadouts select 0) select 0; [b]// This Removes the rest of [[ ]] from the database with it returns[/b]
_myValue = _myValue select 0;[b] //No clue, tried without and with it[/b]
_myValue = _myValue call ISSE_str_StrToInt;[b] //This converts a string to int (Tried this and without it, gives pritty much the same)[/b]
Ammount = _myValue; [b]//This is a Variable Array (Example: Ammount = 5000; Works perfect[/b]

-Sincerely,

Staffan

Share this post


Link to post
Share on other sites

_dbloadouts = call compile _dbloadouts;

This actually converts the string to an array.

Since you have the value encapsulated in three arrays (I'm not sure why it's three, you may want to look into that...). You should be able to just use "select 0" down to the specific value. Perhaps you have one extra select in there?

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  

×