bool Game::SAMP::addChatMessage(const char *text) { static auto addr = Utils::Pattern::findPattern( g_dwModuleBase, g_dwModuleLength, Game::SAMP::PatternTable::AddChatMessage::byteMask, Game::SAMP::PatternTable::AddChatMessage::useMask ); if (addr == 0) return false; DWORD dwCallAddr = *(DWORD *)(addr + 0xD) + addr + 0xD + 0x4; DWORD dwInfo = *(DWORD *)(addr + 0x2); CHECK_OFFSET(dwInfo, false, DWORD) __asm mov edx, dword ptr[dwInfo] __asm mov eax, [edx] __asm push text __asm push eax __asm call dwCallAddr __asm add esp, 8 return true; }
static cell AMX_NATIVE_CALL set_pdata_ehandle(AMX *amx, cell *params) { int index = params[1]; CHECK_ENTITY(index); int offset = params[2]; CHECK_OFFSET(offset); int entity = params[3]; CHECK_ENTITY(entity); #if defined(__linux__) offset += params[4]; #elif defined(__APPLE__) // Use Linux offset in older plugins if (params[0] / sizeof(cell) == 4) offset += params[4]; else offset += params[5]; #endif edict_t *pEntity = TypeConversion.id_to_edict(entity); set_pdata<edict_t*>(TypeConversion.id_to_edict(index), offset, pEntity); if (pEntity) { set_pdata<int>(TypeConversion.id_to_edict(index), offset + 4, pEntity->serialnumber); } return 1; }
static cell AMX_NATIVE_CALL set_pdata_vector(AMX *amx, cell *params) { int index = params[1]; CHECK_ENTITY(index); int offset = params[2]; CHECK_OFFSET(offset); #if defined(__linux__) offset += params[4]; #elif defined(__APPLE__) // Use Linux offset in older plugins if (params[0] / sizeof(cell) == 4) offset += params[4]; else offset += params[5]; #endif cell *pcvec = MF_GetAmxAddr(amx, params[3]); Vector vec(amx_ctof(pcvec[0]), amx_ctof(pcvec[1]), amx_ctof(pcvec[2])); set_pdata<Vector>(TypeConversion.id_to_edict(index), offset, vec); return 1; }
ArrayType StructValueInfo::GetArrayType() const { if ( CHECK_OFFSET ( StructValueInfo, m_ArrayType, m_Size ) ) { return ( ArrayType ) m_ArrayType; } return ( ArrayType ) 0xffffffff; }
const char* StructValueInfo::GetTypeName() const { if ( CHECK_OFFSET ( StructValueInfo, m_TypeName, m_Size ) ) { return &*m_TypeName; } return 0; }
Tag* SelectItem::GetTags() const { if ( CHECK_OFFSET ( SelectItem, m_Tags, m_Size ) ) { return &*m_Tags; } return 0; }
Definition* Struct::GetDefinition() const { if ( CHECK_OFFSET ( Struct, m_Definition, m_Size ) ) { return &*m_Definition; } return 0; }
Tag* Struct::GetTags() const { if ( CHECK_OFFSET ( Struct, m_Tags, m_Size ) ) { return &*m_Tags; } return 0; }
StructValueInfo* StructField::GetValueInfo() { if ( CHECK_OFFSET ( StructField, m_ValueInfo, m_Size ) ) { return &m_ValueInfo; } return 0; }
const char* BasicInfo::GetDescription() const { if ( CHECK_OFFSET ( BasicInfo, m_Description, m_Size ) ) { return &*m_Description; } return 0; }
const char* BasicInfo::GetName() const { if ( CHECK_OFFSET ( BasicInfo, m_Name, m_Size ) ) { return &*m_Name; } return 0; }
uint32_t BitfieldFlag::GetBit() const { if ( CHECK_OFFSET ( BitfieldFlag, m_Bit, m_Size ) ) { return m_Bit; } return 0; }
BitfieldFlagValue* BitfieldFlag::GetValue() const { if ( CHECK_OFFSET ( BitfieldFlag, m_Value, m_Size ) ) { return &*m_Value; } return 0; }
uint32_t BitfieldFlag::GetNameHash() const { if ( CHECK_OFFSET ( BitfieldFlag, m_NameHash, m_Size ) ) { return m_NameHash; } return 0; }
uint32_t BitfieldFlagValue::GetCount() const { if ( CHECK_OFFSET ( BitfieldFlagValue, m_Count, m_Size ) ) { return m_Count; } return 0; }
int32_t Select::GetDefaultItem() const { if ( CHECK_OFFSET ( Select, m_DefaultItem, m_Size ) ) { return m_DefaultItem; } return -1; }
uint32_t Select::GetNumItems() const { if ( CHECK_OFFSET ( Select, m_NumItems, m_Size ) ) { return m_NumItems; } return 0; }
StructFieldValue* StructValueInfo::GetValue() const { if ( CHECK_OFFSET ( StructValueInfo, m_Value, m_Size ) ) { return &*m_Value; } return 0; }
uint32_t StructValueInfo::GetKeyType() const { if ( CHECK_OFFSET ( StructValueInfo, m_KeyType, m_Size ) ) { return m_KeyType; } return 0xffffffff; }
uint32_t Bitfield::GetNumFlags() const { if ( CHECK_OFFSET ( Bitfield, m_NumFlags, m_Size ) ) { return m_NumFlags; } return 0; }
uint32_t StructUnknownValue::GetCount() const { if ( CHECK_OFFSET ( StructUnknownValue, m_Count, m_Size ) ) { return m_Count; } return 0; }
int32_t Bitfield::GetDefaultFlag() const { if ( CHECK_OFFSET ( Bitfield, m_DefaultFlag, m_Size ) ) { return m_DefaultFlag; } return -1; }
Struct* Struct::GetParent() const { if ( CHECK_OFFSET ( Struct, m_Parent, m_Size ) ) { return &*m_Parent; } return 0; }
Tag* Bitfield::GetTags() const { if ( CHECK_OFFSET ( Bitfield, m_Tags, m_Size ) ) { return &*m_Tags; } return 0; }
const char* BasicInfo::GetLabel() const { if ( CHECK_OFFSET ( BasicInfo, m_Label, m_Size ) ) { return &*m_Label; } return 0; }
uint32_t Aggregate::GetNameHash() const { if ( CHECK_OFFSET ( Aggregate, m_NameHash, m_Size ) ) { return m_NameHash; } return 0; }
const char* BasicInfo::GetAuthor() const { if ( CHECK_OFFSET ( BasicInfo, m_Author, m_Size ) ) { return &*m_Author; } return 0; }
uint32_t SelectItem::GetNameHash() const { if ( CHECK_OFFSET ( SelectItem, m_NameHash, m_Size ) ) { return m_NameHash; } return 0; }
uint32_t StructValueInfo::GetTypeNameHash() const { if ( CHECK_OFFSET ( StructValueInfo, m_TypeNameHash, m_Size ) ) { return m_TypeNameHash; } return 0; }
const char* Aggregate::GetLabel() const { if ( CHECK_OFFSET ( Aggregate, m_Label, m_Size ) ) { return &*m_Label; } return 0; }