PHP Code:
public touchNet(ball, goalpost)
{
remove_task(55555)
new team = get_user_team(ballowner)
new golent = GoalEnt[team]
if (goalpost != golent && ballowner > 0)
{
new aname[64]
new Float:netOrig[3]
new netOrig2[3]
entity_get_vector(ball, EV_VEC_origin,netOrig)
new l
for(l=0;l<3;l++)
netOrig2[l] = floatround(netOrig[l])
flameWave(netOrig2)
get_user_name(ballowner,aname,63)
new frags = get_user_frags(ballowner)
entity_set_float(ballowner, EV_FL_frags, float(frags + 10))
play_wav(0, SoundDirect[16])
new assisters[4] = { 0, 0, 0, 0 }
new iassisters = 0
new ilastplayer = iassist[ team ]
if ( ilastplayer == 0 )
ilastplayer = 15
else
ilastplayer--
if ( assist[ ilastplayer ] != 0 )
{
new i, x, bool:canadd, playerid
for(i=0; i<16; i++)
{
// Stop if we've already found 4 assisters
if ( iassisters == MAX_ASSISTERS )
break
playerid = assist[ i ]
// Skip if player is invalid
if ( playerid == 0 )
continue
// Skip if kicker is counted as an assister
if ( playerid == assist[ ilastplayer ] )
continue
canadd = true
// Loop through each assister value
for(x=0; x<3; x++)
// make sure we can add them
if ( playerid == assisters[ x ] )
{
canadd = false
break
}
// Skip if they've already been added
if ( canadd == false )
continue
// They didn't kick the ball last, and they haven't been added, add them
assisters[ iassisters++ ] = playerid
}
// This gives each person an assist, xp, and prints that out to them
new c, pass
for(c=0; c<iassisters; c++)
{
pass = assisters[c]
Event_Record(pass, ASSIST, -1, ConfigPro[3])
client_print(pass, print_chat, "[SJ] You won %i exp for the assist", ConfigPro[3])
///////////////////////////////////////////////
if(sj_systemrank == 1 && get_pcvar_num(CVAR_RANK))
{
if(UserPassword[pass])
Pro_Asis[pass] += 1
if(VerificarPossUP(pass))
log_amx("7 Rank ok")
}
///////////////////////////////////////////////
}
}
iassist[ 0 ] = 0
/////////////////////ASSIST CODE HERE///////////
for(l=0; l<3; l++)
distorig[1][l] = floatround(netOrig[l])
new distshot = (get_distance(distorig[0],distorig[1])/12)
new gainedxp = distshot + ConfigPro[4]
format(temp1,63,"%s [%s] Scored a goal from %i feet!!",TeamNames[team],aname,distshot)
if(distshot > MadeRecord[ballowner][DISTANCE])
Event_Record(ballowner, DISTANCE, distshot, 0)// record distance, and make that distance exp
Event_Record(ballowner, GOAL, -1, gainedxp) //zero xp for goal cause distance is what gives it.
///////////////////////////////////////////////
if(sj_systemrank == 1 && get_pcvar_num(CVAR_RANK))
{
if(UserPassword[ballowner])
Pro_Goal[ballowner] += 1
if(VerificarPossUP(ballowner))
log_amx("8 Rank ok")
}
///////////////////////////////////////////////
//Increase Score, and update cvar score
score[team]++
switch(team)
{
case 1: set_cvar_num("score_ct",score[team])
case 2: set_cvar_num("score_t",score[team])
}
server_cmd("setear_score %d %d", score[1], score[2])
client_print(ballowner, print_chat, "[SJ] You won %i exp for scoring a goal from %i feet", gainedxp,distshot)
Gol_Sprite(ballowner)
new oteam = (team == 1 ? 2 : 1)
increaseTeamXP(team, 75)
increaseTeamXP(oteam, 50)
moveBall(0)
new x
for(x=1; x<=maxplayers; x++) {
if(is_user_connected(x))
{
Event_Record(x, GOALY, GoalyPoints[x], 0)
new kills = get_user_frags(x)
new deaths = cs_get_user_deaths(x)
setScoreInfo(x)
if( deaths > 0)
PlayerDeaths[x] = deaths
if( kills > 0)
PlayerKills[x] = kills
}
}
if(score[team] < get_pcvar_num(CVAR_SCORE)) {
new r = random_num(0,5)
play_wav(0, SoundDirect[r]);
}
else
{
winner = team
format(scoreboard,1024,"-+- TEAM %s -+-^nWON!!!",TeamNames[team])
set_task(1.0,"showhud_winner",0,"",0,"a",3)
play_wav(0, SoundDirect[20])
ActiveJoinTeam = 0
sj_systemrank = 0
BorrarSistemExp()
}
server_cmd("sv_restart 4")
}