ItsMods

Full Version: question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
(02-18-2012, 13:14)zxz0O0 Wrote: [ -> ]
(02-18-2012, 13:04)blueberry9 Wrote: [ -> ]now i need to test it, right?
Yeah, now put it on dedicated server.

i did.

got nothing.
no unlimited sprint.
tried enabling the dvar and that didn't work.

i wanted the dll to produce a config section in the sv_config.cfg.

i'm assuming i need some code like this which is from Pozzuhs Speed Plugin:

Code:
ServerPrint("Speed plugin loaded. Author: Pozzuh. Version 1.3");

if (GetServerCFG("SPEEDPLUGIN", "Speed", "-1") == "-1")
SetServerCFG("SPEEDPLUGIN", "Speed", "190");
if (GetServerCFG("SPEEDPLUGIN", "JumpHeight", "-1") == "-1")
SetServerCFG("SPEEDPLUGIN", "JumpHeight", "39");
if (GetServerCFG("SPEEDPLUGIN", "FallDamage", "-1") == "-1")
SetServerCFG("SPEEDPLUGIN", "FallDamage", "1");

try
{
g_speed_var = Convert.ToInt32(GetServerCFG("SPEEDPLUGIN", "Speed", "190"));
jump_height_var = Convert.ToInt32(GetServerCFG("SPEEDPLUGIN", "JumpHeight", "39"));
fall_damage_var = Convert.ToInt32(GetServerCFG("SPEEDPLUGIN", "FallDamage", "1"));
}

maybe something like this??

Code:
ServerPrint("sprintUnlimited plugin loaded.");

if (GetServerCFG("SPRINTPLUGIN", "Sprint", "-1") == "-1")
SetServerCFG("SPRINTPLUGIN", "Sprint", "Enabled");


try
{
player_sprintUnlimited_var = Convert.ToInt32(GetServerCFG("SPRINTPLUGIN", "Sprint", "1"));
}
Just try now without sv_config.ini. We don't know if the adresses work.

Do you have set the project to .NET Framework 3.0 in properties?
(02-18-2012, 13:37)zxz0O0 Wrote: [ -> ]Just try now without sv_config.ini. We don't know if the adresses work.

Do you have set the project to .NET Framework 3.0 in properties?
not yet.
doing now

saved as 3.0
(02-18-2012, 13:41)blueberry9 Wrote: [ -> ]
(02-18-2012, 13:37)zxz0O0 Wrote: [ -> ]Just try now without sv_config.ini. We don't know if the adresses work.

Do you have set the project to .NET Framework 3.0 in properties?
not yet.
doing now

changed the target framework to 3.0


i tested the dll.
it didn't work
i'm using VCE now instead of VS.
it's easier for a n00b like me.

as was mentioned earlier, the offsets may be incorrect.
but my code builds fine in VCE (Framework 4.0) until i set the .NET Framework to 3.0.
then all the errors and warnings pop up.

here's the code:

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using Addon;

namespace plugin_test
{
    //"<class name> : CPlugin" is needed to inherit the functions
    public class plugin_test : CPlugin
    {
        //Example overrides for functions
        public override void OnServerFrame()
        {
        }

        [DllImport("kernel32.dll")]
        static extern bool VirtualProtect(IntPtr lpAddress, uint dwSize,
        uint flNewProtect, out uint lpflOldProtect);

        unsafe public override void OnServerLoad()
        {
            ServerPrint("Plugin: sprintUnlimited loaded");

            uint lol = 0;
            uint size = 0x4;
            uint pro = 0x40;

            IntPtr addr = (IntPtr)0x587CD34;
            IntPtr addr2 = (IntPtr)0x587CD50;
            IntPtr addr3 = (IntPtr)0x587CD60;

            VirtualProtect(addr, size, pro, out lol);
            VirtualProtect(addr2, size, pro, out lol);
            VirtualProtect(addr3, size, pro, out lol);
            *(int*)0x587CD34 = 1;
            *(int*)0x587CD50 = 1;
            *(int*)0x587CD60 = 1;
        }

        public override ChatType OnSay(string Message, ServerClient Client)
        {
            return Addon.ChatType.ChatContinue;
        }

        public override string OnCheckBan(string xuid)
        {
            //Return a string if the player is banned
            //otherwise return null
            //xuid = xuid in the "status" command
            return null;
        }
    }
}
Plugins only work if they are compiled with .NET Framework 3.0.

Linq is a new feature in .NET Framework 3.5 (see http://msdn.microsoft.com/en-us/library/....linq.aspx ) and does not exist in 3.0.

Remove this line from your code
Code:
using System.Linq;
and also remove it from References
(02-20-2012, 16:06)zxz0O0 Wrote: [ -> ]Plugins only work if they are compiled with .NET Framework 3.0.

Linq is a new feature in .NET Framework 3.5 (see http://msdn.microsoft.com/en-us/library/....linq.aspx ) and does not exist in 3.0.

Remove this line from your code
Code:
using System.Linq;
and also remove it from References

thanks.
addon.dll is also a problem with 3.0
what to do about that?
(02-20-2012, 16:23)blueberry9 Wrote: [ -> ]
(02-20-2012, 16:06)zxz0O0 Wrote: [ -> ]Plugins only work if they are compiled with .NET Framework 3.0.

Linq is a new feature in .NET Framework 3.5 (see http://msdn.microsoft.com/en-us/library/....linq.aspx ) and does not exist in 3.0.

Remove this line from your code
Code:
using System.Linq;
and also remove it from References

thanks.
addon.dll is also a problem with 3.0
what to do about that?
No it should not be a problem. Though maybe you use an old version. Remove addon.dll from References, download latest version from here: http://cod6hmod.itshax.com/mw3_addon/ and add latest addon.dll again to References.
(02-20-2012, 16:31)zxz0O0 Wrote: [ -> ]
(02-20-2012, 16:23)blueberry9 Wrote: [ -> ]
(02-20-2012, 16:06)zxz0O0 Wrote: [ -> ]Plugins only work if they are compiled with .NET Framework 3.0.

Linq is a new feature in .NET Framework 3.5 (see http://msdn.microsoft.com/en-us/library/....linq.aspx ) and does not exist in 3.0.

Remove this line from your code
Code:
using System.Linq;
and also remove it from References

thanks.
addon.dll is also a problem with 3.0
what to do about that?
No it should not be a problem. Though maybe you use an old version. Remove addon.dll from References, download latest version from here: http://cod6hmod.itshax.com/mw3_addon/ and add latest addon.dll again to References.

ok.
thanks again.
i'll try that when i get home

(02-20-2012, 17:19)blueberry9 Wrote: [ -> ]
(02-20-2012, 16:31)zxz0O0 Wrote: [ -> ]
(02-20-2012, 16:23)blueberry9 Wrote: [ -> ]
(02-20-2012, 16:06)zxz0O0 Wrote: [ -> ]Plugins only work if they are compiled with .NET Framework 3.0.

Linq is a new feature in .NET Framework 3.5 (see http://msdn.microsoft.com/en-us/library/....linq.aspx ) and does not exist in 3.0.

Remove this line from your code
Code:
using System.Linq;
and also remove it from References

thanks.
addon.dll is also a problem with 3.0
what to do about that?
No it should not be a problem. Though maybe you use an old version. Remove addon.dll from References, download latest version from here: http://cod6hmod.itshax.com/mw3_addon/ and add latest addon.dll again to References.

ok.
thanks again.
i'll try that when i get home

that did the trick.
thanks!
i was able to build the dll.
but it caused the server not to run and i got a crash dump error relative to this address: "0x6DA709" which is not even in the code. but "0x6DA708" is.

so i removed "0x6DA708" and the server ran but no unlimited sprint.

here's the edit i made:

Code:
IntPtr addr = (IntPtr)0x6D9634;
            IntPtr addr2 = (IntPtr)0x6DE490;

            plugin_test.VirtualProtect(addr, size, pro, out lol);
            plugin_test.VirtualProtect(addr2, size, pro, out lol);      
            *(float*)0x6D9634 = 1.0f;
            *(float*)0x6DE490 = 1.0f;

i realize that by removing that address i could be disabling something i want to be in the plugin. just not sure what dvar that address represents
Ok. Now either the addresses are wrong or it isn't loaded yet. You can try to move it to OnMapChange() if it doesn't work there then the addresses are wrong.
Pages: 1 2 3 4