Podmiana modeli broni.
Blondyna
23.11.2012
Cześć, chcę się dowiedzieć czemu nie działa mi podamiana modelów broni w klasie.
* Do public plugin_init dodałem:
* Za plugin_init dodałem:
* Na koniec .sma dodałem:
Użytkownik Vesfper edytował ten post 23.11.2012 15:48
* Do public plugin_init dodałem:
register_event("CurWeapon", "CurWeapon", "be", "1=1")
* Za plugin_init dodałem:
public plugin_precache() { precache_model("models/cod/SteamTools_net_DualMP5.mdl"); }
* Na koniec .sma dodałem:
public CurWeapon(id) { if(ma_klase[id] && get_user_weapon(id) == CSW_MP5NAVY) entity_set_string(id, EV_SZ_viewmodel, "models/cod/SteamTools_net_DualMP5.mdl") }
Użytkownik Vesfper edytował ten post 23.11.2012 15:48
Split
23.11.2012
Moj urywek z kodu klasy...
public CurWeapon(id) { new weapon = read_data(2); if(ma_klase[id]) { if(weapon == CSW_M4A1) { set_pev(id, pev_viewmodel2, "models/CsNaxcod/soldat/v_m4a1.mdl") set_pev(id, pev_weaponmodel2, "models/soldat/p_m4a1.mdl") } if(weapon == CSW_DEAGLE ) { set_pev(id, pev_viewmodel2, "models/soldat/v_deagle.mdl") set_pev(id, pev_weaponmodel2, "models/soldat/p_deagle.mdl") } if(weapon == CSW_KNIFE) { set_pev(id, pev_viewmodel2, "models/soldat/v_knife.mdl") set_pev(id, pev_weaponmodel2, "models/CsNaxcod/soldat/p_knife.mdl") } } } public fw_SetModel(entity, model[]) { if(!pev_valid(entity)) return FMRES_IGNORED if(!equali(model, "models/w_m4a1.mdl")&&!equali(model, "models/w_deagle.mdl")&&!equali(model, "models/w_knife.mdl")) return FMRES_IGNORED; new entityowner = pev(entity, pev_owner); if(!ma_klase[entityowner]) return FMRES_IGNORED; if(equali(model, "models/w_m4a1.mdl")) engfunc(EngFunc_SetModel, entity, "models/w_deagle.mdl") else if(equali(model, "models/w_m4a1.mdl")) engfunc(EngFunc_SetModel, entity, "models/w_knife.mdl") return FMRES_SUPERCEDE }
Droso
23.11.2012
public CurWeapon(id) { if(ma_klase[id] && get_user_weapon(id) == CSW_MP5NAVY){ entity_set_string(id, EV_SZ_viewmodel, "models/cod/SteamTools_net_DualMP5.mdl") } }Dobry jest to model? Jest to model v_?
+ podmień kod powyżej, choć twój też powinien działać.
Na pewno masz klasę tą aktywną?
Użytkownik HubertTM edytował ten post 23.11.2012 16:00
Blondyna
23.11.2012
, Daje cały kod klasy:
#include <amxmodx> #include <amxmisc> #include <codmod> #include <hamsandwich> #include <engine> #include <ColorChat> #include <fakemeta> #define DMG_BULLET (1<<1) new const nazwa[] = "Fighter"; new const opis[] = "Dostajesz drugie MP5, twoje obrazenia sa dwukrotnie zwiekszone"; new const bronie = (1<<CSW_MP5NAVY); new const zdrowie = 15; new const kondycja = 25; new const inteligencja = 15; new const wytrzymalosc = 0; new skoki[33]; new bool:ma_klase[33]; public plugin_init() { register_plugin(nazwa, "1.0", "amxx.pl"); cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc); RegisterHam(Ham_TakeDamage, "player", "TakeDamage"); register_event("CurWeapon", "CurWeapon", "be", "1=1") register_forward(FM_CmdStart, "fwCmdStart_MultiJump"); } public plugin_precache() { precache_model("models/cod/SteamTools_net_DualMP5.mdl"); } public cod_class_enabled(id) { ColorChat(id, RED, "[INFO] ^x01Klasa ^x04Fighter ^x01zostala stworzona przez ^x04 Vesfper"); return PLUGIN_HANDLED } public cod_class_disabled(id) { ma_klase[id] = false; } public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits) { if(!is_user_connected(idattacker)) return HAM_IGNORED; if(!ma_klase[idattacker]) return HAM_IGNORED; if(get_user_team(this) != get_user_team(idattacker) && get_user_weapon(idattacker) == CSW_MP5NAVY && damagebits & DMG_BULLET) cod_inflict_damage(idattacker, this, 5.0, 0.0, idinflictor, damagebits); return HAM_IGNORED; } public CurWeapon(id) { if(ma_klase[id] && get_user_weapon(id) == CSW_MP5NAVY) entity_set_string(id, EV_SZ_viewmodel, "models/cod/SteamTools_net_DualMP5.mdl") } public fwCmdStart_MultiJump(id, uc_handle) { if(!is_user_alive(id) || !ma_klase[id]) return FMRES_IGNORED; new flags = pev(id, pev_flags); if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(id, pev_oldbuttons) & IN_JUMP) && skoki[id]) { skoki[id]--; new Float:velocity[3]; pev(id, pev_velocity,velocity); velocity[2] = random_float(265.0,285.0); set_pev(id, pev_velocity,velocity); } else if(flags & FL_ONGROUND) skoki[id] = 2; return FMRES_IGNORED; }
Split
23.11.2012
Trzymaj, sprawdz czy dziala
Użytkownik Jotpe edytował ten post 23.11.2012 16:20
#include <amxmodx> #include <amxmisc> #include <codmod> #include <hamsandwich> #include <engine> #include <ColorChat> #include <fakemeta> #define DMG_BULLET (1<<1) new const nazwa[] = "Fighter"; new const opis[] = "Dostajesz drugie MP5, twoje obrazenia sa dwukrotnie zwiekszone"; new const bronie = (1<<CSW_MP5NAVY); new const zdrowie = 15; new const kondycja = 25; new const inteligencja = 15; new const wytrzymalosc = 0; new skoki[33]; new bool:ma_klase[33]; public plugin_init() { register_plugin(nazwa, "1.0", "amxx.pl"); cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc); RegisterHam(Ham_TakeDamage, "player", "TakeDamage"); register_event("CurWeapon", "CurWeapon", "be", "1=1") register_forward(FM_CmdStart, "fwCmdStart_MultiJump"); } public plugin_precache() { precache_model("models/cod/SteamTools_net_DualMP5.mdl"); } public cod_class_enabled(id) { ColorChat(id, RED, "[INFO] ^x01Klasa ^x04Fighter ^x01zostala stworzona przez ^x04 Vesfper"); return PLUGIN_HANDLED } public cod_class_disabled(id) { ma_klase[id] = false; } public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits) { if(!is_user_connected(idattacker)) return HAM_IGNORED; if(!ma_klase[idattacker]) return HAM_IGNORED; if(get_user_team(this) != get_user_team(idattacker) && get_user_weapon(idattacker) == CSW_MP5NAVY && damagebits & DMG_BULLET) cod_inflict_damage(idattacker, this, 5.0, 0.0, idinflictor, damagebits); return HAM_IGNORED; } public CurWeapon(id) { new weapon = read_data(2); if(ma_klase[id]) { if(weapon == CSW_MP5NAVY) { set_pev(id, pev_viewmodel2, "models/cod/SteamTools_net_DualMP5.mdl") set_pev(id, pev_weaponmodel2, "models/p_mp5.mdl") } } } public fwCmdStart_MultiJump(id, uc_handle) { if(!is_user_alive(id) || !ma_klase[id]) return FMRES_IGNORED; new flags = pev(id, pev_flags); if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(id, pev_oldbuttons) & IN_JUMP) && skoki[id]) { skoki[id]--; new Float:velocity[3]; pev(id, pev_velocity,velocity); velocity[2] = random_float(265.0,285.0); set_pev(id, pev_velocity,velocity); } else if(flags & FL_ONGROUND) skoki[id] = 2; return FMRES_IGNORED; }
Użytkownik Jotpe edytował ten post 23.11.2012 16:20
Split
23.11.2012
SteamTools_net_DualMP5.mdl
Moze zamien na v_mp5.mdl
A jaki to jest model v czy p czy w?
Moze zadziala
Użytkownik Jotpe edytował ten post 23.11.2012 18:21
Moze zamien na v_mp5.mdl
A jaki to jest model v czy p czy w?
Moze zadziala
Użytkownik Jotpe edytował ten post 23.11.2012 18:21
Pan PrO
23.11.2012
Zobacz Teraz.
#include <amxmodx>
#include <amxmisc>
#include <codmod>
#include <hamsandwich>
#include <engine>
#include <ColorChat>
#include <fakemeta>
#define DMG_BULLET (1<<1)
new const nazwa[] = "Fighter";
new const opis[] = "Dostajesz drugie MP5, twoje obrazenia sa dwukrotnie zwiekszone";
new const bronie = (1<<CSW_MP5NAVY);
new const zdrowie = 15;
new const kondycja = 25;
new const inteligencja = 15;
new const wytrzymalosc = 0;
new skoki[33];
new bool:ma_klase[33];
public plugin_init()
{
register_plugin(nazwa, "1.0", "amxx.pl");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
register_event("CurWeapon", "CurWeapon", "be", "1=1")
register_forward(FM_CmdStart, "fwCmdStart_MultiJump");
}
public plugin_precache()
precache_model("models/cod/SteamTools_net_DualMP5.mdl");
public cod_class_enabled(id)
{
ColorChat(id, RED, "[INFO] ^x01Klasa ^x04Fighter ^x01zostala stworzona przez ^x04 Vesfper");
return PLUGIN_HANDLED
}
public cod_class_disabled(id)
{
ma_klase[id] = false;
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[idattacker])
return HAM_IGNORED;
if(get_user_team(this) != get_user_team(idattacker) && get_user_weapon(idattacker) == CSW_MP5NAVY && damagebits & DMG_BULLET)
cod_inflict_damage(idattacker, this, damage, 0.0, idinflictor, damagebits);
return HAM_IGNORED;
}
public CurWeapon(id)
{
new weapon = read_data(2);
if(weapon == CSW_MP5NAVY && ma_klase[id])
set_pev(id, pev_viewmodel2, "models/cod/SteamTools_net_DualMP5.mdl");
}
public fwCmdStart_MultiJump(id, uc_handle)
{
if(!is_user_alive(id) || !ma_klase[id])
return FMRES_IGNORED;
new flags = pev(id, pev_flags);
if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(id, pev_oldbuttons) & IN_JUMP) && skoki[id])
{
skoki[id]--;
new Float:velocity[3];
pev(id, pev_velocity,velocity);
velocity[2] = random_float(265.0,285.0);
set_pev(id, pev_velocity,velocity);
}
else if(flags & FL_ONGROUND)
skoki[id] = 2;
return FMRES_IGNORED;
}