Raised This Month: $ Target: $400
 0% 

Weapon model change


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 04-07-2011 , 13:41   Weapon model change
Reply With Quote #1

Hello,

I have a weapon model, but when I get the weapon and change to a pistol it keeps the weapon model instead of taking the pistol. When I shoot I do hear the pistol shot, so that means that the weapon model replaces the pistol, but when I change to another item (like a knife) and then change to the pistol I do get it. So I was wondering what I did wrong with this code:

PHP Code:
    new wpnid read_data(2)

        if(
player_class[id] == Mage  && wpnid == CSW_AK47 ) {
        
entity_set_string(idEV_SZ_viewmodelMAGICAK47)
        } 
egbertjan is offline
Old 04-08-2011, 14:18
egbertjan
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 04-08-2011 , 15:41   Re: Weapon model change
Reply With Quote #2

Try this (untested):

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>

public plugin_init()
    
RegisterHam(Ham_Item_Deploy"weapon_ak47""FwdAk47DeployPost"1);
    
    
public 
FwdAk47DeployPost(iWeapon)
{    
    new 
id entity_get_edict(iWeaponEV_ENT_owner);
    
    if(
id && player_class[id] == Mage)
        
entity_set_string(idEV_SZ_viewmodelMAGICAK47);

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 04-08-2011 , 16:18   Re: Weapon model change
Reply With Quote #3

This seems to be working perfectly! Thank you very much! If I will have other questions, could I PM you?

Edit: There is 1 run time error. When I drop the gun, and pick it up it says "Index out of bounds" Also I would have to switch weapons to get the model back on.

Last edited by egbertjan; 04-08-2011 at 16:26.
egbertjan is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-08-2011 , 16:29   Re: Weapon model change
Reply With Quote #4

Quote:
Originally Posted by egbertjan View Post
Please, any suggestions?
Don't bump until 2 weeks have passed since last post.

Also, try this:

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>

#define m_pPlayer 41

public plugin_init()
    
RegisterHam(Ham_Item_Deploy"weapon_ak47""FwdAk47DeployPost"1);
    
    
public 
FwdAk47DeployPost(iWeapon)
{    
    new 
id get_pdata_cbase(iWeaponm_pPlayer4);
    
    if(
id && player_class[id] == Mage)
        
entity_set_string(idEV_SZ_viewmodelMAGICAK47);

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 04-08-2011 at 16:35.
Exolent[jNr] is offline
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 04-08-2011 , 16:41   Re: Weapon model change
Reply With Quote #5

Thank you, this is working.

Sorry for the quick bump, sometimes I got the feeling that when it's not at the first page anymore people will not look into it anymore. I will try to set that out of my mind.
egbertjan 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 20:11.


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