Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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, 0x48);
- }
- 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
- };
Comments
-
- You need to change addresses for the cod and T.U you need.
Add Comment
Please, Sign In to add comment