Problem z klasą cod- nie mozna uzyc rakiet...
unlimited 22.03.2016
Tak jak w temacie. nałożyłem ogranicznik użycia rakiety w klasie i teraz w ogóle nie idzie użyć
Załączone pliki
- codclass_batman.sma 3,87 KB 48 Ilość pobrań
DoCzyszczenia 24.03.2016
Spoiler
#include <amxmodx> #include <codmod> #include <hamsandwich> #include <fakemeta> #include <engine> #include <colorchat> new const perk_name[] = "Rakieta Balistyczna"; new const perk_desc[] = "Sterujesz Rakieta przez LW sek zadajaca max 165(+0.5 INT),&gdy kierujesz twoja widocznosc to 20/255"; new bool: blokada, bool: predator[26], bool:ma_perk[26], czas[26]; new sprite_blast, cache_trail, wartosc_perku[26], user_controllsem[26], posiadaczy; public plugin_init(){ register_plugin(perk_name, "1.0", "cypis"); cod_register_perk(perk_name, perk_desc, 8, 13); register_forward(FM_PlayerPreThink, "PreThink"); register_touch("predator_ent", "*", "touchedpredator"); register_event("HLTV", "BlokadaStart", "a", "1=0", "2=0"); } public plugin_precache(){ sprite_blast = precache_model("sprites/dexplo.spr"); cache_trail = precache_model("sprites/smoke.spr"); precache_model("models/cod_predator.mdl"); } public BlokadaStart(){ blokada = true; set_task(12.0,"Odblokuj"); new iEnt = find_ent_by_class(-1, "predator_ent"); while(iEnt > 0) { remove_entity(iEnt); iEnt = find_ent_by_class(iEnt, "predator_ent"); } for(new id;id <= 25;id++){ if(ma_perk[id]) predator[id] = true; } } public cod_perk_enabled(id, wartosc){ if(posiadaczy>1) return COD_STOP; posiadaczy++ wartosc_perku[id] = wartosc; predator[id] = true; ma_perk[id] = true; return COD_CONTINUE; } public cod_perk_disabled(id){ posiadaczy--; predator[id] = false; ma_perk[id] = false; } public Odblokuj(){ blokada = false; } public brak_kontroli(id){ id-=6098 if(!ma_perk[id]) remove_task(id+6098) czas[id]--; client_print(id,print_center,"** %i **",czas[id]); if(czas[id]<=0){ attach_view(id, id); user_controllsem[id] = 0; set_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255); remove_task(id+6098) } } public cod_perk_used(id){ if(blokada){ client_print(id,print_center,"Rakiety mozna uzyc 10 sek po rozpoczeciu rundy!"); return PLUGIN_CONTINUE; } if(!predator[id]){ client_print(id,print_center,"Rakieta zostala juz zuzyta"); return PLUGIN_CONTINUE; } new name[33]; get_user_name(id, name, 32) if (get_user_team(id) == 1) ColorChat(0, GREY, "^x04 ~~^x03 Rakieta Balistyczna zostala wystrzelona przez^x04 %s^x03 [TT]",name); else ColorChat(0, GREY, "^x04 ~~^x03 Rakieta Balistyczna zostala wystrzelona przez^x04 %s^x03 [CT]",name); czas[id] = wartosc_perku[id] client_print(id,print_center,"** %i **",czas[id]); set_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 20); set_task(1.0, "brak_kontroli",id+6098, .flags="b") new Float:Origin[3], Float:Angle[3], Float:Velocity[3]; velocity_by_aim(id, 650, Velocity); entity_get_vector(id, EV_VEC_origin, Origin); entity_get_vector(id, EV_VEC_v_angle, Angle); Angle[0] *= -1.0; new ent = create_entity("info_target"); entity_set_string(ent, EV_SZ_classname, "predator_ent"); entity_set_model(ent, "models/cod_predator.mdl"); entity_set_int(ent, EV_INT_solid, 2); entity_set_int(ent, EV_INT_movetype, 5); entity_set_edict(ent, EV_ENT_owner, id); entity_set_origin(ent, Origin); entity_set_vector(ent, EV_VEC_velocity, Velocity); entity_set_vector(ent, EV_VEC_angles, Angle); message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BEAMFOLLOW); write_short(ent); write_short(cache_trail); write_byte(10); write_byte(5); write_byte(205); write_byte(237); write_byte(163); write_byte(200); message_end(); predator[id] = false; attach_view(id, ent); user_controllsem[id] = ent; return PLUGIN_CONTINUE; } public PreThink(id) { if(user_controllsem[id]) { new ent = user_controllsem[id]; if(is_valid_ent(ent)) { new Float:Velocity[3], Float:Angle[3]; velocity_by_aim(id, 500, Velocity); entity_get_vector(id, EV_VEC_v_angle, Angle); entity_set_vector(ent, EV_VEC_velocity, Velocity); entity_set_vector(ent, EV_VEC_angles, Angle); } else attach_view(id, id); } return FMRES_IGNORED; } public touchedpredator(ent, id) { if(!is_valid_ent(ent)) return PLUGIN_CONTINUE; new owner = entity_get_edict(ent, EV_ENT_owner); remove_task(owner+6098) bombs_explode(ent, 171.0 + cod_get_user_intelligence(owner)*0.5 , 340.0); if(is_user_alive(owner)) attach_view(owner, owner); user_controllsem[owner] = 0; set_rendering(owner, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255); return PLUGIN_CONTINUE; } bombs_explode(ent, Float:zadaje, Float:promien) { if(!is_valid_ent(ent)) return; new attacker = entity_get_edict(ent, EV_ENT_owner); new Float:entOrigin[3], Float:fDamage, Float:Origin[3]; entity_get_vector(ent, EV_VEC_origin, entOrigin); entOrigin[2] += 1.0; new entlist[33]; new team_attacker = get_user_team(attacker) new numfound = find_sphere_class(ent, "player", promien, entlist, 32); for(new i=0; i < numfound; i++) { new victim = entlist[i]; if(!is_user_alive(victim) || team_attacker == get_user_team(victim)) continue; entity_get_vector(victim, EV_VEC_origin, Origin); fDamage = zadaje - (0.5*get_distance_f(Origin, entOrigin)); ExecuteHam(Ham_TakeDamage, victim, ent, attacker, fDamage, DMG_BULLET); } message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_EXPLOSION); write_coord(floatround(entOrigin[0])); write_coord(floatround(entOrigin[1])); write_coord(floatround(entOrigin[2])); write_short(sprite_blast); write_byte(32); write_byte(20); write_byte(0); message_end(); remove_entity(ent); }
Użytkownik DoCzyszczenia edytował ten post 24.03.2016 14:42
unlimited 25.03.2016
W tej klasie nie polega na tym zeby sterowac rakieta tylko zeby leciala tam gdzie sie wycelowalo i leci w linii prostej
ale i tak łap plusa za jakąś pomoc
DoCzyszczenia 25.03.2016
Jak zwykla to lap ten kod tutaj leci w lini prostej:
Spoiler
#include <amxmodx> #include <codmod> #include <hamsandwich> #include <engine> new const nazwa[] = "Wsparcie Ogniowe"; new const opis[] = "Posiada 2 rakiety, kazda zadaje 60DMG(+0.7 INT)"; new const bronie = (1<<CSW_MP5NAVY); new const zdrowie = 15; new const kondycja = 0; new const inteligencja = 0; new const wytrzymalosc = 0; new sprite_blast, ilosc_rakiet_gracza[33], poprzednia_rakieta_gracza[33], bool:blokada; public plugin_init(){ register_plugin(nazwa, "1.0", "amxx.pl"); register_event("HLTV", "BlokadaStart", "a", "1=0", "2=0"); cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc); register_touch("rocket", "*" , "DotykRakiety"); RegisterHam(Ham_Spawn, "player", "fwSpawn_Rakiety", 1); } public plugin_precache(){ sprite_blast = precache_model("sprites/dexplo.spr"); precache_model("models/rpgrocket.mdl"); } public BlokadaStart(){ blokada = true; set_task(12.0,"Odblokuj"); new iEnt = find_ent_by_class(-1, "rocket"); while(iEnt > 0) { remove_entity(iEnt); iEnt = find_ent_by_class(iEnt, "rocket"); } } public Odblokuj() blokada = false; public client_disconnect(id){ new entRakiety = find_ent_by_class(0, "rocket"); while(entRakiety > 0){ if(entity_get_edict(entRakiety, EV_ENT_owner) == id) remove_entity(entRakiety); entRakiety = find_ent_by_class(entRakiety, "rocket"); } } public cod_class_enabled(id) ilosc_rakiet_gracza[id] = 2; public cod_class_skill_used(id){ if(blokada){ client_print(id,print_center,"Rakiety mozna uzyc 10 sek po rozpoczeciu rundy!"); return PLUGIN_CONTINUE; } if(!ilosc_rakiet_gracza[id]){ client_print(id, print_center, "Wykorzystales juz wszystkie rakiety!"); return PLUGIN_CONTINUE; } if(poprzednia_rakieta_gracza[id] + 2.0 > get_gametime()){ client_print(id, print_center, "Rakiet mozesz uzywac co 2 sekundy!"); return PLUGIN_CONTINUE; } poprzednia_rakieta_gracza[id] = floatround(get_gametime()); ilosc_rakiet_gracza[id]--; new Float: Origin[3], Float: vAngle[3], Float: Velocity[3]; entity_get_vector(id, EV_VEC_v_angle, vAngle); entity_get_vector(id, EV_VEC_origin , Origin); new Ent = create_entity("info_target"); entity_set_string(Ent, EV_SZ_classname, "rocket"); entity_set_model(Ent, "models/rpgrocket.mdl"); vAngle[0] *= -1.0; entity_set_origin(Ent, Origin); entity_set_vector(Ent, EV_VEC_angles, vAngle); entity_set_int(Ent, EV_INT_effects, 2); entity_set_int(Ent, EV_INT_solid, SOLID_BBOX); entity_set_int(Ent, EV_INT_movetype, MOVETYPE_FLY); entity_set_edict(Ent, EV_ENT_owner, id); VelocityByAim(id, 1000 , Velocity); entity_set_vector(Ent, EV_VEC_velocity ,Velocity); message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BEAMFOLLOW); write_short(Ent); write_short(sprite_blast); write_byte(10); write_byte(5); write_byte(205); write_byte(237); write_byte(163); write_byte(200); message_end(); return PLUGIN_CONTINUE; } public fwSpawn_Rakiety(id) ilosc_rakiet_gracza[id] = 2; public DotykRakiety(ent){ if (!is_valid_ent(ent)) return; new attacker = entity_get_edict(ent, EV_ENT_owner); new Float:fOrigin[3]; entity_get_vector(ent, EV_VEC_origin, fOrigin); new iOrigin[3]; for(new i=0;i<3;i++) iOrigin[i] = floatround(fOrigin[i]); message_begin(MSG_BROADCAST,SVC_TEMPENTITY, iOrigin); write_byte(TE_EXPLOSION); write_coord(iOrigin[0]); write_coord(iOrigin[1]); write_coord(iOrigin[2]); write_short(sprite_blast); write_byte(32); write_byte(20); write_byte(0); message_end(); new entlist[33]; new numfound = find_sphere_class(ent, "player", 180.0, entlist, 32); new team_attack = get_user_team(attacker) for (new i=0; i < numfound; i++){ new pid = entlist[i]; if (is_user_alive(pid) && team_attack != get_user_team(pid)) cod_inflict_damage(attacker, pid, 60.0, 0.7, ent, (1<<24)); } remove_entity(ent); }
unlimited 25.03.2016
O to mi chodziło a mógłbyś jeszcze dodać do tego grawitację 450? Próbuje dodać ale nie idzie skompilować
DoCzyszczenia 25.03.2016
http://amxx.pl/topic...cja-dla-klasy/
tu masz napisane jak dodać a jak nie poradzisz sobie to przeslij sma sprobuje
Użytkownik DoCzyszczenia edytował ten post 25.03.2016 20:02
unlimited 25.03.2016
Nie udaje sie skompilowac ;//
Załączone pliki
- codclass_batman.sma 4,26 KB 41 Ilość pobrań