Raised This Month: $ Target: $400
 0% 

Changing weapons model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 08-09-2011 , 12:14   Changing weapons model
Reply With Quote #1

Can someone give me a simple code that changes knife's model.
dreamedward is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 08-09-2011 , 13:03   Re: Changing weapons model
Reply With Quote #2

Weapon Model Replacement
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 08-09-2011 , 13:06   Re: Changing weapons model
Reply With Quote #3

Search in the tutorial section.

cheap_suit made a tutorial about this.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 08-09-2011 , 14:57   Re: Changing weapons model
Reply With Quote #4

Found the script -
PHP Code:
#include <amxmodx> 
#include <engine> 
#include <fakemeta> 
new VIEW_MODEL[]    = "models/v_newKnife.mdl" 
new PLAYER_MODEL[]    = "models/p_newKnife.mdl" 
new WORLD_MODEL[]    = "models/w_knife.mdl"
new OLDWORLD_MODEL[]    = "models/w_knife.mdl"
new PLUGIN_NAME[]        = "Custom Knife Model" 
new PLUGIN_AUTHOR[]    = "Cheap_Suit" 
new PLUGIN_VERSION[]     = "1.0" 
public plugin_init() 
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)     
    
register_event("CurWeapon""Event_CurWeapon""be","1=1")
    
register_forward(FM_SetModel"fw_SetModel")

public 
plugin_precache() 
{    
    
precache_model(VIEW_MODEL)     
    
precache_model(PLAYER_MODEL
    
precache_model(WORLD_MODEL)

public 
Event_CurWeapon(id
{     
    new 
weaponID read_data(2
    if(
weaponID != CSW_KNIFE)
        return 
PLUGIN_CONTINUE
    set_pev
(idpev_viewmodel2VIEW_MODEL)
    
set_pev(idpev_weaponmodel2PLAYER_MODEL)
    
    return 
PLUGIN_CONTINUE 
}
public 
fw_SetModel(entitymodel[])
{
    if(!
is_valid_ent(entity)) 
        return 
FMRES_IGNORED
    
if(!equali(modelOLDWORLD_MODEL)) 
        return 
FMRES_IGNORED
    
new className[33]
    
entity_get_string(entityEV_SZ_classnameclassName32)
    
    if(
equal(className"weaponbox") || equal(className"armoury_entity") || equal(className"grenade"))
    {
        
engfunc(EngFunc_SetModelentityWORLD_MODEL)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED

Now how can I make it to change the knife model only when I write a command in chat and at a new round to reset back to the normal knife model?
dreamedward is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 08-09-2011 , 15:35   Re: Changing weapons model
Reply With Quote #5

Try something like this:

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

new VIEW_MODEL[]        = "models/v_newKnife.mdl" 
new PLAYER_MODEL[]       = "models/p_newKnife.mdl" 
new WORLD_MODEL[]        = "models/w_knife.mdl"
new OLDWORLD_MODEL[]    = "models/w_knife.mdl"

new PLUGIN_NAME[]       = "Custom Knife Model" 
new PLUGIN_AUTHOR[]        = "Cheap_Suit" 
new PLUGIN_VERSION[]    = "1.0" 

new boolg_bHasModel[33] = {false, ...};

public 
plugin_init() 
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR
    
    
register_clcmd("say /knife""CmdKnife");
    
register_logevent("EventRoundStart"2"1=Round_Start");
    
register_event("CurWeapon""Event_CurWeapon""be","1=1")
    
    
register_forward(FM_SetModel"fw_SetModel")


public 
CmdKnife(id)
{
    
g_bHasModel[id] = true;
    
    return 
PLUGIN_HANDLED;
}

public 
plugin_precache() 
{    
    
precache_model(VIEW_MODEL)     
    
precache_model(PLAYER_MODEL
    
precache_model(WORLD_MODEL)

public 
Event_CurWeapon(id
{     
    if(!
g_bHasModel[id])
        return 
PLUGIN_CONTINUE;
        
    new 
weaponID read_data(2
    if(
weaponID != CSW_KNIFE)
        return 
PLUGIN_CONTINUE
    set_pev
(idpev_viewmodel2VIEW_MODEL)
    
set_pev(idpev_weaponmodel2PLAYER_MODEL)
    
    return 
PLUGIN_CONTINUE 
}
public 
fw_SetModel(entitymodel[])
{
    if(!
is_valid_ent(entity)) 
        return 
FMRES_IGNORED
    
if(!equali(modelOLDWORLD_MODEL)) 
        return 
FMRES_IGNORED
    
new className[33]
    
entity_get_string(entityEV_SZ_classnameclassName32)
    
    if(
equal(className"weaponbox") || equal(className"armoury_entity") || equal(className"grenade"))
    {
        
engfunc(EngFunc_SetModelentityWORLD_MODEL)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED
}  


public 
EventRoundStart()
    
arrayset(g_bHasModelfalsesizeof(g_bHasModel)); 
If you're not able to code yourself, it might be easier to use the plugin wickedd posted.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 08-10-2011 , 05:25   Re: Changing weapons model
Reply With Quote #6

I was wondering could you tell me how can I make it to all players by menu? I mean Im the admin and every round I choose which knife will be for Ts which knife for CTs. Something like 1. New knife1
2. New knife2 3.New Knife3
I'll be very greatful! Thanks!
dreamedward is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-10-2011 , 10:06   Re: Changing weapons model
Reply With Quote #7

There is already a different knife model plugin with a menu and all.
Search for it.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 08-10-2011 , 10:59   Re: Changing weapons model
Reply With Quote #8

Yes but its not the same. Has many differences than what I want.
dreamedward is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-10-2011 , 11:17   Re: Changing weapons model
Reply With Quote #9

Of course It won't be exactly the same but all of the functionality is there.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 08-10-2011 , 16:45   Re: Changing weapons model
Reply With Quote #10

Well could you tell me how can I make it the Admin to set different knife models to all players, not for himself only? And every round the models to reset and to let him choose the knifes for Ts and CTs. Here is the plugin: http://forums.alliedmods.net/showthread.php?t=44586
dreamedward 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 09:12.


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