No niestety, ale wiedza z metod numerycznych umyka po północy
Zapomniałem o nawiasach w linijce z obliczeniami mnoznika dystansu.
Poprawiona funkcja:
Spoilerpublic paint_fire(id, num) { new a, ent; while (a++ < g_pbcount - 1 && !ent) if (g_pbstatus[a] == 0) ent = g_pbstatus[a] = g_paintballs[a]; if (!ent) while (a-- > 1 && !ent) if (g_pbstatus[a] == 2) ent = g_pbstatus[a] = g_paintballs[a]; if (pev_valid(ent) && is_user_alive(id)) { new Float:vangles[3], Float:nvelocity[3], Float:voriginf[3], vorigin[3], clr; set_pev(ent, pev_owner, id); new my_pbgun = user_has_pbgun(id); set_pev(ent, pev_classname, "pbBullet"); engfunc(EngFunc_SetModel, ent, "models/w_paintball.mdl"); if (my_pbgun == PB_SNIPER) //make them smaller to avoid creation collisions engfunc(EngFunc_SetSize, ent, Float:{0.0, 0.0, 0.0}, Float:{1.0, 1.0, 1.0}); else engfunc(EngFunc_SetSize, ent, Float:{-1.0, -1.0, -1.0}, Float:{1.0, 1.0, 1.0}); switch (get_pcvar_num(color)) { case 2: clr = (get_user_team(id) == 1) ? 0 : 1; case 3: clr = (get_user_team(id) == 1) ? 4 : 3; case 4: clr = (get_user_team(id) == 1) ? 2 : 5; default: clr = random_num(0, 6); } set_pev(ent, pev_skin, clr); set_pev(ent, pev_gravity, 0.5); vangles[0] = random_float(-180.0, 360.0); vangles[1] = random_float(-180.0, 360.0); set_pev(ent, pev_angles, vangles); pev(id, pev_v_angle, vangles); set_pev(ent, pev_v_angle, vangles); get_user_origin(id, vorigin, 1); IVecFVec(vorigin, voriginf); if (my_pbgun == PB_SNIPER) { new Float:vresult[3], Float:fDistance, Float:fDistanceStep = 20.0; fDistance = power(-1, num)*((num+1)/2)*fDistanceStep; // obliczenie mnoznika dystansu wzgledem srodkowej kulki if(fDistance != 0.0) { angle_vector(vangles, ANGLEVECTOR_RIGHT, vresult) xs_vec_mul_scalar(vresult, fDistance, vresult); xs_vec_add(voriginf, vresult, voriginf); } } engfunc(EngFunc_SetOrigin, ent, voriginf); pev(id, pev_view_ofs, vangles); set_pev(ent, pev_view_ofs, vangles); new veloc; if (get_pcvar_num(gravity)) set_pev(ent, pev_movetype, MOVETYPE_BOUNCE); else set_pev(ent, pev_movetype, MOVETYPE_FLY); set_pev(ent, pev_solid, 2); //Different guns shoot at different speeds switch (my_pbgun) { case PB_MARKER: veloc = get_pcvar_num(speed_marker); case PB_GLOCK: veloc = get_pcvar_num(speed_pistol); case PB_USP: veloc = get_pcvar_num(speed_pistol); case PB_SNIPER: veloc = get_pcvar_num(speed_sniper); case PB_SUPERMARKER: veloc = get_pcvar_num(speed_smarker); default: veloc = get_pcvar_num(speed_pistol); } velocity_by_aim(id, veloc, nvelocity); //Fix aim for bots if (is_user_bot(id)) switch (my_pbgun) { case PB_MARKER: nvelocity[2] += (get_pcvar_num(gravity))? 150 : 0; case PB_GLOCK: nvelocity[2] += (get_pcvar_num(gravity))? 200 : 0; case PB_USP: nvelocity[2] += (get_pcvar_num(gravity))? 200 : 0; case PB_SNIPER: nvelocity[2] += (get_pcvar_num(gravity))? 35 : 0; case PB_SUPERMARKER: nvelocity[2] += (get_pcvar_num(gravity))? 100 : 0; default: nvelocity[2] += (get_pcvar_num(gravity))? 150 : 0; } //Recoil!!! if (cs_get_user_zoom(id)== CS_SET_NO_ZOOM){ //the sniper will shoot terribly bad without a scope new modifier = (my_pbgun != PB_SNIPER)? 1 : 5; new buttons = pev(id, pev_button); if (my_pbgun == PB_SNIPER) modifier = 2; else //shoot worse while moving if (buttons & IN_JUMP || buttons & IN_FORWARD || buttons & IN_BACK || buttons & IN_MOVELEFT || buttons & IN_MOVERIGHT) modifier *= 2; new disp = get_pcvar_num(dispersion); nvelocity[0] += (random(disp)-disp/2) * modifier; nvelocity[1] += (random(disp)-disp/2) * modifier; nvelocity[2] += (random(disp)-disp/2) * modifier; } set_pev(ent, pev_velocity, nvelocity); set_pev(ent, pev_effects, pev(ent, pev_effects) & ~EF_NODRAW); //glow set_task(0.1, "paint_glow", ent); set_task(15.0 , "paint_reset", ent+TASK_PB_RESET); } return ent; }
Umyka?? Człowieku za**bisty jesteś.. Wykorzystałeś wiedzę i poświęciłeś swój czas... Dzięki WIELKIE 5!!! dla Ciebie.! Temat do zamknięcia... A ty mordeczko możesz na pw wysłać mi adres to wyśle ci pół litra...