Jump to content
Sign in to follow this  
Naiss

inidb problem

Recommended Posts

okay so im trying to make an variable called Cash save over restart and shit with inidb and this is what im trying to do

[GetPlayerUID player,"RPP_Cash",Cash, "SCALAR"] call inidb_read; //this one is reading the Cash var but it wont read it and set it to what i had before the restart happend :(


[GetPlayerUID player,"RPP_Cash", "Cash", Cash] call iniDB_write; //this is what i use for writing it to the db stuff, and this one works just fine

Share this post


Link to post
Share on other sites
okay so im trying to make an variable called Cash save over restart and shit with inidb and this is what im trying to do

[GetPlayerUID player,"RPP_Cash",Cash, "SCALAR"] call inidb_read; //this one is reading the Cash var but it wont read it and set it to what i had before the restart happend :(


[GetPlayerUID player,"RPP_Cash", "Cash", Cash] call iniDB_write; //this is what i use for writing it to the db stuff, and this one works just fine

So.. something like this?

_player = getAssignedCuratorUnit _x;
		if (_x == _player) then {} else {
			_name = name _x;
			_name_money = _name + "_money";
			_pub_name_money = str (_name_money); 
			_Profile = format["%1", getPlayerUID _x]; 
			_name_UID = _name + "_" + _Profile;
			_money = missionNamespace getVariable _pub_name_money;
			_exist = _name_UID call iniDB_exists;
			if (isNil {_money}) then {
				if (_exist) then { _money = [_name_UID, _Profile, "Money", "SCALAR"] call iniDB_read;} else {
					_money = 100;
				};
				[_name_UID, _Profile, "Name", _name] call iniDB_write;
				[_name_UID, _Profile, "Money", _money] call iniDB_write;
				_clientID = owner _x;
				missionNamespace setVariable [_pub_name_money, _money];
				_clientID publicVariableClient format ["%1", _pub_name_money];
			} else {
				if (_money > 999999) then {
					_offence = "Money over 1 Million";
					["Report", _Profile, "Name", _name] call iniDB_write;
					["Report", _Profile, "Different_Money", _money] call iniDB_write;
					["Report", _Profile, "Offence", _offence] call iniDB_write;
				};
				[_name_UID, _Profile, "Name", _name] call iniDB_write;
				[_name_UID, _Profile, "Money", _money] call iniDB_write;
				missionNamespace setVariable [_pub_name_money, _money];
				_clientID = owner _x;
				_clientID publicVariableClient format ["%1", _pub_name_money];
				if (isNil {adminOnline}) then {adminOnline = false;};
				if (isNil {admin1Online}) then {admin1Online = false;};
				if (isNil {admin2Online}) then {admin2Online = false;};
				if (adminOnline) then { missionNamespace setVariable [_pub_name_money, _money]; AdminID publicVariableClient format ["%1", _pub_name_money];} else {adminOnline = false;};
				if (admin1Online) then { missionNamespace setVariable [_pub_name_money, _money]; AdminID1 publicVariableClient format ["%1", _pub_name_money];} else {adminOnline1 = false;};
				if (admin2Online) then { missionNamespace setVariable [_pub_name_money, _money]; AdminID2 publicVariableClient format ["%1", _pub_name_money];} else {adminOnline2 = false;};
			};
		};
	}forEach playableUnits;
};
};

Your much better off with mysql its alot easier to work with..

or use our prebuilt system.. http://www.armaholic.com/page.php?id=27734 its not updated practically but yeah... it works see if you can detangle our mess of hell

Share this post


Link to post
Share on other sites

i don't know how the mysql coding works for arma 3 :P if i knew how it work i would have used that

---------- Post added at 13:56 ---------- Previous post was at 13:53 ----------

and if you can please explain how this code really works, i just started working with inidb :P

Share this post


Link to post
Share on other sites

Its been forever man, I just pulled some of the code from like our year old mission that was part of the money

---------- Post added at 10:15 ---------- Previous post was at 10:08 ----------

I could probably paste the mysql code here its easy to work with in my opinion I believe

Share this post


Link to post
Share on other sites

well if you can that would be greate :)

---------- Post added at 16:55 ---------- Previous post was at 15:27 ----------

okay so the only problem im having right now is that when a player connect back to the game after restart or what ever it wont load the stats from the db (inidbi) all i need to get working now is the data return

Share this post


Link to post
Share on other sites
Look this example: http://forums.bistudio.com/showthrea...=1#post2757861 (keep in mind that there is iniDBI not iniDB!).

srry but that did not help me :(

here is what im trying to do correct me please if something is wrong

Read stats:

private ["_name","_Profile","_name_UID"];
_name = name player;
_Profile = format["%1", getPlayerUID player];
_name_UID = _name + "_" + _Profile;
_exist = _name_UID call iniDB_exists;
systemChat "Checking if you got an account...";
if (_exist) then {
	[_name_UID,_Profile,Cash, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Bank, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Admin_lvl, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,CopLevel, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Mining_Skill, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Vehicle_Skill, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Fishing_Skill, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Crafting_Skill, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Gathering_Skill, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Vehicle_Storage, "ARRAY"] call inidb_read;
	[_name_UID,_Profile,RPP_PlayerInventory, "ARRAY"] call inidb_read;
	[_name_UID,_Profile,RPP_License, "ARRAY"] call inidb_read;
	[_name_UID,_Profile,Saving_PD_Gear, "ARRAY"] call inidb_read;
	[_name_UID,_Profile,Company_Workerslist, "ARRAY"] call inidb_read;
	[_name_UID,_Profile,Company_Applyed, "ARRAY"] call inidb_read;
	[_name_UID,_Profile,Company_Bank, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Company_Storage, "ARRAY"] call inidb_read;
	[_name_UID,_Profile,Company_CraftList, "ARRAY"] call inidb_read;
	[_name_UID,_Profile,Company_Info, "ARRAY"] call inidb_read;
	[_name_UID,_Profile,Company_Owning, "STRING"] call inidb_read;
	[_name_UID,_Profile,Company_Workers, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Company_MaxWorkers, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Company_WorkingFor, "ARRAY"] call inidb_read;
	[_name_UID,_Profile,RPP_Username, "STRING"] call inidb_read;
	[_name_UID,_Profile,RPP_Password, "STRING"] call iniDB_read;
	[_name_UID,_Profile,RPP_NewPlayer, "STRING"] call inidb_read;
	[_name_UID,_Profile,RPP_PlayerLevel, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,RPP_PlayerStatus, "STRING"] call inidb_read;
	[_name_UID,_Profile,JailTime_H, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,JailTime_M, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,JailTime_S, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Hunger, "SCALAR"] call inidb_read;
	[_name_UID,_Profile,Thirst, "SCALAR"] call inidb_read;
	systemChat "Account found";
} else {
	[_name_UID,_Profile, "Cash", Cash] call iniDB_write;
	[_name_UID,_Profile, "Bank", Bank] call iniDB_write;
	[_name_UID,_Profile, "Admin_lvl", Admin_lvl] call iniDB_write;
	[_name_UID,_Profile, "CopLevel", CopLevel] call iniDB_write;
	[_name_UID,_Profile, "Mining_Skill", Mining_Skill] call iniDB_write;
	[_name_UID,_Profile, "Vehicle_Skill", Vehicle_Skill] call iniDB_write;
	[_name_UID,_Profile, "Fishing_Skill", Fishing_Skill] call iniDB_write;
	[_name_UID,_Profile, "Crafting_Skill", Crafting_Skill] call iniDB_write;
	[_name_UID,_Profile, "Vehicle_Storage", Vehicle_Storage] call iniDB_write;
	[_name_UID,_Profile, "RPP_PlayerInventory", RPP_PlayerInventory] call iniDB_write;
	[_name_UID,_Profile, "RPP_License", RPP_License] call iniDB_write;
	[_name_UID,_Profile, "Saving_PD_Gear", Saving_PD_Gear] call iniDB_write;
	[_name_UID,_Profile, "Company_Workerslist", Company_Workerslist] call iniDB_write;
	[_name_UID,_Profile, "Company_Applyed", Company_Applyed] call iniDB_write;
	[_name_UID,_Profile, "Company_Bank", Company_Bank] call iniDB_write;
	[_name_UID,_Profile, "Company_Storage", Company_Storage] call iniDB_write;
	[_name_UID,_Profile, "Company_CraftList", Company_CraftList] call iniDB_write;
	[_name_UID,_Profile, "Company_Info", Company_Info] call iniDB_write;
	[_name_UID,_Profile, "Company_Owning", Company_Owning] call iniDB_write;
	[_name_UID,_Profile, "Company_Workers", Company_Workers] call iniDB_write;
	[_name_UID,_Profile, "Company_MaxWorkers", Company_MaxWorkers] call iniDB_write;
	[_name_UID,_Profile, "Company_WorkingFor", Company_WorkingFor] call iniDB_write;
	[_name_UID,_Profile, "RPP_Username", RPP_Username] call iniDB_write;
	[_name_UID,_Profile, "RPP_Password", RPP_Password] call iniDB_write;
	[_name_UID,_Profile, "RPP_NewPlayer", RPP_NewPlayer] call iniDB_write;
	[_name_UID,_Profile, "RPP_PlayerLevel", RPP_PlayerLevel] call iniDB_write;
	[_name_UID,_Profile, "RPP_PlayerStatus", RPP_PlayerStatus] call iniDB_write;
	[_name_UID,_Profile, "JailTime_H", JailTime_H] call iniDB_write;
	[_name_UID,_Profile, "JailTime_M", JailTime_M] call iniDB_write;
	[_name_UID,_Profile, "JailTime_S", JailTime_S] call iniDB_write;
	[_name_UID,_Profile, "Hunger", Hunger] call iniDB_write;
	[_name_UID,_Profile, "Thirst", Thirst] call iniDB_write;
	systemChat "New user added to the RP Project Database";
};
RPP_inidb_read = true;

Save:

private ["_name","_Profile","_name_UID"];
_name = name player;
_Profile = format["%1", getPlayerUID player];
_name_UID = _name + "_" + _Profile;
RPP_inidb_read = false;
[] call RPP_StatSaver_Read;
waitUntil {RPP_inidb_read};
[_name_UID,_Profile, "Cash", Cash] call iniDB_write;
[_name_UID,_Profile, "Bank", Bank] call iniDB_write;
[_name_UID,_Profile, "Admin_lvl", Admin_lvl] call iniDB_write;
[_name_UID,_Profile, "CopLevel", CopLevel] call iniDB_write;
[_name_UID,_Profile, "Mining_Skill", Mining_Skill] call iniDB_write;
[_name_UID,_Profile, "Vehicle_Skill", Vehicle_Skill] call iniDB_write;
[_name_UID,_Profile, "Fishing_Skill", Fishing_Skill] call iniDB_write;
[_name_UID,_Profile, "Crafting_Skill", Crafting_Skill] call iniDB_write;
[_name_UID,_Profile, "Vehicle_Storage", Vehicle_Storage] call iniDB_write;
[_name_UID,_Profile, "RPP_PlayerInventory", RPP_PlayerInventory] call iniDB_write;
[_name_UID,_Profile, "RPP_License", RPP_License] call iniDB_write;
[_name_UID,_Profile, "Saving_PD_Gear", Saving_PD_Gear] call iniDB_write;
[_name_UID,_Profile, "Company_Workerslist", Company_Workerslist] call iniDB_write;
[_name_UID,_Profile, "Company_Applyed", Company_Applyed] call iniDB_write;
[_name_UID,_Profile, "Company_Bank", Company_Bank] call iniDB_write;
[_name_UID,_Profile, "Company_Storage", Company_Storage] call iniDB_write;
[_name_UID,_Profile, "Company_CraftList", Company_CraftList] call iniDB_write;
[_name_UID,_Profile, "Company_Info", Company_Info] call iniDB_write;
[_name_UID,_Profile, "Company_Owning", Company_Owning] call iniDB_write;
[_name_UID,_Profile, "Company_Workers", Company_Workers] call iniDB_write;
[_name_UID,_Profile, "Company_MaxWorkers", Company_MaxWorkers] call iniDB_write;
[_name_UID,_Profile, "Company_WorkingFor", Company_WorkingFor] call iniDB_write;
[_name_UID,_Profile, "RPP_Username", RPP_Username] call iniDB_write;
[_name_UID,_Profile, "RPP_Password", RPP_Password] call iniDB_write;
[_name_UID,_Profile, "RPP_NewPlayer", RPP_NewPlayer] call iniDB_write;
[_name_UID,_Profile, "RPP_PlayerLevel", RPP_PlayerLevel] call iniDB_write;
[_name_UID,_Profile, "RPP_PlayerStatus", RPP_PlayerStatus] call iniDB_write;
[_name_UID,_Profile, "JailTime_H", JailTime_H] call iniDB_write;
[_name_UID,_Profile, "JailTime_M", JailTime_M] call iniDB_write;
[_name_UID,_Profile, "JailTime_S", JailTime_S] call iniDB_write;
[_name_UID,_Profile, "Hunger", Hunger] call iniDB_write;
[_name_UID,_Profile, "Thirst", Thirst] call iniDB_write;

Share this post


Link to post
Share on other sites

Is this code intended for multiplayer game? If so, iniDB is server-side database extension, not player-side. So you need to send request to server, server needs to retrieve data from database and send them to player.

Also iniDB_read returns variable value and its third parameter is variable name, so you need to use quotes:

Cash = [_name_UID, _Profile, "Cash", "SCALAR"] call inidb_read;

Edited by Schatten

Share this post


Link to post
Share on other sites

haha ye thats right, im trying to load via the client LOL, i feel so stupid right now xD thanks this explain it all now

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  

×