• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help me for creating a friendly robbing system
#1
Hello community,
I’m currently developing a small, beginner-friendly bank robbery system for my open.mp gamemode and would like technical guidance on designing it properly, especially with MySQL integration and clean server-side logic.

📘 Requirements I Want to Implement
1. Robbery Requirements
Before a robbery can begin, the player must meet these conditions:
  • Must be inside the bank interior (interior ID check + area check)
  • Must possess a weapon
  • Must have a “mask” item (boolean check or inventory table)
  • Must have a valid getaway vehicle outside the bank (vehicle must be owned or rented — not strict)
  • No police nearby (optional future addition)

2. Robbery Flow
Technical flow I want to build:
  1. Player enters robbery checkpoint
  2. Script checks:
    • Player has mask
    • Player has weapon
    • Player is not wanted already
    • Bank is not in cooldown
  3. Robbery starts:
    • Set
      IsRobbing[playerid] = true
    • Create a timer (20–30 seconds)
    • Freeze player or play animation
  4. If timer completes:
    • Give reward
    • Write robbery log into MySQL
    • Add wanted level
    • Set global cooldown
  5. If player:
    • Leaves interior
    • Dies
    • Disconnects
    • Cancels robbery
      → robbery fails, timer stops, and MySQL logs failure.

3. MySQL Integration Needed
I want to store robbery activity in a table such as:

CREATE TABLE robberies (
    id INT AUTO_INCREMENT PRIMARY KEY,
    player_id INT NOT NULL,
    status ENUM('SUCCESS','FAILED') NOT NULL,
    amount INT DEFAULT 0,
    timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Usage:
  • When robbery starts → optional insert “STARTED”
  • When completed → insert “SUCCESS”
  • When failed → insert “FAILED”
I am using BlueG’s MySQL R41-4.

4. Variables & Suggested Structure
I am planning to use:

new bool:IsRobbing[MAX_PLAYERS];
new RobberyTimer[MAX_PLAYERS];
new RobberyCooldown;

I need suggestions:
  • Best way to handle cooldown storage (global variable vs MySQL field)
  • Whether robbery interior should use a dynamic area instead of a simple CP
  • Whether I should use
    SetTimerEx
    or y_timers from YSI
  • Best practice for structuring robbery logic (separate module vs callbacks)

5. What I am Requesting
I am looking for:
✔ Clean structural guidance
✔ A simple example showing the robbery logic
✔ Recommended approach for failure detection
✔ Suggested way to integrate the MySQL logging
✔ Advice on keeping the system beginner-friendly but scalable
This is my first robbery system, so I want to design it correctly from the beginning instead of patching it later.
  Reply


Forum Jump: