Jump to content

xForcer

Members
  • Posts

    36
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by xForcer

  1. The author asked for chatInput to be disabled and cursor shown when he has the browser opened. The solution I provided works perfectly for his use case, I myself am using it. You want him to press ALT key manually just to show the cursor after disabling the chatInput? Really?
  2. Hello everyone! This will be a short guide on how to use colors when using custom chat, not the default one. I know I am not the only one frustrated about this so that's why I want to share this to everyone. Important credits: - Carlos (ex RageMP member) Helped me the most, basically solving everything and giving me a big smile. I still owe you a beer - @Chainksain This dude actually has the same way of doing things as me so big shoutout to him for examples Let's start! Requirements: - Visual Studio 17 or better - Net Core 2.2 - RageMP C# 0.3.7 1. First, create a class that will be used for your chat colorization stuff. Everything will be commented using System; namespace CustomChatColorsTutorial { public static class ChatColorization { // Few general colors public const string ColorRed = "#A80707"; public const string ColorDodgerBlue = "#1E90FF"; /// <summary> /// HEX colorization /// </summary> /// <param name="text">The text you want to colorize</param> /// <param name="color">Use colors from ChatColorization class</param> /// <returns></returns> public static string ColorizeText(string text, string color) { return "<strong style='color:" + color + "'>" + text + "</strong>"; } } } 2. To use colors, do something like this: using System; using GTANetworkAPI; using GTANetworkMethods; namespace CustomChatColorsTutorial { public static class Chat { public void SendExampleMessage(Client player) { NAPI.Chat.SendChatMessageToPlayer(player, ChatColorization.ColorizeText("This is an example", ChatColorization.ColorDodgerBlue)); } } } This will output: This is an example 3. This was simple so far, I agree. But what about mixing few colors in one sentence? Let's say we want to send an error message but nice and clean. This is how we do it: using System; namespace CustomChatColorsTutorial { public static class ChatColorization { // Few general colors public const string ColorRed = "#A80707"; public const string ColorDodgerBlue = "#1E90FF"; // Remember: If you don't explicitly colorize text, it will use your custom chat's default color (white) // In this case, brackets will be white public static string ErrorMessage(string message) { return "(" + ColorizeText("Error", ColorRed) + ") - " + message; } /// <summary> /// HEX colorization /// </summary> /// <param name="text">The text you want to colorize</param> /// <param name="color">Use colors from ChatColorization class</param> /// <returns></returns> public static string ColorizeText(string text, string color) { return "<strong style='color:" + color + "'>" + text + "</strong>"; } } } And then we use that in our Chat class using System; using GTANetworkAPI; using GTANetworkMethods; namespace CustomChatColorsTutorial { public static class Chat { public void SendExampleMessage(Client player) { NAPI.Chat.SendChatMessageToPlayer(player, ChatColorization.ErrorMessage("Something bad happened, please contact the adminstrator!")); } } } This will output: (Error) - Something bad happened, please contact the adminstrator! That's it! You can now use custom colors in your custom chat. If you need assistance, just ask. If something is wrong, please tell me to correct it. Leave feedback. Thank you for reading! xForcer Changelog: Cleaner formatting of ErrorMessage. Removed substring constants
  3. This happens because of these lines mp.gui.chat.activate(false); mp.gui.cursor.show(true, true); If they are next to each other, your cursor will not appear. We need a solution! Edit: @MrPancakers told me to use a timeout/timer and it WORKS! TL;DR: Use a timeout of 1ms to show the cursor after deactivating chat input
  4. You would have to access the target player (recipient) via his ID or Name public void CMD_Kick(Client client, string idOrName, string grund) Then implement the logic for looping all IDs and Names and find the exact one you want
  5. I am curious, what did you use for removing buildings?
  6. Sure, even better. Great idea Kar, haven't thought about that!
  7. Great! What about Croatian forum board, can we perhaps have that?
  8. Absolutely!
  9. I would choose MySQL over JSON anytime, anyday
  10. You are missing something else or did something wrong in the process. Try doing everything from the scratch if you still have this problem
  11. Did you build the solution and copied every dll needed to the runtime folder as the tutorial says?
  12. Yes, you just have to use a different provider Finally updated the code. If there is anything wrong, let me know so I can quickly fix it. I could eventually add repositories and other advanced stuff, but I would like to keep it simple and effective
  13. Use int to store and load money to/from database. You can store the money into C# properties per player or use SetEntityData. You can find better tutorials for that
  14. Are you sure you followed every step carefully? Btw, I will update this tutorial this week per Adam's suggestion. Haven't had the time to do it recently
  15. I was on the edge to use it or not. Some say it's not needed but as you stated in a multi threaded environment with many db calls, immediately disposing is the way to go. Since this was targeted at beginners you can see why I did the way I did, BUT I guess no harm can be done if I update my tutorial. Thank you for the feedback, I appreciate it!
  16. Thanks, I'll try!
  17. It is actually called "Data storage #4 undefined 0;" Any info on this? Edit: Did some digging. Allegedly, it is fixed in the next update.
  18. Been searching for a way to play videos on CEF. Is there a way?
  19. Nah. Something else was on my mind considering RageMP can't take any money unless it's a donation, otherwise Take-Two could intervene.
  20. Oh, I remember seeing some rules against that. That's great news
  21. Are you sure?
  22. Just recently started adding add-on vehicles via dlcpacks and got this error. What causes this error?
  23. Exactly that. Check for migrations, update your database and use TRY/CATCH block. I use them a lot
  24. This is currently a known issue. Developers have announced a better way of downloading client packages, so fingers crossed
  25. Thanks for the feedback! I got a VPS on Vultr for free, $50 credits through a coupon so I'll use it for a month and see how it is. I actually like having a VPS rather than only a gameserver, I can do more with it. And those dedicated prices are attractive. Kinda want that more now haha. Thanks! By the way, I can see my server has 90ms ping. A lot of servers have the same ping. What's the deal with that?
×
×
  • Create New...