Raised This Month: $32 Target: $400
 8% 

Changing weapon models (Extended)


Post New Thread Reply   
 
Thread Tools Display Modes
[DoD]GoldenEagle
Member
Join Date: Nov 2005
Location: In Front Of Computer Sys
Old 07-21-2006 , 19:48   Re: Changing weapon models
Reply With Quote #11

So what do i do with the
#include <amxmodx>
#include <engine>
#include <fakemeta>

new VIEW_MODEL[] = "models/v_<model name>.mdl"
new PLAYER_MODEL[] = "models/p_<model name>.mdl"
new WORLD_MODEL[] = "models/w_<model name>.mdl"

new OLDWORLD_MODEL[] = "models/w_<model name>.mdl" // the world model you want replaced

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

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_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)
{
// might not work for other mods
new weaponID = read_data(2)

// eg, if weapon is not ak then continue
if(weaponID != CSW_AK47)
return PLUGIN_CONTINUE

// this set's the view model (what you see when holding the gun)
entity_set_string(id, EV_SZ_viewmodel, VIEW_MODEL)

// this set's the player model (what you see when people holding the gun)
entity_set_string(id, EV_SZ_weaponmodel, PLAYER_MODEL)

return PLUGIN_CONTINUE
}

public fw_SetModel(entity, model[])
{
// check if its a valid entity or else we'll get errors
if(!is_valid_ent(entity))
return FMRES_IGNORED

// checks if it's the model we want to change
if(!equali(model, OLDWORLD_MODEL))
return FMRES_IGNORED

new className[33]
entity_get_string(entity, EV_SZ_classname, className, 32)

// dropped weapons map weapons c4 + grenades
if(equal(className, "weaponbox") || equal(className, "armoury_entity") || equal(className, "grenade"))
{
// set's the world model (what you see on the ground)
entity_set_model(entity, WORLD_MODEL)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
__________________
[DoD]GoldenEagle is offline
[DoD]GoldenEagle
Member
Join Date: Nov 2005
Location: In Front Of Computer Sys
Old 07-22-2006 , 00:13   Re: Changing weapon models
Reply With Quote #12

Ok i get it now but what do i do with this now?
__________________
[DoD]GoldenEagle is offline
[DoD]GoldenEagle
Member
Join Date: Nov 2005
Location: In Front Of Computer Sys
Old 07-22-2006 , 01:05   Re: Changing weapon models
Reply With Quote #13

Ok see now that i copoed that code what do i do change something or put it on notepad.....what?
__________________
[DoD]GoldenEagle is offline
tupacaveli
BANNED
Join Date: Jul 2006
Old 07-23-2006 , 09:54   Re: Changing weapon models
Reply With Quote #14

i tried this one but the w_ mdls still dont work on my server after several days of trying and retrying.
tupacaveli is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 07-23-2006 , 13:00   Re: Changing weapon models
Reply With Quote #15

You didnt put that right mode in new OLDMODEL[]
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
[DoD]GoldenEagle
Member
Join Date: Nov 2005
Location: In Front Of Computer Sys
Old 07-27-2006 , 12:43   Re: Changing weapon models
Reply With Quote #16

Can you jsut psot a whole script or not jsut those two pieces?
__________________
[DoD]GoldenEagle is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 07-28-2006 , 00:12   Re: Changing weapon models
Reply With Quote #17

The whole script is the first one. The second one is only if you want to use fakemeta.
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
Dave-orangekiller
Junior Member
Join Date: Jul 2006
Old 07-28-2006 , 00:24   Re: Changing weapon models
Reply With Quote #18

hi,

im lost with code can a person explain to me how to put knife model with this code (i wan a v_knife.mdl and p_knife.mdl)

#include <amxmodx>
#include <engine>
#include <fakemeta>

new VIEW_MODEL[] = "models/v_<model name>.mdl"
new PLAYER_MODEL[] = "models/p_<model name>.mdl"
new WORLD_MODEL[] = "models/w_<model name>.mdl"

new OLDWORLD_MODEL[] = "models/w_<model name>.mdl" // the world model you want replaced

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

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_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)
{
// might not work for other mods
new weaponID = read_data(2)

// eg, if weapon is not ak then continue
if(weaponID != CSW_AK47)
return PLUGIN_CONTINUE

// this set's the view model (what you see when holding the gun)
entity_set_string(id, EV_SZ_viewmodel, VIEW_MODEL)

// this set's the player model (what you see when people holding the gun)
entity_set_string(id, EV_SZ_weaponmodel, PLAYER_MODEL)

return PLUGIN_CONTINUE
}

public fw_SetModel(entity, model[])
{
// check if its a valid entity or else we'll get errors
if(!is_valid_ent(entity))
return FMRES_IGNORED

// checks if it's the model we want to change
if(!equali(model, OLDWORLD_MODEL))
return FMRES_IGNORED

new className[33]
entity_get_string(entity, EV_SZ_classname, className, 32)

// dropped weapons map weapons c4 + grenades
if(equal(className, "weaponbox") || equal(className, "armoury_entity") || equal(className, "grenade"))
{
// set's the world model (what you see on the ground)
entity_set_model(entity, WORLD_MODEL)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
Dave-orangekiller is offline
Send a message via MSN to Dave-orangekiller
Dave-orangekiller
Junior Member
Join Date: Jul 2006
Old 07-29-2006 , 13:05   Re: Changing weapon models
Reply With Quote #19

oki but the problem it's in that code wat i change i want to know all i change sorry code and me are not friend lol all time i try they said not work i put wat i change

Code:
#include <amxmodx> #include <engine> #include <fakemeta>
new VIEW_MODEL[] = "models/v_knife.mdl" new PLAYER_MODEL[] = "models/p_knife.mdl" new WORLD_MODEL[] = "models/w_<model name>.mdl" (WAT I DO)
new OLDWORLD_MODEL[] = "models/w_<model name>.mdl" // the world model you want replaced (WAT I DO)
new PLUGIN_NAME[] = "knife" new PLUGIN_AUTHOR[] = "Cheap_Suit" new PLUGIN_VERSION[] = "1.0"
public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR) register_event("CurWeapon", "Event_CurWeapon", "be","1=1") register_forward(FM_SetModel, "fw_SetModel") (WAT I DO) }
public plugin_precache() { precache_model(v_knife) precache_model(p_knife) precache_model(WORLD_MODEL) (WAT I DO) }
public Event_CurWeapon(id) { // might not work for other mods new weaponID = read_data(2)
// eg, if weapon is not ak then continue if(weaponID != CSW_KNIFE) return PLUGIN_CONTINUE
// this set's the view model (what you see when holding the gun) entity_set_string(id, EV_SZ_viewmodel, v_knife.mdl)
// this set's the player model (what you see when people holding the gun) entity_set_string(id, EV_SZ_weaponmodel, p_knife.mdl)
return PLUGIN_CONTINUE }
public fw_SetModel(entity, model[]) { // check if its a valid entity or else we'll get errors (WAT I DO) if(!is_valid_ent(entity)) return FMRES_IGNORED
// checks if it's the model we want to change if(!equali(model, OLDWORLD_MODEL)) (WAT I DO) return FMRES_IGNORED
new className[33] entity_get_string(entity, EV_SZ_classname, className, 32) (WAT I DO)
// dropped weapons map weapons c4 + grenades if(equal(className, "weaponbox") || equal(className, "armoury_entity") || equal(className, "grenade")) (WAT I DO) { // set's the world model (what you see on the ground) entity_set_model(entity, WORLD_MODEL) (WAT I DO) return FMRES_SUPERCEDE } return FMRES_IGNORED }


Last edited by Dave-orangekiller; 07-29-2006 at 13:17.
Dave-orangekiller is offline
Send a message via MSN to Dave-orangekiller
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 07-29-2006 , 23:50   Re: Changing weapon models
Reply With Quote #20

WORLD_MODEL - is the new w_ skin for the custom weapon.
OLDWORLD_MODEL - is the default skin for weapon. This is needed because a lot of entities goes through FM_SetModel. We just need to filter out which model we want to change.

As for your knife model, if you dont have an custom world knife model, then just use the default.

Example:

Code:
new WORLD_MODEL[] = "models/w_knife.mdl"  
new OLDWORLD_MODEL[] = "models/w_knife.mdl"
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
Reply


Thread Tools
Display Modes

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 04:26.


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