ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 1970

Custom Sprite code [Help me plsxx]

by xMG - 07-30-2018 - 02:12 AM
#1
I'm pretty new to modding on GTA 5 (As in C++ wise) and I was thinking of adding a custom banner for a mod menu. I have the banner and ytd done all I need to know is how to actually implement it.

For example found this code but don't really know what to do with it.
Code:
GameFunction:
static uint32*(*FileRegister)(int*, const char*, bool, const char*, bool) = "48 89 5C 24 ? 48 89 6C 24 ? 48 89 7C 24 ? 41 54 41 56 41 57 48 83 EC 50 48 8B EA 4C 8B FA 48 8B D9 4D 85 C9"_scan.as<decltype(FileRegister)>();

Generic Functions:
bool FileExists(const std::string& fileName)
{
    struct stat buffer;
    return (stat(fileName.c_str(), &buffer) == 0);
}

const std::string GetModulePath(HMODULE module)
{
    std::string path;
    char buffer[MAX_PATH];
    GetModuleFileNameA(module, buffer, MAX_PATH);
    PathRemoveFileSpecA(buffer);
    path = buffer;
    return path;
}


USAGE:

//ScriptMain
const std::string name = "title_images.ytd";
const std::string delim = "\\";

std::string fullPath = GetModulePath(YOUR_DLL_MODULE) + delim + name;

if (FileExists(fullPath))
{
    int textureID;
    FileRegister(&textureID, fullPath.c_str(), true, name.c_str(), false);

    if (textureID == -1)
    {
        _error("Failed to register %s", fullPath.c_str());
    }
    else
    {
        _print("Registered File %s with ID:%i", fullPath.c_str(), textureID);
    }
}

*use the name as the textureDict without extension
eg.
Sprite("title_images", "forum_banner", 0.f, { 255, 255, 255, 255 })
Reply
#2
i see its for pc, check out the native speedo on the scripthook v, that loads external png images
Reply
#3
But how would I go about loading .ytds
Reply
#4
Why mess with rpf files when you can just load a png/pg
Reply
#5
No no I mean like for example ToxicMenu they have the same feature you just make a folder with your ytd in it and then load it but that's where I don't know how to load it.
Example: http://i.prntscr.com/_5-4r-LbRXmpfzC-PImHjw.png
Reply
#6
How do u do this for xbox 360?
lol
Reply
#7
(07-31-2018 - 04:47 PM)clbmodzlive Wrote: How do u do this for xbox 360?
lol

I'm not 100% sure but I think you can use the Liberty V tool
Reply
#8
(07-31-2018 - 04:49 PM)xMG Wrote:
(07-31-2018 - 04:47 PM)clbmodzlive Wrote: How do u do this for xbox 360?
lol

I'm not 100% sure but I think you can use the Liberty V tool

Yes. I how how to do it that why by adding custom texture to the TU. But I wanna know how to do it without adding it to the TU
Reply
#9
If you can't use that why not use OpenIV.asi to load that.
Actually "_scan" doesn't exist in sudomod, so you need to change that to let it work in your project.
Reply

Users browsing: 1 Guest(s)