Coder Social home page Coder Social logo

athenavehicledealership's Introduction

AthenaVehicleDealerShip

image image

SETUP

This is a server & clientside plugin. So you will have to take care of both imports by yourself.

  • Drag Serverside Content (vehicledealer/index) into /src/core/plugins
  • Drag Clientside Content (vehicledealer/index) into /src/core/client-plugins

Serverside Imports:

'./vehicledealer/index',

Clientside Imports:

import './vehicledealer/index';

FEATURES

  • Non Hologram Vehicle Dealer
  • Vehicles are freezed & undestroyable
  • /vehpos Command to get correct vehicle positions
  • Players can Interact with Vehicles which will open an inputmenu to buy the vehicle which they are before.
  • Nice sweet Textlabels
  • Based on Athenas Interaction Controller
  • Using Athena's Dealership Purchase Function so vehicles will be spawned on the garage

ATHENA CONFIGURATION

  • If you skip that part created vehicles will have lock icons and stuff about them and you may encounter some weird stuff. You'll have to search yourself for the correct lines.

src/core/server/extensions/vehicleFuncs.ts

// Used to skip keys for a vehicle.
// Used for checking ownership while ignoring keys.
if (vehicle.behavior == Vehicle_Behavior.NO_SAVE) return false;

src/core/client/systems/interaction.ts

if (vehicle.getStreamSyncedMeta(VEHICLE_STATE.OWNER) != "dealership") {
  if (isVehicleLocked) 
  {
    drawTexture('mpsafecracking', 'lock_closed', newPosition, 1);
  } else {
    drawTexture('mpsafecracking', 'lock_open', newPosition, 1);
  }
}

// Press 'X' to lock vehicle      
if (vehicle.getStreamSyncedMeta(VEHICLE_STATE.OWNER) != "dealership") {
  const lockText = LocaleController.get(LOCALE_KEYS.VEHICLE_TOGGLE_LOCK);
  interactText = InteractionController.appendText(interactText, KEY_BINDS.VEHICLE_LOCK, lockText);
}

SERVERSIDE-CONFIGURATION

// Setup for spawned vehicle Dealer Cars
const dealerCarPrimaryColor = new alt.RGBA(255, 255, 255, 255);
const dealerCarSecondaryColor = new alt.RGBA(255, 255, 255, 255);
const dealerCarPlateText = 'DEALER';

// Textlabel Setup
const textLabelDistance = 3.5;

// InteractionController Setup
const interactionRange = 0.8;
const interactionDescription = "Buy Vehicle";

// Blip Setup
const blipSprite = 663;
const blipColor = 2;
const blipPositions = [
    { "x": -50.05485534667969, "y": -1110.887451171875, "z": 26.4357967376709 }, // Index 0
    { "x": -579.6703491210938, "y": 323.5991516113281, "z": 84.7758560180664 } // Index 1 and so on.....
];

const blipNames = [
    "VehicleDealer-1", // Blip for Index 0 of Blip Positions
    "Lords-Vehicledealership" // Blip for Index 1 of Blip Positions and so on.
];
// Keep Orders Pos, Rot, VehicleModel for example:
// Dont mix them
/* 
    vehiclePositons:
    { SultanRS Pos }

    vehicleRotations: 
    { SultanRS Rot }

    vehiclesToSell:
    "sultanRS"

*/
const vehiclePositions = [
    // Dealer 1 Positions ...
    { x: -61.8989, y: -1117.5297, z: 25.7920 }, // SultanRS Position
    { x: -59.0901, y: -1117.3319, z: 25.7245 }, // Emerus Position
    { x: -56.2934, y: -1117.4456, z: 26.0101 }, // Zentorno Position
    { x: -53.5368, y: -1117.5863, z: 26.0094 }, // T20 Position
    { x: -50.6375, y: -1117.5499, z: 25.9621 }, // Reaper Position
    { x: -47.7709, y: -1116.7627, z: 25.6915 }, // Tyrant Position
    { x: -44.9958, y: -1116.9357, z: 25.9978 }, // Comet2 Position
    { x: -42.3344, y: -1116.9359, z: 25.6663 }, // Jester Position

    // Dealer 2 Positions ...
    { x: -587.3350, y: 315.3230, z: 84.6508 },

    // Dealer 3 Positions ...
    // < - >

    // And so on.
];

const vehicleRotations = [
    { x: 0.0007, y: 0.0007, z: 0.0449 }, // SultanRS Rotation
    { x: 0.0007, y: 0.0007, z: 0.0269 }, // Emerus Rotation
    { x: 0.0001, y: -0.0006, z: 0.0315 }, // Zentorno Rotation
    { x: -0.0007, y: 0.0065, z: 0.0470 }, // T20 Rotation
    { x: 0.0098, y: 0.0000, z: 0.0540 }, // Reaper Rotation
    { x: -0.0013, y: 0.0002, z: 0.0621 }, // Tyrant Rotation
    { x: -0.0011, y: 0.0000, z: 0.0509 }, // Comet2 Rotation
    { x: 0.0026, y: -0.0004, z: 0.0152 }, // Jester Rotation

    // Dealer 2 Rotations ...
    { x: -0.0038, y: 0.0356, z: -0.1070 },

    // Dealer 3 Rotations ...
    // < - >

    // And so on.
];

const vehiclesToSell = [
    // Dealer 1 Vehicles ...
    "sultanrs",
    "emerus",
    "zentorno",
    "t20",
    "reaper",
    "tyrant",
    "comet2",
    "jester",

    // Dealer 2 Vehicles ...
    "feltzer2",

    // Dealer 3 Vehicles ...
    // < - >

    // And so on.
];

CLIENTSIDE CONFIGURATION

const securityText = "I am sure to buy this vehicle!";
const wrongCaptcha = "The captcha you've submitted seems to be wrong. Try again.";
const noCaptcha = "You've no captcha submitted in the input menu!";

athenavehicledealership's People

Contributors

booster1212 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.