INSERT INTO `bans` (
`type`,
`value`,
`expires`,
`added`,
`admin_id`,
`comment`
) SELECT
3 AS `type`,
`accounts`.`id` AS `value`,
UNIX_TIMESTAMP(DATE_ADD(CURDATE(), INTERVAL 24 HOUR)) AS `expires`,
UNIX_TIMESTAMP(CURDATE()) AS `added`,
933 AS `admin_id`,
'Temporary ban on all accounts.' AS `comment`
FROM `accounts`;
It is to ban all old accounts for 1 day, and only to release new accounts, for a function that cannot raise the highest levels in the game.Possible with an SQL query.
... But, why?
You should be able to do /closeserver if you want to lock everyone from the game while testing stuff on your GM etc.
hi, my schema is:What is your SQL schema for accounts table and bans table?
id | name | password | premdays | lastday | key | blocked internal usage | warnings | group_id | page_lastday | email_new | email_new_time | created | rlname | location | page_access | email_code | next_email | premium_points | vote | last_post | flag | viptime | vip_time | vipdays | salt |
---|
id | type 1 - ip banishment, 2 - namelock, 3 - account banis… | value ip address (integer), player guid or account numbe… | param used only for ip banishment mask (integer) | active | expires | added | admin_id | comment |
---|
INSERT INTO `bans` (
`type`,
`value`,
`expires`,
`added`,
`admin_id`,
`comment`
) SELECT
3 AS `type`,
`accounts`.`id` AS `value`,
UNIX_TIMESTAMP(DATE_ADD(CURDATE(), INTERVAL 24 HOUR)) AS `expires`,
UNIX_TIMESTAMP(CURDATE()) AS `added`,
933 AS `admin_id`,
'Temporary ban on all accounts.' AS `comment`
FROM `accounts`;
Thanks! worked perfectlyI advice you to always take database backups before attempting to run untested SQL queries.
SQL:INSERT INTO [ICODE]bans[/ICODE] ( [ICODE]type[/ICODE], [ICODE]value[/ICODE], [ICODE]expires[/ICODE], [ICODE]added[/ICODE], [ICODE]admin_id[/ICODE], [ICODE]comment[/ICODE] ) SELECT 3 AS [ICODE]type[/ICODE], [ICODE]accounts[/ICODE].[ICODE]id[/ICODE] AS [ICODE]value[/ICODE], UNIX_TIMESTAMP(DATE_ADD(CURDATE(), INTERVAL 24 HOUR)) AS [ICODE]expires[/ICODE], UNIX_TIMESTAMP(CURDATE()) AS [ICODE]added[/ICODE], 933 AS [ICODE]admin_id[/ICODE], 'Temporary ban on all accounts.' AS [ICODE]comment[/ICODE] FROM [ICODE]accounts[/ICODE];
This should ban all accounts on your server for 24 hours after you execute the command.
Otland code tags is a bit buggy atm, here is a pastebin for not obscured code: ... Ban all accounts for a day :) https://otland.net/threads/ban-all-account-query.265699/#post-2568153 (https://gist.github.com/Znote/2c852bf8ba700b58688b915f37684c1d)
The script presumes that GM player id is 933. I took the value from your first screenshot sample.