TommyB123 / eSelection

Dynamic model selection library for SA-MP servers
44 stars 13 forks source link

Update to open.mp #8

Closed mysy00 closed 1 year ago

mysy00 commented 1 year ago

To avoid bunch of warnings on open.mp servers.

This update also breaks compatibility with samp servers. If you wish to support both, I could make the necessary changes.

TommyB123 commented 1 year ago

If you'd be willing to make the changes required for compatibility on both platforms, I'd appreciate it. I don't wish for this library to be incompatible with servers still running on SA-MP. I don't use open.mp on my projects, so I'd hate for my own library to be incompatible. ;)

mysy00 commented 1 year ago

Sure thing. I'm stuck on my main server on samp as well due to the lack of FCNPC but I also have a server version migrated to open.mp awaiting for NPCs. :)

Should be done but let me know if you see anything invalid. It now attempts to use open.mp by default but if it fails, it falls back to a_samp.

When it comes to those enums I added, I only test for 1 defined symbol since there's a good chance that if somebody has 1 of them, he also has others as well.

Another option is to simply add a tag and a compile-time check like so:

#if !defined TEXT_DRAW_ALIGN
    #define TEXT_DRAW_ALIGN: _:
#endif
PlayerTextDrawAlignment(playerid, g_MenuPageNumber[playerid], TEXT_DRAW_ALIGN:3);

But the issue with this is that it seems to be a bit harder to maintain. It looks simpler at first glance but once you decide to migrate fully to open.mp, with the current implementation all you have to do is remove the extra definitions and you're done.

I gave it a quick go on the open.mp and samp with the test file I added, it appears to work.