Raised This Month: $ Target: $400
 0% 

[Help] entity_set_model Can't Change The Model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xvil
BANNED
Join Date: Feb 2012
Old 03-02-2012 , 12:09   [Help] entity_set_model Can't Change The Model
Reply With Quote #1

Decription: Changing The C4 Model in the Server

If I plant The Bomb The Model Will Be Changed
Code:
But I've a problem if i select the item C4 the Model will Not be Changed
Please Help

Full Script:
Spoiler
Attached Files
File Type: zip C4new.zip (481.0 KB, 81 views)

Last edited by Xvil; 03-02-2012 at 13:57.
Xvil is offline
Old 03-02-2012, 13:16
Xvil
This message has been deleted by Xvil. Reason: Unless Comment
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 03-02-2012 , 14:21   Re: [Help] entity_set_model Can't Change The Model
Reply With Quote #2

Try FM_SetModel forward.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-02-2012 , 14:30   Re: [Help] entity_set_model Can't Change The Model
Reply With Quote #3

That is not how you change the model of the C4.
The player models are different from the planted C4 models.

For changing weapon models, look at the tutorial in the Code Snippets / Tutorial section.

For changing the C4 model, hook when it is planted and just change it there.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Xvil
BANNED
Join Date: Feb 2012
Old 03-02-2012 , 14:41   Re: [Help] entity_set_model Can't Change The Model
Reply With Quote #4

Ok
Xvil is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 03-02-2012 , 16:57   Re: [Help] entity_set_model Can't Change The Model
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
That is not how you change the model of the C4.
The player models are different from the planted C4 models.

For changing weapon models, look at the tutorial in the Code Snippets / Tutorial section.

For changing the C4 model, hook when it is planted and just change it there.
Is using the CSX forward already to late to change the model?
Doc-Holiday is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-02-2012 , 17:06   Re: [Help] entity_set_model Can't Change The Model
Reply With Quote #6

Quote:
Originally Posted by Doc-Holiday View Post
Is using the CSX forward already to late to change the model?
You can use that or the log event that is sent.
Then find the bomb entity and set it's model.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 03-03-2012 , 02:01   Re: [Help] entity_set_model Can't Change The Model
Reply With Quote #7

Work fine:
PHP Code:
// Now include
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>

// http://wiki.alliedmods.net/CBasePlayerItem_%28CS%29
// m_pPlayer     41     45     +4     CBasePlayer*     ( get_pdata_cbase() ) 
#define m_pPlayer        41

#define CBasePlayerItem    4

// Precache
public plugin_precache()
{
    
// Precache model if needed
    //precache_model("models/v_ak47.mdl");
    //precache_model("models/p_ak47.mdl");
    //precache_model("models/w_ak47.mdl");
}

// Init
public plugin_init()
{
    
// Register SetModel forward (PRE)
    
register_forward(FM_SetModel"SetModelPre"0);
    
    
// Register Deploy weapon_c4 forward (POST)
    
RegisterHam(Ham_Item_Deploy"weapon_c4""C4DeployPost"1);
}

// Hook setmodel (PRE)
public SetModelPre(pEntity, const szModel[])
{
    
// If modelname not equal c4 model...
    
if (!equal(szModel"models/w_c4.mdl"))
        return 
FMRES_IGNORED;
    
    
// Now set new model
    
entity_set_model(pEntity"models/w_ak47.mdl");
    
    
// Block
    
return FMRES_SUPERCEDE;
}

// Hook deploy c4 (POST)
public C4DeployPost(pEntity)
{
    
// Now get owner of weapon from private data (from variable m_pPlayer of CBasePlayerItem class)
    
new pPlayer get_pdata_cbase(pEntitym_pPlayerCBasePlayerItem);
    
    
// Now set view and player model (v_ and p_)
    
entity_set_string(pPlayerEV_SZ_viewmodel"models/v_ak47.mdl");
    
entity_set_string(pPlayerEV_SZ_weaponmodel"models/p_ak47.mdl");

__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
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 21:17.


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