Rage Show My Location Plugin API Example for Plugin Developers

For plugin developers :

This is example of use of two exposed by my plugin static methods, using reflection to dynamically load ma plugin after checking if user has it installed in GTA 5. Plugin doesn’t need to be referenced in project properties this is only code which is needed to load it and use exposed functions

GetCounty(String street)

GetSpeedLimitINTString street)

use this code (its example) to get speed limit for given street name :

namespace YourPLugin
{
    using System;
    using System.IO; // we're looking for file here so we need IO namespace
    using System.Reflection;
    // among other namespaces  from LSPDFR and RPH You should use reflection to load assembly and operate on its exported methods

    class Plugin
    {
        static int GetSpeedLimit(String streetname) // or other function
        {
            int speed_limit = 0; // initialise var
            string path = Directory.GetCurrentDirectory();
            path = path + "\\Plugins\\RageShowMyLocation.dll";
            if (File.Exists(path)) // there must be exact path this one is only for example
            {
                var DLL = Assembly.LoadFile(path); 
                var LocationDLLtype = DLL.GetType("RageShowMyLocation.RageShowMyLocationClass");
                var class_object = Activator.CreateInstance(LocationDLLtype, null);
                object[] param_street_name = new object[1];
                param_street_name[0] = streetname;
                string street_w_location = (string)LocationDLLtype.GetMethod("GetCounty").Invoke(class_object,param_street_name);
                object[] param_street_wloc = new object[1];
                param_street_wloc[0] = street_w_location;
                var speed_limit_untyped = LocationDLLtype.GetMethod("GetSpeedLimitINT").Invoke(class_object,param_street_wloc);
                speed_limit = (int)speed_limit_untyped;
            }
            return speed_limit;
            
                      
            
        }
    }
}

You have to provide proper class for Rage Plugin Hook yourself -  this is just example of how to use my plugin API  in Your code. This code also check if Rage Show My Location is installed by user.