================================================================================
CS SERVER - PLUGINS INSTALLATION TUTORIAL
================================================================================

Complete installation guide for Authentication, Registration, and Skins System
Version: 2.0 | Last Updated: 2025

================================================================================
SYSTEM REQUIREMENTS
================================================================================

✓ AMX Mod X 1.8.3 or higher
✓ MySQL Database (PHP 7.0+)
✓ Web Server (Apache/Nginx with PHP)
✓ Counter-Strike 1.6 Server

================================================================================
STEP 1: DATABASE SETUP
================================================================================

1. Create MySQL database and import the schema:
   - Database name: (your_database_name)
   - Import SQL file: database_schema.sql
   - Verify tables are created:
     * counter_strike_users
     * counter_strike_admins
     * counter_strike_skins
     * counter_strike_user_skins
     * counter_strike_settings
     * counter_strike_plugins

2. Update database credentials in:
   📁 PE HOST/config.php
   - DB_HOST, DB_USER, DB_PASS, DB_NAME

================================================================================
STEP 2: SERVER INSTALLATION (CS Server)
================================================================================

1. Copy plugin files to server:
   📁 cstrike/addons/amxmodx/plugins/
   - cs_user_auth_motd.amxx
   - cs_shop_skins.amxx

2. Copy configuration files:
   📁 cstrike/addons/amxmodx/configs/
   - vip_skin_shop.cfg (configure your skins here)

3. Copy model files (if using custom skins):
   📁 cstrike/models/vip/custom/
   - v_*.mdl (view models)
   - p_*.mdl (player models)
   - w_*.mdl (world models)

4. Update plugins.ini:
   📁 cstrike/addons/amxmodx/configs/plugins.ini
   Add lines:
   cs_user_auth_motd.amxx
   cs_shop_skins.amxx

5. Restart server or change map to load plugins

================================================================================
STEP 3: WEB SERVER INSTALLATION
================================================================================

1. Upload all PHP files to web server:
   📁 PE HOST/ (or your web directory)
   - config.php (configure database)
   - util.php
   - motd_auth.php
   - shop_skins.php
   - get_user_skins.php
   - admin_add_skin.php
   - admin_register.php
   - admin_settings.php
   - (all other PHP files)

2. Set proper file permissions:
   - PHP files: 644
   - Directories: 755

3. Verify PHP extensions are enabled:
   - PDO
   - PDO_MySQL
   - Session support

================================================================================
STEP 4: CONFIGURATION
================================================================================

1. Configure Authentication Plugin:
   📁 cstrike/addons/amxmodx/scripting/cs_user_auth_motd.sma
   - Update: gHost, gPath, gPort (lines ~30-35)
   - Match your web server URL

2. Configure Skins Plugin:
   📁 cstrike/addons/amxmodx/scripting/cs_shop_skins.sma
   - Update: gHost, gPath, gPort (lines ~30-35)
   - Must match authentication plugin settings

3. Configure Skin Definitions:
   📁 cstrike/addons/amxmodx/configs/vip_skin_shop.cfg
   Format: weapon_key | skin_key | Display Name | v_model | p_model | w_model
   Example:
   m4a1 | musica | M4A1 Musica | models/vip/custom/v_m4a1_muzica.mdl | ...

================================================================================
STEP 5: TESTING
================================================================================

1. Test Authentication:
   - Connect to server
   - Register account via MOTD
   - Verify auto-login works
   - Check database for user entry

2. Test Skins System:
   - Purchase skin from shop (/shop command)
   - Verify skin appears in /skins menu
   - Apply skin and verify models load
   - Check skin persists after map change

3. Test Admin Panel:
   - Access admin_add_skin.php
   - Create admin account
   - Add test skin
   - Verify skin appears in shop

================================================================================
STEP 6: TROUBLESHOOTING
================================================================================

Common Issues:

❌ "User not found" errors:
   → Check database connection in config.php
   → Verify user exists in counter_strike_users table

❌ Skins not appearing:
   → Check vip_skin_shop.cfg format
   → Verify Display Name matches database exactly
   → Use /refreshskins command to reload

❌ HTTP 400 Bad Request:
   → Verify gHost, gPath, gPort in plugin
   → Check web server allows requests from CS server IP
   → Verify PHP files are accessible

❌ Models not loading:
   → Check model files exist in correct path
   → Verify file permissions (readable)
   → Check model paths in vip_skin_shop.cfg

================================================================================
COMMANDS REFERENCE
================================================================================

In-Game Commands:
  /shop          - Open skins shop (MOTD)
  /skins         - View your purchased skins
  /refreshskins  - Refresh skins from database
  /reloadskins   - Reload skins and open menu

Admin Commands:
  (Via admin panel web interface)

================================================================================
SUPPORT & UPDATES
================================================================================

For issues or updates, check:
- Server logs: cstrike/addons/amxmodx/logs/
- PHP error logs: (web server error log)
- Database connection: Test via admin panel

================================================================================
END OF TUTORIAL
================================================================================

