Post: [1.13][C++ Script] All Client Stats
05-02-2015, 07:41 AM #1
SC58
Former Staff
(adsbygoogle = window.adsbygoogle || []).push({});

Hello NGU

I have had this for while now and thought people would maybe wanna use this in there sprx menu or for making a auto lobby or something along the line for use of this. :p

This can be C&P to work on Ghosts as well!

You must login or register to view this content.

    
struct msg_t
{
int overflowed;
int readOnly;
char* data;
char* splitData;
int maxsize;
int cursize;
int splitSize;
int readcount;
int bit;
int lastEntityRef;
int targetLocalNetID;
int useZlib;
};

opd_s SV_SendServerCommandMsg_t = { 0x450BDC, TOC };
void(*SV_SendServerCommandMsg)(int clientNum, svscmd_type type, msg_t * msg) = (void(*)(int, svscmd_type, msg_t *))&SV_SendServerCommandMsg_t;
opd_s SV_GetClientPersistentDataBuffer_t = { 0x446FF8, TOC };
char *(*SV_GetClientPersistentDataBuffer)(int clientNum) = (char *(*)(int))&SV_GetClientPersistentDataBuffer_t;

int Client_t(int clientNum)
{
return *(int*)0x223A190 + (0x46480 * clientNum);
}

char * GetClientCurrentStatValue(int clientNum, int statIndex)
{
return SV_GetClientPersistentDataBuffer(clientNum) + statIndex;
}

msg_t msg;
char msgBuffer[0x400];

void AllocateMsg()
{
memset(msgBuffer, 0, 0x400);
memset(&msg, 0, 0x4Cool Man (aka Tustin);
}

void MSG_Init(msg_t *buf, char *data, int length)
{
buf->overflowed = 0;
buf->readOnly = 0;
buf->data = data;
buf->splitData = 0;
buf->maxsize = length;
buf->cursize = 0;
buf->splitSize = 0;
buf->readcount = 0;
buf->bit = 0;
buf->lastEntityRef = 0;
buf->targetLocalNetID = 0;
buf->useZlib = 0;
}

void MSG_WriteByte(msg_t *msg, int c)
{
if (msg->cursize >= msg->maxsize)
msg->overflowed = 1;
else
msg->data[msg->cursize++] = c;
}

void MSG_WriteLong(msg_t *msg, int c)
{
int32_t *dst;

if (msg->maxsize - msg->cursize < 4)
{
msg->overflowed = 1;
}
dst = (int32_t*)&msg->data[msg->cursize];
*dst = c;
msg->cursize += sizeof(int32_t);
}

void MSG_WriteData(msg_t *buf, const void *data, int lenght)
{
for(int i = 0; i < lenght; i++)
{
MSG_WriteByte(buf, ((char*)data)[i]);
}
}

void strncpyz(char *dest, const char *src, int destsize)
{
strncpy(dest, src, destsize - 1);
dest[destsize-1] = 0;
}

void MSG_WriteString(msg_t *sb, const char *s)
{
if (!s)
{
MSG_WriteData(sb, "", 1);
}
else
{
int l;
char string[0x400];

l = strlen(s);
if (l >= 0x400)
{
MSG_WriteData(sb, "", 1);
}
strncpyz(string, s, sizeof(string));
MSG_WriteData(sb, string, l + 1);
}
}

void MSG_WriteBits(msg_t *msg, int bits, int bitcount)
{
if (msg->maxsize - msg->cursize < 4)
{
msg->overflowed = 1;
}

if (bitcount)
{
for (int i = 0; bitcount != i; i++)
{
if (!(msg->bit & 7))
{
msg->bit = 8 * msg->cursize;
msg->data[msg->cursize] = 0;
msg->cursize++;
}

if (bits & 1)
msg->data[msg->bit >> 3] |= 1 << (msg->bit & 7);

msg->bit++;
bits >>= 1;
}
}
}

void MSG_WriteShort(msg_t *msg, int c)
{
signed short* dst;

if (msg->maxsize - msg->cursize < 2)
{
msg->overflowed = 1;
}
dst = (short*)&msg->data[msg->cursize];
*dst = c;
msg->cursize += sizeof(short);
}

void SetStatsInt(int clientNum, int statIndex, int value)
{
AllocateMsg();
MSG_Init(&msg, msgBuffer, 0x400);
MSG_WriteByte(&msg, 0x47);
MSG_WriteLong(&msg, statIndex);
MSG_WriteByte(&msg, sizeof(value));
MSG_WriteBits(&msg, value, 32);
SV_SendServerCommandMsg(Client_t(clientNum), SV_CMD_RELIABLE, &msg);
}

void SetStatsBytes(int clientNum, int statIndex, const void * value)
{
AllocateMsg();
MSG_Init(&msg, msgBuffer, 0x400);
MSG_WriteByte(&msg, 0x47);
MSG_WriteLong(&msg, statIndex);
MSG_WriteByte(&msg, sizeof(value));
MSG_WriteData(&msg, value, sizeof(value));
SV_SendServerCommandMsg(Client_t(clientNum), SV_CMD_RELIABLE, &msg);
}

void SetStatsString(int clientNum, int statIndex, const char * value)
{
AllocateMsg();
MSG_Init(&msg, msgBuffer, 0x400);
MSG_WriteByte(&msg, 0x47);
MSG_WriteLong(&msg, statIndex);
MSG_WriteByte(&msg, strlen(value));
MSG_WriteString(&msg, value);
SV_SendServerCommandMsg(Client_t(clientNum), SV_CMD_RELIABLE, &msg);
}

enum statIndex
{
Prestige = 0x9,
RankXP = 0xA5,
Score = 0xE2,
Kills = 0xB9,
Deaths = 0x91,
Wins = 0x10E,
Losses = 0xC1,
GamesPlayed = 0xA9,
Accuracy = 0x4D,
Class1Name = 0x4DE5
};



Hope you enjoy!
Last edited by SC58 ; 07-22-2016 at 07:35 AM.

The following 20 users say thank you to SC58 for this useful post:

/SneakerStreet/, AutoModder, CuTiXz, DecoyOcToPuS, Geo, ItsLollo1000, LBK, Loxy, Maty360414, oStankyModz, Reyz, Script Kiddie, seb5594, Smoky420, SonyBlack, basshead4ever, SyGnUs, TheLastHelmet, Tustin
05-06-2015, 02:51 PM #20
Originally posted by xX View Post
and that's why we have fuckers like him to do the job and us enjoy it, if you want to get technical. you butt hurt bro bro? pipe down, and get off the nuts, givin me a rash.


i aint going to start an argument with you on here as its not my thread... but you just said SC58 was a "fucker" and yet you say "get off my nuts" so it looks like your the only fucker here dont you think ?
05-06-2015, 04:47 PM #21
iDon
I’m too L33T
Originally posted by Connerg123 View Post
i aint going to start an argument with you on here as its not my thread... but you just said SC58 was a "fucker" and yet you say "get off my nuts" so it looks like your the only fucker here dont you think ?


fucker,people,coders all same shit to me. im not the one butthurt, so yea, in that case were all fuckers then. have a good day sir.
05-06-2015, 04:54 PM #22
CuTiXz
Climbing up the ladder
Thank you Cool Man (aka Tustin) EnzoTiphat
05-08-2015, 01:51 AM #23
ImHaXUnique
Space Ninja
What happened to only 1.11? :troll:

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo