Code Monkey home page Code Monkey logo

altv-os-interactions's Introduction

Open Source - Interactions

Created by LeonMrBonnie

❤️ Support me by becoming a Patron
⭐ This repository if you found it useful!

Generic badge


Description

This repository provides an alt:V resource to create interactions.

An interaction is a position on the map where you can press a button to do something.

This resource provides an easy way to create and remove interactions.

Installing Dependencies / Installation

I cannot stress this enough. Ensure you have NodeJS 13+ or you will have problems.

  • NodeJS 13+
  • An Existing or New Gamemode
  • General Scripting Knowledge

After simply add the name of this resource to your server.cfg resource section.

altv-os-interactions

Also add the name of this resource to the deps array of your resource.cfg from your main gamemode.

Then simply clone this repository into your main server resources folder.

cd resources
git clone https://github.com/LeonMrBonnie/altv-os-interactions

Ensure your package.json includes this property:

"type": "module"

Importing the resource

You can import the resource by using:

import * as Interactions from "altv-os-interactions";

And you can then use the functions by using e.g. Interactions.createInteraction("test", new alt.Vector3(0, 0, 0), 5, () => alt.log("Test!"));

Creating a new interaction

You can create an interaction by using the exported function createInteraction.

Parameter Type Description
name String Unique name to identify the textlabel.
pos Vector3 A Vector3 or pos to place it.
range Number Interaction range.
handler Function The function to be executed when the player interacts.

Removing an existing interaction

You can remove an existing interaction by using the exported function removeInteraction.

Parameter Type Description
name String Unique name to identify the textlabel.

Interacting with an interaction

You can interact with an interaction by standing in its range and pressing E.
If you want to change this keybind, edit the INTERACTION_KEY constant in the client.js file to your desired keycode.

Other alt:V Open Source Resources

altv-os-interactions's People

Contributors

leonmrbonnie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.