Mam akurat taki problem, że nikt nie może podnieść piłki inie wiem dlaczego. Jakieś pomysły?

Kod php:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>



#define PLUGIN "Pilka"
#define VERSION "1.0"
#define AUTHOR "Gierek"

new Float:velocity[3]
new 
Float:testorigin[3]



new 
ball[] = "models/kickball/ball.mdl"

new BALL_BOUNCE_GROUND[] = "kickball/bounce.wav"
new BALL_KICKED[] = "kickball/kicked.wav"
new BALL_PICKED_UP[] = "kickball/gotball.wav"

new ballholder
new pilka
new PressedAction[33]


public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);

    
register_touch("Ball""*""touchWorld")
    
register_touch("Ball""player""DotykPilki")


    
register_concmd"amx_ball""PostawPilke"ADMIN_ADMIN);


    
register_think("Ball","ball_think")

    
register_clcmd("say /wtf""Gracz")
}

public 
Gracz(id)
{
    
client_print(idprint_chat" %i ma sd"ballholder);
    return 
PLUGIN_HANDLED
}

public 
plugin_precache()
{
    
engfuncEngFunc_PrecacheSoundBALL_BOUNCE_GROUND)
    
engfuncEngFunc_PrecacheSoundBALL_PICKED_UP)
    
engfuncEngFunc_PrecacheSoundBALL_KICKED)
    
engfuncEngFunc_PrecacheModelball)
}

public 
client_PreThink(id)
{
    if(
is_valid_ent(pilka) && is_user_connected(id))
    {
        new 
button entity_get_int(idEV_INT_button)
        new 
usekey = (button IN_USE)


        if( 
id != ballholder )
            
PressedAction[id] = usekey
        
else
        {
            if( 
usekey && !PressedAction[id])
            {
                
kickBall(ballholder0)
            }
            else
                if( !
usekey && PressedAction[id])
                    
PressedAction[id] = 0
        
}
    }
}
public 
PostawPilke(id)
{

    new 
iEnt find_ent_by_class(-1"Ball");
    while(
iEnt 0
    {
        
remove_entity(iEnt);
        
iEnt find_ent_by_class(iEnt"Ball");    
    }

    new 
Float:origin[3];
    
entity_get_vector(idEV_VEC_originorigin);
        
    new 
ent create_entity("info_target");
    
entity_set_string(ent ,EV_SZ_classname"Ball");
    
entity_set_edict(ent ,EV_ENT_ownerid);
    
entity_set_origin(entorigin);
    
entity_set_int(entEV_INT_movetypeMOVETYPE_BOUNCE)
    
entity_set_int(entEV_INT_solidSOLID_BBOX);
    
entity_set_model(entball);
    
pilka=ent
    drop_to_floor
(ent);
    
entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.05) ;
    
    return 
PLUGIN_CONTINUE;
}

public 
touchWorld(ballworld)
{

    if(
get_speed(ball) > 10)
    {
        new 
Float:v[3]
        
entity_get_vector(ballEV_VEC_velocityv)

        
v[0] = (v[0] * 0.85)
        
v[1] = (v[1] * 0.85)
        
v[2] = (v[2] * 0.85)
        
entity_set_vector(ballEV_VEC_velocityv)
        
emit_sound(ballCHAN_ITEMBALL_BOUNCE_GROUND1.0ATTN_NORM0PITCH_NORM)
    }

    return 
PLUGIN_HANDLED
}
public 
DotykPilki(entid)
{

    if(
ballholder == 0)
    {
        
emit_sound(entCHAN_ITEMBALL_PICKED_UP1.0ATTN_NORM0PITCH_NORM)
        
ballholder id
    
}

//    user_kill(id, 1)

    
return PLUGIN_HANDLED
}

public 
kickBall(idvelType)
{

    new 
a,x

    
//Give it some lift
    
ball_infront(id55.0)

    
testorigin[2] += 10

    
new Float:tempO[3], Float:returned[3]
    new 
Float:dist2

    entity_get_vector
(idEV_VEC_origintempO)
    new 
tempEnt trace_lineidtempOtestoriginreturned )

    
dist2 get_distance_f(testoriginreturned)

    
//ball_infront(id, 55.0)

    
if( point_contents(testorigin) != CONTENTS_EMPTY || (!is_user_connected(tempEnt) && dist2 ) )//|| tempDist < 65)
        
return PLUGIN_HANDLED
    
else
    {
        
//Check Make sure our ball isnt inside a wall before kicking
        
new Float:ballF[3], Float:ballR[3], Float:ballL[3]
        new 
Float:ballB[3], Float:ballTR[3], Float:ballTL[3]
        new 
Float:ballBL[3], Float:ballBR[3]

        for(
x=0x<3x++) {
                
ballF[x] = testorigin[x];    ballR[x] = testorigin[x];
                
ballL[x] = testorigin[x];    ballB[x] = testorigin[x];
                
ballTR[x] = testorigin[x];    ballTL[x] = testorigin[x];
                
ballBL[x] = testorigin[x];    ballBR[x] = testorigin[x];
            }

        for(
a=1a<=6a++) {

            
ballF[1] += 3.0;    ballB[1] -= 3.0;
            
ballR[0] += 3.0;    ballL[0] -= 3.0;

            
ballTL[0] -= 3.0;    ballTL[1] += 3.0;
            
ballTR[0] += 3.0;    ballTR[1] += 3.0;
            
ballBL[0] -= 3.0;    ballBL[1] -= 3.0;
            
ballBR[0] += 3.0;    ballBR[1] -= 3.0;

            if(
point_contents(ballF) != CONTENTS_EMPTY || point_contents(ballR) != CONTENTS_EMPTY ||
            
point_contents(ballL) != CONTENTS_EMPTY || point_contents(ballB) != CONTENTS_EMPTY ||
            
point_contents(ballTR) != CONTENTS_EMPTY || point_contents(ballTL) != CONTENTS_EMPTY ||
            
point_contents(ballBL) != CONTENTS_EMPTY || point_contents(ballBR) != CONTENTS_EMPTY)
                    return 
PLUGIN_HANDLED
        
}
    }

    new 
kickVel random_num(100600)


    new 
Float:ballorig[3]
    
entity_get_vector(id,EV_VEC_origin,ballorig)

    
velocity_by_aim(idkickVelvelocity)

    
ballholder 0
    entity_set_origin
(pilka,testorigin)
    
entity_set_vector(pilka,EV_VEC_velocity,velocity)

    
emit_sound(pilkaCHAN_ITEMBALL_KICKED1.0ATTN_NORM0PITCH_NORM)

    return 
PLUGIN_HANDLED
}
public 
ball_infront(idFloat:dist)
{

    new 
Float:nOrigin[3]
    new 
Float:vAngles[3// plug in the view angles of the entity
    
new Float:vReturn[3// to get out an origin fDistance away

    
entity_get_vector(pilka,EV_VEC_origin,testorigin)
    
entity_get_vector(id,EV_VEC_origin,nOrigin)
    
entity_get_vector(id,EV_VEC_v_angle,vAngles)


    
vReturn[0] = floatcosvAngles[1], degrees ) * dist
    vReturn
[1] = floatsinvAngles[1], degrees ) * dist

    vReturn
[0] += nOrigin[0]
    
vReturn[1] += nOrigin[1]

    
testorigin[0] = vReturn[0]
    
testorigin[1] = vReturn[1]
    
testorigin[2] = nOrigin[2]
}
public 
ball_think()
{
    if(
ballholder 0)
    {
        
entity_get_vector(ballholderEV_VEC_origin,testorigin)

        if(!
is_user_alive(ballholder))
        {

            new 
tname[32]
            
get_user_name(ballholder,tname,31)

            
ballholder 0

            testorigin
[2] += 5
            entity_set_origin
(pilkatestorigin)

            new 
Float:vel[3], x
            
for(x=0;x<3;x++)
                
vel[x] = 1.0

            entity_set_vector
(pilka,EV_VEC_velocity,vel)
            
entity_set_float(pilka,EV_FL_nextthink,halflife_time() + 0.05)
            return 
PLUGIN_HANDLED
        
}
        
entity_set_int(pilkaEV_INT_solidSOLID_NOT)

        
//Put ball in front of player
        
ball_infront(ballholder55.0)
        new 
i
        
for(i=0;i<3;i++)
            
velocity[i] = 0.0
        
//Add lift to z axis
        
new flags entity_get_int(ballholderEV_INT_flags)
        if(
flags FL_DUCKING)
            
testorigin[2] -= 10
        
else
            
testorigin[2] -= 30

        entity_set_vector
(pilka,EV_VEC_velocity,velocity)
          
entity_set_origin(pilka,testorigin)
    }
    else
        
entity_set_int(pilkaEV_INT_solidSOLID_BBOX)
        
    
entity_set_float(pilka,EV_FL_nextthink,halflife_time() + 0.05)
    return 
PLUGIN_HANDLED
}
public 
client_disconnect(id)
    if(
ballholder == id )
        
ballholder 


---------- Post dodany 08-09-2011 o godzinie 23:17 ----------

@Edit
Doszedłem do takiego czegoś: Jak powstaje piłka, to można ją podnieść. Podobnie jak się ją kopnie. Ale gdy zatrzyma się w miejscu na ziemi, to nie da się z nią nic zrobić.
Kod php:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <engine>



#define PLUGIN "Pilka"
#define VERSION "1.0"
#define AUTHOR "Gierek"

new Float:velocity[3]
new 
Float:testorigin[3]



new 
ball[] = "models/kickball/ball.mdl"

new BALL_BOUNCE_GROUND[] = "kickball/bounce.wav"
new BALL_KICKED[] = "kickball/kicked.wav"
new BALL_PICKED_UP[] = "kickball/gotball.wav"

new ballholder
new pilka
new polozenie[3]
new 
beamspr

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);


    
register_touch("Ball""player""DotykPilki")
    
register_touch("Ball""*""touchWorld")

    
register_concmd"amx_ball""Miejsce"ADMIN_ADMIN);


    
register_think("Ball","ball_think")

    
register_clcmd("say /sklep""Gracz")

    new 
ent = -1
    
while((ent fm_find_ent_by_class(ent"func_pushable")))
    {                
        
remove_entity(ent);
    }

}

public 
Gracz(id)
{
    
client_print(idprint_chat" %i ma sd"ballholder);
    return 
PLUGIN_HANDLED
}

public 
plugin_precache()
{
    
engfuncEngFunc_PrecacheSoundBALL_BOUNCE_GROUND)
    
engfuncEngFunc_PrecacheSoundBALL_PICKED_UP)
    
engfuncEngFunc_PrecacheSoundBALL_KICKED)
    
engfuncEngFunc_PrecacheModelball)
    
beamspr engfuncEngFunc_PrecacheModel,"sprites/laserbeam.spr")
}

public 
client_PreThink(id)
{
    if(
is_valid_ent(pilka) && is_user_connected(id))
    {
        new 
button entity_get_int(idEV_INT_button)
        new 
usekey = (button IN_USE)


        if( 
id == ballholder )
            if( 
usekey )
                
kickBall(ballholder0)
    }
}
public 
Miejsce(id)
{
    
get_user_origin(id,polozenie)

    
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY//message begin
    
write_byte(TE_PARTICLEBURST )
    
write_coord(polozenie[0]) // origin
    
write_coord(polozenie[1]) // origin
    
write_coord(polozenie[2]) // origin
    
write_short(20// radius
    
write_byte(1// particle color
    
write_byte(4// duration * 10 will be randomized a bit
    
message_end()

    
polozenie[2]=polozenie[2]+150
    PostawPilke
()

}
public 
PostawPilke()
{

    new 
iEnt find_ent_by_class(-1"Ball");
    while(
iEnt 0
    {
        
remove_entity(iEnt);
        
iEnt find_ent_by_class(iEnt"Ball");    
    }
    
    new 
Float:polozenie2[3]
    for(new 
i=0;i<2;i++)
    
polozenie2[i]=polozenie[i]*1.0

        
    
new ent create_entity("info_target");
    
entity_set_string(ent ,EV_SZ_classname"Ball");
    
entity_set_origin(entpolozenie2);
    
entity_set_int(entEV_INT_movetypeMOVETYPE_BOUNCE)
    
entity_set_int(entEV_INT_solidSOLID_BBOX);
    
entity_set_model(entball);
    
pilka=ent
//    drop_to_floor(ent);
    
entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.05) ;
    
    return 
PLUGIN_CONTINUE;
}

public 
touchWorld(ballworld)
{
    if(
get_speed(ball) > 10)
    {
        new 
Float:v[3]
        
entity_get_vector(ballEV_VEC_velocityv)

        
v[0] = (v[0] * 0.85)
        
v[1] = (v[1] * 0.85)
        
v[2] = (v[2] * 0.85)
        
entity_set_vector(ballEV_VEC_velocityv)
        
emit_sound(ballCHAN_ITEMBALL_BOUNCE_GROUND1.0ATTN_NORM0PITCH_NORM)
    }
    return 
PLUGIN_HANDLED
}
public 
DotykPilki(entid)
{
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED

    
if(ballholder == 0)
    {
        
emit_sound(entCHAN_ITEMBALL_PICKED_UP1.0ATTN_NORM0PITCH_NORM)
        
ballholder id
        beam
()
    }
    return 
PLUGIN_HANDLED
}

public 
kickBall(idvelType)
{

    new 
a,x

    
//Give it some lift
    
ball_infront(id55.0)

    
testorigin[2] += 10

    
new Float:tempO[3], Float:returned[3]
    new 
Float:dist2

    entity_get_vector
(idEV_VEC_origintempO)
    new 
tempEnt trace_lineidtempOtestoriginreturned )

    
dist2 get_distance_f(testoriginreturned)

    
//ball_infront(id, 55.0)

    
if( point_contents(testorigin) != CONTENTS_EMPTY || (!is_user_connected(tempEnt) && dist2 ) )//|| tempDist < 65)
        
return PLUGIN_HANDLED
    
else
    {
        
//Check Make sure our ball isnt inside a wall before kicking
        
new Float:ballF[3], Float:ballR[3], Float:ballL[3]
        new 
Float:ballB[3], Float:ballTR[3], Float:ballTL[3]
        new 
Float:ballBL[3], Float:ballBR[3]

        for(
x=0x<3x++) {
                
ballF[x] = testorigin[x];    ballR[x] = testorigin[x];
                
ballL[x] = testorigin[x];    ballB[x] = testorigin[x];
                
ballTR[x] = testorigin[x];    ballTL[x] = testorigin[x];
                
ballBL[x] = testorigin[x];    ballBR[x] = testorigin[x];
            }

        for(
a=1a<=6a++) {

            
ballF[1] += 3.0;    ballB[1] -= 3.0;
            
ballR[0] += 3.0;    ballL[0] -= 3.0;

            
ballTL[0] -= 3.0;    ballTL[1] += 3.0;
            
ballTR[0] += 3.0;    ballTR[1] += 3.0;
            
ballBL[0] -= 3.0;    ballBL[1] -= 3.0;
            
ballBR[0] += 3.0;    ballBR[1] -= 3.0;

            if(
point_contents(ballF) != CONTENTS_EMPTY || point_contents(ballR) != CONTENTS_EMPTY ||
            
point_contents(ballL) != CONTENTS_EMPTY || point_contents(ballB) != CONTENTS_EMPTY ||
            
point_contents(ballTR) != CONTENTS_EMPTY || point_contents(ballTL) != CONTENTS_EMPTY ||
            
point_contents(ballBL) != CONTENTS_EMPTY || point_contents(ballBR) != CONTENTS_EMPTY)
                    return 
PLUGIN_HANDLED
        
}
    }

    new 
kickVel random_num(200800)


    new 
Float:ballorig[3]
    
entity_get_vector(id,EV_VEC_origin,ballorig)

    
velocity_by_aim(idkickVelvelocity)

    
ballholder 0
    entity_set_origin
(pilka,testorigin)
    
entity_set_vector(pilka,EV_VEC_velocity,velocity)

    
emit_sound(pilkaCHAN_ITEMBALL_KICKED1.0ATTN_NORM0PITCH_NORM)

    return 
PLUGIN_HANDLED
}
public 
ball_infront(idFloat:dist)
{

    new 
Float:nOrigin[3]
    new 
Float:vAngles[3// plug in the view angles of the entity
    
new Float:vReturn[3// to get out an origin fDistance away

    
entity_get_vector(pilka,EV_VEC_origin,testorigin)
    
entity_get_vector(id,EV_VEC_origin,nOrigin)
    
entity_get_vector(id,EV_VEC_v_angle,vAngles)


    
vReturn[0] = floatcosvAngles[1], degrees ) * dist
    vReturn
[1] = floatsinvAngles[1], degrees ) * dist

    vReturn
[0] += nOrigin[0]
    
vReturn[1] += nOrigin[1]

    
testorigin[0] = vReturn[0]
    
testorigin[1] = vReturn[1]
    
testorigin[2] = nOrigin[2]
}
public 
ball_think()
{
    if(
ballholder 0)
    {
        
entity_get_vector(ballholderEV_VEC_origin,testorigin)

        if(!
is_user_alive(ballholder))
        {

            new 
tname[32]
            
get_user_name(ballholder,tname,31)

            
ballholder 0

            testorigin
[2] += 5
            entity_set_origin
(pilkatestorigin)

            new 
Float:vel[3], x
            
for(x=0;x<3;x++)
                
vel[x] = 1.0

            entity_set_vector
(pilka,EV_VEC_velocity,vel)
            
entity_set_float(pilka,EV_FL_nextthink,halflife_time() + 0.05)
            return 
PLUGIN_HANDLED
        
}
        if(
entity_get_int(pilka,EV_INT_solid) != SOLID_NOT)
            
entity_set_int(pilkaEV_INT_solidSOLID_NOT)

        
//Put ball in front of player
        
ball_infront(ballholder55.0)
        new 
i
        
for(i=0;i<3;i++)
            
velocity[i] = 0.0
        
//Add lift to z axis
        
new flags entity_get_int(ballholderEV_INT_flags)
        if(
flags FL_DUCKING)
            
testorigin[2] -= 10
        
else
            
testorigin[2] -= 30

        entity_set_vector
(pilka,EV_VEC_velocity,velocity)
          
entity_set_origin(pilka,testorigin)
    }
    else
        if(
entity_get_int(pilka,EV_INT_solid) != SOLID_BBOX)
            
entity_set_int(pilkaEV_INT_solidSOLID_BBOX)
        
    
entity_set_float(pilka,EV_FL_nextthink,halflife_time() + 0.05)
    return 
PLUGIN_HANDLED
}
public 
client_disconnect(id)
    if(
ballholder == id )
        
ballholder 0

//BALL BEAM
#define BALL_BEAM_WIDTH        5
#define BALL_BEAM_LIFE        10
#define BALL_BEAM_RED        115
#define BALL_BEAM_GREEN        255
#define BALL_BEAM_BLUE        10
#define BALL_BEAM_ALPHA        175

beam()
{
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(22)         // TE_BEAMFOLLOW
    
write_short(pilka)     // ball
    
write_short(beamspr)// laserbeam
    
write_byte(BALL_BEAM_LIFE)    // life
    
write_byte(BALL_BEAM_WIDTH)    // width
    
write_byte(BALL_BEAM_RED)    // R
    
write_byte(BALL_BEAM_GREEN)    // G
    
write_byte(BALL_BEAM_BLUE)    // B
    
write_byte(BALL_BEAM_ALPHA)    // brightness
    
message_end()



---------- Post dodany 09-09-2011 o godzinie 11:37 ----------

@Edit
Dobra. Wszystko już gra. Zapomniałem o 1-dnej rzeczy.
Kod php:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <engine>



#define PLUGIN "Pilka"
#define VERSION "1.0"
#define AUTHOR "Gierek"

new Float:velocity[3]
new 
Float:testorigin[3]



new 
ball[] = "models/kickball/ball.mdl"

new BALL_BOUNCE_GROUND[] = "kickball/bounce.wav"
new BALL_KICKED[] = "kickball/kicked.wav"
new BALL_PICKED_UP[] = "kickball/gotball.wav"

new ballholder
new pilka
new polozenie[3]
new 
beamspr

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);


    
register_touch("Ball""player""DotykPilki")
    
register_touch("Ball""*""touchWorld")

    
register_concmd"amx_ball""Miejsce"ADMIN_ADMIN);


    
register_think("Ball","ball_think")

    new 
ent = -1
    
while((ent fm_find_ent_by_class(ent"func_pushable")))
    {                
        
remove_entity(ent);
    }

}
public 
plugin_precache()
{
    
engfuncEngFunc_PrecacheSoundBALL_BOUNCE_GROUND)
    
engfuncEngFunc_PrecacheSoundBALL_PICKED_UP)
    
engfuncEngFunc_PrecacheSoundBALL_KICKED)
    
engfuncEngFunc_PrecacheModelball)
    
beamspr engfuncEngFunc_PrecacheModel,"sprites/laserbeam.spr")
}

public 
client_PreThink(id)
{
    if(
is_valid_ent(pilka) && is_user_connected(id))
    {
        new 
button entity_get_int(idEV_INT_button)
        new 
usekey = (button IN_USE)


        if( 
id == ballholder )
            if( 
usekey )
                
kickBall(ballholder0)
    }
}
public 
Miejsce(id)
{
    
get_user_origin(id,polozenie)

    
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY//message begin
    
write_byte(TE_PARTICLEBURST )
    
write_coord(polozenie[0]) // origin
    
write_coord(polozenie[1]) // origin
    
write_coord(polozenie[2]) // origin
    
write_short(20// radius
    
write_byte(1// particle color
    
write_byte(4// duration * 10 will be randomized a bit
    
message_end()
    
PostawPilke()

}
public 
PostawPilke()
{

    new 
iEnt find_ent_by_class(-1"Ball");
    while(
iEnt 0
    {
        
remove_entity(iEnt);
        
iEnt find_ent_by_class(iEnt"Ball");    
    }
    
    new 
Float:polozenie2[3]
    for(new 
i=0;i<2;i++)
        
polozenie2[i]=polozenie[i]*1.0
        
    
new ent create_entity("info_target");
    
entity_set_string(ent ,EV_SZ_classname"Ball");
    
entity_set_origin(entpolozenie2);
    
entity_set_int(entEV_INT_movetypeMOVETYPE_BOUNCE)
    
entity_set_int(entEV_INT_solidSOLID_BBOX);
    
entity_set_model(entball);


    new 
Float:MinBox[3]
    new 
Float:MaxBox[3]
    
MinBox[0] = -15.0
    MinBox
[1] = -15.0
    MinBox
[2] = 0.0
    MaxBox
[0] = 15.0
    MaxBox
[1] = 15.0
    MaxBox
[2] = 12.0

    entity_set_vector
(entEV_VEC_minsMinBox)
    
entity_set_vector(entEV_VEC_maxsMaxBox)


    
pilka=ent
    entity_set_float
(ent,EV_FL_nextthink,halflife_time() + 0.05) ;
    
    return 
PLUGIN_CONTINUE;
}

public 
touchWorld(ballworld)
{
    if(
get_speed(ball) > 10)
    {
        new 
Float:v[3]
        
entity_get_vector(ballEV_VEC_velocityv)

        
v[0] = (v[0] * 0.85)
        
v[1] = (v[1] * 0.85)
        
v[2] = (v[2] * 0.85)
        
entity_set_vector(ballEV_VEC_velocityv)
        
emit_sound(ballCHAN_ITEMBALL_BOUNCE_GROUND1.0ATTN_NORM0PITCH_NORM)
    }
    return 
PLUGIN_HANDLED
}
public 
DotykPilki(entid)
{
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED

    
if(ballholder == 0)
    {
        
emit_sound(entCHAN_ITEMBALL_PICKED_UP1.0ATTN_NORM0PITCH_NORM)
        
ballholder id
        beam
()
    }
//    user_kill(id,0)
    
return PLUGIN_HANDLED
}

public 
kickBall(idvelType)
{

    new 
a,x

    
//Give it some lift
    
ball_infront(id55.0)

    
testorigin[2] += 10

    
new Float:tempO[3], Float:returned[3]
    new 
Float:dist2

    entity_get_vector
(idEV_VEC_origintempO)
    new 
tempEnt trace_lineidtempOtestoriginreturned )

    
dist2 get_distance_f(testoriginreturned)

    
//ball_infront(id, 55.0)

    
if( point_contents(testorigin) != CONTENTS_EMPTY || (!is_user_connected(tempEnt) && dist2 ) )//|| tempDist < 65)
        
return PLUGIN_HANDLED
    
else
    {
        
//Check Make sure our ball isnt inside a wall before kicking
        
new Float:ballF[3], Float:ballR[3], Float:ballL[3]
        new 
Float:ballB[3], Float:ballTR[3], Float:ballTL[3]
        new 
Float:ballBL[3], Float:ballBR[3]

        for(
x=0x<3x++) {
                
ballF[x] = testorigin[x];    ballR[x] = testorigin[x];
                
ballL[x] = testorigin[x];    ballB[x] = testorigin[x];
                
ballTR[x] = testorigin[x];    ballTL[x] = testorigin[x];
                
ballBL[x] = testorigin[x];    ballBR[x] = testorigin[x];
            }

        for(
a=1a<=6a++) {

            
ballF[1] += 3.0;    ballB[1] -= 3.0;
            
ballR[0] += 3.0;    ballL[0] -= 3.0;

            
ballTL[0] -= 3.0;    ballTL[1] += 3.0;
            
ballTR[0] += 3.0;    ballTR[1] += 3.0;
            
ballBL[0] -= 3.0;    ballBL[1] -= 3.0;
            
ballBR[0] += 3.0;    ballBR[1] -= 3.0;

            if(
point_contents(ballF) != CONTENTS_EMPTY || point_contents(ballR) != CONTENTS_EMPTY ||
            
point_contents(ballL) != CONTENTS_EMPTY || point_contents(ballB) != CONTENTS_EMPTY ||
            
point_contents(ballTR) != CONTENTS_EMPTY || point_contents(ballTL) != CONTENTS_EMPTY ||
            
point_contents(ballBL) != CONTENTS_EMPTY || point_contents(ballBR) != CONTENTS_EMPTY)
                    return 
PLUGIN_HANDLED
        
}
    }

    new 
kickVel random_num(200800)


    new 
Float:ballorig[3]
    
entity_get_vector(id,EV_VEC_origin,ballorig)

    
velocity_by_aim(idkickVelvelocity)

    
ballholder 0
    entity_set_origin
(pilka,testorigin)
    
entity_set_vector(pilka,EV_VEC_velocity,velocity)

    
emit_sound(pilkaCHAN_ITEMBALL_KICKED1.0ATTN_NORM0PITCH_NORM)

    return 
PLUGIN_HANDLED
}
public 
ball_infront(idFloat:dist)
{

    new 
Float:nOrigin[3]
    new 
Float:vAngles[3// plug in the view angles of the entity
    
new Float:vReturn[3// to get out an origin fDistance away

    
entity_get_vector(pilka,EV_VEC_origin,testorigin)
    
entity_get_vector(id,EV_VEC_origin,nOrigin)
    
entity_get_vector(id,EV_VEC_v_angle,vAngles)


    
vReturn[0] = floatcosvAngles[1], degrees ) * dist
    vReturn
[1] = floatsinvAngles[1], degrees ) * dist

    vReturn
[0] += nOrigin[0]
    
vReturn[1] += nOrigin[1]

    
testorigin[0] = vReturn[0]
    
testorigin[1] = vReturn[1]
    
testorigin[2] = nOrigin[2]
}
public 
ball_think()
{
    if(
ballholder 0)
    {
        
entity_get_vector(ballholderEV_VEC_origin,testorigin)

        if(!
is_user_alive(ballholder))
        {

            new 
tname[32]
            
get_user_name(ballholder,tname,31)

            
ballholder 0

            testorigin
[2] += 5
            entity_set_origin
(pilkatestorigin)

            new 
Float:vel[3], x
            
for(x=0;x<3;x++)
                
vel[x] = 1.0

            entity_set_vector
(pilka,EV_VEC_velocity,vel)
            
entity_set_float(pilka,EV_FL_nextthink,halflife_time() + 0.05)
            return 
PLUGIN_HANDLED
        
}
        if(
entity_get_int(pilka,EV_INT_solid) != SOLID_NOT)
            
entity_set_int(pilkaEV_INT_solidSOLID_NOT)

        
//Put ball in front of player
        
ball_infront(ballholder55.0)
        new 
i
        
for(i=0;i<3;i++)
            
velocity[i] = 0.0
        
//Add lift to z axis
        
new flags entity_get_int(ballholderEV_INT_flags)
        if(
flags FL_DUCKING)
            
testorigin[2] -= 10
        
else
            
testorigin[2] -= 30

        entity_set_vector
(pilka,EV_VEC_velocity,velocity)
          
entity_set_origin(pilka,testorigin)
    }
    else
        if(
entity_get_int(pilka,EV_INT_solid) != SOLID_BBOX)
            
entity_set_int(pilkaEV_INT_solidSOLID_BBOX)
        
    
entity_set_float(pilka,EV_FL_nextthink,halflife_time() + 0.05)
    return 
PLUGIN_HANDLED
}
public 
client_disconnect(id)
    if(
ballholder == id )
        
ballholder 0

//BALL BEAM
#define BALL_BEAM_WIDTH        5
#define BALL_BEAM_LIFE        10
#define BALL_BEAM_RED        115
#define BALL_BEAM_GREEN        255
#define BALL_BEAM_BLUE        10
#define BALL_BEAM_ALPHA        175

beam()
{
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(22)         // TE_BEAMFOLLOW
    
write_short(pilka)     // ball
    
write_short(beamspr)// laserbeam
    
write_byte(BALL_BEAM_LIFE)    // life
    
write_byte(BALL_BEAM_WIDTH)    // width
    
write_byte(BALL_BEAM_RED)    // R
    
write_byte(BALL_BEAM_GREEN)    // G
    
write_byte(BALL_BEAM_BLUE)    // B
    
write_byte(BALL_BEAM_ALPHA)    // brightness
    
message_end()