Quote:
Originally Posted by SoccerjamTR
Thanks but i didn't understand because of my poor code knowledge. Can you edit the public for like that ?
|
I'm bad to I have little knowledge only try this :
Code:
public Offside(id)
{
new PossCancha[MAX_PLAYER + 1][3], alive = 0
new origin_x[3], team
for(new i = 1; i <= MAX_PLAYER; i++)
{
if(is_user_alive(i) && !is_user_bot(i) && !is_user_hltv(i) && is_user_connected(i) && !user_is_keeper[i] && !soy_spec[i])
{
alive++
get_user_origin(i, origin_x)
team = get_user_team(i)
PossCancha[alive][0] = i
PossCancha[alive][1] = origin_x[0]
PossCancha[alive][2] = team
}
}
if(alive >= 3)
{
new ball_owner_team = get_user_team(ballowner)
new temp
if(ball_owner_team == 1)
{
for(new i = 1; i < alive; i++)
{
for(new j = i + 1; j <= alive; j++)
{
if(PossCancha[i][1] > PossCancha[j][1])
{
temp = PossCancha[i]
PossCancha[i] = PossCancha[j]
PossCancha[j] = temp
}
}
}
}
else if(ball_owner_team == 2)
{
for(new i = 1; i < alive; i++)
{
for(new j = i + 1; j <= alive; j++)
{
if(PossCancha[i][1] < PossCancha[j][1])
{
temp = PossCancha[i]
PossCancha[i] = PossCancha[j]
PossCancha[j] = temp
}
}
}
}
if(ball_owner_team != PossCancha[1][2])
return false;
if(id == PossCancha[1][0] || id == PossCancha[2][0])
return false;
SentenceOffside(PossCancha[1][0], PossCancha[2][0])
}
}
This version of the Offside function increases the number of offside catching players to 2 by checking if the player ID passed to the function is equal to the ID of the first or second player in the sorted PossCancha array.
You can also increase the number of offside catching players to 3 by:
Code:
if(id == PossCancha[1][0] || id == PossCancha[2][0] || id == PossCancha[3][0])
Please keep in mind that increasing the offside catching player number may require other adjustments to the code to work correctly, so it's important to test the changes thoroughly.
__________________