Raised This Month: $ Target: $400
 0% 

Change models in AddToFullPack - CSDM FFA


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 11-24-2009 , 02:43   Change models in AddToFullPack - CSDM FFA
Reply With Quote #1

Hello. I want (for a CSDM FFA server) that each player sees all the others with an enemy model. Like, if I'm CT all the others look like Terrorists to me. (Not a new idea)

ES_ModelIndex (even with ES_Team) won't do it. It is not a problem from fakemeta because I also tried with Orpheu. If someone can find out a way, I will be appreciated.

One sucking solution may be make all players have the same team but that wouldn't be so nice.

Last edited by joaquimandrade; 11-25-2009 at 01:49.
joaquimandrade is offline
platzpatrone
Veteran Member
Join Date: Apr 2007
Location: Germany
Old 11-24-2009 , 02:50   Re: Change models in AddToFullPack
Reply With Quote #2

what about checking in wich team u are and set the model from
all other players to the other team model ?

if a player connect then check if he has the model if not then give him
the model.
platzpatrone is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 11-24-2009 , 02:57   Re: Change models in AddToFullPack
Reply With Quote #3

To make this, AddToFallPack must be used because data has to be tweaked individually. This is not about setting a model, is about telling each user the model that each one of the other players has dressed.
joaquimandrade is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-24-2009 , 12:46   Re: Change models in AddToFullPack
Reply With Quote #4

I made something similar to this by request on here.
I can't remember if it was Suggestions/Requests or Scripting Help, but I'm sure you can find it.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 11-24-2009 , 13:30   Re: Change models in AddToFullPack
Reply With Quote #5

From client.cpp (hldsk) you have:

It copies modelindex for whatever entity in ent
PHP Code:
    state->modelindex ent->v.modelindex
So, as I understand, you can play with modelindex.

Have you tried with EngFunc_InfoKeyValue on "model" key?
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 11-24-2009 , 14:48   Re: Change models in AddToFullPack
Reply With Quote #6

Quote:
Originally Posted by Exolent[jNr] View Post
I made something similar to this by request on here.
I can't remember if it was Suggestions/Requests or Scripting Help, but I'm sure you can find it.
You mean this post?
http://forums.alliedmods.net/showpos...83&postcount=8

Quote:
Originally Posted by joropito View Post
From client.cpp (hldsk) you have:

It copies modelindex for whatever entity in ent
PHP Code:
    state->modelindex ent->v.modelindex
So, as I understand, you can play with modelindex.

Have you tried with EngFunc_InfoKeyValue on "model" key?
Nothing to do with this.
joaquimandrade is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-24-2009 , 14:55   Re: Change models in AddToFullPack
Reply With Quote #7

Quote:
Originally Posted by joaquimandrade View Post
No I meant this post:
http://forums.alliedmods.net/showpos...9&postcount=15

But the other one may work too.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 11-24-2009 , 15:09   Re: Change models in AddToFullPack
Reply With Quote #8

It makes people invisible. I'm not understanding how you are trying to achieve it because, even with entities for each player to carry the model ES_ModelIndex would still be needed. The other post code just sets ES_ModelIndex so it doesn't work.

Edit: still, I confirmed that ES_ModelIndex works for non players so, the idea of creating entities to carry a model should work. The problem is that the animations also would need to be set and I'm afraid it will start to waste many resources.

Last edited by joaquimandrade; 11-24-2009 at 15:18.
joaquimandrade is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 11-24-2009 , 19:48   Re: Change models in AddToFullPack
Reply With Quote #9

Based on Exolent's idea of creating extra entities, here goes a solution: (Didn't have to update player animations but, had to create an extra entity for the weapon carried)

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <cstrike>

enum EntityPart
{
    
Body,
    
Weapon
}

new 
EntitiesOwner

new CsInternalModel:InternalModelChangeTable[CsInternalModel] = 
{
    
_:CS_DONTCHANGE
    
_:CS_T_ARCTIC,//CS_CT_URBAN
    
_:CS_CT_GSG9,//CS_T_TERROR
    
_:CS_CT_GIGN,//CS_T_LEET
    
_:CS_CT_URBAN,//CS_T_ARCTIC
    
_:CS_T_TERROR,//CS_CT_GSG9
    
_:CS_T_LEET,//CS_CT_GIGN
    
_:CS_T_GUERILLA,//CS_CT_SAS
    
_:CS_CT_SAS,//CS_T_GUERILLA
    
_:CS_CT_VIP
    
_:CZ_CT_SPETSNAZ,//CZ_T_MILITIA
    
_:CZ_T_MILITIA,//CZ_CT_SPETSNAZ
}

new 
CsTeams:InternalModelChangeTableTeam[CsInternalModel] = 
{
    
_:CS_TEAM_UNASSIGNED
    
_:CS_TEAM_CT,//CS_CT_URBAN
    
_:CS_TEAM_T,//CS_T_TERROR
    
_:CS_TEAM_T,//CS_T_LEET
    
_:CS_TEAM_T,//CS_T_ARCTIC
    
_:CS_TEAM_CT,//CS_CT_GSG9
    
_:CS_TEAM_CT,//CS_CT_GIGN
    
_:CS_TEAM_CT,//CS_CT_SAS
    
_:CS_TEAM_T,//CS_T_GUERILLA
    
_:CS_TEAM_CT
    
_:CS_TEAM_T,//CZ_T_MILITIA
    
_:CS_TEAM_CT,//CZ_CT_SPETSNAZ
}

new 
CsInternalModel:TeamsDefaultInternalModel[CsTeams] =
{
    
0,
    
_:CS_T_GUERILLA,
    
_:CS_CT_SAS,
    
0
}

new 
InternalModelModels[CsInternalModel][] = 
{
    
"",
    
"urban",
    
"terror",
    
"leet",
    
"arctic",
    
"gsg9",
    
"gign",
    
"sas",
    
"guerilla",
    
"vip",
    
"militia",
    
"spetsnaz"
}

new 
InternalModelModelIDs[CsInternalModel

const 
OffsetInternalModel 126

new Trie:ModelToCsInternalModel

new CsTeams:TeamsSum CS_TEAM_T CS_TEAM_CT

public plugin_precache()
{
    
ModelToCsInternalModel TrieCreate()
    
    new 
model[50]
    
    for(new 
CsInternalModel:CS_CT_URBAN;i<CsInternalModel;i++)
    {
        
format(model,charsmax(model),"models/player/%s/%s.mdl",InternalModelModels[i],InternalModelModels[i])
        
        
TrieSetCell(ModelToCsInternalModel,model,i)
    }
    
    
register_forward(FM_PrecacheModel,"PrecacheModel",1)
}

public 
PrecacheModel(model[])
{
    static 
CsInternalModel:internalModel 
    
    
if(TrieGetCell(ModelToCsInternalModel,model,internalModel))
    {
        
InternalModelModelIDs[internalModel] = get_orig_retval()
    }
}

public 
plugin_init()
{
    
register_forward(FM_AddToFullPack,"AddToFullPackPre",0);
    
register_forward(FM_AddToFullPack,"AddToFullPackPost",1);
    
    
set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
}

public 
plugin_cfg()
{
    
EntitiesOwner create_entity("info_target")
    
    for(new 
EntityPart:i=Body;i<EntityPart;i++)
    {
        for(new 
j=1;j<=get_maxplayers();j++)
        {
            new 
ent create_entity("info_target")
            
            
set_pev(ent,pev_owner,EntitiesOwner)
            
set_pev(ent,pev_aiment,j)
            
set_pev(ent,pev_movetype,MOVETYPE_FOLLOW)
            
set_pev(ent,pev_solid,SOLID_NOT)
            
            
entity_set_model(ent,"models/player/leet/leet.mdl");
                                
            
set_pev(ent,pev_iuser1,_:i)
        }
    }
}

public 
AddToFullPackPre(es,e,ent,host,hostflags,player,pSet)
{
    if(!
player)
    {
        if(
is_valid_ent(ent) && (pev(ent,pev_owner) == EntitiesOwner))
        {
            new 
aiment pev(ent,pev_aiment)
            
            if((
aiment == host) || !is_user_connected(aiment) || (pev(aiment,pev_effects) & EF_NODRAW) || (cs_get_user_team(host) != cs_get_user_team(aiment)) )
            {
                
forward_return(FMV_CELL,0)
                return 
FMRES_SUPERCEDE
            
}
        }
    }
    
    return 
FMRES_IGNORED
}
public 
AddToFullPackPost(es,e,ent,host,hostflags,player,pSet)
{
    if(!
player && get_orig_retval())
    {
        if(
is_valid_ent(ent) && (pev(ent,pev_owner) == EntitiesOwner))
        {
            new 
aiment pev(ent,pev_aiment)
            
            if(
pev(ent,pev_iuser1) == _:Weapon)
            {
                static 
weaponModel[50]
                
pev(aiment,pev_weaponmodel2,weaponModel,charsmax(weaponModel))
            
                if(
weaponModel[0])
                {
                    
set_es(es,ES_ModelIndex,engfunc(EngFunc_ModelIndex,weaponModel))
                    
set_es(es,ES_Sequence,pev(aiment,pev_weaponanim))
                }
                else
                {
                    
set_es(es,ES_Effects,EF_NODRAW)
                }        
            }
            else
            {
                new 
CsTeams:wantedTeam TeamsSum cs_get_user_team(host)
                
                new 
CsInternalModel:internalModel CsInternalModel:get_pdata_int(aiment,OffsetInternalModel)
                
                if(
internalModel)
                {
                    
internalModel InternalModelChangeTable[internalModel]
                    
                    if(
InternalModelChangeTableTeam[internalModel] != wantedTeam)
                    {
                        
internalModel TeamsDefaultInternalModel[wantedTeam]
                    }
                }
                else
                {
                    
internalModel TeamsDefaultInternalModel[wantedTeam]
                }
                
                
set_es(es,ES_ModelIndex,InternalModelModelIDs[internalModel])
            }
        }
    }
    else if(
is_user_connected(ent) && (ent != host) && (cs_get_user_team(host) == cs_get_user_team(ent)))
    {
        
set_es(es,ES_RenderMode,kRenderTransAlpha)
        
set_es(es,ES_RenderAmt,0)
    }

Don't know if it does affect performance on big servers. Maybe I'll post it on new plugin submissions after testing it in a real server. Optimizations accepted
joaquimandrade is offline
T-z3P
Senior Member
Join Date: Apr 2008
Location: Iasi, Romania
Old 11-25-2009 , 11:47   Re: Change models in AddToFullPack - CSDM FFA
Reply With Quote #10

Works well thanks
+K
__________________


T-z3P is offline
Send a message via Yahoo to T-z3P Send a message via Skype™ to T-z3P
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 13:43.


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