i've been trying to create a plugin for Nukem's Server Addon that will either enable unlimited sprint or make the sprint duration longer.
i've been working on this for 9 days now.
part of the problem is i'm new to C#.
but i'm learning fast, i think.
i've generated code that builds with no errors but it doesn't change the sprint properties in the server.
i've made a whole lot of dll's.
trying different things.
none of it is working though.
i believe it's because the addresses i'm using are wrong.
i downloaded CE and olldbg but i really don't know how to use them.
the dvars i'm trying to use are: player_sprintUnlimited and/or scr_player_sprintTime.
these are some of the addresses i've gotten so far: 0x1B81D64, 0x769C10, 0x587CD34, 0x587CD50, 0x587CD60
I don't know about the adresses, but have you selected .NET 3.0 as a build target?
Do the plugins load at all, that's what took me some time to figure out when i created the RCON tool
...........................
(02-24-2012, 19:20)bonemind Wrote: [ -> ]I don't know about the adresses, but have you selected .NET 3.0 as a build target?
Do the plugins load at all, that's what took me some time to figure out when i created the RCON tool
thank you for responding.
yes, i'm using 3.0.
the plugins build using VCE and they load in the server but i think these addresses are not correct
(02-24-2012, 21:15)blueberry9 Wrote: [ -> ] (02-24-2012, 19:20)bonemind Wrote: [ -> ]I don't know about the adresses, but have you selected .NET 3.0 as a build target?
Do the plugins load at all, that's what took me some time to figure out when i created the RCON tool
thank you for responding.
yes, i'm using 3.0.
the plugins build using VCE and they load in the server but i think these addresses are not correct
code?
(02-24-2012, 21:31)crAyon Wrote: [ -> ] (02-24-2012, 21:15)blueberry9 Wrote: [ -> ] (02-24-2012, 19:20)bonemind Wrote: [ -> ]I don't know about the adresses, but have you selected .NET 3.0 as a build target?
Do the plugins load at all, that's what took me some time to figure out when i created the RCON tool
thank you for responding.
yes, i'm using 3.0.
the plugins build using VCE and they load in the server but i think these addresses are not correct
code?
here's one i tried for scr_player_sprintTime:
Code:
using System;
using System.Collections.Generic;
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: SprintTime loaded");
uint lol = 0;
uint size = 0x4;
uint pro = 0x40;
IntPtr addr = (IntPtr)00787EDC;
plugin_test.VirtualProtect(addr, size, pro, out lol);
*(float*)00787EDC = 12.8f;
}
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;
}
}
}
here's another one:
Code:
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Addon;
namespace Sprint_Time
{
//"<class name> : CPlugin" is needed to inherit the functions
public class Class1 : CPlugin
{
public int scr_player_sprintTime_var = 0;
IntPtr j_sprintTime = (IntPtr)0x769C10;
[DllImport("kernel32.dll")]
private static extern bool VirtualProtect(IntPtr lpAddress, uint dwSize, uint flNewProtect, out uint lpflOldProtect);
unsafe public override void OnServerLoad()
{
ServerPrint("SprintTime plugin by blueberry9 loaded.");
if (GetServerCFG("SPRINTTIMEPLUGIN", "SprintTime", "-1") == "-1")
SetServerCFG("SPRINTTIMEPLUGIN", "SprintTime", "4");
try
{
scr_player_sprintTime_var = Convert.ToInt32(GetServerCFG("SPRINTTIMEPLUGIN", "SprintTime", "4"));
}
catch (Exception e)
{
ServerPrint("SprintTime plugin loaded.");
}
}
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;
}
}
}
here's one i tried for player_sprintUnlimited:
Code:
using System;
using System.Runtime.InteropServices;
using System.Security;
using Addon;
//Compile with /unsafe
//And a reference to "addon/dist/addon.dll"
namespace unlimited_sprint
{
public class Program : CPlugin
{
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool WriteProcessMemory(IntPtr hProcess, int lpBaseAddress, byte[] lpBuffer, int nSize, out int lpNumberOfBytesWritten);
unsafe public override void OnServerLoad()
{
ServerPrint("Plugin: Unlimited Sprint loaded.");
int dwout = 0;
byte[] bytes = { 0x90, 0x90, 0x90, 0x90 };
byte[] bytes2 = { 0x90, 0x90, 0x90 };
byte[] bytes3 = { 0x90, 0x90, 0x90 };
WriteProcessMemory(((IntPtr)(-1)), 0x587CD34, bytes, bytes.Length, out dwout);
WriteProcessMemory(((IntPtr)(-1)), 0x587CD50, bytes2, bytes2.Length, out dwout);
WriteProcessMemory(((IntPtr)(-1)), 0x587CD60, bytes3, bytes3.Length, out dwout);
}
}
}
I will take a look at this tonight.
(02-25-2012, 00:35)crAyon Wrote: [ -> ]I will take a look at this tonight.
thanks crAyon
i know someone knows at least one of these two addresses
(02-28-2012, 17:20)blueberry9 Wrote: [ -> ]i know someone knows at least one of these two addresses
Who?