Installation

Installation of Red Multichar AIO

1

Download the script

  1. Download the codemred-multicharacter resource from your keymaster

  2. Extract the folder to your server's resources directory.

  3. Do NOT rename the folder - it must stay as codemred-multicharacter

2

Add to server config

Open your server.cfg file and add:

ensure oxmysql
ensure vorp_core
ensure vorp_menu
ensure codemred-multicharacter
3

Database setup

Basic Character Tables

The basic character tables are created automatically by VORP Core. However, you need to add additional columns for the playtime feature.

PlayTime Feature

The playtime feature tracks how long each character has been played and when they last logged in.

Step 1: Run SQL Commands

Open your database management tool (phpMyAdmin, HeidiSQL, etc.) and run the following SQL commands:

-- Add playtime column to characters table
ALTER TABLE `characters` 
ADD COLUMN `playtime` INT(11) DEFAULT 0 
COMMENT 'Total playtime in seconds';

-- Add last_login column to track when character was last played
ALTER TABLE `characters` 
ADD COLUMN `last_login` TIMESTAMP NULL DEFAULT NULL 
COMMENT 'Last time character was played';

-- Add index for better performance on playtime queries
CREATE INDEX `idx_characters_playtime` ON `characters` (`playtime`);

-- Add index for last_login queries
CREATE INDEX `idx_characters_last_login` ON `characters` (`last_login`);

-- Update existing characters to have 0 playtime if they don't have it set
UPDATE `characters` SET `playtime` = 0 WHERE `playtime` IS NULL;

Verify Installation

After running the SQL commands, verify that the new columns exist:

DESCRIBE characters;

You should see playtime and last_login columns in the result.

What Does PlayTime Track?

  • playtime: Total time the character has been played (in seconds)

    • Updated every time the player disconnects

    • Can be used for statistics, leaderboards, or rewards

  • last_login: Timestamp of when the character was last played

    • Updated when the player selects the character

    • Useful for inactive character cleanup or welcome messages

Example Usage

You can query playtime data like this:

-- Get top 10 characters by playtime
SELECT firstname, lastname, playtime/3600 as hours_played 
FROM characters 
ORDER BY playtime DESC 
LIMIT 10;

-- Get characters that haven't logged in for 30 days
SELECT firstname, lastname, last_login 
FROM characters 
WHERE last_login < DATE_SUB(NOW(), INTERVAL 30 DAY);

Last updated