Post: C# Spawn Solid Models & Stairs to Heaven
07-08-2014, 03:54 PM #1
GMTPS3
Do a barrel roll!
(adsbygoogle = window.adsbygoogle || []).push({}); This Community is realy fucked but i make my Release for People like: Mango_Knife, Seb, Bass_Haxor, xJoren Smile
Have Fun using this Smile

Big Thanks to Seb5594 Smile <3





    public static class Spawner
{
#region Read + Write

private static float[] ReadFloatLength(uint Offset, int Length)
{
byte[] buffer = new byte[Length * 4];
PS3.GetMemory(Offset, buffer);
ReverseBytes(buffer);
float[] Array = new float[Length];
for (int i = 0; i < Length; i++)
{
Array[i] = BitConverter.ToSingle(buffer, (Length - 1 - i) * 4);
}
return Array;
}

private static void WriteByte(uint Offset, byte Byte)
{
byte[] buffer = new byte[1];
buffer[0] = Byte;
PS3.SetMemory(Offset, buffer);
}

private static void WriteFloatArray(uint Offset, float[] Array)
{
byte[] buffer = new byte[Array.Length * 4];
for (int Lenght = 0; Lenght < Array.Length; Lenght++)
{
ReverseBytes(BitConverter.GetBytes(Array[Lenght])).CopyTo(buffer, Lenght * 4);
}
PS3.SetMemory(Offset, buffer);
}

private static void WriteInt(uint Offset, int Value)
{
PS3.SetMemory(Offset, ReverseBytes(BitConverter.GetBytes(Value)));
}

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

#endregion

public enum Bush : uint//I will seach for these and Release them Smile
{
CarePackage = 2,//com_plasticcase_friendly
Bomb = 3,//com_bomb_objective
Barrel = 11,//com_barrel_benzin
}

public static uint SolidModel(float[] Origin, float[] Angles, string Model = "com_plasticcase_friendly", Bush Index = Bush.CarePackage)
{
uint Entity = (uint)RPC.Call(0x01C058C);//G_Spawn
WriteFloatArray(Entity + 0x138, Origin);//Position
WriteFloatArray(Entity + 0x144, Angles);//Orientation
RPC.Call(0x01BEF5C, Entity, Model);//G_SetModel
RPC.Call(0x01B6F68, Entity); //SP_script_model
RPC.Call(0x002377B8, Entity);//SV_UnlinkEntity
WriteByte(Entity + 0x101, 4);
WriteInt(Entity + 0x8C, (int)Index);
RPC.Call(0x0022925C, Entity);//SV_SetBrushModel
RPC.Call(0x00237848, Entity);//SV_LinkEntity
return Entity;
}

public static float[] GetOrigin(uint Client)
{
return ReadFloatLength(0x110a29c + (Client * 0x3980), 3);
}

public static float[] GetAngles(uint Client)
{
return ReadFloatLength(0x110a3d8 + (Client * 0x3980), 3);
}

public static float[] AnglesToForward(float[] Origin, float[] Angles, uint diff)
{
float num = ((float)Math.Sin((Angles[0] * Math.PI) / 180)) * diff;
float num1 = (float)Math.Sqrt(((diff * diff) - (num * num)));
float num2 = ((float)Math.Sin((Angles[1] * Math.PI) / 180)) * num1;
float num3 = ((float)Math.Cos((Angles[1] * Math.PI) / 180)) * num1;
return new float[] { Origin[0] + num3, Origin[1] + num2, Origin[2] - num };
}

private static uint[] STHIndexes;
public static void StairsToHeaven(uint Client, uint Stairs = 41, int Time = 200)//When you use STH you can Freeze dont make it to Fast 200 is Good time and dont to Much Staris 41 Stairs = 2 Rounds Smile
{
uint[] Index = new uint[Stairs];
float[] Origin = GetOrigin(Client);
float[] Angles = new float[3];
for (uint i = 0; i < Stairs; )
{
Index[i] = SolidModel(AnglesToForward(Origin, Angles, 60), Angles);
Angles[1] += 18;
Origin[2] += 10;
i++;
Thread.Sleep(Time);
}
STHIndexes = Index;
}

public static void RemoveSTH()
{
for (uint i = 0; i < STHIndexes.Length; i++)
PS3.SetMemory(STHIndexes[i] + 0xF, new byte[]{ 0x2});
}
}


Spawn a Create:
    
uint Client = Put Client Number here!;
float[] Origin = Spawner.AnglesToForward(Spawner.GetOrigin(Client), Spawner.GetAngles(Client),80);
Origin[2] += 40;//
Spawner.SolidModel(Origin, new float[] { 0, 0, 0 });


Spawn the Stairs to Heaven:
    
Spawner.StairsToHeaven(Put Client Number here!);


Remove the STH:
    Spawner.RemoveSTH();
Last edited by GMTPS3 ; 07-12-2014 at 06:57 AM.

The following 24 users say thank you to GMTPS3 for this useful post:

-JM-, ▶DaOriginal209◀, Akaipwn, BaSs_HaXoR, FusionIsDaName, iifire, Joren, jwm614, kiwi_modz, LaRip8, Mango_Knife, moxl, nay1995, noobRus, RaGE_LoLo69, RTE, seanhellen, Swaqq, Laser, Fatality, xHostModer, xPAQz, xSyntheticPatch
07-13-2014, 04:50 PM #20
Mango_Knife
In my man cave
O Head model?
I founded it ages ago :p
And weapon model :p
07-13-2014, 10:19 PM #21
GMTPS3
Do a barrel roll!
Originally posted by mrdarkblue View Post
Is it possible to replace bullet models with this method? I was thinking How About replacing model from c4 with à chicken, explosive chickens Happy

Its working i already find it haha
07-13-2014, 10:20 PM #22
GMTPS3
Do a barrel roll!
Originally posted by Knife View Post
O Head model?
I founded it ages ago :p
And weapon model :p

Thats is the Riot Shield Model and its not the Weapon Model what you mean its the Viewmodel <3
07-14-2014, 10:11 AM #23
makeabce
I defeated!
Originally posted by GMTPS3 View Post
This Community is realy fucked but i make my Release for People like: Mango_Knife, Seb, Bass_Haxor, xJoren Smile
Have Fun using this Smile

Big Thanks to Seb5594 Smile <3





    public static class Spawner
{
#region Read + Write

private static float[] ReadFloatLength(uint Offset, int Length)
{
byte[] buffer = new byte[Length * 4];
PS3.GetMemory(Offset, buffer);
ReverseBytes(buffer);
float[] Array = new float[Length];
for (int i = 0; i < Length; i++)
{
Array[i] = BitConverter.ToSingle(buffer, (Length - 1 - i) * 4);
}
return Array;
}

private static void WriteByte(uint Offset, byte Byte)
{
byte[] buffer = new byte[1];
buffer[0] = Byte;
PS3.SetMemory(Offset, buffer);
}

private static void WriteFloatArray(uint Offset, float[] Array)
{
byte[] buffer = new byte[Array.Length * 4];
for (int Lenght = 0; Lenght < Array.Length; Lenght++)
{
ReverseBytes(BitConverter.GetBytes(Array[Lenght])).CopyTo(buffer, Lenght * 4);
}
PS3.SetMemory(Offset, buffer);
}

private static void WriteInt(uint Offset, int Value)
{
PS3.SetMemory(Offset, ReverseBytes(BitConverter.GetBytes(Value)));
}

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

#endregion

public enum Bush : uint//I will seach for these and Release them Smile
{
CarePackage = 2,//com_plasticcase_friendly
Bomb = 3,//com_bomb_objective
Barrel = 11,//com_barrel_benzin
}

public static uint SolidModel(float[] Origin, float[] Angles, string Model = "com_plasticcase_friendly", Bush Index = Bush.CarePackage)
{
uint Entity = (uint)RPC.Call(0x01C058C);//G_Spawn
WriteFloatArray(Entity + 0x138, Origin);//Position
WriteFloatArray(Entity + 0x144, Angles);//Orientation
RPC.Call(0x01BEF5C, Entity, Model);//G_SetModel
RPC.Call(0x01B6F68, Entity); //SP_script_model
RPC.Call(0x002377B8, Entity);//SV_UnlinkEntity
WriteByte(Entity + 0x101, 4);
WriteInt(Entity + 0x8C, (int)Index);
RPC.Call(0x0022925C, Entity);//SV_SetBrushModel
RPC.Call(0x00237848, Entity);//SV_LinkEntity
return Entity;
}

public static float[] GetOrigin(uint Client)
{
return ReadFloatLength(0x110a29c + (Client * 0x3980), 3);
}

public static float[] GetAngles(uint Client)
{
return ReadFloatLength(0x110a3d8 + (Client * 0x3980), 3);
}

public static float[] AnglesToForward(float[] Origin, float[] Angles, uint diff)
{
float num = ((float)Math.Sin((Angles[0] * Math.PI) / 180)) * diff;
float num1 = (float)Math.Sqrt(((diff * diff) - (num * num)));
float num2 = ((float)Math.Sin((Angles[1] * Math.PI) / 180)) * num1;
float num3 = ((float)Math.Cos((Angles[1] * Math.PI) / 180)) * num1;
return new float[] { Origin[0] + num3, Origin[1] + num2, Origin[2] - num };
}

private static uint[] STHIndexes;
public static void StairsToHeaven(uint Client, uint Stairs = 41, int Time = 200)//When you use STH you can Freeze dont make it to Fast 200 is Good time and dont to Much Staris 41 Stairs = 2 Rounds Smile
{
uint[] Index = new uint[Stairs];
float[] Origin = GetOrigin(Client);
float[] Angles = new float[3];
for (uint i = 0; i < Stairs; )
{
Index[i] = SolidModel(AnglesToForward(Origin, Angles, 60), Angles);
Angles[1] += 18;
Origin[2] += 10;
i++;
Thread.Sleep(Time);
}
STHIndexes = Index;
}

public static void RemoveSTH()
{
for (uint i = 0; i < STHIndexes.Length; i++)
PS3.SetMemory(STHIndexes[i] + 0xF, new byte[]{ 0x2});
}
}


Spawn a Create:
    
uint Client = Put Client Number here!;
float[] Origin = Spawner.AnglesToForward(Spawner.GetOrigin(Client), Spawner.GetAngles(Client),80);
Origin[2] += 40;//
Spawner.SolidModel(Origin, new float[] { 0, 0, 0 });


Spawn the Stairs to Heaven:
    
Spawner.StairsToHeaven(Put Client Number here!);


Remove the STH:
    Spawner.RemoveSTH();


Btw, do you spawn the models when shooting? Or do i need to manually type the positions and spawn them with clicking a button? And is there any way to get / save current positions,like for making custom maps?
Last edited by makeabce ; 07-14-2014 at 10:13 AM.
07-14-2014, 02:06 PM #24
nay1995
The Master
Originally posted by makeabce View Post
Btw, do you spawn the models when shooting? Or do i need to manually type the positions and spawn them with clicking a button? And is there any way to get / save current positions,like for making custom maps?


for shooting models do this:

First you will need key_isdown:
    
public string Key_IsDown(uint ClientNum)
{

byte[] But = new byte[3];

GetMemory(0x110D5E1 + (0x3980 * ClientNum), But);

string mystring = null;
mystring = BitConverter.ToString(But);
string result = mystring.Replace("-", "");
string result1 = result.Replace(" ", "");


string key = result1;
string KeyPressed = "";
if (key == "000000")
{
KeyPressed = "NONE";
}
else if (key == "000400")
{
KeyPressed = "X";
}
else if (key == "000020")
{
KeyPressed = "[]";
}
else if (key == "000200")
{
KeyPressed = "Crouch";
}
else if (key == "000100")
{
KeyPressed = "Prone";
}
else if (key == "000400")
{
KeyPressed = "X";
}
else if (key == "000004")
{
KeyPressed = "R3";
}
else if (key == "002002")
{
KeyPressed = "L3";
}
else if (key == "004000")
{
KeyPressed = "R2";
}
else if (key == "008000")
{
KeyPressed = "L2";
}
else if (key == "080800")
{
KeyPressed = "L1";
}
else if (key == "000001")
{
KeyPressed = "R1";
}
else if (key == "000220")
{
KeyPressed = "Crouch + []";
}
else if (key == "000120")
{
KeyPressed = "Prone + []";
}
else if (key == "002006")
{
KeyPressed = "R3 + L3";
}
else if (key == "000204")
{
KeyPressed = "R3";
}
else if (key == "002202")
{
KeyPressed = "L3";
}
else if (key == "004200")
{
KeyPressed = "R2";
}
else if (key == "008200")
{
KeyPressed = "L2";
}
else if (key == "004100")
{
KeyPressed = "Prone + R2";
}
else if (key == "008100")
{
KeyPressed = "Prone + L2";
}
else if (key == "004200")
{
KeyPressed = "Crouch + R2";
}
else if (key == "008400")
{
KeyPressed = "Crouch + L2";
}
else if (key == "000201")
{
KeyPressed = "Crouch + R1";
}
else if (key == "081000")
{
KeyPressed = "Crouch + L1";
}
else if (key == "000101")
{
KeyPressed = "Prone + R1";
}
else if (key == "080900")
{
KeyPressed = "Prone + L1";
}
else if (key == "00C100")
{
KeyPressed = "Prone + R2 + L2";
}
else if (key == "00C200")
{
KeyPressed = "Crouch + R2 + L2";
}
else if (key == "00C000")
{
KeyPressed = "R2 + L2";
}
else if (key == "000104")
{
KeyPressed = "Prone + R3";
}
else if (key == "000204")
{
KeyPressed = "Crouch + R3";
}
else
{
KeyPressed = key;
}

return KeyPressed;
}


then make a timer and put this in it:
    
for (uint i = 0; i < 17; i++)
{
switch (Key_IsDown(i))
{
case "R1":
playerModel(i);
break;
}
}


Then finally put this somewhere:
    
public void playerModel(uint Client)
{
float[] Origin = entity.AnglesToForward(entity.GetOrigin(Client), entity.GetAngles(Client), 80);
Origin[2] += 40;
entity.SolidModel(Origin, new float[] { 0, 0, 0 });
iPrintln((int)Client, "Model Spawned");
}

The following user thanked nay1995 for this useful post:

GMTPS3
07-14-2014, 02:09 PM #25
nay1995
The Master
also for anyone wanting to delete all models that have been spawned this is what i do.

put these two variables in the form or class:
    
public static uint[] mods = new uint[0x280];
public static int num = -1;


then change the current solid model function for this:
    
public static uint SolidModel(float[] Origin, float[] Angles, string Model = "com_plasticcase_friendly", Bush Index = Bush.CarePackage)
{
num++;
uint Entity = (uint)RPC2.Call(0x01C058C);//G_Spawn
WriteFloatArray(Entity + 0x138, Origin);//Position
WriteFloatArray(Entity + 0x144, Angles);//Orientation
RPC2.Call(0x01BEF5C, Entity, Model);//G_SetModel
RPC2.Call(0x01B6F68, Entity); //SP_script_model
RPC2.Call(0x002377B8, Entity);//SV_UnlinkEntity
WriteByte(Entity + 0x101, 4);
WriteInt(Entity + 0x8C, (int)Index);
RPC2.Call(0x0022925C, Entity);//SV_SetBrushModel
RPC2.Call(0x00237848, Entity);//SV_LinkEntity
mods[num] = Entity;

if (num >= 633)
{
RemoveObjects(); // if to many objects on the map, removes them all
num = -1;
}

return Entity;
}


then finally call this when you want to remove all spawned models:
    
public static void RemoveObjects()
{
for (uint i = 0; i < mods.Length; i++)
PS3.SetMemory(mods[i], new byte[0x280]);
}

The following 2 users say thank you to nay1995 for this useful post:

jwm614, kiwi_modz
07-15-2014, 05:25 AM #26
kiwi_modz
I defeated!
Originally posted by nay1995 View Post
also for anyone wanting to delete all models that have been spawned this is what i do.

put these two variables in the form or class:
    
public static uint[] mods = new uint[0x280];
public static int num = -1;


then change the current solid model function for this:
    
public static uint SolidModel(float[] Origin, float[] Angles, string Model = "com_plasticcase_friendly", Bush Index = Bush.CarePackage)
{
num++;
uint Entity = (uint)RPC2.Call(0x01C058C);//G_Spawn
WriteFloatArray(Entity + 0x138, Origin);//Position
WriteFloatArray(Entity + 0x144, Angles);//Orientation
RPC2.Call(0x01BEF5C, Entity, Model);//G_SetModel
RPC2.Call(0x01B6F68, Entity); //SP_script_model
RPC2.Call(0x002377B8, Entity);//SV_UnlinkEntity
WriteByte(Entity + 0x101, 4);
WriteInt(Entity + 0x8C, (int)Index);
RPC2.Call(0x0022925C, Entity);//SV_SetBrushModel
RPC2.Call(0x00237848, Entity);//SV_LinkEntity
mods[num] = Entity;

if (num >= 633)
{
RemoveObjects(); // if to many objects on the map, removes them all
num = -1;
}

return Entity;
}


then finally call this when you want to remove all spawned models:
    
public static void RemoveObjects()
{
for (uint i = 0; i < mods.Length; i++)
PS3.SetMemory(mods[i], new byte[0x280]);
}


Good tut. Why is it once I remove everything the game freezes when the games over / fast restart...
07-15-2014, 03:40 PM #27
jwm614
NextGenUpdate Elite
Originally posted by ResistTheKiwi View Post
Good tut. Why is it once I remove everything the game freezes when the games over / fast restart...


Same problem here I'm mess wit it wen I get off work

I made a remove last entity an it works great

    public static void RemoveAll()
{

for (uint i = 0; i < mods.Length; i++)
PS3.SetMemory(mods[i] + 0xF, new byte[] { 0x2 });
}


this works no more freeze on restart
Last edited by jwm614 ; 07-15-2014 at 10:55 PM.

The following 3 users say thank you to jwm614 for this useful post:

kiwi_modz, moxl, nay1995
07-16-2014, 06:42 AM #28
kiwi_modz
I defeated!
Originally posted by jwm614 View Post
Same problem here I'm mess wit it wen I get off work

I made a remove last entity an it works great

    public static void RemoveAll()
{

for (uint i = 0; i < mods.Length; i++)
PS3.SetMemory(mods[i] + 0xF, new byte[] { 0x2 });
}


this works no more freeze on restart


Thanks bro. Will give it ago in a few days when I have got time Smile thanks. And also nice work on your latest bunker tool Smile I'll also be using it when I'm free.

The following user thanked kiwi_modz for this useful post:

jwm614

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo