Kula Plasma
Stachuu :D ??
24.03.2012
Nie odpowiadam tez za zla/niedobra optymalizacje.
Kod u mnie działał juz od dłuższego czasu i nic nie bugowal.
1.U gory dodajemy.
#include <hamsandwich> #include <xs> #define BALL_CLASSNAME "displacer_ball" #define BEAM_CLASSNAME "dispball_beam" new wait1[33] new m_Plasma,m_DispRing,m_ExitPortal new SPRITE_PLASMA[] = "sprites/plasma.spr" new SPRITE_RING[] = "sprites/displacer_ring.spr" new SPRITE_PORTAL[] = "sprites/exit1.spr"
2.plugin_init
register_think(BALL_CLASSNAME, "DispBall_Think"); register_think(BEAM_CLASSNAME, "DispBeam_Think"); register_touch(BALL_CLASSNAME, "*", "DispBall_Explode_Touch");
3.public plugin_precache()
m_ExitPortal = precache_model(SPRITE_PORTAL); m_DispRing = precache_model(SPRITE_RING); m_Plasma = precache_model(SPRITE_PLASMA);
4.na koniec
Wywolanie w sposob dowolny uzywajac kula1(id)
Teraz mala konfiguracja
Czas:
new czas = 10-<img src='https://amxx.pl/public/style_emoticons/<#EMO_DIR#>/haha.gif' class='bbc_emoticon' alt='xD' /> if (halflife_time()-wait1[id] <= 10)Czas podany w sekunach okresla jak czesto mozemy uzywac kuli
Zasieg ataku obszarowego:
while ((id = engfunc(EngFunc_FindEntityInSphere, id, origin, 280.0)))280.0 oznacza dystans
Szansa ataku obszarowego:
if (random_float(0.0, 1.0) <= 0.20.2=20%,0.3=30% etc.
Jesli o czym zapomnialem proszę o napisanie.
Dolanczam pliki.
zdjecie dodam wieczorem teraz mam problemy z formatem
Attached Files
Stachuu :D ??
24.03.2012
all opiera sie na tym aby wywolac kula1(id)
Legendarny :) ? 24.03.2012
Szukamy.
//bow model
Dodajemy Pod tym .
if (button2 & IN_RELOAD && on_knife[id] && button[id]==0 && player_class[id]==Twoja Klasa){
kula1(id)
}
W tedy użycie (plasmy , kule) wywołujemy przez Nóż + R
Edited by raksoPL, 24.03.2012 19:29.
Stachuu :D ??
25.03.2012
[URL=http://imageshack.us/photo/my-images/195/denuke0002kx.png/]
Edited by Stachuu :D ??, 25.03.2012 17:48.
Pietras11
25.03.2012
Stachuu :D ??
25.03.2012
Pietras11
25.03.2012
aaaaaa
23.12.2013
Witam mam problem tak jak nizej za pomoc +
Warning: Symbol is assigned a value that is never used: "m_ExitPortal" on line 16193
GoldenKill
26.12.2013
Zmień
new m_Plasma,m_DispRing,m_ExitPortal
na
new m_Plasma,m_DispRing
Jeszcze tu
m_ExitPortal = precache_model(SPRITE_PORTAL); m_DispRing = precache_model(SPRITE_RING); m_Plasma = precache_model(SPRITE_PLASMA);
na
m_DispRing = precache_model(SPRITE_RING); m_Plasma = precache_model(SPRITE_PLASMA);
aaaaaa
27.12.2013
To ja tak mialem zrobione dzialala mi ta plasma ale crashowal sie server przez nia
new m_Plasma,m_DispRing//,m_ExitPortal
GoldenKill
27.12.2013
m_DispRing = precache_model(SPRITE_RING); m_Plasma = precache_model(SPRITE_PLASMA); precache_model(SPRITE_PORTAL);
dodaj tak
aaaaaa
27.12.2013
no sprobuje ale watpie bo jak zrobilem tak jak bylo napisane to mialem z ta kula problem .Gdy ja wystrzelilem niewalila ona piorunami tylko leciala i np zatrzymywala sie na scianie po czym nieznikala nawet od nastepnej rundy.Niewiem w czym tkwi problem raczej sie niepomylilem z niczym kopiuj wklej
0-0-0
27.12.2013
Zrób wszystko według poradnika tylko zamiast tego dłuższego kodu wklej to:
public kula1(id) { new xD = floatround(halflife_time()-wait1[id]) new czas = 10-xD if (halflife_time()-wait1[id] <= 10) { client_print(id, print_center, "Za %d sek mozesz uzyc mocy!", czas) return PLUGIN_CONTINUE; } else { DispBall_Spawn(id) wait1[id]=floatround(halflife_time()) } return PLUGIN_HANDLED } public DispBall_Explode(ent) { if (!pev(ent, pev_iuser3)){ new Float: origin[3]; pev(ent, pev_origin, origin); set_pev(ent, pev_iuser3, 1); UTIL_MakeBeamCylinder(origin, m_DispRing) ; new Players[32], playerCount, a get_players(Players, playerCount, "ah") new id = pev(ent,pev_owner) for (new i=0; i<playerCount; i++) { a = Players[i] new Float:aOrigin[3] pev(a,pev_origin,aOrigin) if (get_user_team(id) != get_user_team(a) && get_distance_f(aOrigin,origin) < 280.0) { ExecuteHamB(Ham_TakeDamage, a, ent, id, 25.0+player_intelligence[id]*1.5, DMG_ENERGYBEAM ); } } } set_pev(ent, pev_velocity, Float:{0.0, 0.0, 0.0}); set_pev(ent, pev_iuser4, 1); set_pev(ent, pev_nextthink, get_gametime() + 0.6); } public DispBall_Spawn(id) { static AllocStringCached; if (!AllocStringCached) { AllocStringCached = engfunc(EngFunc_AllocString, "info_target"); } new ent = engfunc(EngFunc_CreateNamedEntity, AllocStringCached); if(!pev_valid(ent)) return 0; set_pev(ent, pev_classname, BALL_CLASSNAME); new Float: origin[3]; new Float: velocity[3]; new Float: v_forward[3]; new Float: v_right[3]; new Float: v_up[3]; GetGunPosition(id, origin); global_get(glb_v_forward, v_forward); global_get(glb_v_right, v_right); global_get(glb_v_up, v_up); //xs_vec_mul_scalar(v_forward, 29.0, v_forward) xs_vec_mul_scalar(v_right, 2.0, v_right); xs_vec_mul_scalar(v_up, -5.0, v_up); xs_vec_add(origin, v_forward, origin); xs_vec_add(origin, v_right, origin); xs_vec_add(origin, v_up, origin); set_pev(ent, pev_origin, origin); set_pev(ent, pev_owner, id); set_pev(ent, pev_dmg, 100.0); engfunc(EngFunc_SetModel, ent, m_ExitPortal); engfunc(EngFunc_SetSize, ent, Float:{0.0, 0.0, 0.0} , Float:{0.0, 0.0, 0.0}); set_pev(ent, pev_effects, pev(ent, pev_effects) | EF_LIGHT); set_rendering(ent, kRenderFxNone, 0, 0, 0, kRenderTransAdd, 255); velocity_by_aim(id, 500, velocity); set_pev(ent, pev_velocity, velocity); dllfunc(DLLFunc_Spawn, ent); set_pev(ent, pev_movetype, MOVETYPE_FLY); set_pev(ent, pev_solid, SOLID_BBOX); set_pev(ent, pev_scale, 5); set_pev(ent, pev_nextthink, get_gametime() + 0.1); return ent; } public DispBall_Think(ent) { if (!pev_valid(ent)) return; DispBall_Animate(ent); if (pev(ent, pev_iuser4)) { remove_entity(ent); return; } static Float: velocity[3]; pev(ent, pev_velocity, velocity); if (!vector_length(velocity) || !IsInWorld(ent)) { DispBall_Explode(ent) return; } static ptr, i, id, owner, beam; static Float: Dist; static Float: flFraction; static Float: origin[3]; static Float: vecDir[3]; static Float: vecEndPos[3]; Dist = 1.00; ptr = create_tr2(); pev(ent, pev_origin, origin); while ((id = engfunc(EngFunc_FindEntityInSphere, id, origin, 280.0))) { if (random_float(0.0, 1.0) <= 0.2 && pev(id, pev_takedamage) && is_visible(id, ent) && id != (owner = pev(ent, pev_owner))) { static Float: target_origin[3]; pev(id, pev_origin, target_origin); ExecuteHamB(Ham_TakeDamage, id, ent, owner, 22.0, DMG_ENERGYBEAM ); if ((beam = BeamCreate(id, SPRITE_PLASMA, m_Plasma, 65.0))) { RelinkBeam(beam, origin, target_origin); BeamSetColor(beam, 255.0, 255.0, 255.0); BeamSetNoise(beam, 45); BeamSetBrightness(beam, 255.0); BeamSetScrollRate(beam, 35.0); BeamLiveForTime(beam, 0.1); } } } for (i = 0; i < 10; i++) { vecDir[0] = random_float(-1.0, 1.0); vecDir[1] = random_float(-1.0, 1.0); vecDir[2] = random_float(-1.0, 1.0); VecNormilize(vecDir, vecDir); xs_vec_mul_scalar(vecDir, 1536.0, vecDir); xs_vec_add(vecDir, origin, vecDir); engfunc(EngFunc_TraceLine, origin, vecDir, IGNORE_MONSTERS, ent, ptr); get_tr2(ptr, TR_flFraction, flFraction); if (Dist > flFraction) { get_tr2(ptr, TR_vecEndPos, vecEndPos); Dist = flFraction; } } if (Dist < 1.0) { if ((beam = BeamCreate(ent, SPRITE_PLASMA, m_Plasma, 30.0))) { RelinkBeam(beam, vecEndPos, origin); BeamSetColor(beam, 23.0, 170.0, 17.0); BeamSetNoise(beam, 65); BeamSetBrightness(beam, 255.0); BeamSetScrollRate(beam, 35.0); BeamLiveForTime(beam, 1.0); } } set_pev(ent, pev_nextthink, get_gametime() + 0.1); free_tr2(ptr); } public DispBeam_Think(ent) { if (pev_valid(ent)) { remove_entity(ent); } } public DispBall_Explode_Touch(ent) { if (pev_valid(ent)) { DispBall_Explode(ent); } } stock GetGunPosition(const player, Float:origin[3] ) { new Float:viewOfs[3]; pev(player, pev_origin, origin); pev(player, pev_view_ofs, viewOfs); xs_vec_add( origin, viewOfs, origin); } stock BeamCreate(const endIndex, const pSpriteName[], const spriteIndex, const Float: width) { static AllocStringCached; if (!AllocStringCached) { AllocStringCached = engfunc(EngFunc_AllocString, "beam"); } static ent; if (!(ent = engfunc(EngFunc_CreateNamedEntity, AllocStringCached))) return 0; set_pev(ent, pev_classname, BEAM_CLASSNAME); set_pev(ent, pev_flags, pev(ent, pev_flags) | FL_CUSTOMENTITY); BeamSetFrame(ent, 0); set_pev(ent, pev_model, pSpriteName); BeamSetTexture(ent, spriteIndex); BeamSetWidth(ent, width); set_pev(ent, pev_skin, endIndex); set_pev(ent, pev_sequence, 0); set_pev(ent, pev_rendermode, 1); DispatchSpawn(ent); return ent; } stock RelinkBeam(const beam, const Float: startPos[3], const Float: endPos[3]) { static Float: mins[3], Float: maxs[3]; mins[0] = floatmin(startPos[0], endPos[0]); mins[1] = floatmin(startPos[1], endPos[1]); mins[2] = floatmin(startPos[2], endPos[2]); maxs[0] = floatmax(startPos[0], endPos[0]); maxs[1] = floatmax(startPos[1], endPos[1]); maxs[2] = floatmax(startPos[2], endPos[2]); xs_vec_sub(mins, startPos, mins); xs_vec_sub(maxs, startPos, maxs); set_pev(beam, pev_mins, mins); set_pev(beam, pev_maxs, maxs); engfunc(EngFunc_SetSize, beam, mins, maxs); engfunc(EngFunc_SetOrigin, beam, startPos); } stock VecNormilize(Float: in[3], Float: out[3]) { static Float: vlen; vlen = vector_length(in); vlen = 1/vlen; out[0] *= vlen; out[1] *= vlen; out[2] *= vlen; } stock UTIL_MakeBeamCylinder(const Float:origin[3], const m_Sprite) { message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BEAMCYLINDER); engfunc(EngFunc_WriteCoord, origin[0]); engfunc(EngFunc_WriteCoord, origin[1]); engfunc(EngFunc_WriteCoord, origin[2]); engfunc(EngFunc_WriteCoord, origin[0]); engfunc(EngFunc_WriteCoord, origin[1]); engfunc(EngFunc_WriteCoord, origin[2] + 200.0) ; write_short(m_Sprite) ; write_byte(0); write_byte(10); write_byte(3); write_byte(20); write_byte(0); write_byte(255); write_byte(255); write_byte(255); write_byte(255); write_byte(0); message_end(); } DispBall_Animate(const ent) { entity_set_float(ent, EV_FL_frame, entity_get_float(ent, EV_FL_frame) + 10.0); if (entity_get_float(ent, EV_FL_frame) > 24.0) entity_set_float(ent, EV_FL_frame, 0.0); } BeamLiveForTime(const ent, const Float: time) { set_pev(ent, pev_nextthink, halflife_time() + time); } BeamSetColor(const ent, const Float: red, const Float: green, const Float: blue) { static Float: rgb[3]; rgb[0] = red; rgb[1] = green; rgb[2] = blue; set_pev(ent, pev_rendercolor, rgb); } BeamSetBrightness(const ent, const Float: brightness) { set_pev(ent, pev_renderamt, brightness); } BeamSetNoise(const ent, const noise) { set_pev(ent, pev_body, noise); } BeamSetFrame(const ent, const frame) { set_pev(ent, pev_frame, frame); } BeamSetScrollRate(const ent, const Float: speed) { set_pev(ent, pev_animtime, speed); } BeamSetTexture(const ent, const spriteIndex) { set_pev(ent, pev_modelindex, spriteIndex); } BeamSetWidth(const ent, const Float: width) { set_pev(ent, pev_scale, width); }
aaaaaa
22.04.2014
Zrobiłem tak ale czasem sie crashuje server po tym zabiegu ale juz rzadziej takze dzięki za pomoc