{"id":23396313,"url":"https://github.com/stuyk/altv-os-context-menu","last_synced_at":"2025-04-11T14:42:14.830Z","repository":{"id":104272482,"uuid":"280974988","full_name":"Stuyk/altv-os-context-menu","owner":"Stuyk","description":"alt:V Context Menu for Right-Clicking on Objects In-Game. Runescape Style.","archived":false,"fork":false,"pushed_at":"2021-04-11T12:47:42.000Z","size":144,"stargazers_count":16,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T10:51:11.233Z","etag":null,"topics":["altv","esx","fivem","ragemp"],"latest_commit_sha":null,"homepage":"https://stuyk.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Stuyk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":["stuyk"]}},"created_at":"2020-07-20T00:23:26.000Z","updated_at":"2024-09-24T20:13:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"2386119d-345e-4cfd-a175-aa67cd8eb8a2","html_url":"https://github.com/Stuyk/altv-os-context-menu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stuyk%2Faltv-os-context-menu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stuyk%2Faltv-os-context-menu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stuyk%2Faltv-os-context-menu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stuyk%2Faltv-os-context-menu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Stuyk","download_url":"https://codeload.github.com/Stuyk/altv-os-context-menu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248420244,"owners_count":21100344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["altv","esx","fivem","ragemp"],"created_at":"2024-12-22T07:34:59.519Z","updated_at":"2025-04-11T14:42:14.796Z","avatar_url":"https://github.com/Stuyk.png","language":"JavaScript","funding_links":["https://github.com/sponsors/stuyk","https://github.com/sponsors/Stuyk/"],"categories":[],"sub_categories":[],"readme":"# Open Source - Context Menu - alt:V\n\n[❤️ Become a Sponsor of my Open Source Work](https://github.com/sponsors/Stuyk/)\n\n[⌨️ Learn how to script for alt:V](https://altv.stuyk.com/)\n\n[💡 Need a Roleplay Script? Try Athena!](https://gtavathena.com/)\n\n⭐ This repository if you found it useful!\n\n---\n\n![](https://i.imgur.com/srGHPbB.jpeg)\n\n# Description\n\nThis allows you to create a simple context menu for players to utilize. Which means they can hold `left alt` and `right-click` on objects to select different objects based on their models. Which is great for creating in-depth options for players to utilize.\n\n## Installing Dependencies / Installation\n\n**I cannot stress this enough. Ensure you have NodeJS 13+ or you will have problems.**\n\n-   [NodeJS 13+](https://nodejs.org/en/download/current/)\n-   An Existing or New Gamemode\n-   General Scripting Knowledge\n\nAfter simply add the name of this resource to your `server.cfg` resource section.\n\n`altv-os-context-menu`\n\nThen simply clone this repository into your main server resources folder.\n\n```\ncd resources\ngit clone https://github.com/Stuyk/altv-os-context-menu\n```\n\nEnsure your `package.json` includes this property:\n\n```json\n\"type\": \"module\"\n```\n\n# Configuring A Menu\n\nAll menus must be created on **client-side**.\nThey only need to be initialized once.\nThey are attached to an identifier and an entity id.\n\nGo in-game. Hold `alt` and `right-click` on any object.\nOpen your console with `F8` then look at the model number for the object.\n\n`alt.emit('context:CreateMenu')`\n\n| Argument | Description                                           |\n| -------- | ----------------------------------------------------- |\n| `model`  | The model of the model you wish to append options to. |\n| `title`  | The name of the menu.                                 |\n\n### Example\n\n```js\nalt.on('context:Ready', () =\u003e {\n    alt.emit('context:CreateMenu', 1329570871, 'Trash Can');\n});\n```\n\n# Appending to Menu\n\nAll menus have an identifier.\nUse the identifier to apply options to a menu.\n\n`alt.emit('context:CreateMenu')`\n\n| Argument            | Description                                                                                   |\n| ------------------- | --------------------------------------------------------------------------------------------- |\n| `model`             | The model of the model you wish to append options to.                                         |\n| `contextOptionName` | The name of the option you are appending.                                                     |\n| `eventCallbackName` | The event to call when the option is selected. Comes through `alt.emit` or `alt.onClient`     |\n| `isServer`          | If true. Then the `callbackName` event will come through `alt.onClient`. Otherwise `alt.emit` |\n\n### Example\n\n```js\nalt.on('context:Ready', () =\u003e {\n    alt.emit('context:CreateMenu', 1329570871, 'Trash Can');\n    alt.emit('context:AppendToMenu', 1329570871, 'Look in Trash', 'trashcan:Look', false);\n    alt.emit('context:AppendToMenu', 1329570871, 'Dig in Trash', 'trashcan:Dig', true);\n});\n```\n\n### Example - Recieving the Event on Client-side.\n\n```js\nalt.on('trashcan:Look', data =\u003e {\n    alt.log(JSON.stringify(data));\n});\n```\n\n### Example - Recieving the Event on Server-side.\n\n```js\nalt.onClient('trashcan:Dig', (player, data) =\u003e {\n    console.log(data);\n    alt.log(`${player.name} has dug in the trash. What an animal!`);\n});\n```\n\n# Other alt:V Open Source Resources\n\n-   [Authentication by Stuyk](https://github.com/Stuyk/altv-os-auth)\n-   [Discord Authentication by Stuyk](https://github.com/Stuyk/altv-discord-auth)\n-   [Global Blip Manager by Dzeknjak](https://github.com/jovanivanovic/altv-os-global-blip-manager)\n-   [Global Marker Manager by Dzeknjak](https://github.com/jovanivanovic/altv-os-global-marker-manager)\n-   [Chat by Dzeknjak](https://github.com/jovanivanovic/altv-os-chat)\n-   [Entity Sync for JS by LeonMrBonnie](https://github.com/LeonMrBonnie/altv-os-js-entitysync)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuyk%2Faltv-os-context-menu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstuyk%2Faltv-os-context-menu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuyk%2Faltv-os-context-menu/lists"}