Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies and more


(Tutorial/How to) Useful MySQL Events for Epoch Servers


Bilco

Recommended Posts

I have some Events that I have found on various websites that I use and would like to share with the community. Some of these may come standard with Epoch but I have adjusted some to suit my needs for my server.

 

Event Settings (you can modify an existing event or create a new one and disable the old within phpMyAdmin -> Events page)

 

Event name: updateStockDaily

 

Status: Enabled

 

Event type: Recurring

 

Execute every: 1 day

 

Start: "The date will auto populate when creating, no need to input anything"

 

End: "Leave this blank if you are running a recurring event, no need to input anything"

 

Definition: 

UPDATE `traders_data` SET qty=9999 WHERE qty<9999 AND afile<>'trade_any_vehicle' AND afile<>'trade_any_boat'

On completion preserve: You'll see a check box, can be left unchecked.

 

Definer: "The definer will auto populate when creating, no need to input anything"

 

Comment: Updates out of stock vendors "This can also be left blank"

 

The rest of my events, without all the lingo. You can run them every couple hours or every day:

UnlockNonKeyVehicles

UPDATE
            `Object_DATA`
        SET
            `Object_DATA`.`CharacterID` = 0
        WHERE
            `Object_DATA`.`CharacterID` <> 0
            AND `Object_DATA`.`CharacterID` <= 12500
            AND `Object_DATA`.`Classname` NOT LIKE 'Tent%'
            AND `Object_DATA`.`Classname` NOT LIKE '%Locked'
            AND `Object_DATA`.`Classname` NOT LIKE 'Land%'
            AND `Object_DATA`.`Classname` NOT LIKE 'Cinder%'
            AND `Object_DATA`.`Classname` NOT LIKE 'Wood%'
            AND `Object_DATA`.`Classname` NOT LIKE 'Metal%'
            AND `Object_DATA`.`Classname` NOT LIKE '%Storage%'
            AND `Object_DATA`.`Classname` NOT IN ('OutHouse_DZ', 'GunRack_DZ', 'WorkBench_DZ', 'Sandbag1_DZ', 'FireBarrel_DZ', 'DesertCamoNet_DZ', 'StickFence_DZ', 'LightPole_DZ', 'DeerStand_DZ', 'ForestLargeCamoNet_DZ', 'Plastic_Pole_EP1_DZ', 'Hedgehog_DZ', 'FuelPump_DZ', 'Fort_RazorWire', 'SandNest_DZ', 'ForestCamoNet_DZ', 'Fence_corrugated_DZ', 'CanvasHut_DZ', 'Generator_DZ')
            AND FindVehicleKeysCount(Object_DATA.CharacterID) = 0

setDamageOnAge

UPDATE `object_data` SET `Damage`=0.1 WHERE `ObjectUID` <> 0 AND `CharacterID` <> 0 AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY) AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') )

This sets damage on a wall so that it can be maintained

resetVaults

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

removeObjectEmpty

DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 24 DAY) AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') OR (`Inventory` = '[[[],[]],[[],[]],[[],[]]]') )

Removes abandoned storage objects and vehicles

removeDamagedVehicles
2 hour

DELETE FROM `object_data` WHERE Damage > '0.6'

Removes damaged vehicles

CleanupVaults
2 hour

DELETE FROM `Object_DATA` WHERE Classname='VaultStorageLocked' AND inventory='[]' AND Datestamp < NOW() - INTERVAL 10 DAY

cleans old empty vaults

CleanupOldLogins

DELETE FROM Player_LOGIN WHERE Datestamp < NOW() - INTERVAL 10 DAY

cleans old logins

CleanupOldCharacters
2 hour

DELETE FROM Character_DATA WHERE LastLogin < NOW() - INTERVAL 10 DAY

cleans old characters

CleanupDeadCharacters
2 hour

DELETE FROM Character_DATA WHERE Alive=0 AND LastLogin < NOW() - INTERVAL 1 DAY

cleans dead

 

If you still don't understand how to implement an event and need help, post here and I will try and help out.

Share this post


Link to post
Share on other sites

I forgot to mention that the update stock daily event is only used for the non mission traders. This means that if your traders are configured in your mission pbo because you're using the coin system, that specific event is useless as it only updates the traders in the mysql.

Share this post


Link to post
Share on other sites

  • 1 year later...

I forgot to mention that the update stock daily event is only used for the non mission traders. This means that if your traders are configured in your mission pbo because you're using the coin system, that specific event is useless as it only updates the traders in the mysql.

I thought all Trader inventory is (updated) unlimited replenishment for all Epoch and Non EPOCH versions? ) i.e. overpoch,origins.

I also, know that just simply adding the CFG into the mission pbo for EPOCH ONLY, and changing the server_traders call from the init.sqf overrides the use of the database for inventory.

 

I like your setup it's very organized though. good stuff.

 

Thanks for the information

Share this post


Link to post
Share on other sites

  • 6 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...