Rozbłysjk granatu w Zombie Plague - Jak zr...
zielu001
23.05.2010
Witam, potrzebuję wiedzieć jak zrobiono rozbłysk granatu zapalającego, i pobieranie graczy którzy znajdują się w promieniu.
Kod z zombieplague:
Kod z zombieplague:
// Fire Grenade Explosion fire_explode(ent) { // Get origin static Float:originF[3] pev(ent, pev_origin, originF) // Make the explosion create_blast2(originF) // Fire nade explode sound static sound[64] ArrayGetString(grenade_fire, random_num(0, ArraySize(grenade_fire) - 1), sound, charsmax(sound)) emit_sound(ent, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM) // Collisions static victim victim = -1 while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0) { // Only effect alive zombies if (!is_user_valid_alive(victim) || !g_zombie[victim] || g_nodamage[victim]) continue; // Heat icon? if (get_pcvar_num(cvar_hudicons)) { message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, victim) write_byte(0) // damage save write_byte(0) // damage take write_long(DMG_BURN) // damage type write_coord(0) // x write_coord(0) // y write_coord(0) // z message_end() } if (g_nemesis[victim]) // fire duration (nemesis is fire resistant) g_burning_duration[victim] += get_pcvar_num(cvar_fireduration) else g_burning_duration[victim] += get_pcvar_num(cvar_fireduration) * 5 // Set burning task on victim if not present if (!task_exists(victim+TASK_BURN)) set_task(0.2, "burning_flame", victim+TASK_BURN, _, _, "b") } // Get rid of the grenade engfunc(EngFunc_RemoveEntity, ent) }
DarkGL
23.05.2010
static Float:originF[3]
pev(ent, pev_origin, originF)
// Make the explosion
create_blast2(originF)
funkcja create_blast2 (jest w zm)
do pobierania odległości między graczami (lub obiektami )służy get_entity_distance(id,id2)
załóżmy że szukamy graczy któży są w odległości 1200 unitów
new tablica[32]
new ile = 0;
for(new i = 1;i<33;i++){
if(is_user_alive(i) && i != id && get_user_team(i) != get_user_team(id)){
if(get_entity_distance(id,i) < 1200){
tablica[ile] = i;
ile++;
}
}
}
zielu001
23.05.2010
Tak, ale ta funkcja którą podaleś jest na sprawdzanie odleglosci graczy(for) od gracza(id), a mi chodzi o pobieranie graczy którzy są w promieniu tego połysku ( funkcja create_blast2)
DarkGL
23.05.2010
no to masz
w victim jest id gracza
za aasdasd wstawiasz liczbę rzeczywistą
static victim
victim = -1
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, asdasd)) != 0){
}
w victim jest id gracza
za aasdasd wstawiasz liczbę rzeczywistą