Log in to reply

[Tutorial] Custom Notification Icon 'No Replace' C#/SHVDN3

  • New file path in v1.58 (Icons)
    New= mods\update\update.rpf\x64\textures\script_txds.rpf
    Old= mods/x64b.rpf/data/cdimages/scaleform_generic.rpf

    Hello everyone,
    Here is a quick tutorial on "How to add and use custom notification icon" in C# / SHVDN3
    Without any original games files replacement ! You also could use the first part of the tutorial & use a different notifications way with custom icons
    So to start, you will need OpenIV, and a picture in size 64x64 (Pixels) in .dds type
    You could use any software to create this picture or download it & convert.
    I'm using GIMP, which allow exporting/converting in .dds (& is free !)

    Each notifications have 3 fields,

    • Subject, Who or what send the message (Here = City Car Shop)
    • Object, what type of message or what message is about (Here = Information : )
    • Message, obviously what it says ! (Here = Welcome to the Shop)

    When you have your picture (in .dds), you will have to put it in game file.
    Here the picture will be call "Icon01"
    Open OpenIV & allow edit
    Go to mods\update\update.rpf\x64\patch\data\cdimages\scaleform_generic.rpf (If needed dump original files to mods folder)
    Then open New (Top left), & click textures dictionary (.ytd)
    Enter the texture dictionary name you wants, here we will take "TextureDict01", then click OK
    Now, find it & open it.
    Then import your pictures (Top left) in .dds format
    & then SAVE !

    Now the most interesting part, the code !
    Create a Method in ModName : Scripts

    void notifyAboveMap(string msgtype, string msg)
                Function.Call(Hash.BEGIN_TEXT_COMMAND_THEFEED_POST, "STRING");
                Function.Call(Hash.ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME, msg);
                Function.Call(Hash.REQUEST_​STREAMED_​TEXTURE_​DICT, "TextureDict01", true); //Here you put the texture dictionary name you choose before
                Function.Call(Hash.END_​TEXT_​COMMAND_​THEFEED_​POST_​MESSAGETEXT, "TextureDict01", "Icon01", false, 1, "Turf Weapons & Armor Stock", msgtype); //the 5th argument here is Subject/Biggest top title, see picture

    Now we have our method, lets call it in your scripts,

    notifyAboveMap("~g~Information ~w~:, "~b~Welcome ~y~to ~w~the ~g~Shop") // here you put Object first & Message then

    Then it should work ! If not fell free to ask ! If anyone need help it will be a pleasure for me,
    Also if anyone have any suggestion/modifications/improvements to make the code better i'm open minded ;)
    I really hope it will help someone, has it took me 1 week to fully understand and find how to :P
    See you & have fun !

  • Hello, and thank you for this really good and clear tutorial.

    Is there any possibility to have a custom icon without using OpenIV ? Like putting dds (and/or other) file in the scripts directory, and then call it in our code, as we do for the settings file with ScriptHookV.NET ?
    Something like this :
    Function.Call(Hash.END_​TEXT_​COMMAND_​THEFEED_​POST_​MESSAGETEXT, "scripts/TextureDict01.ytd", "scripts/Icon01.dds", false, 1, "Turf Weapons & Armor Stock", msgtype);

    Thanks :)

  • @Romanops

    Conventional answer is no, every file or asset has designated locations.

    If it is a Windows file or folder you have great flexibility. For example you can rename your dlcpacks folder and relocate it.

    If it is an rpf, you're much more limited because you need OpenIV or Codewalker or a tool using the Codewalker core to make changes,

    The non conventional method is using c#. You would use it in conjunction with the notification function to draw an icon or sprite on the screen, taking into account positioning and probably screen resolution. The icon would of course be displayed next to the notification text. The default icon would need to be replaced with a transparent image.

    Alternatively you show your notification text and icon as an image.

Log in to reply

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.