AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Knife Model Script Help (https://forums.alliedmods.net/showthread.php?t=58363)

oreo824 07-24-2007 17:55

Knife Model Script Help
 
Hey guys, Havent been on these forms in a while! now im back into cs and scripting.

I need help, i want to precache a knife model (v_knife2.mdl) and have every player in the server have that model as their knife. This is a very simple script exept every time i try someones script or edit theirs it just doesent work.

Thanks,

oreo824

Edit:

Code:


#include <amxmodx>
#include <engine>

public plugin_init()   
 { 
 register_plugin( "eGKnife" ,"1.0", "incRo")
 register_event("CurWeapon","event_curweapon","b")
}
 
public plugin_precache() 
 {   
 precache_model("models/custom/egknife.mdl")
}
public event_curweapon(id)
 {
 new ammo, clip
 if(get_user_weapon(id,ammo,clip) == CSW_KNIFE)
  {
  entity_set_string(id,EV_SZ_viewmodel,"models/custom/egknife.mdl") 
 } 

}

can someone verify this? i compiled and checked and everything worked fine except the model didnt show up :|

Rolnaaba 07-24-2007 20:03

Re: Knife Model Script Help
 
try this:
Code:
#include <amxmodx> #include <fakemeta> public plugin_init() {       register_plugin( "eGKnife" ,"1.0", "incRo");         register_event("CurWeapon","event_curweapon","b"); }   public plugin_precache() {         precache_model("models/custom/egknife.mdl") } public event_curweapon(id) {     new wpnid = read_data(2);         if(wpnid == CSW_KNIFE) {         set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, "models/custom/egknife.mdl"));     }   }

oreo824 07-25-2007 00:37

Re: Knife Model Script Help
 
It doesent work :(

stupok 07-25-2007 00:57

Re: Knife Model Script Help
 
I tested this with the c4 model and it worked, so I hope it will do the job for you too:

Code:
#include <amxmodx> #include <fakemeta> public plugin_init() {       register_plugin( "eGKnife" ,"1.0", "incRo")         register_event("CurWeapon","event_curweapon","b","1=1","2=29") //CSW_KNIFE = 29 } public plugin_precache() {         precache_model("models/custom/egknife.mdl") } public event_curweapon(id) {     set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, "models/custom/egknife.mdl")) }

oreo824 07-25-2007 14:18

Re: Knife Model Script Help
 
It wont load correctly, it loads as "unknown" and when i restart the server the server doesent come up anymore unless i take it off.

Heres what i got:

Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()

    register_plugin( "eGKnife" ,"1.0", "incRo")
   
    register_event("CurWeapon","event_curweapon","b","1=1","2=29") //CSW_KNIFE = 29
}

public plugin_precache()
{   
    precache_model("models/custom/v_knife.mdl")
}

public event_curweapon(id)
{
    set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, "models/custom/v_knife.mdl"))
}


stupok 07-25-2007 14:38

Re: Knife Model Script Help
 
Copy and paste the code you have into an .sma file

Move the .sma file to amxmodx/scripting

Move the .sma file onto compile.exe

Go to amxmodx/scripting/compiled

Move the .amxx file to amxmodx/plugins

Open amxmodx/configs/plugins.ini and add the name of the amxx file

oreo824 07-26-2007 14:48

Re: Knife Model Script Help
 
I did exactly what you told me to do,
still shows up as unknown please help :|

owned 07-26-2007 15:40

Re: Knife Model Script Help
 
Do you have the module fakemeta enabled?

stupok 07-26-2007 16:13

Re: Knife Model Script Help
 
Type "amx_plugins" and "meta list" in your server console and paste the output here.

oreo824 07-26-2007 16:24

Re: Knife Model Script Help
 
Quote:

Originally Posted by owned (Post 508623)
Do you have the module fakemeta enabled?

thank you so much, i completely forgot about this.

thanks stupok69 by the way for the help with the code


All times are GMT -4. The time now is 21:25.

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