Post: [1.24/c++]Script Thread
08-11-2014, 09:03 PM #1
(adsbygoogle = window.adsbygoogle || []).push({});
It seems no one else is gonna do it so I will take the pleasure Smile Hopefully this gets some things in motion, I will try my best to update this if you want anything added post it below.

TOC = 0x0072DCE8 //thanks to seb

SV_GameSendServerCommand
    
opd_s SV = { 0x228FA8, TOC };void(*SV_GSSC)(int client, int type, char* cmd) = (void(*)(int, int, char*))&SV;


Some useful SV_GSSC functions
    
void iPrintlnBold(int client, char* text)
{
char buf[100];
strcpy(buf, "c \"");
strcat(buf, text);
SV_GSSC(client, 0, buf);
}

void iPrintln(int client, char* text)
{
char buf[100];
strcpy(buf, "f \"");
strcat(buf, text);
SV_GSSC(client, 0, buf);
}

void SetVision(int client, char* Vision)
{
char buf[100];
strcpy(buf, "j \"");
strcat(buf, Vision);
SV_GSSC(client, 0, buf);
}

void SetFOV(int client, char* fov)
{
char buf[100];
strcpy(buf, "q cg_fov \"");
strcat(buf, fov);
SV_GSSC(client, 0, buf);
}

void KickWithMessage(int client, char* Message)
{
char buf[100];
strcpy(buf, "r \"");
strcat(buf, Message);
SV_GSSC(client, 0, buf);
}


cl_InGame
    
bool InGame()
{
if (*(char*)0x018d4c64 != 1)
return false;
return true;
}


sprintf
    

opd_s Com_sprintf_t = { 0x00298874, TOC };
int(*Com_sprintf)(char *dest, int size, const char *fmt, ...) = (int(*)(char *, int, char const *, ...))&Com_sprintf_t;




G_Client
    

int G_Client(int clientIndex, int Mod = 0x00)
{
return 0x110A280 + (0x3980 * clientIndex) + Mod;
}



Keyboard
    
char* KeyBoard(char* Title)
{
opd_s key = { 0x026F5BC, TOC };
void(*Run)(int, char*, char*, int, int, int) = (void(*)(int, char*, char*, int, int, int))&key;
Run(0, Title, "", 40, 0x72DCE8, 0x7239A0);
while (PS3::ReadInt32(0x73145C) != 0)
{
continue;
}
return PS3::ReadString(0x2380E22);
}//I know you can use the one in the cell but it crashes the game for me :Fa:


Spawn solid models
    
opd_s G_SetModel_t = { 0x01BEF5C, TOC };
void(*G_SetModel)(int clientIndex, const char* Model) = (void(*)(int, const char*))&G_SetModel_t;

opd_s G_Spawn_t = { 0x01C058C, TOC };
int(* G_Spawn)() = (int(*)())&G_Spawn_t;

opd_s SV_SetBrushModel_t = { 0x0022925C, TOC };
void(*SV_SetBrushModel)(int Entity) = (void(*)(int))&SV_SetBrushModel_t;

opd_s SP_Script_Model_t = { 0x01B6F68, TOC };
void(*SP_Script_Model)(int Entity) = (void(*)(int))&SP_Script_Model_t;

opd_s SV_UnlinkEntity_t = { 0x002377B8, TOC };
void(*SV_UnlinkEntity)(int Entity) = (void(*)(int))&SV_UnlinkEntity_t;

opd_s SV_linkEntity_t = { 0x00237848, TOC };
void(*SV_linkEntity)(int Entity) = (void(*)(int))&SV_linkEntity_t;

int SpawnEntity( float* Origin, float* Angles, const char* Model = "com_plasticcase_friendly", int Index = 2)
{
int Entity = (int)G_Spawn();
PS3::WriteFloat(Entity + 0x138, Origin, 3);
PS3::WriteFloat(Entity + 0x144, Angles, 3);
G_SetModel(Entity, Model);
SP_Script_Model(Entity);
SV_UnlinkEntity(Entity);
*(char*)(Entity + 0x101) = 4;
*(int*)(Entity + 0x8C) = Index;
SV_SetBrushModel(Entity);
SV_linkEntity(Entity);
return Entity;
}


FreezeClient
    
void FreezeClient(int clientIndex)
{
if(!Client[clientIndex].Frozen)
{
*(char*)((clientIndex * 0x3980) + Offsets::FreezeClient) = 0x3F;
iPrintlnBold(clientIndex, "Freeze bitch!");
Client[Client[clientIndex].ClientSelected].Frozen = true;
}
else
{
*(char*)((clientIndex * 0x3980) + Offsets::FreezeClient) = 0x00;
iPrintlnBold(clientIndex, "Move along ******!");
Client[Client[clientIndex].ClientSelected].Frozen = false;
}
}


kick with message
    
void KickWithMessage(int client, const char* Message)
{
opd_s kick = { 0x00223BD0, TOC };
int(*kickwmessage)(int client, const char* message) = (int(*)(int, const char*))&kick;
kickwmessage(client, Message);
}


Set Model
    
void SetModel(int client, const char* Model)
{
opd_s setmodel = {0x1BEF5C, TOC};
void(*G_SetModel)(int client, const char* model) = (void(*)(int, const char*))&setmodel;
G_SetModel((0xFCA280 + (client * 0x280)), Model);
}


No clip
    
void NoClip(int client)
{
if(!Client[client].NoClip)
{
*(char*)(0x0110D87F + (0x3980 * client)) = 0x02;
iPrintln(client, "NoClip: [ ^2Enabled ^7]");
Client[client].NoClip = true;
}
else
{
*(char*)(0x0110D87F + (0x3980 * client)) = 0x00;
iPrintln(client, "NoClip: [ ^1Disabled ^7]");
Client[client].NoClip = false;
}
}


GodMode
    
void GodMode(int client)
{
if(!Client[client].GodMode)
{
*(char*)(0x0FCA41E + (0x280 * client)) = 0xFF;
iPrintln(client, "Godmode: [ ^2Enabled ^7]");
Client[client].GodMode = true;
}
else
{
*(char*)(0x0FCA41E + (0x280 * client)) = 0x00;
iPrintln(client, "Godmode: [ ^1Disabled ^7]");
Client[client].GodMode = false;
}
}


PlayFX
    
opd_s index = { 0x1BEB6C, TOC };
int(*GetFXIndex)(const char* effect) = (int(*)(const char*))&index;

opd_s temp = { 0x1C0B7C, TOC };
int (*g_temp)(float* Origin, int effectIndex) = (int(*)(float*, int))&temp;

int PlayFX(float* Origin, char* Effect)
{
int EffectIndex = GetFXIndex(Effect);
int ent = g_temp(Origin, 0x56);
if (ent == 0)
return 0;
*(int*)(ent + 0xA0) = EffectIndex;
return ent;
}


BG_FindWeaponIndexForName
    
int BG_FindWeaponIndexForName(const char* Weapon)
{
opd_s GWI = { 0x3CFD0, TOC };
void(*ReturnIndex)(int buffer, const char* Weapon) = (void(*)(int, const char*))&GWI;
ReturnIndex(0x1100000, Weapon);
return *(int*)0x1100000;
}


Dvar_GetString
    
opd_s gs = { 0x002911A8, TOC };
const char*(*Dvar_GetString)(const char* Dvar) = (const char*(*)(const char*))&gs;


Get Mapname, HostName and GameMode
    
const char* MapName()
{
return Dvar_GetString("ui_mapname");
}

const char* GameMode()
{
return Dvar_GetString("ui_gametype");
}

const char* HostName()
{
return Dvar_GetString("sv_hostname");
}


G_GivePlayerWeapon + extras Smile
    
void GiveWeapon(int clientIndex, const char* Weapon, int Akimbo = 0)
{
int Index = BG_FindWeaponIndexForName(Weapon);
G_GivePlayerWeapon((int*)G_Client(clientIndex), Index, Akimbo);
Add_Ammo((int*)G_Entity(clientIndex), Index, 0, 9999, 1);
char buf[100];
Com_sprintf(buf, 100, "a %i \"", Index, "\"");
SV_GSSC(clientIndex, buf);
}


Useful Links
You must login or register to view this content.
You must login or register to view this content.
Last edited by OLDSCHOOLMODZHD ; 10-12-2014 at 05:46 PM. Reason: updated

The following 25 users say thank you to OLDSCHOOLMODZHD for this useful post:

-JM-, Absolute Zero, Boliberrys, EvilFerg, Freezy :D, Geo, ItsLollo1000, JackMods-, Jim Halpert, Joren, Krxxl, LaRip8, MrBeastMods, oStankyModz, SaberNGU, seanhellen, ShutTheCrunchUp, StonedYoda, Swaqq, TheGreenPlanet, Laser, xProvXKiller, zRayz-
03-14-2015, 03:45 AM #20
Originally posted by StonedYoda View Post
Can someone please give me the ReadInt32 function? thx


int ReadInt32(int add)
{
return *(int*)(add);
}

Easy af i wrote that in like 3 seconds its that easy

The following user thanked Connerg123 for this useful post:

StonedYoda
03-14-2015, 03:48 AM #21
Originally posted by FusionIsDaName View Post
    double cos1(double x)
{
double t = -x*x / 2;
double sum = 1 + t;
for (int i = 2; i<20; ++i)
{
t *= -x*x / (2 * i*(2 * i - 1));
sum += t;
}
return sum;
}
double sin1(double x)
{
double term = x;
double sum = x;
for (int n = 1; n<10; ++n)
{
term *= x*x / (2 * n * (2 * n + 1));
sum += n % 2 ? -term : term;
}
return sum;
}
struct Vec3
{
float x, y, z;
};
struct Vec4
{
float pitch, yaw, roll;
};

float* AnglesToFoward(Vec4 Angles, Vec3 Origin, float diff = 200)
{
float PI = 3.1415926535897931;
float num = ((float)sin1((Angles.pitch * PI) / 180)) * diff;
float num1 = (float)sqrt(((diff * diff) - (num * num)));
float num2 = ((float)sin1((Angles.yaw * PI) / 180)) * num1;
float num3 = ((float)cos1((Angles.yaw * PI) / 180)) * num1;
float forward[] = { Origin.x + num3, Origin.y + num2, Origin.z - num };
return forward;
}


Credits to bitwise, You forgot that bit ... , Im sooooo drunk right now so take note lmao

The following user thanked Connerg123 for this useful post:

FusionIsDaName
03-21-2015, 09:22 PM #22
-JM-
Space Ninja
Originally posted by FusionIsDaName View Post
    double cos1(double x)
{
double t = -x*x / 2;
double sum = 1 + t;
for (int i = 2; i<20; ++i)
{
t *= -x*x / (2 * i*(2 * i - 1));
sum += t;
}
return sum;
}
double sin1(double x)
{
double term = x;
double sum = x;
for (int n = 1; n<10; ++n)
{
term *= x*x / (2 * n * (2 * n + 1));
sum += n % 2 ? -term : term;
}
return sum;
}
struct Vec3
{
float x, y, z;
};
struct Vec4
{
float pitch, yaw, roll;
};

float* AnglesToFoward(Vec4 Angles, Vec3 Origin, float diff = 200)
{
float PI = 3.1415926535897931;
float num = ((float)sin1((Angles.pitch * PI) / 180)) * diff;
float num1 = (float)sqrt(((diff * diff) - (num * num)));
float num2 = ((float)sin1((Angles.yaw * PI) / 180)) * num1;
float num3 = ((float)cos1((Angles.yaw * PI) / 180)) * num1;
float forward[] = { Origin.x + num3, Origin.y + num2, Origin.z - num };
return forward;
}


STFU I LOVE YOU Winky Winky no homo
05-12-2015, 02:50 AM #23
me gusta
05-12-2015, 07:20 PM #24
Haha, thank you im a noob just learning C++ Smile
05-12-2015, 07:31 PM #25
FRINZ
I’m too L33T
no ur not

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo