Raised This Month: $51 Target: $400
 12% 

Models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gubka
Veteran Member
Join Date: Jan 2012
Location: Russia
Old 12-02-2016 , 23:57   Models
Reply With Quote #1

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
Without this string, i dont have errors
Quote:
CPlayer->pEntity->SetModel("models/player/custom_player/cso2_zombi/police.mdl");
or may be SetModel is wrong method, because i found it here https://forums.alliedmods.net/showth...=PrecacheModel

events.cpp
PHP Code:
bool OnPlayerInfect(int clientIndex)
{
    
// Validate client
    
ZPBaseClient *CPlayer ZP_GetPlayer(clientIndex);
    if (!
CPlayer)
    {
        return 
false;
    }

    
CPlayer->pEntity->SetModel("models/player/custom_player/cso2_zombi/police.mdl");
    
    return 
true;

playertool.cpp
PHP Code:
/**
 * @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;
    }
    
    
// Validate entity
    
CBaseEntity *pEntity ZP_GetBaseEntity(clientIndex);
    if (!
pEntity)
    {
        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);
}

/**
 * @brief Validate index of the entity.
 *
 * @param index            The index.
 * @return                The entity index.
 **/
CBaseEntity *ZP_GetBaseEntity(int index)
{
    
// Validate entity
    
edict_t *pEdict gamehelpers->EdictOfIndex(index);
    if (!
pEdict || pEdict->IsFree())
    {
        return 
NULL;
    }
    
    
// Validate entity
    
IServerUnknown *pUnknown pEdict->GetUnknown();
    if (!
pUnknown)
    {
        return 
NULL;
    }
    
    
// Return index
    
return pUnknown->GetBaseEntity();

__________________

Last edited by gubka; 12-03-2016 at 00:14.
gubka is offline
Send a message via ICQ to gubka
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 12-03-2016 , 07:24   Re: Models
Reply With Quote #2

Did you include file that defines "CBaseEntity"?
__________________
WildCard65 is offline
gubka
Veteran Member
Join Date: Jan 2012
Location: Russia
Old 12-03-2016 , 09:09   Re: Models
Reply With Quote #3

Quote:
Originally Posted by WildCard65 View Post
Did you include file that defines "CBaseEntity"?
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
PHP Code:
CPlayer->pEntity->SetModel("models/player/custom_player/cso2_zombi/police.mdl"); 
But with it i have this error, or i need to add other include? Thank for helping.
And also i have that in my code, and it compile great
Spoiler


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                GetModelIndexvoid ) const = 0;
     
virtual string_t        GetModelNamevoid ) const = 0;

    
virtual void            SetModelIndexint 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);
__________________

Last edited by gubka; 12-03-2016 at 11:08.
gubka is offline
Send a message via ICQ to gubka
gubka
Veteran Member
Join Date: Jan 2012
Location: Russia
Old 12-04-2016 , 11:00   Re: Models
Reply With Quote #4

PHP Code:
IServerEntity *pBase = (IServerEntity *)CPlayer->pEntity;
pBase->SetModelIndex(index of precached model); 
That method do not work properly, models don't have animation and they in the ground
May be smbd now how to set player model?

Is it possible to use UTIL_SetModel ? because i didn't find it in the public folder
__________________

Last edited by gubka; 12-04-2016 at 11:08.
gubka is offline
Send a message via ICQ to gubka
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode