void lockIntDvarToValue(uint pointer, byte value)
{
uint _flag = 0x4; // First value is pointer to name ( const char* ), so dvar flag is at 0x4
uint _value = 0xB; // Default value is at 0x11
//Thanks To momo5502
// Get pointer to dvar
byte[] buffer = new byte[4];
GetMemory(pointer, ref buffer);
Array.Reverse(buffer);
uint dvar = BitConverter.ToUInt32(buffer, 0);
// Get current dvar flag
byte[] flag = new byte[2];
GetMemory(dvar + _flag, ref flag);
Array.Reverse(flag);
ushort shortFlag = BitConverter.ToUInt16(flag, 0);
// Check if dvar is already write protected
if ((shortFlag & 0x800) != 0x800)
{
shortFlag |= 0x800;
flag = BitConverter.GetBytes(shortFlag);
Array.Reverse(flag);
// Apply new dvarflag
SetMemory(dvar + _flag, flag);
}
// Apply new value
SetMemory(dvar + _value, new byte[] { value });
}
void forceHost()
{
lockIntDvarToValue(0x8AEE34, 0x1); // Lock 'party_minplayers' to 1/*change 0x01 to 0x06 for default*/
lockIntDvarToValue(0x8AEE40, 0x12); // Lock 'party_maxplayers' to 18 /*You can change 0x12, to 0x4 for 4 clients, or 6 for 6 clients and so on...*/
//Thanks To momo5502
}
void lockIntDvarToValue(uint pointer, byte value)
{
uint _flag = 0x4; // First value is pointer to name ( const char* ), so dvar flag is at 0x4
uint _value = 0xB; // Default value is at 0x11
//Thanks To momo5502
// Get pointer to dvar
byte[] buffer = new byte[4];
GetMemory(pointer, ref buffer);
Array.Reverse(buffer);
uint dvar = BitConverter.ToUInt32(buffer, 0);
// Get current dvar flag
byte[] flag = new byte[2];
GetMemory(dvar + _flag, ref flag);
Array.Reverse(flag);
ushort shortFlag = BitConverter.ToUInt16(flag, 0);
// Check if dvar is already write protected
if ((shortFlag & 0x800) != 0x800)
{
shortFlag |= 0x800;
flag = BitConverter.GetBytes(shortFlag);
Array.Reverse(flag);
// Apply new dvarflag
SetMemory(dvar + _flag, flag);
}
// Apply new value
SetMemory(dvar + _value, new byte[] { value });
}
void forceHost()
{
lockIntDvarToValue(0x8AEE34, 0x1); // Lock 'party_minplayers' to 1/*change 0x01 to 0x06 for default*/
lockIntDvarToValue(0x8AEE40, 0x12); // Lock 'party_maxplayers' to 18 /*You can change 0x12, to 0x4 for 4 clients, or 6 for 6 clients and so on...*/
//Thanks To momo5502
}
void lockIntDvarToValue(uint pointer, byte value)
{
uint _flag = 0x4; // First value is pointer to name ( const char* ), so dvar flag is at 0x4
uint _value = 0xB; // Default value is at 0x11
//Thanks To momo5502
// Get pointer to dvar
byte[] buffer = new byte[4];
GetMemory(pointer, ref buffer);
Array.Reverse(buffer);
uint dvar = BitConverter.ToUInt32(buffer, 0);
// Get current dvar flag
byte[] flag = new byte[2];
GetMemory(dvar + _flag, ref flag);
Array.Reverse(flag);
ushort shortFlag = BitConverter.ToUInt16(flag, 0);
// Check if dvar is already write protected
if ((shortFlag & 0x800) != 0x800)
{
shortFlag |= 0x800;
flag = BitConverter.GetBytes(shortFlag);
Array.Reverse(flag);
// Apply new dvarflag
SetMemory(dvar + _flag, flag);
}
// Apply new value
SetMemory(dvar + _value, new byte[] { value });
}
void forceHost()
{
lockIntDvarToValue(0x8AEE34, 0x1); // Lock 'party_minplayers' to 1/*change 0x01 to 0x06 for default*/
lockIntDvarToValue(0x8AEE40, 0x12); // Lock 'party_maxplayers' to 18 /*You can change 0x12, to 0x4 for 4 clients, or 6 for 6 clients and so on...*/
//Thanks To momo5502
}
Copyright © 2025, NextGenUpdate.
All Rights Reserved.