Raised This Month: $ Target: $400
 0% 

Custom weapon models


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
M4Maniac
Member
Join Date: Aug 2005
Old 03-23-2006 , 19:42   Custom weapon models
#1

Code:
#include <amxmodx> 
#include <engine> // this plugin requires Engine 

public plugin_init() 
{ 
register_plugin("oh hello" , "1.0" , "v3x"); 
register_event("CurWeapon" , "set_models" , "be" , "1=1"); // if we don't check for the isActive parameter then the skins will act up and change unexpectedly on you (if 0) 
} 
public plugin_precache() 
{ 
precache_model("models/v_newdeag.mdl"); // the view model 
precache_model("models/p_newdeag.mdl"); // the player (view) model 
} 

public set_models(id) 
{ 
if(!is_user_alive(id)) // if the player is dead for some reason, prevent the rest of the function from being executed 
{ 
return PLUGIN_HANDLED; 
} 

new weapid = read_data(2); // get the weapon ID 
switch(weapid) 
{ 
case CSW_DEAGLE: // check if it's the weapon ID we want (see below for weapon constants) 
{ 
entity_set_string(id , EV_SZ_viewmodel , "models/v_newdeag.mdl"); // set the view model 
entity_set_string(id , EV_SZ_weaponmodel , "models/p_newdeag.mdl"); // set the player (view) model 
} 
} 
return PLUGIN_CONTINUE; 
}
Thats what i have

heres what i did:
1) Make that plugin an SMA

2) Compile it with AMXX Compiler

3) Got my Model for the deagle and replaced it with the old one

4) Put my plugin in my plugins folder

5) Added it to plugins.ini

6) Restarted my server

7) Tried to use it but it didn't work....

What am I doing wrong?
[/code]
M4Maniac is offline
akysiev
Junior Member
Join Date: Mar 2006
Location: Earth
Old 03-24-2006 , 07:20  
#2

I had a similar problem and resorted to using get_user_weapon instead of reading the message data.

Replace

Code:
new weapid = read_data(2); // get the weapon ID

with

Code:
new clip, ammo, weapid = get_user_weapon(id, clip, ammo);
akysiev is offline
M4Maniac
Member
Join Date: Aug 2005
Old 03-24-2006 , 08:48  
#3

okay i did that but when i try to compile i get these errors:
Code:
/home/users/amxmodx/tmp3/texthwctJ8.sma(23) : error 029: invalid expression, assumed zero /home/users/amxmodx/tmp3/texthwctJ8.sma(23) : warning 215: expression has no effect /home/users/amxmodx/tmp3/texthwctJ8.sma(34) : warning 203: symbol is never used: "clip" 1 Error. Could not locate output file /home/groups/amxmodx/public_html/websc3/texthwctJ8.amx (compile failed).
M4Maniac is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-24-2006 , 08:53  
#4

how can you fail replacing one line? dear man, try again.
[ --<-@ ] Black Rose is offline
M4Maniac
Member
Join Date: Aug 2005
Old 03-24-2006 , 09:40  
#5

Okay i got it to compile but the plugin still isnt working..
M4Maniac is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-24-2006 , 15:04  
#6

well i can't se any errors, what exactly did you do with the files? what are they named? in wich directory?
[ --<-@ ] Black Rose is offline
M4Maniac
Member
Join Date: Aug 2005
Old 03-24-2006 , 18:25  
#7

Okay i will tell you what i just did:
Code:
#include <amxmodx> #include <engine> // this plugin requires Engine public plugin_init() { register_plugin("oh hello" , "1.0" , "v3x"); register_event("CurWeapon" , "set_models" , "be" , "1=1"); // if we don't check for the isActive parameter then the skins will act up and change unexpectedly on you (if 0) } public plugin_precache() { precache_model("models/v_glock18.mdl"); // the view model precache_model("models/p_glock18.mdl"); // the player (view) model } public set_models(id) { if(!is_user_alive(id)) // if the player is dead for some reason, prevent the rest of the function from being executed { return PLUGIN_HANDLED; } new clip, ammo, weapid = get_user_weapon(id, clip, ammo); switch(weapid) { case CSW_DEAGLE: // check if it's the weapon ID we want (see below for weapon constants) { entity_set_string(id , EV_SZ_viewmodel , "models/v_glcok18.mdl"); // set the view model entity_set_string(id , EV_SZ_weaponmodel , "models/p_glcok18.mdl"); // set the player (view) model } } return PLUGIN_CONTINUE; }

1) I took the files i dled and i put my p_glock18, v_glock18, and w_glock18 in the Models folder.

2) I took the plugin and placed it in my plugins folder

3) i edited the plugins.ini
M4Maniac is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-24-2006 , 19:30  
#8

God, just use the web compiler.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
M4Maniac
Member
Join Date: Aug 2005
Old 03-24-2006 , 19:49  
#9

I did but i still get no result do i have to type something when in console in the game to get it to work?
M4Maniac is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-24-2006 , 20:04  
#10

Quote:
models/v_glock18.mdl
models/p_glock18.mdl
Won't work because those are the names of the default model files. Rename them or move them to a different directory.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Closed Thread


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 16:45.


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