Raised This Month: $ Target: $400
 0% 

[SOLVED] Can't set state in AddToFullPack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 02-07-2013 , 07:37   [SOLVED] Can't set state in AddToFullPack
Reply With Quote #1

Well. I am making a module that can show sprite hud (using entity). But i can't compile it, and can't fix it. i dont understand

PHP Code:
int AddToFullPack(struct entity_state_s *stateint eedict_t *entedict_t *hostint hostflagsint playerunsigned char *pSet)
{
    if(!
IS_VALID_ENT(host) || !IS_VALID_ENT(ent))
        return 
0;
    if(
ENTINDEX(host) <= || ENTINDEX(host) > gpGlobals->maxClients)
        return 
0;
        
    if(
EDICT_TO_INT(ent) == g_PlayerHud[ENTINDEX(host)])
    {
        
Vector OriginForVecvOffSets;
        
        
// Get Host Origin
        
Origin host->v.origin;

        
// Get View Ofs
        
vOffSets host->v.view_ofs

        
// Add View Ofs to Origin
        
Origin Origin vOffSets;

        
// Get Velocity
        
float VelocityL ent->v.iuser3;
        
ForVec fm_velocity_by_aim(hostVelocityL);

        
// Velocity Vec to Origin Vec
        
Origin Origin ForVec;

        
// Set Origin for Hud
        
SET_ORIGIN(entOrigin);
        
state->origin Origin// ERROR Here

        // Set Effect
        
state->rendermode kRenderTransAdd// ERROR Here
        
state->renderamt 255// ERROR Here
    
}

    return 
1;

Error:
Code:
1>------ Build started: Project: EntSprClient, Configuration: Debug Win32 ------
1>  main.cpp
1>c:\users\dias\desktop\entsprclient\entsprclient\main.cpp(102): error C2027: use of undefined type 'entity_state_s'
1>          e:\sdk\hlsdk-2.3-p3\multiplayer\engine\eiface.h(252) : see declaration of 'entity_state_s'
1>c:\users\dias\desktop\entsprclient\entsprclient\main.cpp(102): error C2227: left of '->origin' must point to class/struct/union/generic type
1>c:\users\dias\desktop\entsprclient\entsprclient\main.cpp(105): error C2027: use of undefined type 'entity_state_s'
1>          e:\sdk\hlsdk-2.3-p3\multiplayer\engine\eiface.h(252) : see declaration of 'entity_state_s'
1>c:\users\dias\desktop\entsprclient\entsprclient\main.cpp(105): error C2227: left of '->rendermode' must point to class/struct/union/generic type
1>c:\users\dias\desktop\entsprclient\entsprclient\main.cpp(106): error C2027: use of undefined type 'entity_state_s'
1>          e:\sdk\hlsdk-2.3-p3\multiplayer\engine\eiface.h(252) : see declaration of 'entity_state_s'
1>c:\users\dias\desktop\entsprclient\entsprclient\main.cpp(106): error C2227: left of '->renderamt' must point to class/struct/union/generic type
1>  EntSprClient_Utils.cpp
1>  Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Full "main.cpp"
PHP Code:
#include "amxxmodule.h"
#include "EntSprClient_Utils.h"

int g_PlayerHud[33];
bool IS_PLAYER_VALID[33];

/* First edict which is null */
edict_t g_pNullEdict;

/* A few conversion methods */
#define INT_TO_EDICT( i ) \
    
( ( edict_t * ) ( g_pNullEdict ) )
#define EDICT_TO_INT( i ) \
    
( ( int ) ( g_pNullEdict ) )

void ClientPutInServeredict_t *pEntity )
{
    
int iPlayer ENTINDEX(pEntity);

    
IS_PLAYER_VALIDiPlayer ] = true;
}

void ClientDisconnectedict_t *pEntity )
{
    
int iPlayer ENTINDEX(pEntity);

    
IS_PLAYER_VALIDiPlayer ] = false;
}

static 
cell AMX_NATIVE_CALL show_sprhud(AMX *amxcell *pParameters
{
    
int IdId pParameters[1];
    
int MaxClientMaxClient gpGlobals->maxClients;
//    char *szSprite = (char)pParameters[2];

    
if(Id <= || Id MaxClient)
        return 
0;
    if(
gpGlobals->time <= 4)
        return 
0;
    if(
FNullEnt(INT_TO_EDICT(Id)) || INT_TO_EDICT(Id)->pvPrivateData == NULL)
        return 
0;

    
edict_t *pHudEnt;
    
pHudEnt INDEXENT(g_PlayerHud[Id]);

    if(!
IS_VALID_ENT(pHudEnt)) // Entity isn't created
    
{
        
pHudEnt CREATE_NAMED_ENTITY(MAKE_STRING("env_sprite"));

        if(!
IS_VALID_ENT(pHudEnt))
                return 
0;

        
g_PlayerHud[Id] = ENTINDEX(pHudEnt);
    }
        
    
pHudEnt->v.takedamage 0.0;
    
pHudEnt->v.solid SOLID_NOT;
    
pHudEnt->v.movetype MOVETYPE_NONE;

    
int iLength 0;
    
char *model MF_GetAmxString(amxpParameters[2], 0, &iLength); 
    
    
SET_MODEL(ENT(pHudEnt), model);

    
pHudEnt->v.rendermode kRenderTransAdd;
    
pHudEnt->v.renderamt 0.0;
    
pHudEnt->v.scale gpGlobals->time + (float)pParameters[3];
    
pHudEnt->v.iuser3 pParameters[4];    

    return 
g_PlayerHud[Id];
}

int AddToFullPack(struct entity_state_s *stateint eedict_t *entedict_t *hostint hostflagsint playerunsigned char *pSet)
{
    if(!
IS_VALID_ENT(host) || !IS_VALID_ENT(ent))
        return 
0;
    if(
ENTINDEX(host) <= || ENTINDEX(host) > gpGlobals->maxClients)
        return 
0;
        
    if(
EDICT_TO_INT(ent) == g_PlayerHud[ENTINDEX(host)])
    {
        
Vector OriginForVecvOffSets;
        
        
// Get Host Origin
        
Origin host->v.origin;

        
// Get View Ofs
        
vOffSets host->v.view_ofs

        
// Add View Ofs to Origin
        
Origin Origin vOffSets;

        
// Get Velocity
        
float VelocityL ent->v.iuser3;
        
ForVec fm_velocity_by_aim(hostVelocityL);

        
// Velocity Vec to Origin Vec
        
Origin Origin ForVec;

        
// Set Origin for Hud
        
SET_ORIGIN(entOrigin);
        
state->origin Origin;

        
// Set Effect
        
state->rendermode kRenderTransAdd;
        
state->renderamt 255;
    }

    return 
1;
}

static 
cell AMX_NATIVE_CALL remove_sprhud(AMX *, cell pParameters
{
    
int IdId pParameters[1];
    
int MaxClientMaxClient gpGlobals->maxClients;

    if(
Id <= || Id MaxClient)
        return 
0;
    if(
gpGlobals->time <= 4)
        return 
0;
    if(
FNullEnt(INT_TO_EDICT(Id)) || INT_TO_EDICT(Id)->pvPrivateData == NULL
        return 
0;

    if(
IS_VALID_ENT(INDEXENT(g_PlayerHud[Id]))) REMOVE_ENTITY(INT_TO_EDICT(g_PlayerHud[Id]));
    
    return 
0;
}

// Register Natives
AMX_NATIVE_INFO EntSprClient[] = 
{
    {
"show_sprhud"show_sprhud},
    {
"remove_sprhud"remove_sprhud},

    {
NULLNULL}
};

void OnAmxxAttachvoid 
{
    
MF_AddNatives(EntSprClient);
}

void ServerActivate_Postedict_t pFirstEdictintint ) {
    
g_pNullEdict pFirstEdict;

    
RETURN_METAMRES_IGNORED );

dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 02-07-2013 , 07:47   Re: Can't set state in AddToFullPack
Reply With Quote #2

It doesn't know how to find the declaration of the structure "entity_state_s".
__________________
micapat is offline
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 02-07-2013 , 07:59   Re: Can't set state in AddToFullPack
Reply With Quote #3

my friend can use and compile it. why can't i-.-
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-07-2013 , 08:56   Re: Can't set state in AddToFullPack
Reply With Quote #4

Try removing struct in front of entity_state_s. I doubt it's a solution, but trying won't hurt.
__________________

Last edited by hleV; 02-07-2013 at 08:58.
hleV is offline
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 02-07-2013 , 10:57   Re: Can't set state in AddToFullPack
Reply With Quote #5

^
- I tried, still getting that problem

Last edited by dias; 02-07-2013 at 10:59.
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 02-08-2013 , 04:39   Re: Can't set state in AddToFullPack
Reply With Quote #6

Here is the project. I hoped that someone can test compile and fix it
Attached Files
File Type: zip EntSprClient.zip (44.2 KB, 68 views)
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
Shadows In Rain
Senior Member
Join Date: Apr 2010
Location: Russia::Siberia
Old 02-08-2013 , 08:14   Re: Can't set state in AddToFullPack
Reply With Quote #7

In this translation unit (*.cpp file) you need to #include header file, which defines entity_state_s, i.e. common/entity_state.h.
__________________
I'm using Google translator, yarrr. |.◕‿‿◕.|
Shadows In Rain is offline
Send a message via ICQ to Shadows In Rain
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 02-08-2013 , 09:39   Re: Can't set state in AddToFullPack
Reply With Quote #8

SOLVED. Thanks man
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
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 11:17.


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