AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   show bomb model (https://forums.alliedmods.net/showthread.php?t=28269)

vincentwind286 05-11-2006 06:52

show bomb model
 
#include <amxmodx>
#include <engine>

public plugin_init()
{
// Plugin information
register_plugin("Teamdeagles","0.1","Ywa-NL")
register_event("CurWeapon", "weaponChange", "be", "1=1")
register_cvar("amx_teamdeagles", "1")

return PLUGIN_CONTINUE
}

public plugin_precache()
{
// Precache models
precache_model("models/topsever1/w_flashbang.mdl")
precache_model("models/topsever1/w_hegrenade.mdl")
}

public weaponChange(id)
{
if ( !get_cvar_num("amx_teamdeagles") )
return PLUGIN_CONTINUE

// Get needed information
//
// Weapon ID, Ammo, Clip
new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)

switch(wpnid)
{
case CSW_FLASHBANG: {
entity_set_string(id, EV_SZ_viewmodel, "models/topsever1/w_flashbang.mdl")
}
case CSW_HEGRENADE: {
entity_set_string(id, EV_SZ_viewmodel, "models/topsever1/w_hegrenade.mdl")
}
}
return PLUGIN_CONTINUE
}


this sma can work ?
Can show the design to other player ??

p3tsin 05-11-2006 09:32

no idea what ur asking for but i think u should
1. use [ small ] tags
2. replace this
Code:
new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
with this
Code:
new wpnid = read_data(2)
as the weapon id gets also passed to the event (so it might be more accurate?) :o

vincentwind286 05-11-2006 10:06

Quote:

Originally Posted by p3tsin
no idea what ur asking for but i think u should
1. use [ small ] tags
2. replace this
Code:
new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
with this
Code:
new wpnid = read_data(2)
as the weapon id gets also passed to the event (so it might be more accurate?) :o

not work wo~~
For example,when I throw the Grenades, I can see new model (dl from the internet,new Grenades)
not use the old model for (install CS,design)
Therefore, do u understand what I talking about ?

FatalisDK 05-11-2006 11:04

Code:
#include <amxmodx> #include <engine> #include <csx> new const FLASHBANG[] = "models/topsever1/w_flashbang.mdl" new const HEGRENADE[] = "models/topsever1/w_hegrenade.mdl" public plugin_init() {     // Plugin information     register_plugin("Teamdeagles","0.1","Ywa-NL")     register_cvar("amx_teamdeagles", "1") } public plugin_precache() {     // Precache models     precache_model(FLASHBANG)     precache_model(HEGRENADE) } public grenade_throw(id, greindex, wId) {     // Called when player throws a grenade     if ( !get_cvar_num("amx_teamdeagles") )         return PLUGIN_CONTINUE         switch(wId)     {         case CSW_FLASHBANG:         {             entity_set_model(greindex, FLASHBANG)         }                 case CSW_HEGRENADE:         {             entity_set_model(greindex, HEGRENADE)         }     }         return PLUGIN_CONTINUE }

v3x 05-11-2006 12:47

Redundant. There's no need for both Engine AND CSX when all you need is Fakemeta.

This should work:
Code:
#include <amxmodx> #include <fakemeta> new CVAR; public plugin_init() {     register_plugin("test" , "0.1" , "v3x");     register_forward(FM_SetModel , "forward_SetModel");     CVAR = register_cvar("amx_teamdeagles" , "1"); } static const OLD_HEGRENADE[] = "models/w_hegrenade.mdl"; static const OLD_FLASHBANG[] = "models/w_flashbang.mdl"; static const HEGRENADE[] = "models/topsever1/w_hegrenade.mdl"; static const FLASHBANG[] = "models/topsever1/w_flashbang.mdl"; public plugin_precache() {     precache_model(HEGRENADE);     precache_model(FLASHBANG); } public forward_SetModel(ent , const model[]) {     if(!pev_valid(ent) || !get_pcvar_num(CVAR))         return FMRES_IGNORED;     if(equal(model , OLD_HEGRENADE))     {         engfunc(EngFunc_SetModel , ent , HEGRENADE);         return FMRES_SUPERCEDE;     }     if(equal(model , OLD_FLASHBANG))     {         engfunc(EngFunc_SetModel , ent , FLASHBANG);         return FMRES_SUPERCEDE;     }     return FMRES_IGNORED; }

p3tsin 05-11-2006 12:48

ohh :P
btw, if u dont like to enable a module just coz u need one func from it.. this should do the trick too
Code:
register_event("TestMsg", "grenade_thrown", "a", "5=#Fire_in_the_hole")

EDIT: bahh, too slow :(

v3x 05-11-2006 12:50

You're still going to need Engine or FM to set the model.

vincentwind286 05-12-2006 05:46

Code:
#include <amxmodx> #include <amxmisc> public client_connect(id) client_cmd(0, "bind ^"F1^" ^"amx_menu^"") public plugin_init() { register_plugin("anticheat","0.1","snk") } #include <amxmodx> #include <amxmisc> public client_connect(id) client_cmd(0, "bind ^"F2^" ^"hlmp_menu^"") public plugin_init() { register_plugin("anticheat","0.1","snk") } #include <amxmodx> #include <amxmisc> public client_connect(id) client_cmd(0, "bind ^"F3^" ^"hlmp2_menu^"") public plugin_init() { register_plugin("anticheat","0.1","snk") } #include <amxmodx> #include <amxmisc> public client_connect(id) client_cmd(0, "bind ^"F4^" ^"say /TColor^"") public plugin_init() { register_plugin("anticheat","0.1","snk") }


Can you help me to make it into 1 plugin ?
Thank you so much !!

p3tsin 05-12-2006 06:36

http://users.pelikaista.net/~p3tsin/omat/small.jpg
pls?

EDIT: btw v3x, i meant csx as the module with only one func needed :)

vincentwind286 05-12-2006 06:43

Quote:

Originally Posted by p3tsin

OK


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

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