Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/31/20 in Files

  1. Version 1.0.1

    622 downloads

    RAGEMP-DiscordIntegration This wrapper allows you easily create an instance of a discord bot within your RAGE:MP server. Features: 1. Send messages to discord from your RAGE:MP Server. 2. Send messages to your RAGE:MP Server from your Discord server. 3. Register specific channel for the bot to listen. (Can be changed during runtime). 3. Remove specific channel for the bot to STOP listening. (Can be changed during runtime). 4. Update bot status on setup and/or during runtime How to use the wrapper 1. Add the RAGEMP-DiscordIntegration.dll as a reference to your project in visual studio. 2. Make sure to place the three provided Discord.Net.xx.dll into your server/runtime folder. 3. Enjoy)))) How to set up 1. Create a new application on Discord Developers 2. Create a bot. 3. Invite bot to discord server. 4. Use the token from your bot to initialize the bot as shown in the example below. 5. Register/Remove channels from where your bot sends to all players. Example script. using GTANetworkAPI; using System; using System.Collections.Generic; using System.Text; public class Yes : Script { public Yes() { NAPI.Util.ConsoleOutput("Loaded: yes"); } [ServerEvent(Event.ResourceStart)] public void OnResourceStart() { Integration.DiscordIntegration.SetUpBotInstance("TOKEN_HERE", "RAGE:MP", Discord.ActivityType.Playing, Discord.UserStatus.DoNotDisturb); } [ServerEvent(Event.ChatMessage)] public async void OnChatMessage(Player player, string strMessage) { string strFormatted = $"[RAGE:MP] {player.Name}: {strMessage}"; await Integration.DiscordIntegration.SendMessage(3897429387492374, strFormatted, true).ConfigureAwait(true); } [Command("registerchannel")] public void RegisterDiscord(Player player, ulong discordChannelID) { bool bSuccess = Integration.DiscordIntegration.RegisterChannelForListenting(discordChannelID); player.SendChatMessage(bSuccess ? "Success" : "No Success"); } [Command("removechannel")] public void RemoveDiscordChannel(Player player, ulong discordChannelID) { bool bSuccess = Integration.DiscordIntegration.RemoveChannelFromListening(discordChannelID); player.SendChatMessage(bSuccess ? "Success" : "No Success"); } [Command("botstatus")] public async void UpdateBotStatusCommand(Player player, string gameName, Discord.ActivityType eActivityType, Discord.UserStatus eUserStatus) { await Integration.DiscordIntegration.UpdateBotStatus(gameName, eActivityType, eUserStatus).ConfigureAwait(true); } } Source code can be found on my github: https://github.com/JeremyEspresso/RAGEMP-DiscordIntegration Bugs or feature requests and what not. Just open an issue on the github and I will take a look soon™️.
    1 point
  2. Version 2.0.1

    353 downloads

    NB: This include does not entirely work like the original. NB: The class is now called instructionalButtons instead of hudManager. NB: This include also includes a more advanced version of the BasicScaleform class by kemperr, just called ScaleForm now. v2.0.0 - Added instructionalButton.hasControl(control). - Added instructionalButton.getButtonCount(). - Removed the padding of 10. - Added RGB support (instead of just RGBA... alpha defaults to 180 for RGB). - Revamped the structure used to store buttons (it was dumb before, wasting variables and not making use of Javascript features). v1.0.2 - You can now alter any instructional button without it being redrawn/shown to you (Basically you can edit them, without them popping up on your screen, forcefully). - Added instructionalButton.changeButtonControl(title, new_control). v1.0.1 - Fixed the an issue where when using multiple instructional buttons multi script wide, if one button count was more than others, the buttons would show up across different instructional buttons. - Removed support for hex colours with a #. Now to use a colour, just use 'FF00FF'. Using # here is a waste of time. v1.0.0 - Fixed instructional buttons rendering last button created on the client only. - Instructional buttons background now default to black, if no colour was used. - A padding of 10 is now set on horizontal instructional buttons. - Support for custom button names. - Added instructionalButton.changeButtonTitle(control, new_title). - Added instructionalButton.isActive(). - Example: const instructions = require('/better_instructions'); const horizontalInstructionList = new instructions(-1); horizontalInstructionList.addButton('Create Roadblock', 'M'); horizontalInstructionList.addButton('Right', 175); horizontalInstructionList.addButton('Left', 174); if(!horizontalInstructionList.isActive()) { horizontalInstructionList.toggleHud(true); } setTimeout( () => { if(horizontalInstructionList.isActive()) { horizontalInstructionList.toggleHud(false); } }, 10000); /* Vertical Instructions */ const verticalInstructionList = new instructions(1, 'ff000'); modShopInstructions.addButton('Toggle RAGE Menu', 'F2'); if(!verticalInstructionList.isActive()) { verticalInstructionList.toggleHud(true); } setTimeout( () => { if(verticalInstructionList.isActive()) { verticalInstructionList.toggleHud(false); } }, 10000); Original Include - Credits go to Captien for the original release.
    1 point
×
×
  • Create New...