Post: [C#][1.10] Spawning Solid Models
03-23-2014, 11:33 AM #1
VezahMoDz
Do a barrel roll!
(adsbygoogle = window.adsbygoogle || []).push({}); As Some people still dont know how to replace the offsets xD and I havent seen that Seb updated his Thread for 1.09 + i got asked a lot for it

Credits to Seb for the Original release :P

    
public static uint
G_SpawnAddress = 0x28EAB8,
G_SetModel = 0x28D6AC,
SP_Script_Model = 0x2843C0,
SV_UnlinkEntity = 0x329D10,
SV_LinkEntity = 0x329D90,
G_EntityAddress = 0xE04480,
SV_SetBrushModel = 0x4CE068;

public static Int32 G_Spawn()
{
return RPC.Call(G_SpawnAddress);
}
public static Int32 SpawnCrate(String MapName, Single X, Single Y, Single Z, Single Forward = 0, Single Yaw = 0, Single Pitch = 0)
{
return SpawnModel(MapName, "carepackage_friendly_iw6", X, Y, Z, Forward, Yaw, Pitch);
}
public static void MoveEnt(int ent, float x, float y, float z)
{
Byte[] buffer = new Byte[24];
ArrayBuilder Build = new ArrayBuilder(buffer);
Build.Write.SetFloat(0, x);
Build.Write.SetFloat(4, y);
Build.Write.SetFloat(8, z);
PS3.Extension.WriteBytes((UInt32)ent + 0x138, buffer);
}
public static Int32 SpawnModel(String MapName, String ModelName, Single X, Single Y, Single Z, Single Forward = 0, Single Yaw = 0, Single Pitch = 0)
{
Int32 Ent = G_Spawn();
Byte[] buffer = new Byte[24];
ArrayBuilder Build = new ArrayBuilder(buffer);
Build.Write.SetFloat(0, X);
Build.Write.SetFloat(4, Y);
Build.Write.SetFloat(8, Z);
Build.Write.SetFloat(12, Forward);
Build.Write.SetFloat(16, Yaw);
Build.Write.SetFloat(20, Pitch);
PS3.Extension.WriteBytes((UInt32)Ent + 0x138, buffer);
RPC.Call(G_SetModel, Ent, ModelName);
RPC.Call(SP_Script_Model, Ent);
MakeSolid(Ent, MapName);
return Ent;
}
public static void MakeSolid(Int32 Entity, String Mapname)
{
RPC.Call(SV_UnlinkEntity, Entity);
PS3.Extension.WriteByte((UInt32)Entity + 0x101, 4);
UInt32 Brush = 0;
switch (Mapname)
{
case "mp_prisonbreak":
Brush = G_Entity(0x3Cool Man (aka Tustin);
break;
case "mp_dart":
Brush = G_Entity(0x6B);
break;
case "mp_lonestar":
Brush = G_Entity(0x6A);
break;
case "mp_frag":
Brush = G_Entity(0x55);
break;
case "mp_snow":
Brush = G_Entity(0x56);
break;
case "mp_fahrenheit":
Brush = G_Entity(0xACool Man (aka Tustin);
break;
case "mp_hasima":
Brush = G_Entity(0x63);
break;
case "mp_warhawk":
Brush = G_Entity(0x45);
break;
case "mp_sovereign":
Brush = G_Entity(0x72);
break;
case "mp_zebra":
Brush = G_Entity(0x44);
break;
case "mp_skeleton":
Brush = G_Entity(0x3A);
break;
case "mp_chasm":
Brush = G_Entity(0x49);
break;
case "mp_flooded":
Brush = G_Entity(0x57);
break;
case "mp_strikezone":
Brush = G_Entity(0x57);
break;
}
PS3.Extension.WriteUInt32((UInt32)Entity + 0x8C, PS3.Extension.ReadUInt32(Brush + 0x8C));
RPC.Call(SV_SetBrushModel, Entity);
Or_Int32((UInt32)Entity + 0x11C, PS3.Extension.ReadInt32((UInt32)Entity + 0x11C));
RPC.Call(SV_LinkEntity, Entity);
}
public static UInt32 G_Entity(Int32 clientIndex)
{
return G_EntityAddress + ((UInt32)clientIndex * 0x280);
}

public static void Or_Int32(UInt32 address, Int32 input)
{
Int32 or = PS3.Extension.ReadInt32(address);
or |= input;
PS3.Extension.WriteInt32(address, or);
}


Also here's getOrigin for those who need it :
    
public static uint G_Client(int clientIndex, uint Mod)
{
return (0xF44480 + (UInt32)Mod) + ((uint)clientIndex * 0x3700);
}
public static float[] getOrigin(int clientIndex)
{
return ReadSingle(G_Client(clientIndex, 0x1C), 3);
}


And For those who dont have ReadSingle:
    
public static float[] ReadSingle(uint address, int length)
{
byte[] mem = PS3.Extension.ReadBytes(address, length * 4);
ReverseBytes(mem);
float[] numArray = new float[length];
for (int index = 0; index < length; ++index)
numArray[index] = BitConverter.ToSingle(mem, (length - 1 - index) * 4);
return numArray;
}

public static byte[] ReverseBytes(byte[] inArray)
{
Array.Reverse(inArray);
return inArray;
}
(adsbygoogle = window.adsbygoogle || []).push({});

The following 12 users say thank you to VezahMoDz for this useful post:

-SuperMan, $ticky, BuC-ShoTz, coreconfusion, D3skm, FusionIsDaName, ItsLollo1000, Mango_Knife, MrKiller261, Notorious, ThePaaqoHD, Fatality
03-24-2014, 10:29 PM #11
$ticky
Banned
Originally posted by RatchetBooty View Post
I meant to say G_Client Drack It'd be 0x1b because the g_client origin offset posted is one off :p


But it is truly stored + 0x1C from g_client, don't argue with me.
03-24-2014, 10:40 PM #12
RatchetBooty
Former Staff
Originally posted by ticky View Post
But it is truly stored + 0x1C from g_client, don't argue with me.


I know... I never said other wise. I'm just saying that origin offset posted is one off, it's suppose to be 0x00f43b1c but people posted it like: 0x00f43b1b so if anyone ever was to code something with it they'd think it would be 0x1b... but it truly is 0x1c.
04-03-2014, 05:14 PM #13
VezahMoDz
Do a barrel roll!
Updated to 1.10 ! :P Tell me if something is wrong, i just changed the Offsets and they might be wrong stare
04-04-2014, 03:42 PM #14
Mango_Knife
In my man cave
Originally posted by VezahMoDz View Post
As Some people still dont know how to replace the offsets xD and I havent seen that Seb updated his Thread for 1.09 + i got asked a lot for it

Credits to Seb for the Original release :P

    
public static uint
G_SpawnAddress = 0x28EAB8,
G_SetModel = 0x28D6AC,
SP_Script_Model = 0x2843C0,
SV_UnlinkEntity = 0x329D10,
SV_LinkEntity = 0x329D90,
G_EntityAddress = 0xE04480,
SV_SetBrushModel = 0x4CE068;

public static Int32 G_Spawn()
{
return RPC.Call(G_SpawnAddress);
}
public static Int32 SpawnCrate(String MapName, Single X, Single Y, Single Z, Single Forward = 0, Single Yaw = 0, Single Pitch = 0)
{
return SpawnModel(MapName, "carepackage_friendly_iw6", X, Y, Z, Forward, Yaw, Pitch);
}
public static void MoveEnt(int ent, float x, float y, float z)
{
Byte[] buffer = new Byte[24];
ArrayBuilder Build = new ArrayBuilder(buffer);
Build.Write.SetFloat(0, x);
Build.Write.SetFloat(4, y);
Build.Write.SetFloat(8, z);
PS3.Extension.WriteBytes((UInt32)ent + 0x138, buffer);
}
public static Int32 SpawnModel(String MapName, String ModelName, Single X, Single Y, Single Z, Single Forward = 0, Single Yaw = 0, Single Pitch = 0)
{
Int32 Ent = G_Spawn();
Byte[] buffer = new Byte[24];
ArrayBuilder Build = new ArrayBuilder(buffer);
Build.Write.SetFloat(0, X);
Build.Write.SetFloat(4, Y);
Build.Write.SetFloat(8, Z);
Build.Write.SetFloat(12, Forward);
Build.Write.SetFloat(16, Yaw);
Build.Write.SetFloat(20, Pitch);
PS3.Extension.WriteBytes((UInt32)Ent + 0x138, buffer);
RPC.Call(G_SetModel, Ent, ModelName);
RPC.Call(SP_Script_Model, Ent);
MakeSolid(Ent, MapName);
return Ent;
}
public static void MakeSolid(Int32 Entity, String Mapname)
{
RPC.Call(SV_UnlinkEntity, Entity);
PS3.Extension.WriteByte((UInt32)Entity + 0x101, 4);
UInt32 Brush = 0;
switch (Mapname)
{
case "mp_prisonbreak":
Brush = G_Entity(0x3Cool Man (aka Tustin);
break;
case "mp_dart":
Brush = G_Entity(0x6B);
break;
case "mp_lonestar":
Brush = G_Entity(0x6A);
break;
case "mp_frag":
Brush = G_Entity(0x55);
break;
case "mp_snow":
Brush = G_Entity(0x56);
break;
case "mp_fahrenheit":
Brush = G_Entity(0xACool Man (aka Tustin);
break;
case "mp_hasima":
Brush = G_Entity(0x63);
break;
case "mp_warhawk":
Brush = G_Entity(0x45);
break;
case "mp_sovereign":
Brush = G_Entity(0x72);
break;
case "mp_zebra":
Brush = G_Entity(0x44);
break;
case "mp_skeleton":
Brush = G_Entity(0x3A);
break;
case "mp_chasm":
Brush = G_Entity(0x49);
break;
case "mp_flooded":
Brush = G_Entity(0x57);
break;
case "mp_strikezone":
Brush = G_Entity(0x57);
break;
}
PS3.Extension.WriteUInt32((UInt32)Entity + 0x8C, PS3.Extension.ReadUInt32(Brush + 0x8C));
RPC.Call(SV_SetBrushModel, Entity);
Or_Int32((UInt32)Entity + 0x11C, PS3.Extension.ReadInt32((UInt32)Entity + 0x11C));
RPC.Call(SV_LinkEntity, Entity);
}
public static UInt32 G_Entity(Int32 clientIndex)
{
return G_EntityAddress + ((UInt32)clientIndex * 0x280);
}

public static void Or_Int32(UInt32 address, Int32 input)
{
Int32 or = PS3.Extension.ReadInt32(address);
or |= input;
PS3.Extension.WriteInt32(address, or);
}


Also here's getOrigin for those who need it :
    
public static uint G_Client(int clientIndex, uint Mod)
{
return (0xF44480 + (UInt32)Mod) + ((uint)clientIndex * 0x3700);
}
public static float[] getOrigin(int clientIndex)
{
return ReadSingle(G_Client(clientIndex, 0x1C), 3);
}


And For those who dont have ReadSingle:
    
public static float[] ReadSingle(uint address, int length)
{
byte[] mem = PS3.Extension.ReadBytes(address, length * 4);
ReverseBytes(mem);
float[] numArray = new float[length];
for (int index = 0; index < length; ++index)
numArray[index] = BitConverter.ToSingle(mem, (length - 1 - index) * 4);
return numArray;
}

public static byte[] ReverseBytes(byte[] inArray)
{
Array.Reverse(inArray);
return inArray;
}


Not work, freeze the ps3 everytime i spawn a model.
04-04-2014, 04:07 PM #15
VezahMoDz
Do a barrel roll!
Originally posted by Knife View Post
Not work, freeze the ps3 everytime i spawn a model.


hmm, i havent tested it i just changed the offsets stare it seems that IW patched some stuff as some other function wont work either ._.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo