Hellow, i tried to set model for player, but get errors during compilation, and don't know what wrong for CS:GO. Help please. Thank a million
HTML Code:
extension.cpp
c:\users\msi\desktop\compiler\alliedmodders\sourcemod\public\sample_ext\events.cpp(177) : error C2027: use of undefined type 'CBaseEntity'
C:\users\msi\desktop\compiler\alliedmodders\sourcemod\public\IGameHelpers.h(45) : see declaration of 'CBaseEntity'
c:\users\msi\desktop\compiler\alliedmodders\sourcemod\public\sample_ext\events.cpp(177) : error C2227: left of '->SetModel' must point to class/struct/union/generic type
/** * @brief Called when a client is entering the game. * * @param clientIndex The client index. */ void ClientListener::OnClientPutInServer(int clientIndex) { // Validate client ZPBaseClient *CPlayer = ZP_GetPlayer(clientIndex); if (!CPlayer) { return; }
class CBaseEntity; can be found at IGameHelpers.h witch add to code by #define SMEXT_ENABLE_GAMEHELPERS
And it strange because, code compile without that string
// Return index return pUnknown->GetBaseEntity(); }
/** * @brief Called when a client is entering the game. * * @param clientIndex The client index. */ void ClientListener::OnClientPutInServer(int clientIndex) { // Validate client ZPBaseClient *CPlayer = ZP_GetPlayer(clientIndex); if (!CPlayer) { return; }
// Update main player variables CPlayer->pEdict = gamehelpers->EdictOfIndex(clientIndex); CPlayer->pEntity = pEntity; CPlayer->pInfo = playerinfomngr->GetPlayerInfo(CPlayer->pEdict); CPlayer->userid = engine->GetPlayerUserId(CPlayer->pEdict); }
May be i just use wrong may of SetModel ? Because is quite difficult to find a lot of information, i am really new in c++, i got those CBaseEntity Validations here: https://github.com/alliedmodders/cssdm
And also when i just use smth like that i don't have error
if(!CPlayer->pEntity)
{
}
May be i need to add #include <baseentity.h>
but when i add it , i get fatal error C1083: Cannot open include file: 'baseentity.h': No such file or directory, So do i need copy baseentity.h and 'baseentity.cpp to public folder?
Or may be smbd can explain what i can do with it here.
Also i foind iserverentity.h
May be i need to use that ?
PHP Code:
class IServerEntity : public IServerUnknown { public: virtual ~IServerEntity() {}
// Previously in pev virtual int GetModelIndex( void ) const = 0; virtual string_t GetModelName( void ) const = 0;
virtual void SetModelIndex( int index ) = 0; };
And i can use smth like that for server side? It compile nice, but is it right?
Quote:
IServerEntity *pBase = (IServerEntity *)CPlayer->pEntity;
pBase->SetModelIndex(index of precached model);