17.02.2018, 14:20
Код:
SetPlayerDisableKeysSync(playerid, (KEY_FIRE & KEY_SPRINT & KEY_CROUCH));
SetPlayerDisableKeysSync(playerid, (KEY_FIRE & KEY_SPRINT & KEY_CROUCH));
silent aim sends to server fake bullet data, you need check coords in OnPlayerWeaponShot to fix that cheat.
|
new lLabelID, lColorID, Float:lX, Float:lY, Float:lZ, Float:lDrawDistance, lUseLOS, lPlayerID, lVehicleID; BS_ReadValue ( bs, PR_UINT16, lLabelID, PR_INT32, lColorID, PR_FLOAT, lX, PR_FLOAT, lY, PR_FLOAT, lZ, PR_FLOAT, lDrawDistance, PR_BOOL, lUseLOS, PR_UINT16, lPlayerID, PR_UINT16, lVehicleID ); SendClientMessageEx(lString, 200, playerid, -1, "label [%d %d %.1f %.1f %.1f %.2f %d %d %d]", lLabelID, lColorID, lX, lY, lZ, lDrawDistance, lUseLOS, lPlayerID, lVehicleID);
[18:06:04] label [1025 16777215 0.0 0.0 0.0 15.00 0 -253 9983]
void ScrCreate3DTextLabel(RPCParameters *rpcParams) { PCHAR Data = reinterpret_cast<PCHAR>(rpcParams->input); int iBitLength = rpcParams->numberOfBitsOfData; RakNet::BitStream bsData((unsigned char *)Data,(iBitLength/8)+1,false); WORD ID; CHAR Text[256]; DWORD dwColor; FLOAT vecPos[3]; FLOAT DrawDistance; BYTE UseLOS; WORD PlayerID; WORD VehicleID; bsData.Read((WORD)ID); bsData.Read((DWORD)dwColor); bsData.Read((FLOAT)vecPos[0]); bsData.Read((FLOAT)vecPos[1]); bsData.Read((FLOAT)vecPos[2]); bsData.Read((FLOAT)DrawDistance); bsData.Read((BYTE)UseLOS); bsData.Read((WORD)PlayerID); bsData.Read((WORD)VehicleID); stringCompressor->DecodeString(Text, 256, &bsData); if(settings.uiTextLabelsLogging != 0) { char szCreate3DTextLabelAlert[256]; sprintf_s(szCreate3DTextLabelAlert, sizeof(szCreate3DTextLabelAlert), "[TEXTLABEL] %d - %s (%X, %.3f, %.3f, %.3f, %.2f, %i, %d, %d)", ID, Text, dwColor, vecPos[0], vecPos[1], vecPos[2], DrawDistance, UseLOS, PlayerID, VehicleID); Log(szCreate3DTextLabelAlert); } }
LE: I don't get why don't you simply hook `Create(Player)3DTextLabel` function instead of going so lowlevel. |
//RPCs
#define RPC_ServerJoin (137)
#define RPC_ServerQuit (138)
ShowPlayerOnScoreBoard(playerid, toplayerid, bool:show)
{
if(!IsPlayerConnected(playerid) || !IsPlayerConnected(toplayerid)) return 0;
new BitStream:bs = BS_New(), name[MAX_PLAYER_NAME];
BS_WriteValue(
bs,
PR_UINT16, playerid,
PR_UINT8, 1
);
BS_RPC(bs, toplayerid, RPC_ServerQuit);
BS_Reset(bs);
GetPlayerName(playerid, name, sizeof(name));
BS_WriteValue(
bs,
PR_UINT16, playerid,
PR_INT32, 0,
PR_UINT8, !show,
PR_UINT8, strlen(name),
PR_STRING, name
);
BS_RPC(bs, toplayerid, RPC_ServerJoin);
BS_Delete(bs);
return 1;
}
How do I read packets data? Like how would I know that data this packet has, what type of bits(8,16, etc).
Pretty confused, I would like to print out a packet example; const RCON_CALL = 201; This packet is called when player enter's /rcon So how do I read data for it? I would like to know how can I extract RPC id's. |
ID_RCON_COMMAND (ID: 201) text_length, cmdtext
Here you go most of them: https://sampforum.blast.hk/showthread.php?tid=649570
It is in spanish/portugese, I can't find this thread in english, although the most important info is readable. Код:
ID_RCON_COMMAND (ID: 201) text_length, cmdtext |
enum PR_SpectatingSync
{
PR_lrKey,
PR_udKey,
PR_keys,
Float:PR_position[3]
};
stock BS_ReadSpectatingSync(BitStream:bs, data[PR_SpectatingSync])
{
BS_ReadValue(
bs,
PR_UINT16, data[PR_lrKey],
PR_UINT16, data[PR_udKey],
PR_UINT16, data[PR_keys],
PR_FLOAT, data[PR_position][0],
PR_FLOAT, data[PR_position][1],
PR_FLOAT, data[PR_position][2]
);
}
stock BS_WriteSpectatingSync(BitStream:bs, data[PR_SpectatingSync])
{
BS_WriteValue(
bs,
PR_UINT16, data[PR_lrKey],
PR_UINT16, data[PR_udKey],
PR_UINT16, data[PR_keys],
PR_FLOAT, data[PR_position][0],
PR_FLOAT, data[PR_position][1],
PR_FLOAT, data[PR_position][2]
);
}