Raised This Month: $ Target: $400
 0% 

Model Changing in DoD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 12-17-2005 , 13:45   Model Changing in DoD
Reply With Quote #1

Hey all. I'm working on a new plugin. This plugin as the topic states is going to change models for admins in DoD. I have been doing some searching and located a cs_set_user_model. And then went into the code and found out how it works. But, no dice. I have tried register_forward(FM_SetModel) and register_event(ResetHUD) and then within each of these checked the model to be models/player.mdl and forced it to be a certain model. Now when I attempt to join and look at myself or other admins It stays the same. No model changes. So I'm posting the basic test code. Can someone give a shout if they see where the problem is.

Thanks, and Cheers!

Code:
register_event("ResetHUD", "handle_model", "b")
public handle_model(id)
{
	if(!is_user_connected(id) || !get_cvar_num("dod_am_enabled"))
		return PLUGIN_CONTINUE
	
	// Get Model
	new mdl[128]
	entity_get_string(id, EV_SZ_model, mdl, 127)
	
	new team = entity_get_int(id, EV_INT_team)
	
	if(contain(mdl, "player.mdl") && team > 0)
	{
		entity_set_string(id, EV_SZ_model, models[team - 1])
	}
	
	new temp[128]
	entity_get_string(id, EV_SZ_model, temp, 127)
	log_amx("entid: %d model: %s", id, temp)
		
	return PLUGIN_CONTINUE
}
Code:
register_forward(FM_SetModel, "handle_model")
public handle_model(id, const mdl[])
{
   if(!is_valid_ent(id) || !get_cvar_num("dod_am_enabled"))
      return FMRES_IGNORED

   new temp[128] 
   new team = entity_get_int(id, EV_INT_team)
   
   if(contain(mdl, "models/player.mdl") && team > 0)
   {
      entity_set_string(id, EV_SZ_model, models[team - 1])
      entity_get_string(id, EV_SZ_model, temp, 127)
      log_amx("entid: %d model: %s", id, temp)

      return FMRES_SUPERCEDE
   }

   entity_get_string(id, EV_SZ_model, temp, 127)
   log_amx("entid: %d model: %s", id, temp)  
    
   return FMRES_IGNORED
}
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 12-17-2005 , 15:01  
Reply With Quote #2

Code:
/* The actual return value of the function, use these instead of PLUGIN_HANDLED etc when
 * returning from registered forwards.
 */
#define FMRES_HANDLED	2
#define FMRES_SUPERCEDE	4
#define FMRES_IGNORED	1
#define FMRES_OVERRIDE	3
Code:
register_forward(FM_SetModel, "handle_model") public handle_model(id, const mdl[]) {    if(!is_valid_ent(id) || !get_cvar_num("dod_am_enabled"))       return FMRES_IGNORED        new team = entity_get_int(id, EV_INT_team)        if(contain(mdl, "models/player.mdl") && team > 0)    {       entity_set_string(id, EV_SZ_model, models[team - 1])       return FMRES_SUPERCEDE    }        new temp[128]    entity_get_string(id, EV_SZ_model, temp, 127)    log_amx("entid: %d model: %s", id, temp)            return FMRES_IGNORED }
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 12-17-2005 , 16:11  
Reply With Quote #3

@Cheap_Suit

Yeah did that, thanks though. Just that I got rid of the code cause I didn't think it was working. Then when I was doing this thread I used the code above and forgot to change the FM returns.

Cheers!
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 12-17-2005 , 18:13  
Reply With Quote #4

Might be this...
Code:
containi(mdl, ”models/player.mdl)
Proper Usage:
Code:
containi(mdl, ”models/player.mdl) != -1
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 12-17-2005 , 19:40  
Reply With Quote #5

Nope, that just a redundant statement. I know that it gets that far with my code as at one point in time I have a log_amx command within the if statement.

Thanks, Cheers!
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-18-2005 , 04:34  
Reply With Quote #6

Request a DoD model changing function. In the meantime, you can do what Target suggested:

Quote:
Originally Posted by T(+)rget
To get it working with FM you'd need to completely block ClientUserInfoChanged when model changing is occuring and also set SET_CLIENT_KEYVALUE in PlayerPostThink.

Its how it works in VexdUM, think CStrike module using pvdata offsets?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
watch
Senior Member
Join Date: Sep 2005
Old 12-18-2005 , 08:16  
Reply With Quote #7

I've been trying to do this with tfc without using the tfc module because tfc_setmodel is the only function i use from it.

afaik entity_set_string EV_SZ_model just doesnt work for players

DispatchKeyValue(id,"replacement_model","Aqua fresh"); works in tfc but you have to respawn for it to take effect. How would i make it take effect immediately?

but i think replacement_model is a tfc specific function from item_tfgoal Is there an entity in DOD that allows you to change the playermodel
__________________
Code:
#include <amusing_small_signiture>
watch is offline
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 12-18-2005 , 09:54  
Reply With Quote #8

@XxAvalanchexX

Thanks for the information. But I do have some questiong. I can understand what T(+)rget wrote. But the implementation is in question. Would I do the following for the ClientUserInfoChanged:

Code:
public client_infochanged(id)
{
     if(model has been changed && this is an admin)
     {
          change model back again
          return PLUGIN_HANDLED
     }
     return PLUGIN_CONTINUE
}
As for the PlayerPostThink, that should be simple:

Code:
public client_PostThink(id)
{
 if(model has been changed && this is an admin)
     {
          change model back again
          return PLUGIN_HANDLED
     }
     return PLUGIN_CONTINUE
}
Now the thing is, will these overide the changes, I dont want to be changing the model a billion times as this will cause lagg at least I would assume. Could you or maybe T(+)rget give me some code to look at. I aint no slacker when it comes to coding. Just never played with this kinda stuff before.

Cheers!
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
Jordan
Veteran Member
Join Date: Aug 2005
Old 12-18-2005 , 11:36  
Reply With Quote #9

entity_set_model????????????????????

You probably just could do this:

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <engine> #define PLUGIN "Admin Model" #define VERSION "1.0" #define AUTHOR "Zor" public plugin_init() {     register_plugin("Admin Model", "1.0", "Zor") } public plugin_precache()     precache_model("models/player.mdl") public client_putinserver(id){     new entid     if(is_user_admin(id))     entity_set_model(entid, "models/player.mdl")     return PLUGIN_HANDLED }

Why can't you do this?
Jordan is offline
watch
Senior Member
Join Date: Sep 2005
Old 12-18-2005 , 11:48  
Reply With Quote #10

ive tried entity_set_model before and it doesnt work with players
__________________
Code:
#include <amusing_small_signiture>
watch is offline
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 23:25.


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