1

I am, or rather attempting to, create a mod for GTA V using RAGE Plugin Hook, IronPython, and C#. Unfortunately, I am running into issues.

I received an exception, in either C# or Assembly, and python being my native language, I took;

[8/10/2016 7:39:14 AM.609] ------------------------------
[8/10/2016 7:39:14 AM.609] Exception type: System.ArgumentNullException
[8/10/2016 7:39:14 AM.609] Exception message: Value cannot be null.
[8/10/2016 7:39:14 AM.610] ------------------------------
[8/10/2016 7:39:14 AM.610] Inner exceptions:
[8/10/2016 7:39:14 AM.611] ------------------------------
[8/10/2016 7:39:14 AM.611] Stack trace:
[8/10/2016 7:39:14 AM.611] at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
[8/10/2016 7:39:14 AM.612] at Rage.Plugin.RemoteLogPluginCrash(Plugin plugin, Exception exception)
[8/10/2016 7:39:14 AM.612] at Rage.HookManager.LogPluginCrash(Plugin plugin, Exception exception)
[8/10/2016 7:39:14 AM.612] at Rage.GameFiber.Main()
[8/10/2016 7:39:14 AM.613] at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
[8/10/2016 7:39:14 AM.613] at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
[8/10/2016 7:39:14 AM.617] at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
[8/10/2016 7:39:14 AM.618] at System.Threading.ThreadHelper.ThreadStart()
[8/10/2016 7:39:14 AM.618] ==============================

to mean that I forgot to define a variable, referenced a variable that doesn't exist, or forgot to supply an argument to a function.

Naturally, I looked through and found no issues, so I put it in a python-dedicated IDE.

It turns out, I had forgotten to supply arguments, and had improperly used hasattr. I promptly fixed those issues, however, the problem persists.

I am attempting to "get a feel" for C# still, so I am unsure what this error is referencing, since what it could have been has been fixed, or should have been, and python is my native language.

I may be calling the Rage. part wrong, however, that is the only issue I can find.

Launch Script;

import clr
import Services

clr.AddReference('RagePluginHookSDK')

from RagePluginHookSDK import Rage


def Init():
    wc = Rage.World()
    gc = Rage.Game()
    vl = []

    return wc, gc, vl

def MainLoop(worldclass, gameclass, vehiclelist):
    try:
        Services.RefreshWorld()
        Services.SetWeather(worldclass)
        return True
    except Exception, e:
        Services.Notify("An error has occured: {0}; exiting...".format(e))
        return False

wc, gc, vl = Init()

while True:
    if not MainLoop(wc, gc, vl):
        break
    else:
        Rage.GameFiber.Yield()

Used Services Code;

import clr
import random
import os
from math import pi

clr.AddReference('RagePluginHookSDK')

from RagePluginHookSDK import *

def GetMaxPeds(worldvar):
    return worldvar.PedCapacity()

def RefreshWorld(worldvar):
    pl = worldvar.GetAllPeds()
    vl = worldvar.GetAllVehicles()
    for item in pl:
        if not hasattr(item, 'IsMine'):
            item.Delete()
    for item in vl:
        if not hasattr(item, 'IsMine'):
            item.Delete()

def Notify(gamevar, message):
    Rage.Game.DisplayMessage(str(message))

def SetWeather(worldvar, to=None):
    wtrv = random.randint(0,5)
    if to != None:
        ttl = 60
        wt = to
    elif wtrv == 0:
        wt = 0
        ttl = 90
    elif wtrv == 1:
        wt = 7
        ttl = 45
    elif wtrv == 2:
        wt = 2
        ttl = 30
    elif wtrv == 3:
        wt = 4
        ttl = 45
    elif wtrv == 4:
        wt = 9
        ttl = 15
    worldvar.Weather.set(wt)
    return ttl

def ReadVehicleData():
    cwd = os.getcwd()

    return []

Error Trace is too long to be inserted, my apologies!

x otikoruk x
  • 422
  • 1
  • 6
  • 16

0 Answers0