Jump to content
  • 0

SQL calls help CHILD:501


LunchboxCharlie

Question

How do I check via script, how to check to see if someone has something in the database?  This is a check to see if they have something and if so, don't give them another.
 
_key = format["CHILD:501:dayz_epoch.object_data:[""CharacterID""]:[[""CharacterID"",""="",""%1""]]:[0,8]:",_playerID];
_result = _key call server_hiveReadWrite;
diag_log format ["_result = %1, %2",_result, typeName _result];
 
I know I can do it via a 501 call... however, I need the script to give me the data of a row that matches two criteria. How do I go about that? IE:
 
Where classname = velkaGaraz and the current CharacterID that's being called. They only show an example of a single call. I wouldn't know how to approach via a 501 call, this is new territory for me.
 
 
However, this script doesn't even work. 
Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0

hi charlie,

i think i know what you are trying to do is a restriction for origins buildings, so that everyone can only build 1 level 1 house and only can build the level 2 house if he already has the level 1 house and so on...

there is another solution. i have saved the playerUID as characterID in the databse for the origins Buildings. when the server starts he creates arrays where those IDS are saved and publishes these arrays as public variables.

if the player now builds a house the first check is if his playeruid is already in the buildingarray ....

like this (at least thats how i did it):

Server_Monitor.sqf: these arrays get created when the server starts!

//Define arrays
owner_B1 = [];
owner_B2 = [];
owner_B3 = [];
owner_H1 = [];
owner_H2 = [];
owner_H3 = [];
owner_SG = [];
//switch spawned objects
		switch(_type) do {
			case "Uroven1DrevenaBudka" 	: { owner_B1 set [count owner_B1, _ownerID]; };
			case "Uroven2KladaDomek" 	: { owner_B2 set [count owner_B2, _ownerID]; };
			case "Uroven3DrevenyDomek" 	: { owner_B3 set [count owner_B3, _ownerID]; };
			case "Uroven1VelkaBudka" 	: { owner_H1 set [count owner_H1, _ownerID]; };
			case "Uroven2MalyDomek" 	: { owner_H2 set [count owner_H2, _ownerID]; };
			case "Uroven3VelkyDomek" 	: { owner_H3 set [count owner_H3, _ownerID]; };
			case "malaGaraz" 			: { owner_SG set [count owner_SG, _ownerID]; };
		};
//publish publicVariables
	publicVariable "owner_B1";
	publicVariable "owner_B2";
	publicVariable "owner_B3";
	publicVariable "owner_H1";
	publicVariable "owner_H2";
	publicVariable "owner_H3";
	publicVariable "owner_SG";
	diag_log (format["HOUSE SERVER: Owners Are: B1 %1 B2 %2 B3 %3 H1 %4 H2 %5 H3 %6 SG %7", owner_B1, owner_B2, owner_B3, owner_H1, owner_H2, owner_H3, owner_SG]);

when the player now builds the building you do the check like: (in the player_build.sqf)

if(getplayerUID player in owner_H1) exitwith { cutText["You already build your Hero Level 1 House!","PLAIN DOWN"];};
//also if he is able to build the house he will need to add his playeruid into the array like this, otherwise he would be able to build as many houses as he likes until the next restart!
		owner_H1 set [count owner_H1, _charID];
		publicVariable "owner_H1";

Link to comment
Share on other sites

  • 0

 

hi charlie,

i think i know what you are trying to do is a restriction for origins buildings, so that everyone can only build 1 level 1 house and only can build the level 2 house if he already has the level 1 house and so on...

there is another solution. i have saved the playerUID as characterID in the databse for the origins Buildings. when the server starts he creates arrays where those IDS are saved and publishes these arrays as public variables.

if the player now builds a house the first check is if his playeruid is already in the buildingarray ....

like this (at least thats how i did it):

Server_Monitor.sqf: these arrays get created when the server starts!

//Define arrays
owner_B1 = [];
owner_B2 = [];
owner_B3 = [];
owner_H1 = [];
owner_H2 = [];
owner_H3 = [];
owner_SG = [];
//switch spawned objects
		switch(_type) do {
			case "Uroven1DrevenaBudka" 	: { owner_B1 set [count owner_B1, _ownerID]; };
			case "Uroven2KladaDomek" 	: { owner_B2 set [count owner_B2, _ownerID]; };
			case "Uroven3DrevenyDomek" 	: { owner_B3 set [count owner_B3, _ownerID]; };
			case "Uroven1VelkaBudka" 	: { owner_H1 set [count owner_H1, _ownerID]; };
			case "Uroven2MalyDomek" 	: { owner_H2 set [count owner_H2, _ownerID]; };
			case "Uroven3VelkyDomek" 	: { owner_H3 set [count owner_H3, _ownerID]; };
			case "malaGaraz" 			: { owner_SG set [count owner_SG, _ownerID]; };
		};
//publish publicVariables
	publicVariable "owner_B1";
	publicVariable "owner_B2";
	publicVariable "owner_B3";
	publicVariable "owner_H1";
	publicVariable "owner_H2";
	publicVariable "owner_H3";
	publicVariable "owner_SG";
	diag_log (format["HOUSE SERVER: Owners Are: B1 %1 B2 %2 B3 %3 H1 %4 H2 %5 H3 %6 SG %7", owner_B1, owner_B2, owner_B3, owner_H1, owner_H2, owner_H3, owner_SG]);

when the player now builds the building you do the check like: (in the player_build.sqf)

if(getplayerUID player in owner_H1) exitwith { cutText["You already build your Hero Level 1 House!","PLAIN DOWN"];};
//also if he is able to build the house he will need to add his playeruid into the array like this, otherwise he would be able to build as many houses as he likes until the next restart!
		owner_H1 set [count owner_H1, _charID];
		publicVariable "owner_H1";

 

I think... I think I love you. 

Link to comment
Share on other sites

  • 0

well i put a lot of time into getting this stuff to work in epoch ^^, im interested in the keypad method for the houses though ^^, my houses are soley opened by a playerUID check something like

if(playerUID player == _characterIDHouse) then { player addaction ["OpenHouse",openhouse.sqf];};

have you solved the saving gear for the houses problem already?

if you show me what you have i might be able to help...

Link to comment
Share on other sites

  • 0

well that one is easy. There is one building integrated action called Close Garage which actually only closes the front doors without the gate, the second close garage action is the one we added to the building to close both, front doors and gate. So if you simply rename the self added action to something like Close Small Garage there wont be 2 same named actions anymore...

Link to comment
Share on other sites

  • 0

Epic stuff:

I borrowed someone's house building script that I plan on giving credit for. I feel bad but it saved me so much time, lol
[14:15:23] waTTe.: show me
[14:15:30] waTTe.: i bet he stole it from me
[14:15:31] waTTe.: xD
[14:15:34] *** LunchboxCharlie send originsbuild.sqf ***
[14:15:47] LunchboxCharlie: We got it from banditparty
[14:15:49] waTTe.: jepp thats my code

 

salute the internet xD

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

×
×
  • Create New...