Raised This Month: $ Target: $400
 0% 

[RESOLVED] Replacing player models using FAKEMETA


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
slmclarengt
Veteran Member
Join Date: Jul 2004
Location: The Cookie Jar... or Pul
Old 12-08-2006 , 19:55   [RESOLVED] Replacing player models using FAKEMETA
Reply With Quote #1

Please check this code - to me, it looks fine, but my server will not start. Looking to replace the default CS models with Christmas models.

Code:
 #include <amxmodx>  #include <fakemeta>  #define TREE "models/c14-cristmastree.mdl"  #define ARCTIC "models/player/arctic/arctic.mdl"  #define GUERILLA "models/player/guerilla/guerilla.mdl"  #define LEET "models/player/leet/leet.mdl"  #define MILITIA "models/player/militia/militia.mdl"  #define TERROR "models/player/terror/terror.mdl"  public plugin_init()  {     register_plugin("Model replacement (christmas)","0.10","Avalanche");     register_forward(FM_SetModel,"fw_setmodel");  }  public plugin_precache()  {     precache_model(TREE);     precache_model(ARCTIC);     precache_model(GUERILLA);     precache_model(LEET);     precache_model(MILITIA);     precache_model(TERROR);  }  public fw_setmodel(ent,model[])  {     if(equali(model,"models/w_c4.mdl"))     {         engfunc(EngFunc_SetModel,ent,TREE);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/arctic/arctic.mdl"))     {         engfunc(EngFunc_SetModel,ent,ARCTIC);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/guerilla/guerilla.mdl"))     {         engfunc(EngFunc_SetModel,ent,GUERILLA);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/leet/leet.mdl"))     {         engfunc(EngFunc_SetModel,ent,LEET);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/militia/militia.mdl"))     {         engfunc(EngFunc_SetModel,ent,MILITIA);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/terror/terror.mdl"))     {         engfunc(EngFunc_SetModel,ent,TERROR);         return FMRES_SUPERCEDE;     }     return FMRES_IGNORED;  }

it's from avalanche but I modified it to do more than one model.

Slmclarengt
__________________
But we don’t beat the Reaper by living longer. We beat the Reaper by living well. -Dr. Randy Pausch, R.I.P.

Come play WC3:FT on BnD Clan Server! You know you want to: Connect to WC3:FT BnD - go ahead click me!

Last edited by slmclarengt; 12-12-2006 at 01:12.
slmclarengt is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-09-2006 , 06:54   Re: Replacing models using FAKEMETA (simple)
Reply With Quote #2

Seems like it's the problem with your "models/c14-cristmastree.mdl"

Do you realise that this pointless?
Quote:
if(equali(model,"models/player/terror/terror.mdl"))
{
engfunc(EngFunc_SetModel,ent,TERROR);
return FMRES_SUPERCEDE;
}
TERROR equal to "models/player/terror/terror.mdl"
VEN is offline
slmclarengt
Veteran Member
Join Date: Jul 2004
Location: The Cookie Jar... or Pul
Old 12-09-2006 , 21:10   Re: Replacing models using FAKEMETA (simple)
Reply With Quote #3

Quote:
Originally Posted by VEN View Post
Seems like it's the problem with your "models/c14-cristmastree.mdl"

Do you realise that this pointless?TERROR equal to "models/player/terror/terror.mdl"
Yes, it is "redundant" not pointless, because it would check if the model existed and replace it (but it never worked). Now it looks like this:

Code:
 #include <amxmodx>  #include <fakemeta>  #define TREE "models/c14-cristmastree.mdl"  #define ARCTIC "models/player/arctic/arctic-christmas.mdl"  #define GUERILLA "models/player/guerilla/guerilla-christmas.mdl"  #define LEET "models/player/leet/leet-christmas.mdl"  #define MILITIA "models/player/militia/militia.mdl"  #define TERROR "models/player/terror/terror-christmas.mdl"  public plugin_init()  {     register_plugin("Model replacement (christmas)","0.10","Avalanche");     register_forward(FM_SetModel,"fw_setmodel");  }  public plugin_precache()  {     precache_model(TREE);     precache_model(ARCTIC);     precache_model(GUERILLA);     precache_model(LEET);     precache_model(MILITIA);     precache_model(TERROR);  }  public fw_setmodel(ent,model[])  {     if(equali(model,"models/w_c4.mdl"))     {         engfunc(EngFunc_SetModel,ent,TREE);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/arctic/arctic.mdl"))     {         engfunc(EngFunc_SetModel,ent,ARCTIC);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/guerilla/guerilla.mdl"))     {         engfunc(EngFunc_SetModel,ent,GUERILLA);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/leet/leet.mdl"))     {         engfunc(EngFunc_SetModel,ent,LEET);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/militia/militia.mdl"))     {         engfunc(EngFunc_SetModel,ent,MILITIA);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/terror/terror.mdl"))     {         engfunc(EngFunc_SetModel,ent,TERROR);         return FMRES_SUPERCEDE;     }     return FMRES_IGNORED;  }

The christmas tree bomb works perfectly, but not all the player models. The models download onto the computer, but do not actually show in-game... WHY!!??

Slmclarengt
__________________
But we don’t beat the Reaper by living longer. We beat the Reaper by living well. -Dr. Randy Pausch, R.I.P.

Come play WC3:FT on BnD Clan Server! You know you want to: Connect to WC3:FT BnD - go ahead click me!
slmclarengt is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-10-2006 , 05:22   Re: Replacing models using FAKEMETA (simple, but help plz)
Reply With Quote #4

Because player model isn't set like that. It uses "model" ClientKeyValue. You can use cstrike cs_set_user_model or port it to FM.
VEN is offline
slmclarengt
Veteran Member
Join Date: Jul 2004
Location: The Cookie Jar... or Pul
Old 12-10-2006 , 15:01   Re: Replacing models using FAKEMETA (simple, but help plz)
Reply With Quote #5

Then I tried
Code:
public client_connect(id) {     if(is_user_connected(id))     {         cs_set_user_model(id, TREE) //bomb         cs_set_user_model(id, ARCTIC) //T         cs_set_user_model(id, GUERILLA) //T         cs_set_user_model(id, LEET) //T         cs_set_user_model(id, MILITIA) //T         cs_set_user_model(id, TERROR) //T     }     else         set_task(5.0, "client_connect", id) }

Instead of

Code:
public fw_setmodel(ent,model[])  {     if(equali(model,"models/w_c4.mdl"))     {         engfunc(EngFunc_SetModel,ent,TREE);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/arctic/arctic.mdl"))     {         engfunc(EngFunc_SetModel,ent,ARCTIC);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/guerilla/guerilla.mdl"))     {         engfunc(EngFunc_SetModel,ent,GUERILLA);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/leet/leet.mdl"))     {         engfunc(EngFunc_SetModel,ent,LEET);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/militia/militia.mdl"))     {         engfunc(EngFunc_SetModel,ent,MILITIA);         return FMRES_SUPERCEDE;     }     if(equali(model,"models/player/terror/terror.mdl"))     {         engfunc(EngFunc_SetModel,ent,TERROR);         return FMRES_SUPERCEDE;     }     return FMRES_IGNORED;  }

The cs_set_user_model actually screwed my server over because I don't know which function to call, client_connect or client_authorized or neither? I am newb in this regard, but understand the main concepts.

Slmclarengt
__________________
But we don’t beat the Reaper by living longer. We beat the Reaper by living well. -Dr. Randy Pausch, R.I.P.

Come play WC3:FT on BnD Clan Server! You know you want to: Connect to WC3:FT BnD - go ahead click me!
slmclarengt is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 12-10-2006 , 15:09   Re: Replacing models using FAKEMETA (simple, but help plz)
Reply With Quote #6

Quote:
Originally Posted by slmclarengt View Post
The cs_set_user_model actually screwed my server over because I don't know which function to call, client_connect or client_authorized or neither?
ResetHUD event, check if player is alive and connected.

This is how to use cs_set_user_model().
Code:
#include <amxmodx> #include <cstrike> public plugin_init() {     register_plugin("", "", "")     register_event("ResetHUD", "event_ResetHUD", "be") } public plugin_precache()     precache_model("models/player/christmas/christmas.mdl")     public event_ResetHUD(id)     cs_set_user_model(id, "christmas")

Last edited by [ --<-@ ] Black Rose; 12-10-2006 at 15:25.
[ --<-@ ] Black Rose is offline
slmclarengt
Veteran Member
Join Date: Jul 2004
Location: The Cookie Jar... or Pul
Old 12-10-2006 , 15:24   Re: Replacing models using FAKEMETA (simple, but help plz)
Reply With Quote #7

Quote:
Originally Posted by [ --<-@ ] Black Rose View Post
ResetHUD event, check if player is alive and connected.

This is how to use cs_set_user_model().
Code:
#include <amxmodx> #include <cstrike> public plugin_init() {     register_plugin("", "", "")     register_event("ResetHUD", "event_ResetHUD", "be") } public plugin_precache()     precache_model("models/player/leet/leet.mdl")     public event_ResetHUD(id)     cs_set_user_model(id, "leet")
So presumably I have to replace the CS model with the custom model I want replaced and name it the same name.

IE: I take the christmas model, change name from christmas.mdl to leet.mdl, then use the plugin to use the custom leet.mdl?

Slmclarengt
__________________
But we don’t beat the Reaper by living longer. We beat the Reaper by living well. -Dr. Randy Pausch, R.I.P.

Come play WC3:FT on BnD Clan Server! You know you want to: Connect to WC3:FT BnD - go ahead click me!
slmclarengt is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 12-10-2006 , 15:25   Re: Replacing models using FAKEMETA (simple, but help plz)
Reply With Quote #8

No, there is a model named leet.
Edited code
[ --<-@ ] Black Rose is offline
slmclarengt
Veteran Member
Join Date: Jul 2004
Location: The Cookie Jar... or Pul
Old 12-10-2006 , 15:27   Re: Replacing models using FAKEMETA (simple, but help plz)
Reply With Quote #9

Quote:
Originally Posted by [ --<-@ ] Black Rose View Post
No, there is a model named leet.
Edited code
But then how would christmas know to replace leet?

Slmclarengt
__________________
But we don’t beat the Reaper by living longer. We beat the Reaper by living well. -Dr. Randy Pausch, R.I.P.

Come play WC3:FT on BnD Clan Server! You know you want to: Connect to WC3:FT BnD - go ahead click me!
slmclarengt is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 12-10-2006 , 15:46   Re: Replacing models using FAKEMETA (simple, but help plz)
Reply With Quote #10

Something like...
Code:
#include <amxmodx> #include <cstrike> #include <fakemeta> public plugin_init() {     register_plugin("", "", "")     register_forward(FM_SetModel,"fw_setmodel"); } public plugin_precache()     precache_model("models/player/christmas/christmas.mdl") public fw_setmodel(ent,model[]) {         if ( equal(model, "models/player/leet/leet.mdl") )         cs_set_user_model(ent, "christmas") }
[ --<-@ ] Black Rose is offline
Reply


Thread Tools
Display Modes

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 07:00.


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