Where to change gravity of the ball and make it more closer to player
Hello,
Where I can do these things in this code? Thanks!
PHP Code:
public FwdThinkBall(ent) { if(!pev_valid(ent)) return PLUGIN_HANDLED; set_pev(ent, pev_nextthink, halflife_time()+0.05); new Float:EntOrigin[3], Float:EntVelocity[3]; pev(ent, pev_origin, EntOrigin); pev(ent, pev_velocity, EntVelocity); new owner = pev(ent, pev_iuser1); new solid = pev(ent, pev_solid); static Float:LastThink; if(LastThink < get_gametime()) { if(floatround(vector_length(EntVelocity)) > 10) { message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_KILLBEAM); write_short(g_ball); message_end(); message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BEAMFOLLOW); write_short(g_ball); write_short(g_trail); write_byte(10); write_byte(10); write_byte(0);//r write_byte(0);//g write_byte(0);//b write_byte(255);//alpha ? message_end(); } LastThink = get_gametime()+3.0; } if(owner) { new Float:OwnerOrigin[3]; pev(owner, pev_origin, OwnerOrigin); if(!is_user_alive(owner)) { OwnerOrigin[2] += 5.0; set_pev(ent, pev_iuser1, 0); set_pev(ent, pev_origin, OwnerOrigin); set_pev(ent, pev_velocity, Float:{1.0, 1.0, 0.0}); return PLUGIN_CONTINUE; } if(solid != SOLID_NOT) set_pev(ent, pev_solid, SOLID_NOT); set_pev(ent, pev_frame, pev(ent, pev_frame)); set_pev(ent, pev_animtime, 0.0); set_pev(ent, pev_framerate, 0.0); new Float:Angles[3], Float:vReturn[3]; pev(owner, pev_v_angle, Angles); vReturn[0] = (floatcos(Angles[1], degrees) * 55.0) + OwnerOrigin[0]; vReturn[1] = (floatsin(Angles[1], degrees) * 55.0) + OwnerOrigin[1]; vReturn[2] = OwnerOrigin[2] - ((pev(owner, pev_flags) & FL_DUCKING) ?10.0: 30.0); set_pev(ent, pev_origin, vReturn); set_pev(ent, pev_velocity, Float:{1.0, 1.0, 0.0}); } else { if(solid != SOLID_TRIGGER) set_pev(ent, pev_solid, SOLID_TRIGGER); static Float:VerticalOrigin; if(!EntVelocity[2]) { set_pev(ent, pev_frame, pev(ent, pev_frame)); set_pev(ent, pev_animtime, 0.0); set_pev(ent, pev_framerate, 0.0); static iCounts; if(VerticalOrigin > EntOrigin[2]) { iCounts++; if(iCounts > 10) { iCounts = 0; UpdateBall(); } } else { iCounts = 0; if(PointContents(EntOrigin) != CONTENTS_EMPTY) UpdateBall(); } VerticalOrigin = EntOrigin[2]; } } return PLUGIN_CONTINUE; }
KickBall(id) { new Float:origin[3]; pev(g_ball, pev_origin, origin);
if(PointContents(origin) != CONTENTS_EMPTY) return PLUGIN_HANDLED; new Float:velocity[3], Float:Angles[3]; velocity_by_aim(id, 630, velocity); pev(id, pev_v_angle, Angles); Angles[0] = 0.0; set_pev(g_ball, pev_angles, Angles); set_pev(g_ball, pev_solid, SOLID_TRIGGER); set_pev(g_ball, pev_frame, pev(g_ball, pev_frame)); set_pev(g_ball, pev_animtime, get_gametime()); set_pev(g_ball, pev_framerate, 1.0); set_pev(g_ball, pev_iuser1, 0); set_pev(g_ball, pev_velocity, velocity); jail_set_user_speed(id, 250.0); return PLUGIN_CONTINUE; }
UpdateBall() { if(!pev_valid(g_ball)) return set_pev(g_ball, pev_velocity, Float:{0.0, 0.0, 0.1}); set_pev(g_ball, pev_mins, Float:{-15.0, -15.0, 0.0}); set_pev(g_ball, pev_maxs, Float:{15.0, 15.0, 15.0}); set_pev(g_ball, pev_solid, SOLID_TRIGGER); set_pev(g_ball, pev_frame, 0.0); set_pev(g_ball, pev_animtime, 0.0); set_pev(g_ball, pev_framerate, 0.0); set_pev(g_ball, pev_iuser1, 0); set_pev(g_ball, pev_origin, g_origin); }
|