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

Weird issue with Ham_Spawn and/or cs_set_user_model


Post New Thread Reply   
 
Thread Tools Display Modes
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 03-20-2015 , 13:11   Re: Weird issue with Ham_Spawn and/or cs_set_user_model
Reply With Quote #11

Because I want to use built in modules. Why should I use other ones? I better wait till this gets fixed, then add custom modules, that I don't need and doesn't give me any advantage. That delay is only for changing model to whole server in few seconds, which, as you can see in example, I don't do - I check if player has that model, if don't set it. So player gets model changed once per map if needed.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-20-2015 , 14:39   Re: Weird issue with Ham_Spawn
Reply With Quote #12

Quote:
Originally Posted by GuskiS View Post
Pointless posting doesn't help anyone.
Pointless ? I guess the Orpheu module is not supported anymore in amxx, and is outdated.

Again, use default amxx with code used to confirm issue.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 03-20-2015 , 15:00   Re: Weird issue with Ham_Spawn
Reply With Quote #13

Quote:
Originally Posted by HamletEagle View Post
After doing some tests I found that this is not related with Spawn(), but with cs_set_user_model() native. Tested with 1.8.2

Edit: This are more assumptions and what I saw after playing with debug messages:

After more tests, it seems that SetClientKeyValue is no longer triggered for key model after cs_set_user_model() is used.

Cstrike does SETCLIENTKEYVALUE(params[1], GETINFOKEYBUFFER(pPlayer), "model", (char*)g_players[params[1]].GetModel());. It is calling *g_engfuncs.pfnSetClientKeyValue, this may be the reason why the hook is no longer triggered for name key. Why ? I don't understand.
Just remembered that I had issues with this:
PHP Code:
public client_putinserver(id)
{
    
client_cmd(id"setinfo _ah 0");

I set that on client, then set model on Ham_Spawn, but when player was killed, body that was spawned had different model - the one he has before I set it, weird.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-21-2015 , 09:13   Re: Weird issue with Ham_Spawn
Reply With Quote #14

Quote:
Originally Posted by GuskiS View Post
Just remembered that I had issues with this:
PHP Code:
public client_putinserver(id)
{
    
client_cmd(id"setinfo _ah 0");

I set that on client, then set model on Ham_Spawn, but when player was killed, body that was spawned had different model - the one he has before I set it, weird.
If you mean the dead body, hooking ClCorpse message and applying the model should be enough.
__________________

Last edited by HamletEagle; 03-21-2015 at 09:13.
HamletEagle is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 03-21-2015 , 09:19   Re: Weird issue with Ham_Spawn and/or cs_set_user_model
Reply With Quote #15

That is the thing - I tried changing it in ClCorpse, it still set them to pre-change model
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-21-2015 , 09:56   Re: Weird issue with Ham_Spawn and/or cs_set_user_model
Reply With Quote #16

Quote:
Originally Posted by GuskiS View Post
That is the thing - I tried changing it in ClCorpse, it still set them to pre-change model
ClCorpse wont changes using cs_set_user_model because are cached when the player is alive.

Try to set model using something like this:

PHP 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")

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 03-21-2015 at 09:57.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 03-21-2015 , 11:24   Re: Weird issue with Ham_Spawn and/or cs_set_user_model
Reply With Quote #17

Quote:
Originally Posted by ^SmileY View Post
ClCorpse wont changes using cs_set_user_model because are cached when the player is alive.

Try to set model using something like this:

PHP 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")

I was trying to change message param, not setting user model.
Used set_msg_arg_string, but the problemas was that in ClCorspe message it showed correct string value, however, it made body with different model.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 03-21-2015 at 11:25.
GuskiS 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 14:51.


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