Jump to content
  • 0

Curious on 2 scripts


GhostTown

Question

I saw a few servers have this and was wondering how its done or is it just custom to there server?

Its like 4am for me so Im to tired to check through all the epoch files incase its already included.

 

Abandoned safes now opened after 10 days
Abandoned owned vehicles (locked) that haven't been used in 2 days are now auto unlocked

 

Sorry if this is in the wrong section.

Link to comment
Share on other sites

24 answers to this question

Recommended Posts

  • 0
UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 2 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 2 DAY) AND `CharacterID` > 0 AND `Classname` NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked','WoodShack_DZ','StorageShed_DZ','TentStorageDomed','TentStorageDomed2','TentStorage')  AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL
UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND `CharacterID` > 0 AND `Classname` NOT IN ('VaultStorage')  AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL
Link to comment
Share on other sites

  • 0

The second one needs a bit of tweaking...its to unlock Vaults, not used in 10 days....but the way it is it can 'catch' some vehicles as well...

I am not sure if setting CharacterID to 0 unlocks vaults....maybe also set the classname to VaultStorage ?!?

 

Anyways, a safer SQL would be:

UPDATE `object_data` SET `CharacterID` = 0
WHERE
`LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND
`Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND
`CharacterID` > 0 AND
`Classname` IN ('VaultStorageLocked') AND
`Inventory` <> '[]' AND
`Inventory` IS NOT NULL

This will make sure only Vaults are affected. But testing is required to see if vaults are actually unlocked ingame when setting CharacterID to 0

Link to comment
Share on other sites

  • 0

I understand that part.. But what I got confused on was NOT IN ('VaultStorage') ?

So how would that set it to 0 when he is using the NOT IN

 

VaultStorage locked are the ones you want. Thats why i did: `Classname` IN ('VaultStorageLocked')

 

Run this and see...it will bring all the locked vaults:

SELECT * FROM `object_data` 
WHERE
`LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND
`Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND
`CharacterID` > 0 AND
`Classname` IN ('VaultStorageLocked') AND
`Inventory` <> '[]' AND
`Inventory` IS NOT NULL
Link to comment
Share on other sites

  • 0

So these are functions correct?

Is there any way to turn them into events and have them run on there own?

 

Im still new to creating SQLs and stuff for the Database

 

Turning into an event it easy....I use PHPMyadmin to handle my database...

Just create a new event, select the time interval (once a day for example, starting from now (16:55:00 10/2/14) and then 'what' to execute, i copy paste the SQL function).

With other tools, i got no idea....google your tools' name and the word event :   Navicat event (for example)

Link to comment
Share on other sites

  • 0

If you want you can do this little trick in your fn_selfactions.sqf to notify players when the safe is an Abandoned safe:

	_ownerID = _cursorTarget getVariable ["CharacterID","0"]; // It should be further up in the .sqf file...but i added it here for reference
	if((typeOf(cursortarget) == "VaultStorageLocked") and _ownerID == "0000" and (player distance _cursorTarget < 2)) then {
	   cutText [format["Abandoned safe, code is 0000"], "PLAIN DOWN"];
	};

:P

Link to comment
Share on other sites

  • 0

If you have :

if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cursorTarget < _allowedDistance) and _canDo) then {	//Has some kind of target

Then add it right before the  } else { at the bottom of this if.

I got mine right above:

/ Allow Owner to lock and unlock vehicle

 

 

But i dont use mine to see vault safes...I use it to see Plot IDs, so i can find easily in the database who owns that plot pole...

//At the top of my fn_selfactions
_adminlist = call compile preProcessFileLineNumbers "superadmins.sqf";

// superadmin.sqf is in my root mission folder and has inside:
["xxxxxxx","xxxxxxx","xxxxxxx","xxxxxxx","xxxxxxx"]; // admin UIDs
.....
.....

    if((typeOf(cursortarget) == "Plastic_Pole_EP1_DZ") and _ownerID != "0" and (player distance _cursorTarget < 2)) then {
        if ((getPlayerUID player) in _adminlist) then {
            cutText [format["Plot Pole Owner PUID is: %1",_ownerID], "PLAIN DOWN"];
        };
    };
Link to comment
Share on other sites

  • 0

 

VaultStorage locked are the ones you want. Thats why i did: `Classname` IN ('VaultStorageLocked')

 

Run this and see...it will bring all the locked vaults:

SELECT * FROM `object_data` 
WHERE
`LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND
`Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND
`CharacterID` > 0 AND
`Classname` IN ('VaultStorageLocked') AND
`Inventory` <> '[]' AND
`Inventory` IS NOT NULL

I'm very interested in this, I've added this to my events in my SQL and set it to run once per day but i have not seen any safes change codes to 0... 

i wondering if I'm missing something.

Link to comment
Share on other sites

  • 0

OK. So i did not have the last updated column.... im a dumb ass lol

 

add it in by running

 

ALTER TABLE `Object_DATA`  ADD `LastUpdated` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `Datestamp`;

 

and use MR MGT's code

 

UPDATE `object_data` SET `CharacterID` = 0 WHERE `lastactive` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `CharacterID` > 0 AND `Classname` NOT IN ('VaultStorage') AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL

 

 

only thing i changed was the lastactive to LastUpdated

 

and then.. pure sexyness (if that's a word O.o ) in the sql data base

Link to comment
Share on other sites

  • 0

 

If you have :

if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cursorTarget < _allowedDistance) and _canDo) then {	//Has some kind of target

Then add it right before the  } else { at the bottom of this if.

I got mine right above:

/ Allow Owner to lock and unlock vehicle

 

 

But i dont use mine to see vault safes...I use it to see Plot IDs, so i can find easily in the database who owns that plot pole...

//At the top of my fn_selfactions
_adminlist = call compile preProcessFileLineNumbers "superadmins.sqf";

// superadmin.sqf is in my root mission folder and has inside:
["xxxxxxx","xxxxxxx","xxxxxxx","xxxxxxx","xxxxxxx"]; // admin UIDs
.....
.....

    if((typeOf(cursortarget) == "Plastic_Pole_EP1_DZ") and _ownerID != "0" and (player distance _cursorTarget < 2)) then {
        if ((getPlayerUID player) in _adminlist) then {
            cutText [format["Plot Pole Owner PUID is: %1",_ownerID], "PLAIN DOWN"];
        };
    };

Not to sound as a multinoob, (Which i am) How would i go about to add this wonderful piece of code? Looks really useful, when players try to scam admins into helping them with "their" base 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...