Ошибка - error 017: undefined symbol "PrintChatColor"

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
20
Реакции
6
Помог
3 раз(а)
Ошибка
error 017: undefined symbol "PrintChatColor"
Компилятор
Локальный
Amx Mod X
Исходный код
/*====================================================================================================
[Offside Foul Hard System]

Purpose: $$

Comment: $$

====================================================================================================*/
#define MAX_PLAYER 33

new bool:is_user_foul[MAX_PLAYER + 1]
new user_foul_count[MAX_PLAYER + 1]
new bool:is_offside[MAX_PLAYER + 1]
new off_1
new offbeam
new Coord_Off_Z
new Coord_Off_Y
new Coord_Off_Z_active
new team_play
new dist_enable

/*====================================================================================================
[Keeper System]

Purpose: $$

Comment: $$

====================================================================================================*/
#define MAXZONES 100
#define TASK_BASIS_SHOWZONES 1000

new bool:T_keeper[MAX_PLAYER + 1]
new bool:CT_keeper[MAX_PLAYER + 1]
new bool:is_user_keeper[MAX_PLAYER + 1]

new gkct
new gktt
new zone[MAXZONES]
new maxzones
new timer[33]

new Float:soccerjamct[3]
new Float:soccerjamtt[3]
/*====================================================================================================
[Rank System]

Purpose: $$

Comment: $$

====================================================================================================*/
new g_pGoals
new g_pSteals
new g_pAssists
new g_pDisarm
new g_pBKills
new g_pOffside
new g_pFoul
new MaxPlayers
new stats_enable

enum _:PlData
{
gPoints, gGoals, gSteals, gStealsRv, gAssists, gDisarm, gDisarmRv, gBKills, gBKillsRv, gOffside, gFoul, gWarns
}

new UserData[33][PlData];
new Handle:g_SqlTuple;
new g_Cvar[5]

/*====================================================================================================
[Main Register]

Purpose: $$

Comment: $$

====================================================================================================*/

#pragma dynamic 131072 //I used to much memory =(

#define MAX_SOUNDS 10

#define TIME 10

// Disable knife disarm ? (Leaves only ball disarm)
// Comment this define to disable.
#define KNIFE_DISARM_ON

//When player reaches MAX level, they receive this many levels.
#define MAX_LVL_BONUS 1

//Max levels for each upgrade
#define MAX_LVL_STAMINA 5
#define MAX_LVL_STRENGTH 5
#define MAX_LVL_AGILITY 5
#define MAX_LVL_DEXTERITY 5
#define MAX_LVL_DISARM 5
#define MAX_LVL_POWERPLAY 5

//Prices for each upgrade.
//price = ((UpgradeLevel * UpgradePrice) / 2) + UpgradePrice
#define EXP_PRICE_STAMINA 220
#define EXP_PRICE_STRENGTH 200
#define EXP_PRICE_AGILITY 300
#define EXP_PRICE_DEXTERITY 200
#define EXP_PRICE_DISARM 200

//Experience per stat.
#define EXP_GOALY 100 //for goaly save and goaly points.
#define EXP_STEAL 100
#define EXP_KILL 100
#define EXP_ASSIST 200
#define EXP_GOAL 100

#define BASE_HP 100 //starting hp
#define BASE_SPEED 250.0 //starting run speed
#define BASE_DISARM 10 //starting disarm from lvl 1

#define COUNTDOWN_TIME 10 //Countdown time between rounds.
#define GOALY_DELAY 8.0 //Delay for goaly exp

//Curve Ball Defines
#define CURVE_ANGLE 15 //Angle for spin kick multipled by current direction.
#define CURVE_COUNT 6 //Curve this many times.
#define CURVE_TIME 0.2 //Time to curve again.
#define DIRECTIONS 2 //# of angles allowed.
#define ANGLEDIVIDE 6 //Divide angle this many times for curve.

//Misc. amounts
#define AMOUNT_LATEJOINEXP 100 //latejoinexp * each scored point.
#define AMOUNT_POWERPLAY 5 //added bonus to STR and AGI per powerplay lvl.
#define AMOUNT_GOALY 7 //Goaly camper exp

//Amount of points for each upgrade.
#define AMOUNT_STA 20 //Health per lvl
#define AMOUNT_STR 30 //Stronger kicking per lvl
#define AMOUNT_AGI 13 //Faster Speed per lvl
#define AMOUNT_DEX 10 //Better Catching
#define AMOUNT_DISARM 2 //Disarm ball chance (disarm lvl * this) if random num 1-100 < disarm

#define DISARM_MULTIPLIER 3
/* ------------------------------------------------------------------------- */
/* /---------------- TEAM NAMES ------------ TEAM NAMES ------------/ */
/* ------------------------------------------------------------------------- */

#define TEAMS 4 //Don't edit this.

//Names to be put on scoreboard.
static const TeamNames[TEAMS][] = {
"NULL",
"Красные", //Terrorist Team
"Синие", //CT Team
"NULL"
}
/* ------------------------------------------------------------------------- */
/* /---------------- MODELS ---------------- MODELS ----------------/ */
/* ------------------------------------------------------------------------- */



//You may change the ball model. Just give correct path of new model.
new ball[] = "models/kickball/ball2.mdl"

static const TeamMascots[2][] = {
"models/kingpin.mdl", //TERRORIST MASCOT
"models/garg.mdl" //CT MASCOT
}
/* ------------------------------------------------------------------------- */
/* /---------------- COLORS ---------------- COLORS ----------------/ */
/* ------------------------------------------------------------------------- */
//Format is RGB 0-255

//TEAM MODEL GLOW COLORS
#define TERR_GLOW_RED 250
#define TERR_GLOW_GREEN 10
#define TERR_GLOW_BLUE 10

#define CT_GLOW_RED 10
#define CT_GLOW_GREEN 10
#define CT_GLOW_BLUE 250

//TEAM HUD METER COLOR (Turbo/Curve Angle meters)
#define TERR_METER_RED 250
#define TERR_METER_GREEN 10
#define TERR_METER_BLUE 10

#define CT_METER_RED 10
#define CT_METER_GREEN 10
#define CT_METER_BLUE 250

//BALL GLOW COLOR (default: yellow) //it glows only one color
#define BALL_RED 255
#define BALL_GREEN 200
#define BALL_BLUE 100

//BALL BEAM
#define BALL_BEAM_WIDTH 3
#define BALL_BEAM_LIFE 15
#define BALL_BEAM_RED 145
#define BALL_BEAM_GREEN 30
#define BALL_BEAM_BLUE 66
#define BALL_BEAM_ALPHA 50

/* ------------------------------------------------------------------------- */
/* /---------------- SOUNDS ---------------- SOUNDS ----------------/ */
/* ------------------------------------------------------------------------- */
//-- NOTE: Sounds must be located in sound/kickball/ folder.

new BALL_BOUNCE_GROUND[] = "kickball/bounce.wav"
new BALL_RESPAWN[] = "kickball/returned.wav"
new BALL_KICKED[] = "kickball/kicked.wav"
new BALL_PICKED_UP[] = "kickball/gotball.wav"
new UPGRADED_MAX_LEVEL[] = "kickball/levelup.wav"
new ROUND_START[] = "kickball/prepare.wav"
new SCORED_GOAL[] = "kickball/vastaps.wav"
new STOLE_BALL_FAST[] = "kickball/pussy.wav"
new OFFSIDE[] = "kickball/whistle.wav"

new SCORED_SOUNDS[MAX_SOUNDS][] = {
"kickball/1.wav",
"kickball/2.wav",
"kickball/3.wav",
"kickball/4.wav",
"kickball/5.wav",
"kickball/6.wav",
"kickball/7.wav",
"kickball/8.wav",
"kickball/9.wav",
"kickball/10.wav"
}

/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* /------------------------ END OF CUSTOMIZATION ------------------------/ */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */

/* ------------ DO NOT EDIT BELOW ---------------------------------------------------------- */
/* -------------------------- DO NOT EDIT BELOW -------------------------------------------- */
/* --------------------------------------- DO NOT EDIT BELOW ------------------------------- */
/* ---------------------------------------------------- DO NOT EDIT BELOW ------------------ */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fun>
#include <csx>
#include <sqlx>
#include <hamsandwich>
#include <dhudmessage>
#include <chatcolor>
#include <csstats>

static const AUTHOR[] = "OneEyed | Doondook | LL | proff_q"
static const VERSION[] = "3.2"

#define MAX_TEXT_BUFFER 2047
#define MAX_NAME_LENGTH 33
#define MAX_ASSISTERS 3
#define MAX_BALL_SPAWNS 5
#define POS_X -1.0
#define POS_Y 0.85
#define HUD_CHANNEL 4
#define MESSAGE_DELAY 4.0
#define MPROP_EXITNAME 4

enum {
UNASSIGNED = 0,
T,
CT,
SPECTATOR
}

#define RECORDS 6
enum {
GOAL = 1,
ASSIST,
STEAL,
KILL,
DISTANCE,
GOALY
}

#define UPGRADES 5
enum {
STA = 1, //stamina
STR, //strength
AGI, //agility
DEX, //dexterity
DISARM,
}

static const UpgradeTitles[UPGRADES+1][] = {
"NULL",
"Здоровье",
"Сила",
"Скорость",
"Ловкость",
"Дизарм"
}

new const UpgradeMax[UPGRADES+1] = {
0, //NULL
MAX_LVL_STAMINA, //STAMINA
MAX_LVL_STRENGTH, //STRENGTH
MAX_LVL_AGILITY, //AGILITY
MAX_LVL_DEXTERITY, //DEXTERITY
MAX_LVL_DISARM, //DISARM
}

new const UpgradePrice[UPGRADES+1] = {
0, //NULL
EXP_PRICE_STAMINA,
EXP_PRICE_STRENGTH,
EXP_PRICE_AGILITY,
EXP_PRICE_DEXTERITY,
EXP_PRICE_DISARM,
}

new TeamColors[TEAMS][3] =
{
{ 0, 0, 0 },
{ TERR_GLOW_RED, TERR_GLOW_GREEN, TERR_GLOW_BLUE } ,
{ CT_GLOW_RED, CT_GLOW_GREEN, CT_GLOW_BLUE },
{ 0, 0, 0 }
}

new TeamMeterColors[TEAMS][3] =
{
{ 0, 0, 0 },
{ TERR_METER_RED, TERR_METER_GREEN, TERR_METER_BLUE } ,
{ CT_METER_RED, CT_METER_GREEN, CT_METER_BLUE },
{ 0, 0, 0 }
}


new ballcolor[3] = { BALL_RED, BALL_GREEN, BALL_BLUE }
new PlayerUpgrades[MAX_PLAYER][UPGRADES+1]
new GoalEnt[TEAMS]
new PressedAction[MAX_PLAYER]
new seconds[MAX_PLAYER]
new g_sprint[MAX_PLAYER]
new SideJump[MAX_PLAYER]
new Float:SideJumpDelay[MAX_PLAYER]
new PlayerDeaths[MAX_PLAYER]
new PlayerKills[MAX_PLAYER]
new curvecount
new direction
new Float:BallSpinDirection[3]
new ballspawncount
new Float:TeamBallOrigins[TEAMS][3]
new Float:TEMP_TeamBallOrigins[3]
new Mascots[TEAMS]
new Float:MascotsOrigins[3]
new Float:MascotsAngles[3]
new menu_upgrade[MAX_PLAYER]
new Float:fire_delay
new winner
new Float:GoalyCheckDelay[MAX_PLAYER]
new GoalyCheck[MAX_PLAYER]
new GoalyPoints[MAX_PLAYER]
new Float:BallSpawnOrigin[MAX_BALL_SPAWNS][3]
new TopPlayer[2][RECORDS+1]
new MadeRecord[MAX_PLAYER][RECORDS+1]
new TopPlayerName[RECORDS+1][MAX_NAME_LENGTH]
new g_Experience[MAX_PLAYER]
new Float:testorigin[3]
new Float:velocity[3]
new score[TEAMS]
new scoreboard[1025]
new temp1[64], temp2[64]
new distorig[2][3] //distance recorder
new gmsgShake
new gmsgDeathMsg
new gmsgTextMsg
new gmsgScreenFade
new goaldied[MAX_PLAYER]
new bool:is_dead[MAX_PLAYER]
new PowerPlay, powerplay_list[MAX_LVL_POWERPLAY+1]
new assist[16]
new iassist[TEAMS]
new gamePlayerEquip
new CVAR_SCORE
new CVAR_RESET
new CVAR_GOALSAFETY
new CVAR_KICK
new Float:CVAR_RESPAWN
new CVAR_KILLNEARBALL
new CVAR_KILLNEARHOLDER
new CVAR_KILLNEARAREA
new fire
new smoke
new beamspr
new g_fxBeamSprite
new Burn_Sprite
new ballholder
new ballowner
new aball
new is_kickball
new bool:has_knife[MAX_PLAYER]
new maxplayers
new kick
new goalsafety
new gravity
new g_spr
new g_sprtime
new time_to_time[33]
new moveplr
new origin[3]
new HasView[33]
new health_add
new nKiller
new nKiller_hp
new nHp_add
new bplayer
new adm[33]
new bp[33]

new OFFSET_INTERNALMODEL;

/*====================================================================================================
[Precache]

Purpose: $$

Comment: $$

====================================================================================================*/

public plugin_precache(){
precache_model("models/rpgrocket.mdl")
precache_model("models/gib_skull.mdl")
}

PrecacheSounds() {
new x
for(x=0;x<MAX_SOUNDS;x++)
engfunc( EngFunc_PrecacheSound, SCORED_SOUNDS[x])

engfunc( EngFunc_PrecacheSound, STOLE_BALL_FAST)
engfunc( EngFunc_PrecacheSound, ROUND_START)
engfunc( EngFunc_PrecacheSound, BALL_BOUNCE_GROUND)
engfunc( EngFunc_PrecacheSound, BALL_PICKED_UP)
engfunc( EngFunc_PrecacheSound, BALL_RESPAWN)
engfunc( EngFunc_PrecacheSound, SCORED_GOAL)
engfunc( EngFunc_PrecacheSound, BALL_KICKED)
engfunc( EngFunc_PrecacheSound, UPGRADED_MAX_LEVEL)
engfunc( EngFunc_PrecacheSound, OFFSIDE)
}

PrecacheBall() {
engfunc( EngFunc_PrecacheModel, ball)
}

PrecacheMonsters(team) {
engfunc( EngFunc_PrecacheModel, TeamMascots[team-1])
}

PrecacheSprites() {
g_spr = engfunc( EngFunc_PrecacheModel,"sprites/pass.spr")
beamspr = engfunc( EngFunc_PrecacheModel,"sprites/laserbeam.spr")
fire = engfunc( EngFunc_PrecacheModel,"sprites/shockwave.spr")
smoke = engfunc( EngFunc_PrecacheModel,"sprites/steam1.spr")
Burn_Sprite = engfunc( EngFunc_PrecacheModel,"sprites/xfireball3.spr")
g_fxBeamSprite = engfunc( EngFunc_PrecacheModel,"sprites/lgtning.spr")
offbeam = engfunc( EngFunc_PrecacheModel, "sprites/offbeam.spr")
}

PrecacheOther() {
engfunc( EngFunc_PrecacheModel, "models/rpgrocket.mdl")
engfunc( EngFunc_PrecacheModel, "models/chick.mdl")
}

/*====================================================================================================
[Initialize]

Purpose: $$

Comment: $$

====================================================================================================*/
public plugin_init()
{
/*Warn System*/
register_clcmd("amx_warnmenu", "warnmenu", ADMIN_BAN, "Warnmenu")

/*Keeper System*/
register_clcmd("say /gk", "cmdKeeper")
register_clcmd("say_team /gk", "cmdKeeper")
register_clcmd("say /keeper", "cmdKeeper")
register_clcmd("say_team /keeper", "cmdKeeper")
register_clcmd("say /nogk", "cmdUnKeeper")
register_clcmd("say_team /nogk", "cmdUnKeeper")
register_clcmd("say /nokeeper", "cmdUnKeeper")
register_clcmd("say_team /nokeeper", "cmdUnKeeper")

register_forward(FM_Touch, "fw_touch")

set_task(1.0, "LoadWGZ")

new mapname[31]
get_mapname(mapname, 31)

if(equali(mapname, "soccerjam")) {
soccerjamct[0] = -2472.0
soccerjamct[1] = 0.0
soccerjamct[2] = 1604.0
soccerjamtt[0] = 2055.0
soccerjamtt[1] = 0.0
soccerjamtt[2] = 1604.0
}

if(equali(mapname, "sj_danger")) {
soccerjamct[0] = -2200.0
soccerjamct[1] = 0.0
soccerjamct[2] = 37.0
soccerjamtt[0] = 2200.0
soccerjamtt[1] = 0.0
soccerjamtt[2] = 37.0
}

if(equali(mapname, "sj_monumental")) {
soccerjamct[0] = -2200.0
soccerjamct[1] = 0.0
soccerjamct[2] = 37.0
soccerjamtt[0] = 2200.0
soccerjamtt[1] = 0.0
soccerjamtt[2] = 37.0
}

if(equali(mapname, "sj_ogl")) {
soccerjamct[0] = -2200.0
soccerjamct[1] = 0.0
soccerjamct[2] = 37.0
soccerjamtt[0] = 2200.0
soccerjamtt[1] = 0.0
soccerjamtt[2] = 37.0
}

if(equali(mapname, "sj_dust2")) {
soccerjamct[0] = -2200.0
soccerjamct[1] = 0.0
soccerjamct[2] = 37.0
soccerjamtt[0] = 2200.0
soccerjamtt[1] = 0.0
soccerjamtt[2] = 37.0
}

if(equali(mapname, "sj_sansiro")) {
soccerjamct[0] = -2200.0
soccerjamct[1] = -300.0
soccerjamct[2] = -813.0
soccerjamtt[0] = 2200.0
soccerjamtt[1] = -300.0
soccerjamtt[2] = -813.0
}

/*Offside Foul Hard System*/
register_forward(FM_PlayerPreThink, "go_player")
team_play = 0
dist_enable = 1

/*Rank System*/
g_Cvar[1] = register_cvar("amx_mysql_hostname", "127.0.0.1")
g_Cvar[2] = register_cvar("amx_mysql_username", "root")
g_Cvar[3] = register_cvar("amx_mysql_password", "asfqwf")
g_Cvar[4] = register_cvar("amx_mysql_database", "soccerjam")

register_forward(FM_Sys_Error, "fw_ServerDown")
register_forward(FM_GameShutdown, "fw_ServerDown")
register_forward(FM_ServerDeactivate, "fw_ServerDown")

register_clcmd("say /top10", "top_players")
register_clcmd("say_team /top10", "top_players")
register_clcmd("say /top", "top_players")
register_clcmd("say_team /top", "top_players")
register_clcmd("say /stats", "rankstats_players")
register_clcmd("say_team /stats", "rankstats_players")
register_clcmd("say /rankstats", "rankstats_players")
register_clcmd("say_team /rankstats", "rankstats_players")
register_clcmd("say /rank", "rank_players")
register_clcmd("say_team /rank", "rank_players")

stats_enable = 0

g_pGoals = register_cvar("points_goals", "5")
g_pSteals = register_cvar("points_steals", "2")
g_pAssists = register_cvar("points_assists", "4")
g_pDisarm = register_cvar("points_disarm", "3")
g_pBKills = register_cvar("points_bkills", "3")
g_pOffside = register_cvar("points_offside", "1")
g_pFoul = register_cvar("points_foul", "2")

/*Vimpire*/
health_add = register_cvar("amx_vampire_hp", "30")
register_event("DeathMsg", "hook_death", "a", "1>0")

/*Commentator*/
register_clcmd("say /spec", "spawn_spectators")

/*SoccerJam Experience*/
register_clcmd("amx_exp", "give_xp", ADMIN_KICK, "<nickname> <exp>")

/*Mod Menu*/
register_clcmd("amx_modmenu", "modmenu", ADMIN_KICK, _)
kick = register_cvar("sj_kick", "650")
goalsafety = register_cvar("sj_goalsafety", "650")
gravity = register_cvar("sv_gravity", "800")

/*No Clip*/
register_concmd("+noclip", "onclip")
register_concmd("-noclip", "offclip")

/*Give Me Pass*/
register_event("DeathMsg", "remove_spr", "b")
register_event("ResetHUD", "reset_hud", "be")
register_clcmd("radio3", "CreateSprite")
g_sprtime = register_cvar("amx_passtime", "15")

/*Push Player*/
moveplr = register_cvar("amx_moveplayer", "1")
register_touch("player", "player", "touchtouch")

/*Camera*/
register_clcmd("say /cam", "Camera")

/*SoccerJam*/
maxplayers = get_maxplayers()

register_cvar("soccer_jam_online", "0", FCVAR_SERVER)
register_cvar("soccer_jam_version", VERSION, FCVAR_SERVER)
set_cvar_string("soccer_jam_version", VERSION)
register_dictionary("soccerjam.txt")
if(is_kickball > 0)
{
PrecacheSprites()

register_plugin("Soccer Jam(ON)", VERSION, AUTHOR)
set_cvar_num("soccer_jam_online", 1)

gmsgTextMsg = get_user_msgid("TextMsg")
gmsgDeathMsg = get_user_msgid("DeathMsg")
gmsgShake = get_user_msgid("ScreenShake")
gmsgScreenFade = get_user_msgid("ScreenFade")

maxplayers = get_maxplayers()

if(equali(mapname, "soccerjam")) {
PrecacheOther()
CreateGoalNets()
create_wall()
}

register_clcmd("say /help", "soccerjam_help")
register_clcmd("say /rules", "soccerjam_rules")

register_event("ResetHUD", "Event_ResetHud", "be")
register_event("HLTV","Event_StartRound","a","1=0","2=0")
register_event("Damage", "Event_Damage", "b", "2!0", "3=0", "4!0" )

CVAR_SCORE = register_cvar("sj_score", "30")
CVAR_RESET = register_cvar("sj_reset", "30.0")
CVAR_GOALSAFETY = register_cvar("sj_goalsafety", "650")
CVAR_KICK = register_cvar("sj_kick", "650")
CVAR_RESPAWN = 2.0
CVAR_KILLNEARBALL = register_cvar("sj_kill_distance_ball", "500.0")
CVAR_KILLNEARHOLDER = register_cvar("sj_kill_distance_holder", "96.0")
CVAR_KILLNEARAREA = register_cvar("sj_areas", "700.0")

register_cvar("SCORE_CT", "0")
register_cvar("SCORE_T", "0")

register_menucmd(register_menuid("Team_Select",1), (1<<0)|(1<<1)|(1<<4)|(1<<5), "team_select")

register_touch("PwnBall", "player", "touchPlayer")
register_touch("PwnBall", "soccerjam_goalnet", "touchNet")

register_touch("PwnBall", "worldspawn", "touchWorld")
register_touch("PwnBall", "func_wall", "touchWorld")
register_touch("PwnBall", "func_door", "touchWorld")
register_touch("PwnBall", "func_door_rotating", "touchWorld")
register_touch("PwnBall", "func_wall_toggle", "touchWorld")
register_touch("PwnBall", "func_breakable", "touchWorld")
register_touch("PwnBall", "Blocker", "touchBlocker")

set_task(0.4,"meter",0,_,_,"b")
set_task(0.5,"statusDisplay",7654321,"",0,"b")

register_think("PwnBall","ball_think")
register_think("Mascot", "mascot_think")

register_clcmd("radio1", "LeftDirection", 0)
register_clcmd("radio2", "RightDirection", 0)
register_clcmd("drop", "Turbo")
register_clcmd("lastinv", "BuyUpgrade")
register_message(gmsgTextMsg, "editTextMsg")

register_event("ShowMenu", "menuclass", "b", "4&CT_Select", "4&Terrorist_Select");
register_event("VGUIMenu", "menuclass", "b", "1=26", "1=27");

OFFSET_INTERNALMODEL = is_amd64_server() ? 152 : 126;
}
else
{
register_plugin("Soccer Jam(OFF)", VERSION, AUTHOR)
set_cvar_num("soccer_jam_online",0)
}
return PLUGIN_HANDLED
}

/*====================================================================================================
[Vampire]

Purpose: $$

Comment: $$

====================================================================================================*/

public hook_death()
{
nKiller = read_data(1)

nHp_add = get_pcvar_num (health_add)

nKiller_hp = get_user_health(nKiller)
nKiller_hp += nHp_add

if (nKiller_hp > 220) nKiller_hp = 220

set_user_health(nKiller, nKiller_hp)

message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, nKiller)
write_short(1<<10)
write_short(1<<10)
write_short(0x0000)
write_byte(0)
write_byte(0)
write_byte(200)
write_byte(75)
message_end()

}

/*====================================================================================================
[Camera]

Purpose: $$

Comment: $$

====================================================================================================*/

public Camera(id) {

if( HasView[id] == 1) {
ResetFOV(id)
set_view(id, CAMERA_NONE)

HasView[id] = 2
}
else {
ResetFOV(id)
set_view(id, CAMERA_3RDPERSON)

HasView[id] = 1
}
return PLUGIN_CONTINUE
}

public ResetFOV(id) {
message_begin(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id)
write_byte(90)
message_end()
}

/*====================================================================================================
[Push Player]

Purpose: $$

Comment: $$

====================================================================================================*/

public touchtouch(player, player2)
{
if(get_pcvar_num(moveplr))
{
if((!(task_exists(player * 1000 + player2))) && (!(task_exists(player2 * 1000 + player))))
{
new Float:speed[2][3]
new Float:over_speed[3]

set_task(0.2, "empty_space", player * 1000 + player2)
set_task(0.2, "empty_space", player2 * 1000 + player)

entity_get_vector(player, EV_VEC_velocity, speed[0])
entity_get_vector(player2, EV_VEC_velocity, speed[1])

for(new i = 0; i < 3; i++)
{
over_speed[i] = speed[0][i] + speed[1][i]
speed[0][i] += over_speed[i] * 0.65
speed[1][i] -= over_speed[i] * 0.65
}
entity_set_vector(player, EV_VEC_velocity, speed[0])
entity_set_vector(player2, EV_VEC_velocity, speed[1])
}
}
}

public empty_space() {}

/*====================================================================================================
[Give Me Pass]

Purpose: $$

Comment: $$

====================================================================================================*/

public CreateSprite(id)
{
if(!is_user_alive(id) || is_user_bot(id) || !is_user_connected(id) || is_user_hltv(id))
return PLUGIN_HANDLED;

if(time_to_time[id] > get_systime(0))
return PLUGIN_HANDLED;

if(cs_get_user_team(id) == CS_TEAM_CT)
{
time_to_time[id] = get_systime(TIME)
message_begin(MSG_ALL, SVC_TEMPENTITY);
write_byte(TE_PLAYERATTACHMENT);
write_byte(id);
write_coord(60);
write_short(g_spr);
write_short(get_pcvar_num(g_sprtime));
message_end();
}
else if(cs_get_user_team(id) == CS_TEAM_T)
{
time_to_time[id] = get_systime(TIME)
message_begin(MSG_ALL, SVC_TEMPENTITY);
write_byte(TE_PLAYERATTACHMENT);
write_byte(id);
write_coord(60);
write_short(g_spr);
write_short(get_pcvar_num(g_sprtime));
message_end();
}
return PLUGIN_HANDLED;
}

public RemoveSprite(id)
{
if(is_user_bot(id) || !is_user_connected(id))
return PLUGIN_HANDLED;

message_begin(MSG_ALL, SVC_TEMPENTITY);
write_byte(TE_KILLPLAYERATTACHMENTS);
write_byte(id);
message_end();

return PLUGIN_CONTINUE;
}

public remove_spr()
{
new deadid = read_data(2);

message_begin(MSG_ALL, SVC_TEMPENTITY);
write_byte(TE_KILLPLAYERATTACHMENTS);
write_byte(deadid);
message_end();

return PLUGIN_CONTINUE;
}

public reset_hud()
{
new id;
for(id = 1; id <= get_maxplayers(); id++)
{
message_begin(MSG_ALL, SVC_TEMPENTITY);
write_byte(TE_KILLPLAYERATTACHMENTS);
write_byte(id);
message_end();
}
return PLUGIN_CONTINUE;
}

/*====================================================================================================
[No Clip]

Purpose: $$

Comment: $$

====================================================================================================*/

public onclip(id) {
if(!(get_user_flags(id) & ADMIN_LEVEL_A))
return PLUGIN_CONTINUE;

set_user_noclip(id, 1)
return PLUGIN_HANDLED;
}

public offclip(id) {
if(!(get_user_flags(id) & ADMIN_LEVEL_A))
return PLUGIN_CONTINUE;

set_user_noclip(id, 0)
return PLUGIN_HANDLED;
}

/*====================================================================================================
[Mod Menu]

Purpose: $$

Comment: $$

====================================================================================================*/

public modmenu(id) {
new i_Menu = menu_create("\rРежим игры:", "menu_handler")
menu_additem(i_Menu, "\yОбычная игра", "1", 0)
menu_additem(i_Menu, "\yРакетный мяч", "2", 0)
menu_additem(i_Menu, "\yЛетающий футбол", "3", 0)

menu_setprop(i_Menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, i_Menu, 0)
return PLUGIN_HANDLED;
}

public menu_handler(id, menu, item) {
if (item == MENU_EXIT) {
menu_destroy(menu)

return PLUGIN_HANDLED
}

new s_Data[6], s_Name[64], i_Access, i_Callback
menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)
new i_Key = str_to_num(s_Data)

ClearDHUDMessages();
set_dhudmessage(255, 255, 0, -1.0, 0.0, 2, 15.0, 15.0, 0.1, 1.0, false);

switch(i_Key) {
case 1:{
show_dhudmessage(0, "Включен обычный режим!");
set_pcvar_num(kick, 650);
set_pcvar_num(goalsafety, 650);
set_pcvar_num(gravity, 800);
dist_enable = 1;
stats_enable = 1;
}
case 2:{
show_dhudmessage(0, "Включен режим ракетный мяч!");
set_pcvar_num(kick, 2000);
set_pcvar_num(goalsafety, 2300);
set_pcvar_num(gravity, 800);
dist_enable = 0;
stats_enable = 0;
}
case 3:{
show_dhudmessage(0, "Включен режим летающий футбол!");
set_pcvar_num(kick, 650);
set_pcvar_num(goalsafety, 1000);
set_pcvar_num(gravity, 400);
dist_enable = 0;
stats_enable = 0;
}
}

menu_destroy(menu)
return PLUGIN_HANDLED
}

/*====================================================================================================
[Commentator]

Purpose: $$

Comment: $$

====================================================================================================*/

public spawn_spectators(id) {
new mapname[31]
get_mapname(mapname, 31)

if(!is_user_keeper[id]) {
if(equali(mapname, "soccerjam")) {
if(is_user_alive(id) && id != ballholder) {
cs_set_user_team(id, CS_TEAM_SPECTATOR, CS_DONTCHANGE)
origin[0]=random_num(-2091,-1565)
origin[1]=random_num(2904,3261)
origin[2]=(1940)
spawn(id)
set_user_origin(id,origin)
}
}
else if(equali(mapname, "sj_danger")) {
if(is_user_alive(id) && id != ballholder) {
cs_set_user_team(id, CS_TEAM_SPECTATOR, CS_DONTCHANGE)
origin[0]=random_num(-479,590)
origin[1]=random_num(-1994,-1923)
origin[2]=(804)
spawn(id)
set_user_origin(id,origin)
}
}
else if(equali(mapname, "sj_monumental")) {
if(is_user_alive(id) && id != ballholder) {
cs_set_user_team(id, CS_TEAM_SPECTATOR, CS_DONTCHANGE)
origin[0]=random_num(1380,1689)
origin[1]=random_num(-1935,-1814)
origin[2]=(-91)
spawn(id)
set_user_origin(id,origin)
}
}
else {
cs_set_user_team(id, CS_TEAM_SPECTATOR, CS_DONTCHANGE)
if(is_user_alive(id))
user_kill(id)
}
}

return PLUGIN_CONTINUE
}

/*====================================================================================================
[SoccerJam Experience]

Purpose: $$

Comment: $$

====================================================================================================*/

public give_xp(id, level, cid){
if(!cmd_access(id, level, cid, 3)) {
return PLUGIN_HANDLED
}

new sz_nick[32], sz_xp[12]

read_argv(1, sz_nick, charsmax(sz_nick))
read_argv(2, sz_xp, charsmax(sz_xp))

new sz_player = cmd_target(id, sz_nick, 2 | 8)

new sz_name[32]
get_user_name(id, sz_name, 31)

if(sz_player) {
new sz_bname[32]
get_user_name(sz_player, sz_bname, 31)
g_Experience[sz_player] += str_to_num(sz_xp)

PrintChatColor(id, _, "%L", LANG_PLAYER, "SJ_EXP", sz_name, sz_bname, sz_xp)
console_print(id, "%s exp. has been added to %s", sz_xp, sz_bname)
}
else {
console_print(id, "Invalid player!")
}

return PLUGIN_HANDLED
}

/*====================================================================================================
[Initialize Entities]

Purpose: Handles our custom entities, created with Valve Hammer, and fixes for soccerjam.bsp.

Comment: $$

====================================================================================================*/
public pfn_keyvalue(entid) {

new classname[32], key[32], value[32]
copy_keyvalue(classname, 31, key, 31, value, 31)

new temp_origins[3][10], x, team
new temp_angles[3][10]

if(equal(key, "classname") && equal(value, "soccerjam_goalnet"))
DispatchKeyValue("classname", "func_wall")

if(equal(classname, "game_player_equip")){
if(!is_kickball || !gamePlayerEquip)
gamePlayerEquip = entid
else {
remove_entity(entid)
}
}
else if(equal(classname, "func_wall"))
{
if(equal(key, "team"))
{
team = str_to_num(value)
if(team == 1 || team == 2) {
GoalEnt[team] = entid
set_task(1.0, "FinalizeGoalNet", team)
}
}
}
else if(equal(classname, "soccerjam_mascot"))
{

if(equal(key, "team"))
{
team = str_to_num(value)
create_mascot(team)
}
else if(equal(key, "origin"))
{
parse(value, temp_origins[0], 9, temp_origins[1], 9, temp_origins[2], 9)
for(x=0; x<3; x++)
MascotsOrigins[x] = floatstr(temp_origins[x])
}
else if(equal(key, "angles"))
{
parse(value, temp_angles[0], 9, temp_angles[1], 9, temp_angles[2], 9)
for(x=0; x<3; x++)
MascotsAngles[x] = floatstr(temp_angles[x])
}
}
else if(equal(classname, "soccerjam_teamball"))
{
if(equal(key, "team"))
{
team = str_to_num(value)
for(x=0; x<3; x++)
TeamBallOrigins[team][x] = TEMP_TeamBallOrigins[x]
}
else if(equal(key, "origin"))
{
parse(value, temp_origins[0], 9, temp_origins[1], 9, temp_origins[2], 9)
for(x=0; x<3; x++)
TEMP_TeamBallOrigins[x] = floatstr(temp_origins[x])
}
}
else if(equal(classname, "soccerjam_ballspawn"))
{
if(equal(key, "origin")) {
is_kickball = 1

create_Game_Player_Equip()

PrecacheBall()
PrecacheSounds()

if(ballspawncount < MAX_BALL_SPAWNS) {
parse(value, temp_origins[0], 9, temp_origins[1], 9, temp_origins[2], 9)

BallSpawnOrigin[ballspawncount][0] = floatstr(temp_origins[0])
BallSpawnOrigin[ballspawncount][1] = floatstr(temp_origins[1])
BallSpawnOrigin[ballspawncount][2] = floatstr(temp_origins[2]) + 10.0

ballspawncount++
}
}
}
}

createball() {

new entity = create_entity("info_target")
if (entity) {

entity_set_string(entity,EV_SZ_classname,"PwnBall")
entity_set_model(entity, ball)

entity_set_int(entity, EV_INT_solid, SOLID_BBOX)
entity_set_int(entity, EV_INT_movetype, MOVETYPE_BOUNCE)

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(entity, EV_VEC_mins, MinBox)
entity_set_vector(entity, EV_VEC_maxs, MaxBox)

glow(entity,ballcolor[0],ballcolor[1],ballcolor[2],10)

entity_set_float(entity,EV_FL_framerate,0.0)
entity_set_int(entity,EV_INT_sequence,0)
}
//save our entity ID to aball variable
aball = entity
entity_set_float(entity,EV_FL_nextthink,halflife_time() + 0.05)
return PLUGIN_HANDLED
}


CreateGoalNets() {

new endzone, x
new Float:orig[3]
new Float:MinBox[3], Float:MaxBox[3]

for(x=1;x<3;x++) {
endzone = create_entity("info_target")
if (endzone) {

entity_set_string(endzone,EV_SZ_classname,"soccerjam_goalnet")
entity_set_model(endzone, "models/chick.mdl")
entity_set_int(endzone, EV_INT_solid, SOLID_BBOX)
entity_set_int(endzone, EV_INT_movetype, MOVETYPE_NONE)

MinBox[0] = -25.0; MinBox[1] = -145.0; MinBox[2] = -36.0
MaxBox[0] = 25.0; MaxBox[1] = 145.0; MaxBox[2] = 70.0

entity_set_vector(endzone, EV_VEC_mins, MinBox)
entity_set_vector(endzone, EV_VEC_maxs, MaxBox)

switch(x) {
case 1: {
orig[0] = 2110.0
orig[1] = 0.0
orig[2] = 1604.0
}
case 2: {
orig[0] = -2550.0
orig[1] = 0.0
orig[2] = 1604.0
}
}

entity_set_origin(endzone,orig)

entity_set_int(endzone, EV_INT_team, x)
set_entity_visibility(endzone, 0)
GoalEnt[x] = endzone
}
}

}

create_wall() {
new wall = create_entity("func_wall")
if(wall)
{
new Float:orig[3]
new Float:MinBox[3], Float:MaxBox[3]
entity_set_string(wall,EV_SZ_classname,"Blocker")
entity_set_model(wall, "models/chick.mdl")

entity_set_int(wall, EV_INT_solid, SOLID_BBOX)
entity_set_int(wall, EV_INT_movetype, MOVETYPE_NONE)

MinBox[0] = -72.0; MinBox[1] = -100.0; MinBox[2] = -72.0
MaxBox[0] = 72.0; MaxBox[1] = 100.0; MaxBox[2] = 72.0

entity_set_vector(wall, EV_VEC_mins, MinBox)
entity_set_vector(wall, EV_VEC_maxs, MaxBox)

orig[0] = 2355.0
orig[1] = 1696.0
orig[2] = 1604.0
entity_set_origin(wall,orig)
set_entity_visibility(wall, 0)
}
}

create_mascot(team)
{
new Float:MinBox[3], Float:MaxBox[3]
new mascot = create_entity("info_target")
if(mascot)
{
PrecacheMonsters(team)
entity_set_string(mascot,EV_SZ_classname,"Mascot")
entity_set_model(mascot, TeamMascots[team-1])
Mascots[team] = mascot

entity_set_int(mascot, EV_INT_solid, SOLID_NOT)
entity_set_int(mascot, EV_INT_movetype, MOVETYPE_NONE)
entity_set_int(mascot, EV_INT_team, team)
MinBox[0] = -16.0; MinBox[1] = -16.0; MinBox[2] = -72.0
MaxBox[0] = 16.0; MaxBox[1] = 16.0; MaxBox[2] = 72.0
entity_set_vector(mascot, EV_VEC_mins, MinBox)
entity_set_vector(mascot, EV_VEC_maxs, MaxBox)

entity_set_origin(mascot,MascotsOrigins)
entity_set_float(mascot,EV_FL_animtime,2.0)
entity_set_float(mascot,EV_FL_framerate,1.0)
entity_set_int(mascot,EV_INT_sequence,0)

if(team == 2)
entity_set_byte(mascot, EV_BYTE_controller1, 115)

entity_set_vector(mascot,EV_VEC_angles,MascotsAngles)
entity_set_float(mascot,EV_FL_nextthink,halflife_time() + 1.0)
}
}

create_Game_Player_Equip() {
gamePlayerEquip = create_entity("game_player_equip")
if(gamePlayerEquip) {
//DispatchKeyValue(entity, "weapon_scout", "1")
DispatchKeyValue(gamePlayerEquip, "targetname", "roundstart")
DispatchSpawn(gamePlayerEquip)
}

}

public FinalizeGoalNet(team)
{
new goalnet = GoalEnt[team]
entity_set_string(goalnet,EV_SZ_classname,"soccerjam_goalnet")
entity_set_int(goalnet, EV_INT_team, team)
set_entity_visibility(goalnet, 0)
}

public RightDirection(id) {
if(id == ballholder) {

direction--
if(direction < -(DIRECTIONS))
direction = -(DIRECTIONS)
new temp = direction * CURVE_ANGLE
SendCenterText( id, temp );

}

return PLUGIN_HANDLED
}

public LeftDirection(id) {
if(id == ballholder) {
direction++
if(direction > DIRECTIONS)
direction = DIRECTIONS
new temp = direction * CURVE_ANGLE
SendCenterText( id, temp );

}

return PLUGIN_HANDLED
}


SendCenterText( id, dir )
{
if(dir < 0)
client_print(id, print_center, "%L", id, "CURVING_RIGHT", (dir<0?-(dir):dir));
else if(dir == 0)
client_print(id, print_center, "0 degrees");
else if(dir > 0)
client_print(id, print_center, "%L", id, "CURVING_LEFT", (dir<0?-(dir):dir));
}

public plugin_cfg() {
if(is_kickball) {
server_cmd("sv_maxspeed 999")
server_cmd("sv_restart 1")
server_cmd("sv_airaccelerate 10")
}
else {
new failed[64];
format(failed,63,"%L", LANG_SERVER, "PLUGIN_FAILED");
set_fail_state(failed);
}

new szHostname[30], szUsername[30], szPassword[30], szDatabase[30]
new szError[512], szErr

get_pcvar_string(g_Cvar[1], szHostname, charsmax( szHostname ))
get_pcvar_string(g_Cvar[2], szUsername, charsmax( szUsername ))
get_pcvar_string(g_Cvar[3], szPassword, charsmax( szPassword ))
get_pcvar_string(g_Cvar[4], szDatabase, charsmax( szDatabase ))

g_SqlTuple = SQL_MakeDbTuple(szHostname, szUsername, szPassword, szDatabase)
new Handle:SqlConnection = SQL_Connect(g_SqlTuple, szErr, szError, charsmax( szError ))

if(SqlConnection == Empty_Handle)
set_fail_state( szError )

new Handle:Queries = SQL_PrepareQuery(SqlConnection, "CREATE TABLE IF NOT EXISTS `stats`(`id` INTEGER NOT NULL PRIMARY KEY, `name` VARCHAR(32) NOT NULL, `points` INTEGER NOT NULL, `goals` INTEGER NOT NULL, `assists` INTEGER NOT NULL, `steals` INTEGER NOT NULL, `stealsrv` INTEGER NOT NULL, `disarm` INTEGER NOT NULL, `disarmrv` INTEGER NOT NULL, `bkills` INTEGER NOT NULL, `bkillsrv` INTEGER NOT NULL, `offside` INTEGER NOT NULL, `foul` INTEGER NOT NULL, `warns` INTEGER NOT NULL);")
if(!SQL_Execute(Queries))
{
SQL_QueryError(Queries,szError,charsmax(szError))
set_fail_state(szError);
}
SQL_FreeHandle(Queries)
SQL_FreeHandle(SqlConnection);
}

/*====================================================================================================
[Ball Brain]

Purpose: These functions help control the ball and its activities.

Comment: $$

====================================================================================================*/
public ball_think() {

new maxscore = get_pcvar_num(CVAR_SCORE)
if(score[1] >= maxscore || score[2] >= maxscore) {
entity_set_float(aball,EV_FL_nextthink,halflife_time() + 0.05)
return PLUGIN_HANDLED
}

if(is_valid_ent(aball))
{

new Float:gametime = get_gametime()
if(PowerPlay >= MAX_LVL_POWERPLAY && gametime - fire_delay >= 0.3)
on_fire()

if(ballholder > 0)
{
new team = get_user_team(ballholder)
entity_get_vector(ballholder, EV_VEC_origin,testorigin)


if(!is_user_alive(ballholder)) {

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

remove_task(55555)
set_task(get_pcvar_float(CVAR_RESET),"clearBall",55555)

if(!g_sprint[ballholder])
set_speedchange(ballholder)

format(temp1,63,"%L", LANG_PLAYER, "DROPPED_BALL", TeamNames[team], tname)

//remove glow of owner and set ball velocity really really low
glow(ballholder,0,0,0,0)

ballowner = ballholder
ballholder = 0

testorigin[2] += 5
entity_set_origin(aball, testorigin)

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

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

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

entity_set_vector(aball,EV_VEC_velocity,velocity)
entity_set_origin(aball,testorigin)
}
else {
if(entity_get_int(aball,EV_INT_solid) != SOLID_BBOX)
entity_set_int(aball, EV_INT_solid, SOLID_BBOX)
}
}
entity_set_float(aball,EV_FL_nextthink,halflife_time() + 0.05)
return PLUGIN_HANDLED
}

moveBall(where, team=0) {

if(is_valid_ent(aball)) {
if(team) {
new Float:bv[3]
bv[2] = 50.0
entity_set_origin(aball, TeamBallOrigins[team])
entity_set_vector(aball,EV_VEC_velocity,bv)
}
else {
switch(where) {
case 0: {
new Float:orig[3], x
for(x=0;x<3;x++)
orig[x] = -9999.9
entity_set_origin(aball,orig)
ballholder = -1
}
case 1: {

new Float:v[3], rand
v[2] = 400.0
if(ballspawncount > 1)
rand = random_num(0, ballspawncount-1)
else
rand = 0

entity_set_origin(aball, BallSpawnOrigin[rand])
entity_set_vector(aball, EV_VEC_velocity, v)

PowerPlay = 0
ballholder = 0
ballowner = 0
}
}
}
}
}

public ball_infront(id, Float: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(aball,EV_VEC_origin,testorigin)
entity_get_vector(id,EV_VEC_origin,nOrigin)
entity_get_vector(id,EV_VEC_v_angle,vAngles)


vReturn[0] = floatcos( vAngles[1], degrees ) * dist
vReturn[1] = floatsin( vAngles[1], degrees ) * dist

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

testorigin[0] = vReturn[0]
testorigin[1] = vReturn[1]
testorigin[2] = nOrigin[2]
}


public CurveBall(id) {
if(direction && get_speed(aball) > 5 && curvecount > 0) {

new Float:dAmt = float((direction * CURVE_ANGLE) / ANGLEDIVIDE);
new Float:v[3], Float:v_forward[3];

entity_get_vector(aball, EV_VEC_velocity, v);
vector_to_angle(v, BallSpinDirection);

BallSpinDirection[1] = normalize( BallSpinDirection[1] + dAmt );
BallSpinDirection[2] = 0.0;

angle_vector(BallSpinDirection, 1, v_forward);

new Float:speed = vector_length(v)// * 0.95;
v[0] = v_forward[0] * speed
v[1] = v_forward[1] * speed

entity_set_vector(aball, EV_VEC_velocity, v);

curvecount--;
set_task(CURVE_TIME, "CurveBall", id);
}
}

public clearBall() {
play_wav(0, BALL_RESPAWN);
format(temp1,63,"%L",LANG_PLAYER,"BALL_RESPAWNED")
moveBall(1)
}

/*====================================================================================================
[Mascot Think]

Purpose: $$

Comment: $$

====================================================================================================*/
public mascot_think(mascot)
{
new team = entity_get_int(mascot, EV_INT_team)
new indist[32], inNum, chosen

new id, playerteam, dist
for(id=1 ; id<=maxplayers ; id++)
{
if(is_user_alive(id) && !is_user_bot(id))
{
playerteam = get_user_team(id)
if(playerteam != team)
{
if(!chosen) {
dist = get_entity_distance(id, mascot)
if(dist < get_pcvar_num(CVAR_GOALSAFETY))
if(id == ballholder) {
chosen = id
break
}
else
indist[inNum++] = id
}
}
}
}
if(!chosen) {
new rnd = random_num(0, (inNum-1))
chosen = indist[rnd]
}
if(chosen)
TerminatePlayer(chosen, mascot, team, ( ballholder == chosen ? 230.0 : random_float(5.0, 15.0) ) )
entity_set_float(mascot,EV_FL_nextthink,halflife_time() + 1.0)
}

goaly_checker(id, Float:gametime, team) {
if(!is_user_alive(id) || (gametime - GoalyCheckDelay[id] < GOALY_DELAY) )
return PLUGIN_HANDLED

new dist, gcheck
new Float:pOrig[3]
entity_get_vector(id, EV_VEC_origin, pOrig)
dist = floatround(get_distance_f(pOrig, TeamBallOrigins[team]))

//--/* Goaly Exp System */--//
if(dist < 600 ) {

gcheck = GoalyCheck[id]

if(id == ballholder && gcheck >= 2)
kickBall(id, 1)

GoalyPoints[id]++

if(gcheck < 2)
g_Experience[id] += gcheck * AMOUNT_GOALY
else
g_Experience[id] += gcheck * (AMOUNT_GOALY / 2)

if(gcheck < 5)
GoalyCheck[id]++

GoalyCheckDelay[id] = gametime
}
else
GoalyCheck[id] = 0
return PLUGIN_HANDLED
}

/*====================================================================================================
[Status Display]

Purpose: Displays the Scoreboard information.

Comment: $$

====================================================================================================*/

public statusDisplay()
{
new id, team, bteam = get_user_team(ballholder>0?ballholder:ballowner)
new score_t = score[T], score_ct = score[CT]

set_hudmessage(20, 255, 20, 0.95, 0.20, 0, 1.0, 1.5, 0.1, 0.1, HUD_CHANNEL)
new Float:gametime = get_gametime()
new servername[150]

for(id=1; id<=maxplayers; id++) {
if(is_user_connected(id) && !is_user_bot(id))
{
team = get_user_team(id)
goaly_checker(id, gametime, team)
if(!is_user_alive(id) && !is_dead[id] && (team == 1 || team == 2) && GetPlayerModel(id) != 0xFF)
{
remove_task(id+1000)
has_knife[id] = false;
is_dead[id] = true
new Float:respawntime = CVAR_RESPAWN
set_task(respawntime,"AutoRespawn",id)
set_task((respawntime+0.2), "AutoRespawn2",id)
}
if(!winner) {
format(scoreboard,1024,"Статистика %s^n^n %i %L^n%s - %i | %s - %i ^n%L %i ^n^n%s^n^n^n%s", stats_enable ?"включена":"выключена",get_pcvar_num(CVAR_SCORE),id,"GOALS_WINS",TeamNames[T],score_t,TeamNames[CT],score_ct,id,"EXPERIENCE",g_Experience[id],temp1,team==bteam?temp2:"")
format(servername, 150, "[FIFA 14][SoccerJam][Red %d:%d Blue]", score_t, score_ct)

server_cmd("hostname ^"%s^"", servername)
show_hudmessage(id,"%s",scoreboard)
}
}
}
}

/*====================================================================================================
[Touched]

Purpose: All touching stuff takes place here.

Comment: $$

====================================================================================================*/
public touchWorld(ball, world) {

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

v[0] = (v[0] * 0.85)
v[1] = (v[1] * 0.85)
v[2] = (v[2] * 0.85)
entity_set_vector(ball, EV_VEC_velocity, v)
emit_sound(ball, CHAN_ITEM, BALL_BOUNCE_GROUND, 1.0, ATTN_NORM, 0, PITCH_NORM)
}

return PLUGIN_HANDLED
}

public touchPlayer(ball, player) {

if(is_user_bot(player))
return PLUGIN_HANDLED

if(is_offside[player]) {
return PLUGIN_HANDLED
}

if(is_user_foul[player])
return PLUGIN_HANDLED

new playerteam = get_user_team(player)
if((playerteam != 1 && playerteam != 2))
return PLUGIN_HANDLED

remove_task(55555)

new aname[64], stolen, x
get_user_name(player,aname,63)
new ballteam = get_user_team(ballowner)
if(ballowner > 0 && playerteam != ballteam )
{
new speed = get_speed(aball)
if(speed > 500)
{
//configure catching algorithm
new rnd = random_num(0,100)
new bstr = (PlayerUpgrades[ballowner][STR] * AMOUNT_STR) / 10
new dex = (PlayerUpgrades[player][DEX] * AMOUNT_DEX)
new pct = ( PressedAction[player] ? 40:20 ) + dex

pct += ( g_sprint[player] ? 5 : 0 ) //player turboing? give 5%
pct -= ( g_sprint[ballowner] ? 5 : 0 ) //ballowner turboing? lose 5%
pct -= bstr //ballowner has strength? remove bstr

//will player avoid damage?
if( rnd > pct ) {
new Float:dodmg = (float(speed) / 13.0) + bstr

PrintChatColor(0, _, "%L", LANG_PLAYER, "BALL_SMACKED", aname, floatround(dodmg))

set_msg_block(gmsgDeathMsg,BLOCK_ONCE)
fakedamage(player,"AssWhoopin",dodmg,1)
set_msg_block(gmsgDeathMsg,BLOCK_NOT)

if(!is_user_alive(player)) {
message_begin(MSG_ALL, gmsgDeathMsg)
write_byte(ballowner)
write_byte(player)
write_string("AssWhoopin")
message_end()

new frags = get_user_frags(ballowner)
entity_set_float(ballowner, EV_FL_frags, float(frags + 1))
setScoreInfo(ballowner)
Event_Record(ballowner, KILL, -1, EXP_KILL)

if(stats_enable == 1) {
UserData[ballowner][gPoints] += get_pcvar_num(g_pBKills)
UserData[player][gPoints] -= get_pcvar_num(g_pBKills)
UserData[ballowner][gBKills] += 1
UserData[player][gBKillsRv] += 1
}

PrintChatColor(player, _, "%L", LANG_PLAYER, "KILLED_BY_BALL")
PrintChatColor(ballowner, _, "%L", LANG_PLAYER, "EXP_FOR_BALLKILL")
}
else {
new Float:pushVel[3]
pushVel[0] = velocity[0]
pushVel[1] = velocity[1]
pushVel[2] = velocity[2] + ((velocity[2] < 0)?random_float(-200.0,-50.0):random_float(50.0,200.0))
entity_set_vector(player,EV_VEC_velocity,pushVel)
}
for(x=0;x<3;x++)
velocity[x] = (velocity[x] * random_float(0.1,0.9))
entity_set_vector(aball,EV_VEC_velocity,velocity)
direction = 0
return PLUGIN_HANDLED
}
}

if(speed > 950)
play_wav(0, STOLE_BALL_FAST)

new Float:pOrig[3]
entity_get_vector(player, EV_VEC_origin, pOrig)
new dist = floatround(get_distance_f(pOrig, TeamBallOrigins[playerteam]))
new gainedxp

if(dist < 550) {
gainedxp = EXP_STEAL + EXP_GOALY + (speed / 8)
Event_Record(player, STEAL, -1, EXP_STEAL + EXP_GOALY + (speed / 8))
GoalyPoints[player] += EXP_GOALY/2

if(stats_enable == 1) {
UserData[ballowner][gPoints] -= get_pcvar_num(g_pSteals)
UserData[player][gPoints] += get_pcvar_num(g_pSteals)
UserData[player][gSteals] += 1
UserData[ballowner][gStealsRv] += 1
}
}
else {
gainedxp = EXP_STEAL
Event_Record(player, STEAL, -1, EXP_STEAL)

if(stats_enable == 1) {
UserData[ballowner][gPoints] -= get_pcvar_num(g_pSteals)
UserData[player][gPoints] += get_pcvar_num(g_pSteals)
UserData[player][gSteals] += 1
UserData[ballowner][gStealsRv] += 1
}
}

format(temp1,63,"%L",LANG_PLAYER,"STOLE_BALL",TeamNames[playerteam],aname)
client_print(0,print_console,"%s",temp1)
stolen = 1

message_begin(MSG_ONE, gmsgShake, {0,0,0}, player)
write_short(255 << 12) //ammount
write_short(1 << 11) //lasts this long
write_short(255 << 10) //frequency
message_end()

PrintChatColor(player, _, "%L", LANG_PLAYER, "EXP_FOR_STEAL", gainedxp)

}
if(ballholder == 0) {
emit_sound(aball, CHAN_ITEM, BALL_PICKED_UP, 1.0, ATTN_NORM, 0, PITCH_NORM)

niOffSide()

new msg[64], check
if(!has_knife[player])
give_knife(player)

if(stolen)
PowerPlay = 0
else
format(temp1,63,"%L",LANG_PLAYER,"BALL_PICKUP",TeamNames[playerteam],aname)

if(((PowerPlay > 1 && powerplay_list[PowerPlay-2] == player) || (PowerPlay > 0 && powerplay_list[PowerPlay-1] == player)) && PowerPlay != MAX_LVL_POWERPLAY)
check = true

if(PowerPlay <= MAX_LVL_POWERPLAY && !check) {
g_Experience[player] += (PowerPlay==2?10:25)
powerplay_list[PowerPlay] = player
PowerPlay++
}
curvecount = 0
direction = 0
GoalyCheck[player] = 0

format(temp2, 63, "%L %i",LANG_PLAYER,"POWER_PLAY", PowerPlay>0?PowerPlay-1:0)

ballholder = player
ballowner = 0

if(!g_sprint[player])
set_speedchange(player)


set_hudmessage(255, 20, 20, POS_X, 0.4, 1, 1.0, 1.5, 0.1, 0.1, 2)
format(msg,63,"%L",player,"YOU_HAVE_BALL")
show_hudmessage(player,"%s",msg)

//Glow Player who has ball their team color
beam()
glow(player, TeamColors[playerteam][0], TeamColors[playerteam][1], TeamColors[playerteam][2], 1)
}
return PLUGIN_HANDLED
}

public touchNet(ball, goalpost)
{
remove_task(55555)

new team = get_user_team(ballowner)
if(!is_user_connected(ballowner)) return PLUGIN_HANDLED;

new goalent = GoalEnt[team]

if(PowerPlay <= 3 && goalpost != goalent && team_play == 1) {
set_dhudmessage(255, 255, 0, -1.0, -1.0, 2, 1.0, 1.0, 0.1, 1.0, false);
show_dhudmessage(ballowner, "Чтобы забить гол, совершите серию передач!");

new oteam = (team == 1 ? 2 : 1)
moveBall(0, oteam)
return PLUGIN_HANDLED
}

if (goalpost != goalent && 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++)
distorig[1][l] = floatround(netOrig[l])
new distshot = (get_distance(distorig[0],distorig[1])/12)

if(distshot > 80 && goalpost != goalent && dist_enable == 1) {
set_dhudmessage(255, 255, 0, -1.0, -1.0, 2, 1.0, 1.0, 0.1, 1.0, false);
show_dhudmessage(ballowner, "Минимальная дистанция 80 футов!");

new oteam = (team == 1 ? 2 : 1)
moveBall(0, oteam)
return PLUGIN_HANDLED
}

for(l=0;l<3;l++)
netOrig2[l] = floatround(netOrig[l])
flameWave(netOrig2)
get_user_name(ballowner,aname,63)

play_wav(0, SCORED_GOAL)

/////////////////////ASSIST CODE HERE///////////

new assisters[4] = { 0, 0, 0, 0 }
new iassisters = 0
new ilastplayer = iassist[ team ]

// We just need the last player to kick the ball
// 0 means it has passed 15 at least once
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, EXP_ASSIST)

if(stats_enable == 1) {
UserData[pass][gPoints] += get_pcvar_num(g_pAssists)
UserData[pass][gAssists] += 1
}

PrintChatColor(pass, _, "%L", LANG_PLAYER, "EXP_FOR_ASSIST", EXP_ASSIST)
}
}
iassist[ 0 ] = 0
/////////////////////ASSIST CODE HERE///////////

new gainedxp = distshot + EXP_GOAL

format(temp1,63,"%L",LANG_PLAYER,"SCORED_GOAL",TeamNames[team],aname,distshot)
client_print(0,print_console,"%s",temp1)

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(stats_enable == 1) {
UserData[ballowner][gPoints] += get_pcvar_num(g_pGoals)
UserData[ballowner][gGoals] += 1
}

//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])
}
PrintChatColor(ballowner, _, "%L", LANG_PLAYER, "EXP_FOR_GOAL", gainedxp, distshot)

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, MAX_SOUNDS-1)
play_wav(0, SCORED_SOUNDS[r]);

}
else {
winner = team
format(scoreboard,1024,"%L",LANG_PLAYER,"TEAM_WINS",TeamNames[team])
set_task(1.0,"showhud_winner",0,"",0,"a",3)
}

server_cmd("sv_restart 4")

}
else if(goalpost == goalent) {
moveBall(0, team)
PrintChatColor(ballowner, _, "%L", LANG_PLAYER, "CANNOT_KICK_GOAL")
}
return PLUGIN_HANDLED
}

//This is for soccerjam.bsp to fix locker room.
public touchBlocker(pwnball, blocker) {
new Float:orig[3] = { 2234.0, 1614.0, 1604.0 }
entity_set_origin(pwnball, orig)
}

/*====================================================================================================
[Events]

Purpose: $$

Comment: $$

====================================================================================================*/
public Event_Damage()
{
new victim = read_data(0)
new attacker = get_user_attacker(victim)
if(is_user_alive(attacker)) {
IsFoul(attacker)

if(is_user_alive(victim) ) {

#if !defined KNIFE_DISARM_ON
if(victim == ballholder) {
#endif
new upgrade = PlayerUpgrades[attacker][DISARM]
if(upgrade) {
new disarm = upgrade * AMOUNT_DISARM
new disarmpct = BASE_DISARM + (victim==ballholder?(disarm*2):0)
new rand = random_num(1,100)

if(disarmpct >= rand)
{
new vname[MAX_PLAYER + 1], aname[MAX_PLAYER + 1]
get_user_name(victim,vname, MAX_PLAYER)
get_user_name(attacker,aname, MAX_PLAYER)

#if defined KNIFE_DISARM_ON
if(victim == ballholder) {
#endif
kickBall(victim, 1)

if(stats_enable == 1) {
UserData[attacker][gPoints] -= get_pcvar_num(g_pDisarm)
UserData[victim][gPoints] -= get_pcvar_num(g_pDisarm)
UserData[attacker][gDisarm] += 1
UserData[victim][gDisarmRv] += 1
}

PrintChatColor(attacker, _, "%L", LANG_PLAYER, "DISARM_BALL_ATTACKER", vname)
PrintChatColor(victim, _, "%L", LANG_PLAYER, "DISARM_BALL_VICTIM", aname)
#if defined KNIFE_DISARM_ON
}
else {
new weapon, clip, ammo
weapon = get_user_weapon(victim,clip,ammo)
if(weapon == CSW_KNIFE)
{
strip_user_weapons(victim);
has_knife[victim] = false;
set_task(float(disarm / DISARM_MULTIPLIER), "give_knife", victim+1000)
PrintChatColor(attacker, _, "%L", LANG_PLAYER, "DISARM_KNIFE_ATTACKER", vname)
PrintChatColor(victim, _, "%L", LANG_PLAYER, "DISARM_KNIFE_VICTIM", aname)
}
}
#endif
}
}
#if !defined KNIFE_DISARM_ON
}
#endif
}
else
g_Experience[attacker] += (EXP_KILL/2)
}
}

public Event_StartRound() {
if(winner) {
set_task(1.0, "displayWinnerAwards", 0)
set_task(20.0, "nextmap")
}
else
SetupRound()
}

public nextmap() {
new nextmap[64], map[64], len
get_mapname(map, 31)

read_file("mapcycle.txt", random_num(0,5), nextmap, 63, len)

if(equal(nextmap, map))
set_task(1.0, "nextmap")
else
server_cmd("changelevel %s", nextmap)
}

public SetupRound() {

iassist[ 0 ] = 0

if(!is_valid_ent(aball))
createball()

moveBall(1)

new id
for(id=1; id<=maxplayers; id++) {
if(is_user_connected(id) && !is_user_bot(id)) {
is_dead[id] = false
seconds[id] = 0
g_sprint[id] = 0
PressedAction[id] = 0
}
}
play_wav(0, ROUND_START)

set_task(0.5, "PostSetupRound", 0)
set_task(1.0, "PostPostSetupRound", 0)

return PLUGIN_HANDLED
}

public PostSetupRound() {
new id
for(id=1; id<=maxplayers; id++) {
if(is_user_alive(id) && !is_user_bot(id)){
give_knife(id)

if(is_user_keeper[id]) {
if(cs_get_user_team(id) == CS_TEAM_T)
set_pev(id, pev_origin, soccerjamtt)

if(cs_get_user_team(id) == CS_TEAM_CT)
set_pev(id, pev_origin, soccerjamct)
}
}
}
}

public PostPostSetupRound() {
new id, kills, deaths
for(id=1; id<=maxplayers; id++) {
if(is_user_connected(id) && !is_user_bot(id)) {
kills = PlayerKills[id]
deaths = PlayerDeaths[id]
if(kills)
entity_set_float(id, EV_FL_frags, float(kills))
if(deaths)
cs_set_user_deaths(id,deaths)

setScoreInfo(id)
}
}
}

public Event_ResetHud(id) {
goaldied[id] = 0
set_task(1.0,"PostResetHud",id)
is_user_foul[id] = false;
is_offside[id] = false;
user_foul_count[id] = 0;
}

public PostResetHud(id) {
if(is_user_alive(id) && !is_user_bot(id))
{
new stam = PlayerUpgrades[id][STA]

if(!has_knife[id]) {
give_knife(id)
}

//compensate for our turbo
if(!g_sprint[id])
set_speedchange(id)

if(stam > 0)
entity_set_float(id, EV_FL_health, float(BASE_HP + (stam * AMOUNT_STA)))
}
}

/*====================================================================================================
[Client Commands]

Purpose: $$

Comment: $$

====================================================================================================*/
public Turbo(id)
{
if(is_user_alive(id))
g_sprint[id] = 1
return PLUGIN_HANDLED
}

public client_PreThink(id)
{
if( is_kickball && is_valid_ent(aball) && is_user_connected(id))
{
new button = entity_get_int(id, EV_INT_button)
new usekey = (button & IN_USE)

new up = (button & IN_FORWARD)
new down = (button & IN_BACK)
new moveright = (button & IN_MOVERIGHT)
new moveleft = (button & IN_MOVELEFT)
new jump = (button & IN_JUMP)
new flags = entity_get_int(id, EV_INT_flags)
new onground = flags & FL_ONGROUND
if( (moveright || moveleft) && !up && !down && jump && onground && !g_sprint[id] && id != ballholder)
SideJump[id] = 1

if(!Coord_Off_Z_active)
{
if(onground)
{
new User_Origin[3]
get_user_origin(id, User_Origin)
Coord_Off_Z_active = 1
Coord_Off_Z = User_Origin[2] - 35
Coord_Off_Y = User_Origin[1]
}
}

if(g_sprint[id])
entity_set_float(id, EV_FL_fuser2, 0.0)

if( id != ballholder )
PressedAction[id] = usekey
else {
if( usekey && !PressedAction[id]) {
kickBall(ballholder, 0)
PreOffside(id)
}
else if( !usekey && PressedAction[id])
PressedAction[id] = 0
}

if(is_user_foul[id] || is_offside[id])
{
if((button & IN_ATTACK || button & IN_ATTACK2))
entity_set_int(id, EV_INT_button, (button & ~IN_ATTACK) & ~IN_ATTACK2)
}

if( id != ballholder && (button & IN_ATTACK || button & IN_ATTACK2) ) {

static Float:maxdistance
static reference

if(ballholder > 0) {
reference = ballholder
maxdistance = get_pcvar_float(CVAR_KILLNEARHOLDER)
}
else {
reference = aball
maxdistance = get_pcvar_float(CVAR_KILLNEARBALL)
}

if(!maxdistance)
return

if(entity_range(id, reference) > maxdistance)
entity_set_int(id, EV_INT_button, (button & ~IN_ATTACK) & ~IN_ATTACK2)

}

}
}

public client_PostThink(id) {
if(is_kickball && is_user_connected(id)) {
new Float:gametime = get_gametime()
new button = entity_get_int(id, EV_INT_button)

new up = (button & IN_FORWARD)
new down = (button & IN_BACK)
new moveright = (button & IN_MOVERIGHT)
new moveleft = (button & IN_MOVELEFT)
new jump = (button & IN_JUMP)
new Float:vel[3]

entity_get_vector(id,EV_VEC_velocity,vel)

if( (gametime - SideJumpDelay[id] > 5.0) && SideJump[id] && jump && (moveright || moveleft) && !up && !down) {

vel[0] *= 2.0
vel[1] *= 2.0
vel[2] = 300.0

entity_set_vector(id,EV_VEC_velocity,vel)
SideJump[id] = 0
SideJumpDelay[id] = gametime
}
else
SideJump[id] = 0
}
}

public kickBall(id, velType)
{
remove_task(55555)
set_task(get_pcvar_float(CVAR_RESET),"clearBall",55555)

new team = get_user_team(id)
new a,x

//Give it some lift
ball_infront(id, 55.0)

testorigin[2] += 10

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

entity_get_vector(id, EV_VEC_origin, tempO)
new tempEnt = trace_line( id, tempO, testorigin, returned )

dist2 = get_distance_f(testorigin, returned)

if( point_contents(testorigin) != CONTENTS_EMPTY || (!is_user_connected(tempEnt) && dist2 ) )
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=0; x<3; x++) {
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=1; a<=6; a++) {

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 ent = -1
testorigin[2] += 35.0

while((ent = find_ent_in_sphere(ent, testorigin, 35.0)) != 0) {
if(ent > maxplayers)
{
new classname[32]
entity_get_string(ent, EV_SZ_classname, classname, 31)

if((contain(classname, "goalnet") != -1 || contain(classname, "func_") != -1) &&
!equal(classname, "func_water") && !equal(classname, "func_illusionary"))
return PLUGIN_HANDLED
}
}
testorigin[2] -= 35.0

}

new kickVel
if(!velType)
{
new str = (PlayerUpgrades[id][STR] * AMOUNT_STR) + (AMOUNT_POWERPLAY*(PowerPlay*5))
kickVel = get_pcvar_num(CVAR_KICK) + str
kickVel += g_sprint[id] * 100

if(direction) {
entity_get_vector(id, EV_VEC_angles, BallSpinDirection)
curvecount = CURVE_COUNT
}
}
else {
curvecount = 0
direction = 0
kickVel = random_num(100, 600)
}

new Float:ballorig[3]
entity_get_vector(id,EV_VEC_origin,ballorig)
for(x=0; x<3; x++)
distorig[0][x] = floatround(ballorig[x])

velocity_by_aim(id, kickVel, velocity)

for(x=0; x<3; x++)
distorig[0][x] = floatround(ballorig[x])

/////////////////////WRITE ASSIST CODE HERE IF NEEDED///////////
if ( iassist[ 0 ] == team ) {
if ( iassist[ team ] == 15 )
iassist[ team ] = 0
}
else {
// clear the assist list
new ind
for(ind = 0; ind < 16; ind++ )
assist[ ind ] = 0
// clear the assist index
iassist[ team ] = 0
// set which team to track
iassist[ 0 ] = team
}
assist[ iassist[ team ]++ ] = id
/////////////////////WRITE ASSIST CODE HERE IF NEEDED///////////

ballowner = id
ballholder = 0
entity_set_origin(aball,testorigin)
entity_set_vector(aball,EV_VEC_velocity,velocity)

set_task(CURVE_TIME*2, "CurveBall", id)

emit_sound(aball, CHAN_ITEM, BALL_KICKED, 1.0, ATTN_NORM, 0, PITCH_NORM)

glow(id,0,0,0,0)

beam()

new aname[64]
get_user_name(id,aname,63)

if(!g_sprint[id])
set_speedchange(id)

format(temp1,63,"%L",LANG_PLAYER,"KICKED_BALL",TeamNames[team],aname)
client_print(0,print_console,"%s",temp1)
return PLUGIN_HANDLED
}

/*====================================================================================================
[Command Blocks]

Purpose: $$

Comment: $$

====================================================================================================*/
public client_kill(id) {
if(is_kickball)
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}

public client_command(id) {
if(!is_kickball) return PLUGIN_CONTINUE
new arg[13]
read_argv( 0, arg , 12 )

if ( equal("buy",arg) || equal("autobuy",arg) )
return PLUGIN_HANDLED

return PLUGIN_CONTINUE
}

//fix for an exploit.
public menuclass(id) {

// They changed teams
SetPlayerModel(id, 0xFF);
}

GetPlayerModel(id)
{
if(!is_user_connected(id))
return 0;

return get_pdata_int(id, OFFSET_INTERNALMODEL, 5);
}

SetPlayerModel(id, int)
{
if(!is_user_connected(id))
return;

set_pdata_int(id, OFFSET_INTERNALMODEL, int, 5);
}

public team_select(id, key) {
if(is_kickball) {
new team = get_user_team(id)
//SetPlayerModel(id, 0xFF);
if( (team == 1 || team == 2) && (key == team-1) )
{
new message[64]
format(message, 63, "%L",id,"CANT_REJOIN_TEAM")

message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("StatusText"), {0, 0, 0}, id)
write_byte(0)
write_string(message)
message_end()

engclient_cmd(id,"chooseteam")

return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}

/*====================================================================================================
[Upgrades]

Purpose: This handles the upgrade menu.

Comment: $$

====================================================================================================*/
public BuyUpgrade(id) {

new level[65], num[11], mTitle[101]
format(mTitle,100,"%L",id,"MENU_TITLE")

menu_upgrade[id] = menu_create(mTitle, "Upgrade_Handler")
new x
for(x=1; x<=UPGRADES; x++)
{
new price = ((PlayerUpgrades[id][x] * UpgradePrice[x]) / 2) + UpgradePrice[x]
if((PlayerUpgrades[id][x] + 1) > UpgradeMax[x]) {
format(level,64,"\r%s %L",UpgradeTitles[x],id,"MENU_CHOICE_MAXED",UpgradeMax[x])
}
else {
format(level,64,"%s \r%L \y-- \w%i XP",UpgradeTitles[x], id, "MENU_CHOICE_NEXT", PlayerUpgrades[id][x]+1, price)
}
format(num, 10,"%i",x)
menu_additem(menu_upgrade[id], level, num, 0)
}

menu_addblank(menu_upgrade[id], (UPGRADES+1))
menu_setprop(menu_upgrade[id], MPROP_EXIT, MEXIT_NORMAL)

menu_display(id, menu_upgrade[id], 0)
return PLUGIN_HANDLED
}

public Upgrade_Handler(id, menu, item) {

if(item == MENU_EXIT)
return PLUGIN_HANDLED

new cmd[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, cmd,5, iName, 63, callback)

new upgrade = str_to_num(cmd)

new playerupgrade = PlayerUpgrades[id][upgrade]
new price = ((playerupgrade * UpgradePrice[upgrade]) / 2) + UpgradePrice[upgrade]
new maxupgrade = UpgradeMax[upgrade]

if(playerupgrade != maxupgrade && playerupgrade != maxupgrade+MAX_LVL_BONUS)
{
new needed = g_Experience[id] - price

if( (needed >= 0) )
{
if(playerupgrade < maxupgrade-1)
playerupgrade += 1
else
playerupgrade += MAX_LVL_BONUS+1

g_Experience[id] -= price

if(playerupgrade < maxupgrade)
PrintChatColor(id, _, "%L", LANG_PLAYER, "MENU_UPGRADED", playerupgrade, UpgradeTitles[upgrade], price)
else {
PrintChatColor(id, _, "%L", LANG_PLAYER, "MENU_UPGRADED", maxupgrade, UpgradeTitles[upgrade], price)
#if(MAX_LVL_BONUS > 1)
PrintChatColor(id, _, "%L", LANG_PLAYER, "MENU_MAX_LVL_BONUS", maxupgrade, MAX_LVL_BONUS)
#else
PrintChatColor(id, _, "%L", LANG_PLAYER, "MENU_MAX_LVL", maxupgrade)
#endif

play_wav(id, UPGRADED_MAX_LEVEL)
}
switch(upgrade) {
case STA: {
new stam = playerupgrade * AMOUNT_STA
entity_set_float(id, EV_FL_health, float(BASE_HP + stam))
}
case AGI: {
if(!g_sprint[id])
set_speedchange(id)
}
}
PlayerUpgrades[id][upgrade] = playerupgrade
}
else
PrintChatColor(id, _, "%L", LANG_PLAYER, "MENU_MISSING_EXP", (needed * -1), (playerupgrade+1), UpgradeTitles[upgrade])
}
else {
PrintChatColor(id, _, "%L", LANG_PLAYER, "MENU_UPGRADE_MAXED", UpgradeTitles[upgrade], maxupgrade)
}
return PLUGIN_HANDLED
}

/*====================================================================================================
[Meters]

Purpose: This controls the turbo meter and curve angle meter.

Comment: $$

====================================================================================================*/
public meter()
{
new id
new turboTitle[32]
new sprintText[128], sec
new r, g, b, team
new len, x
new ndir = -(DIRECTIONS)
format(turboTitle,31,"%L",LANG_PLAYER,"TURBO_TITLE");
for(id=1; id<=maxplayers; id++)
{
if(!is_user_connected(id) || !is_user_alive(id) || is_user_bot(id))
continue

sec = seconds[id]
team = get_user_team(id)
r = TeamMeterColors[team][0]
g = TeamMeterColors[team][1]
b = TeamMeterColors[team][2]

if(id == ballholder) {

set_hudmessage(r, g, b, POS_X, 0.75, 0, 0.0, 0.6, 0.0, 0.0, 1)

len = format(sprintText, 127, " %L ^n[",id,"CURVE_TITLE")

for(x=DIRECTIONS; x>=ndir; x--)
if(x==0)
len += format(sprintText[len], 127-len, "%s%s",direction==x?"0":"+", x==ndir?"]":" ")
else
len += format(sprintText[len], 127-len, "%s%s",direction==x?"0":"=", x==ndir?"]":" ")

show_hudmessage(id, "%s", sprintText)
}

set_hudmessage(r, g, b, POS_X, POS_Y, 0, 0.0, 0.6, 0.0, 0.0, 3)

if(sec > 30) {
sec -= 2
format(sprintText, 127, " %s ^n[==============]",turboTitle)
set_speedchange(id)
g_sprint[id] = 0
}
else if(sec >= 0 && sec < 30 && g_sprint[id]) {
sec += 2
set_speedchange(id, 100.0)
}

switch(sec) {
case 0: format(sprintText, 127, " %s ^n[||||||||||||||]",turboTitle)
case 2: format(sprintText, 127, " %s ^n[|||||||||||||=]",turboTitle)
case 4: format(sprintText, 127, " %s ^n[||||||||||||==]",turboTitle)
case 6: format(sprintText, 127, " %s ^n[|||||||||||===]",turboTitle)
case 8: format(sprintText, 127, " %s ^n[||||||||||====]",turboTitle)
case 10: format(sprintText, 127, " %s ^n[|||||||||=====]",turboTitle)
case 12: format(sprintText, 127, " %s ^n[||||||||======]",turboTitle)
case 14: format(sprintText, 127, " %s ^n[|||||||=======]",turboTitle)
case 16: format(sprintText, 127, " %s ^n[||||||========]",turboTitle)
case 18: format(sprintText, 127, " %s ^n[|||||=========]",turboTitle)
case 20: format(sprintText, 127, " %s ^n[||||==========]",turboTitle)
case 22: format(sprintText, 127, " %s ^n[|||===========]",turboTitle)
case 24: format(sprintText, 127, " %s ^n[||============]",turboTitle)
case 26: format(sprintText, 127, " %s ^n[|=============]",turboTitle)
case 28: format(sprintText, 127, " %s ^n[==============]",turboTitle)
case 30: {
format(sprintText, 128, " %s ^n[==============]",turboTitle)
sec = 92
}
case 32: sec = 0
}

seconds[id] = sec
show_hudmessage(id,"%s",sprintText)
}
}

/*====================================================================================================
[Misc.]

Purpose: $$

Comment: $$

====================================================================================================*/
set_speedchange(id, Float:speed=0.0)
{
new Float:agi = float( (PlayerUpgrades[id][AGI] * AMOUNT_AGI) + (id==ballholder?(AMOUNT_POWERPLAY * (PowerPlay*2)):0) )
agi += (BASE_SPEED + speed)
entity_set_float(id,EV_FL_maxspeed, agi)
}

public give_knife(id) {
if(id > 1000)
id -= 1000

remove_task(id+1000)
if (is_user_alive(id))
{
give_item(id, "weapon_knife")
has_knife[id] = true;
}
}

Event_Record(id, recordtype, amt, exp) {
if(amt == -1)
MadeRecord[id][recordtype]++
else
MadeRecord[id][recordtype] = amt

new playerRecord = MadeRecord[id][recordtype]
if(playerRecord > TopPlayer[1][recordtype])
{
TopPlayer[0][recordtype] = id
TopPlayer[1][recordtype] = playerRecord
new name[MAX_NAME_LENGTH+1]
get_user_name(id,name,MAX_NAME_LENGTH)
format(TopPlayerName[recordtype],MAX_NAME_LENGTH,"%s",name)
}
g_Experience[id] += exp
}

Float:normalize(Float:nVel)
{
if(nVel > 360.0) {
nVel -= 360.0
}
else if(nVel < 0.0) {
nVel += 360.0
}

return nVel
}

public editTextMsg()
{
new string[64], radio[64]
get_msg_arg_string(2, string, 63)

if( get_msg_args() > 2 )
get_msg_arg_string(3, radio, 63)

if(containi(string, "#Game_will_restart") != -1 || containi(radio, "#Game_radio") != -1)
return PLUGIN_HANDLED

return PLUGIN_CONTINUE
}

public client_connect(id) {
if(is_kickball)
set_user_info(id,"_vgui_menus","0")

}

public AutoRespawn(id)
if(is_dead[id] && is_user_connected(id)) {
new team = get_user_team(id)
if(team == 1 || team == 2) {
spawn(id)
if(is_user_keeper[id])
cmdUnKeeper(id)
}
else
is_dead[id] = false
}

public AutoRespawn2(id)
if(is_dead[id] && is_user_connected(id)) {
new team = get_user_team(id)
if(team == 1 || team == 2) {
spawn(id)
if(!has_knife[id])
give_knife(id)
}
is_dead[id] = false
}

play_wav(id, wav[])
client_cmd(id,"spk %s",wav)

increaseTeamXP(team, amt) {
new id
for(id=1; id<=maxplayers; id++)
if(get_user_team(id) == team && is_user_connected(id))
g_Experience[id] += amt
}

setScoreInfo(id) {
message_begin(MSG_BROADCAST,get_user_msgid("ScoreInfo"));
write_byte(id);
write_short(get_user_frags(id));
write_short(cs_get_user_deaths(id));
write_short(0);
write_short(get_user_team(id));
message_end();
}

// Erase our current temps (used for ball events)
public eraser(num) {
if(num == 3333)
format(temp1,63,"")
if(num == 4444)
format(temp2,63,"")
return PLUGIN_HANDLED
}
/*====================================================================================================
[Cleanup]

Purpose: $$

Comment: $$

====================================================================================================*/
public client_disconnect(id) {
if(is_kickball) {
new x
for(x = 1; x<=RECORDS; x++)
MadeRecord[id][x] = 0

remove_task(id)
if(ballholder == id ) {
ballholder = 0
clearBall()
}
if(ballowner == id) {
ballowner = 0
}

GoalyPoints[id] = 0
PlayerKills[id] = 0
PlayerDeaths[id] = 0
is_dead[id] = false
seconds[id] = 0
g_sprint[id] = 0
PressedAction[id] = 0
has_knife[id] = false;
g_Experience[id] = 0

for(x=1; x<=UPGRADES; x++)
PlayerUpgrades[id][x] = 0
}

if(is_offside[id])
is_offside[id] = false;

is_user_foul[id] = false;

if(is_user_keeper[id])
cmdUnKeeper(id)

StatsEnable()
save_usr(id)
arrayset(UserData[id], 0, PlData)
}

/*====================================================================================================
[Help]

Purpose: $$

Comment: $$

====================================================================================================*/
public client_putinserver(id) {
if(is_kickball) {
set_task(20.0,"soccerjamHelp",id)
}

arrayset( UserData[id], 0, PlData )
load_data(id)
StatsEnable()

timer[id] = 10
HasView[id] = 2
}

public soccerjamHelp(id)
{
client_cmd(id, "cl_forwardspeed 1000")
client_cmd(id, "cl_backspeed 1000")
client_cmd(id, "cl_sidespeed 1000")

new name[32]
get_user_name(id,name,31)
PrintChatColor(id, _, "%L", LANG_PLAYER, "WELCOME_MSG", name)
PrintChatColor(id, _, "%L", LANG_PLAYER, "WELCOME_HELP_MSG")
LateJoinExp(id)
}

LateJoinExp(id)
{
new total = (score[T] + score[CT]) * AMOUNT_LATEJOINEXP
if(total) {
g_Experience[id] += total
PrintChatColor(id, _, "%L", LANG_PLAYER, "EXP_FOR_LATEJOIN", total)
}
}

public soccerjam_help(id) {
show_motd(id, "help1.txt")
}

public soccerjam_rules(id) {
show_motd(id, "rules.txt")
}

/*====================================================================================================
[Post Game]

Purpose: $$

Comment: $$

====================================================================================================*/
public showhud_winner() {
set_hudmessage(255, 0, 20, -1.0, 0.35, 1, 1.0, 1.5, 0.1, 0.1, HUD_CHANNEL)
show_hudmessage(0,"%s",scoreboard)
}

public displayWinnerAwards()
{
//If NO steal/assist was made, set name to Nobody
new x
for(x=1;x<=RECORDS;x++)
if(!TopPlayer[0][x])
format(TopPlayerName[x],MAX_NAME_LENGTH,"Nobody")

//Display our Winning Team, with Awards, and kill Comm Chair of opponent
new awards[513]
new len = 0
len += format(awards[len], 512-len, "%s %L^n", (winner == 1 ? "Terrorist" : "CT"), LANG_PLAYER, "AWARDS_HEADER" )
len += format(awards[len], 512-len, "%s - %i | %s - %i^n^n", TeamNames[T],score[T],TeamNames[CT],score[CT])
len += format(awards[len], 512-len, " %L^n",LANG_PLAYER,"AWARDS_TITLE")
len += format(awards[len], 512-len, "%i %L -- %s^n", TopPlayer[1][GOAL], LANG_PLAYER, "AWARDS_GOALS", TopPlayerName[GOAL])
len += format(awards[len], 512-len, "%i %L -- %s^n", TopPlayer[1][STEAL], LANG_PLAYER, "AWARDS_STEALS", TopPlayerName[STEAL])
len += format(awards[len], 512-len, "%i %L -- %s^n", TopPlayer[1][ASSIST], LANG_PLAYER, "AWARDS_ASSISTS", TopPlayerName[ASSIST])
len += format(awards[len], 512-len, "%i %L -- %s^n", TopPlayer[1][KILL], LANG_PLAYER, "AWARDS_BALLKILLS", TopPlayerName[KILL])
len += format(awards[len], 512-len, "%i %L -- %s^n", TopPlayer[1][DISTANCE], LANG_PLAYER, "AWARDS_LONGESTGOAL", TopPlayerName[DISTANCE])

set_hudmessage(250, 130, 20, 0.4, 0.35, 0, 1.0, 10.0, 0.1, 0.1, 2)
show_hudmessage(0, "%s", awards)
}
/*====================================================================================================
[Special FX]

Purpose: $$

Comment: $$

====================================================================================================*/
TerminatePlayer(id, mascot, team, Float:dmg) {
new orig[3], Float:morig[3], iMOrig[3]

get_user_origin(id, orig)
entity_get_vector(mascot,EV_VEC_origin,morig)
new x
for(x=0;x<3;x++)
iMOrig[x] = floatround(morig[x])

fakedamage(id,"Terminator",dmg,1)

new hp = get_user_health(id)
if(hp < 0)
increaseTeamXP(team, 25)

new loc = (team == 1 ? 100 : 140)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(0)
write_coord(iMOrig[0]) //(start positionx)
write_coord(iMOrig[1]) //(start positiony)
write_coord(iMOrig[2] + loc) //(start positionz)
write_coord(orig[0]) //(end positionx)
write_coord(orig[1]) //(end positiony)
write_coord(orig[2]) //(end positionz)
write_short(g_fxBeamSprite) //(sprite index)
write_byte(0) //(starting frame)
write_byte(0) //(frame rate in 0.1's)
write_byte(7) //(life in 0.1's)
write_byte(120) //(line width in 0.1's)
write_byte(25) //(noise amplitude in 0.01's)
write_byte(250) //r
write_byte(0) //g
write_byte(0) //b
write_byte(220) //brightness
write_byte(1) //(scroll speed in 0.1's)
message_end()
}

glow(id, r, g, b, on) {
if(on == 1) {
set_rendering(id, kRenderFxGlowShell, r, g, b, kRenderNormal, 255)
entity_set_float(id, EV_FL_renderamt, 1.0)
}
else if(!on) {
set_rendering(id, kRenderFxNone, r, g, b, kRenderNormal, 255)
entity_set_float(id, EV_FL_renderamt, 1.0)
}
else if(on == 10) {
set_rendering(id, kRenderFxGlowShell, r, g, b, kRenderNormal, 255)
entity_set_float(id, EV_FL_renderamt, 1.0)
}
}

on_fire()
{
new rx, ry, rz, Float:forig[3], forigin[3], x
fire_delay = get_gametime()

rx = random_num(-5, 5)
ry = random_num(-5, 5)
rz = random_num(-5, 5)
entity_get_vector(aball, EV_VEC_origin, forig)
for(x=0;x<3;x++)
forigin[x] = floatround(forig[x])

message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(17)
write_coord(forigin[0] + rx)
write_coord(forigin[1] + ry)
write_coord(forigin[2] + 10 + rz)
write_short(Burn_Sprite)
write_byte(7)
write_byte(235)
message_end()
}

beam() {
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(22) // TE_BEAMFOLLOW
write_short(aball) // 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()
}

flameWave(myorig[3]) {
message_begin(MSG_BROADCAST, SVC_TEMPENTITY, myorig)
write_byte( 21 )
write_coord(myorig[0])
write_coord(myorig[1])
write_coord(myorig[2] + 16)
write_coord(myorig[0])
write_coord(myorig[1])
write_coord(myorig[2] + 500)
write_short( fire )
write_byte( 0 ) // startframe
write_byte( 0 ) // framerate
write_byte( 15 ) // life 2
write_byte( 50 ) // width 16
write_byte( 10 ) // noise
write_byte( 255 ) // r
write_byte( 0 ) // g
write_byte( 0 ) // b
write_byte( 255 ) //brightness
write_byte( 1 / 10 ) // speed
message_end()

message_begin(MSG_BROADCAST,SVC_TEMPENTITY,myorig)
write_byte( 21 )
write_coord(myorig[0])
write_coord(myorig[1])
write_coord(myorig[2] + 16)
write_coord(myorig[0])
write_coord(myorig[1])
write_coord(myorig[2] + 500)
write_short( fire )
write_byte( 0 ) // startframe
write_byte( 0 ) // framerate
write_byte( 10 ) // life 2
write_byte( 70 ) // width 16
write_byte( 10 ) // noise
write_byte( 255 ) // r
write_byte( 50 ) // g
write_byte( 0 ) // b
write_byte( 200 ) //brightness
write_byte( 1 / 9 ) // speed
message_end()

message_begin(MSG_BROADCAST,SVC_TEMPENTITY,myorig)
write_byte( 21 )
write_coord(myorig[0])
write_coord(myorig[1])
write_coord(myorig[2] + 16)
write_coord(myorig[0])
write_coord(myorig[1])
write_coord(myorig[2] + 500)
write_short( fire )
write_byte( 0 ) // startframe
write_byte( 0 ) // framerate
write_byte( 10 ) // life 2
write_byte( 90 ) // width 16
write_byte( 10 ) // noise
write_byte( 255 ) // r
write_byte( 100 ) // g
write_byte( 0 ) // b
write_byte( 200 ) //brightness
write_byte( 1 / 8 ) // speed
message_end()

//Explosion2
message_begin( MSG_BROADCAST, SVC_TEMPENTITY)
write_byte( 12 )
write_coord(myorig[0])
write_coord(myorig[1])
write_coord(myorig[2])
write_byte( 80 ) // byte (scale in 0.1's) 188
write_byte( 10 ) // byte (framerate)
message_end()

//TE_Explosion
message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
write_byte( 3 )
write_coord(myorig[0])
write_coord(myorig[1])
write_coord(myorig[2])
write_short( fire )
write_byte( 65 ) // byte (scale in 0.1's) 188
write_byte( 10 ) // byte (framerate)
write_byte( 0 ) // byte flags
message_end()

//Smoke
message_begin( MSG_BROADCAST,SVC_TEMPENTITY,myorig)
write_byte( 5 ) // 5
write_coord(myorig[0])
write_coord(myorig[1])
write_coord(myorig[2])
write_short( smoke )
write_byte( 50 ) // 2
write_byte( 10 ) // 10
message_end()

return PLUGIN_HANDLED
}

stock ClearDHUDMessages(iClear = 8)
for (new iDHUD = 0; iDHUD < iClear; iDHUD++)
show_dhudmessage(0, "");


/*====================================================================================================
[Rank System]

Purpose: $$

Comment: $$

====================================================================================================*/

public load_data(id)
{
new szError[512], ErrorCode
new szName[32]
get_user_name(id, szName, charsmax( szName ))

new Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,szError,511)
SQL_QuoteString(SqlConnection, szName, 32, szName);

new Handle:Query = SQL_PrepareQuery(SqlConnection, "SELECT `id` FROM `stats` WHERE `name`='%s';", szName)

if(!SQL_Execute(Query)) {
SQL_QueryError(Query,szError,511);
log_amx(szError);
return ;
}
if(SQL_NumResults(Query) > 0 ) {
next_load_data(id, "", 0);
}
else {
register_player(id,"");
}

SQL_FreeHandle(Query);
SQL_FreeHandle(SqlConnection);
}

public next_load_data(id,data[],len)
{
new szName[33];
get_user_name(id, szName, charsmax( szName ));

new szError[512], ErrorCode;
new Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,szError,511)
SQL_QuoteString(SqlConnection, szName, 32, szName);

if(SqlConnection == Empty_Handle)
{
log_amx(szError);
return ;
}

new Handle:Query = SQL_PrepareQuery(SqlConnection, "SELECT * FROM `stats` WHERE `name`='%s';", szName)

if(!SQL_Execute(Query))
{
SQL_QueryError(Query,szError,511)
log_amx(szError)
}

if( SQL_NumResults(Query) > 0)
{
UserData[id][gPoints]= SQL_ReadResult(Query, 2);
UserData[id][gGoals]= SQL_ReadResult(Query, 3);
UserData[id][gAssists]= SQL_ReadResult(Query, 4);
UserData[id][gSteals]= SQL_ReadResult(Query, 5);
UserData[id][gStealsRv]= SQL_ReadResult(Query, 6);
UserData[id][gDisarm]= SQL_ReadResult(Query, 7);
UserData[id][gDisarmRv]= SQL_ReadResult(Query, 8);
UserData[id][gBKills]= SQL_ReadResult(Query, 9);
UserData[id][gBKillsRv]= SQL_ReadResult(Query, 10);
UserData[id][gOffside]= SQL_ReadResult(Query, 11);
UserData[id][gFoul]= SQL_ReadResult(Query, 12);
UserData[id][gWarns]= SQL_ReadResult(Query, 13);
}

SQL_FreeHandle(Query);
SQL_FreeHandle(SqlConnection);
}

public register_player(id, data[])
{
new szName[33];
get_user_name(id, szName, charsmax( szName ));

new szError[512], ErrorCode;
new Handle:SqlConnection = SQL_Connect(g_SqlTuple, ErrorCode, szError,511)
SQL_QuoteString(SqlConnection, szName, 32, szName);

if(SqlConnection == Empty_Handle)
{
log_amx(szError);
return ;
}

new Handle:Query = SQL_PrepareQuery(SqlConnection, "INSERT INTO `stats` (`name`, `points`, `goals`, `assists`, `steals`, `stealsrv`, `disarm`, `disarmrv`, `bkills`, `bkillsrv`, `offside`, `foul`, `warns`) VALUES ('%s', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');", szName);

if(!SQL_Execute(Query))
{
SQL_QueryError(Query,szError,511)
log_amx(szError)
}

SQL_FreeHandle(Query);
SQL_FreeHandle(SqlConnection);

UserData[id][gPoints]= 0;
UserData[id][gGoals]= 0;
UserData[id][gSteals]= 0;
UserData[id][gStealsRv]= 0;
UserData[id][gAssists]= 0;
UserData[id][gDisarm]= 0;
UserData[id][gDisarmRv]= 0;
UserData[id][gBKills]= 0;
UserData[id][gBKillsRv]= 0;
UserData[id][gOffside]= 0;
UserData[id][gFoul]= 0;
UserData[id][gWarns]= 0;
}

public save_usr(id)
{
new szName[33];
get_user_name(id, szName, charsmax( szName ));

new szError[512], ErrorCode;
new Handle:szUpdate;
new Handle:SqlConnection = SQL_Connect(g_SqlTuple, ErrorCode, szError, 511)

SQL_QuoteString(SqlConnection, szName, 32, szName)

if(SqlConnection == Empty_Handle)
{
log_amx(szError);
return ;
}

szUpdate = SQL_PrepareQuery(SqlConnection, "UPDATE `stats` SET `points`='%d', `goals`='%d', `assists`='%d', `steals`='%d', `stealsrv`='%d', `disarm`='%d', `disarmrv`='%d', `bkills`='%d', `bkillsrv`='%d', `offside`='%d', `foul`='%d', `warns`='%d' WHERE `stats`.`name`='%s';",
UserData[id][gPoints], UserData[id][gGoals], UserData[id][gAssists], UserData[id][gSteals], UserData[id][gStealsRv], UserData[id][gDisarm], UserData[id][gDisarmRv], UserData[id][gBKills], UserData[id][gBKillsRv], UserData[id][gOffside], UserData[id][gFoul], UserData[id][gWarns], szName)

if(!SQL_Execute(szUpdate))
{
SQL_QueryError(szUpdate, szError, charsmax( szError ))
set_fail_state( szError )
}
}

public top_players(id){

new szError[512], ErrorCode;
new num = 0;
new name[10][32], points[10][11], goals[10][11], assists[10][11], steals[10][11], stealsrv[10][11], disarm[10][11], disarmrv[10][11], bkills[10][11], bkillsrv[10][11], offside[10][11], foul[10][11];

new Handle:SqlConnection = SQL_Connect(g_SqlTuple, ErrorCode, szError, 511)
new Handle:Query = SQL_PrepareQuery(SqlConnection, "SELECT * FROM `stats` ORDER BY `points` DESC, `goals` DESC")

SQL_Execute(Query)

while(SQL_MoreResults(Query) && num <= 9){

SQL_ReadResult(Query, 1, name[num], 31);
SQL_ReadResult(Query, 2, points[num], 10);
SQL_ReadResult(Query, 3, goals[num], 10);
SQL_ReadResult(Query, 4, assists[num], 10);
SQL_ReadResult(Query, 5, steals[num], 10);
SQL_ReadResult(Query, 6, stealsrv[num], 10);
SQL_ReadResult(Query, 7, disarm[num], 10);
SQL_ReadResult(Query, 8, disarmrv[num], 10);
SQL_ReadResult(Query, 9, bkills[num], 10);
SQL_ReadResult(Query, 10, bkillsrv[num], 10);
SQL_ReadResult(Query, 11, offside[num], 10);
SQL_ReadResult(Query, 12, foul[num], 10);

num++
SQL_NextRow(Query)
}

new motd[2001], iLen;

iLen = format(motd, sizeof motd - 1, "<body bgcolor=#000000><font color=#98f5ff><pre>");
iLen += format(motd[iLen], (sizeof motd - 1) - iLen, "<center><h2>---- SoccerJam Top 10 ----</h2></center>^n^n");
iLen += format(motd[iLen], (sizeof motd - 1) - iLen, "<b><U>%2s %-22.22s %8s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s</U></b>^n", "#", "Nick", "Points", "Goals", "Assists", "Steals", "StealsRv", "Disarm", "DisarmRv", "BKills", "BKillsRv", "Offsides", "Fouls");
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"1 %-22.22s %6i %7i %6i %7i %5i %8i %7i %7i %6i %6i %6i^n", name[0], str_to_num(points[0]), str_to_num(goals[0]), str_to_num(assists[0]), str_to_num(steals[0]), str_to_num(stealsrv[0]), str_to_num(disarm[0]), str_to_num(disarmrv[0]), str_to_num(bkills[0]), str_to_num(bkillsrv[0]), str_to_num(offside[0]), str_to_num(foul[0]))
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"2 %-22.22s %6i %7i %6i %7i %5i %8i %7i %7i %6i %6i %6i^n", name[1], str_to_num(points[1]), str_to_num(goals[1]), str_to_num(assists[1]), str_to_num(steals[1]), str_to_num(stealsrv[1]), str_to_num(disarm[1]), str_to_num(disarmrv[1]), str_to_num(bkills[1]), str_to_num(bkillsrv[1]), str_to_num(offside[1]), str_to_num(foul[1]))
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"3 %-22.22s %6i %7i %6i %7i %5i %8i %7i %7i %6i %6i %6i^n", name[2], str_to_num(points[2]), str_to_num(goals[2]), str_to_num(assists[2]), str_to_num(steals[2]), str_to_num(stealsrv[2]), str_to_num(disarm[2]), str_to_num(disarmrv[2]), str_to_num(bkills[2]), str_to_num(bkillsrv[2]), str_to_num(offside[2]), str_to_num(foul[2]))
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"4 %-22.22s %6i %7i %6i %7i %5i %8i %7i %7i %6i %6i %6i^n", name[3], str_to_num(points[3]), str_to_num(goals[3]), str_to_num(assists[3]), str_to_num(steals[3]), str_to_num(stealsrv[3]), str_to_num(disarm[3]), str_to_num(disarmrv[3]), str_to_num(bkills[3]), str_to_num(bkillsrv[3]), str_to_num(offside[3]), str_to_num(foul[3]))
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"5 %-22.22s %6i %7i %6i %7i %5i %8i %7i %7i %6i %6i %6i^n", name[4], str_to_num(points[4]), str_to_num(goals[4]), str_to_num(assists[4]), str_to_num(steals[4]), str_to_num(stealsrv[4]), str_to_num(disarm[4]), str_to_num(disarmrv[4]), str_to_num(bkills[4]), str_to_num(bkillsrv[4]), str_to_num(offside[4]), str_to_num(foul[4]))
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"6 %-22.22s %6i %7i %6i %7i %5i %8i %7i %7i %6i %6i %6i^n", name[5], str_to_num(points[5]), str_to_num(goals[5]), str_to_num(assists[5]), str_to_num(steals[5]), str_to_num(stealsrv[5]), str_to_num(disarm[5]), str_to_num(disarmrv[5]), str_to_num(bkills[5]), str_to_num(bkillsrv[5]), str_to_num(offside[5]), str_to_num(foul[5]))
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"7 %-22.22s %6i %7i %6i %7i %5i %8i %7i %7i %6i %6i %6i^n", name[6], str_to_num(points[6]), str_to_num(goals[6]), str_to_num(assists[6]), str_to_num(steals[6]), str_to_num(stealsrv[6]), str_to_num(disarm[6]), str_to_num(disarmrv[6]), str_to_num(bkills[6]), str_to_num(bkillsrv[6]), str_to_num(offside[6]), str_to_num(foul[6]))
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"8 %-22.22s %6i %7i %6i %7i %5i %8i %7i %7i %6i %6i %6i^n", name[7], str_to_num(points[7]), str_to_num(goals[7]), str_to_num(assists[7]), str_to_num(steals[7]), str_to_num(stealsrv[7]), str_to_num(disarm[7]), str_to_num(disarmrv[7]), str_to_num(bkills[7]), str_to_num(bkillsrv[7]), str_to_num(offside[7]), str_to_num(foul[7]))
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"9 %-22.22s %6i %7i %6i %7i %5i %8i %7i %7i %6i %6i %6i^n", name[8], str_to_num(points[8]), str_to_num(goals[8]), str_to_num(assists[8]), str_to_num(steals[8]), str_to_num(stealsrv[8]), str_to_num(disarm[8]), str_to_num(disarmrv[8]), str_to_num(bkills[8]), str_to_num(bkillsrv[8]), str_to_num(offside[8]), str_to_num(foul[8]))
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"10 %-22.22s %6i %7i %6i %7i %5i %8i %7i %7i %6i %6i %6i^n", name[9], str_to_num(points[9]), str_to_num(goals[9]), str_to_num(assists[9]), str_to_num(steals[9]), str_to_num(stealsrv[9]), str_to_num(disarm[9]), str_to_num(disarmrv[9]), str_to_num(bkills[9]), str_to_num(bkillsrv[9]), str_to_num(offside[9]), str_to_num(foul[9]))

show_motd(id, motd, "Top 10");
}

public rank_players(id){

new szError[512], ErrorCode;
new num = 1;
new name[32], points[11], notes;
new szName[32];
get_user_name(id, szName, 31);

new Handle:SqlConnection = SQL_Connect(g_SqlTuple, ErrorCode, szError, 511);
new Handle:Query = SQL_PrepareQuery(SqlConnection, "SELECT * FROM `stats` ORDER BY `points` DESC, `goals` DESC");

SQL_Execute(Query)
notes = SQL_NumResults(Query)

while(SQL_MoreResults(Query))
{
SQL_ReadResult(Query, 1, name, 31)

if(equal(name, szName))
{
SQL_ReadResult(Query, 2, points, 10)

break
}else{
num++

SQL_NextRow(Query)
}

}

PrintChatColor(id, _, "%L", LANG_PLAYER, "SJ_RANK", num, notes, str_to_num(points))

}

public rankstats_players(id){

new motd[1501],iLen;
new szName[33];
get_user_name(id,szName,32);

iLen = format(motd, sizeof motd - 1,"<body bgcolor=#000000><font color=#98f5ff><pre>");
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<center><h2>---- SoccerJam Stats ----</h2></center>^n^n");
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<center><b>%s</b></center>^n", szName);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<font color=#fff000><b>%-22.22s</b>: %10i^n", "Points", UserData[id][gPoints]);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<b>%-22.22s</b>: %10i^n", "Goals", UserData[id][gGoals]);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<b>%-22.22s</b>: %10i^n", "Assists", UserData[id][gAssists]);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<b>%-22.22s</b>: %10i^n", "Steals", UserData[id][gSteals]);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<b>%-22.22s</b>: %10i^n", "StealsRv", UserData[id][gStealsRv]);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<b>%-22.22s</b>: %10i^n", "Disarm", UserData[id][gDisarm]);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<b>%-22.22s</b>: %10i^n", "DisarmRv", UserData[id][gDisarmRv]);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<b>%-22.22s</b>: %10i^n", "BKills", UserData[id][gBKills]);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<b>%-22.22s</b>: %10i^n", "BKillsRv", UserData[id][gBKillsRv]);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<b>%-22.22s</b>: %10i^n", "Offsides", UserData[id][gOffside]);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"<b>%-22.22s</b>: %10i^n^n", "Fouls", UserData[id][gFoul]);

show_motd(id, motd, "Stats");

return PLUGIN_HANDLED
}

public plugin_end() {
if(g_SqlTuple != Empty_Handle)
SQL_FreeHandle(g_SqlTuple);
}

public fw_ServerDown()
{
for(new i = 0; i <= MaxPlayers; i++)
{
if(is_user_connected(i))
save_usr(i)
}
}

public StatsEnable() {
new suma_player = get_playersnum()

if(suma_player >= 6) {
stats_enable = 1
}
else {
stats_enable = 0
}
}

/*====================================================================================================
[Offside and Foul System]

Purpose: $$

Comment: $$

====================================================================================================*/
public PreOffside(id)
{
if(ballowner > 0)
{
new Float:angles[3]
new pateoteam = get_user_team(ballowner)
entity_get_vector(ballowner, EV_VEC_angles, angles)
if(angles[0] > float(-25) && angles[0] < float(25))
{
if(pateoteam == 1)
{
if(angles[1] > float(0))
{
if(angles[1] > float(130))
{
if(Offside(id))
log_amx("Offside!")
}
}
else
{
if(angles[1] < float(-130))
{
if(Offside(id))
log_amx("Offside!")
}
}
}
else if(pateoteam == 2)
{
if(angles[1] > float(0))
{
if(angles[1] < float(50))
{
if(Offside(id))
log_amx("Offside!")
}
}
else
{
if(angles[1] > float(-50))
{
if(Offside(id))
log_amx("Offside!")
}
}
}
}
}
return true
}

public AvisoFoul(id)
{
new msg[121]
set_hudmessage(255, 225, 128, POS_X, 0.4, 1, 1.0, 1.5, 0.1, 0.1, 2)

if((user_foul_count[id] > 0) && is_user_foul[id])
user_foul_count[id]--
else
{
format(msg,120," ")
show_hudmessage(id,"%s",msg)
is_user_foul[id] = false;
remove_offside(id)
return PLUGIN_HANDLED;
}

format(msg,120,"Нарушение правил!^nТы не сможешь двигаться %d секунд!", user_foul_count[id])
show_hudmessage(id, "%s",msg)

set_task(1.0,"AvisoFoul",id)

return PLUGIN_HANDLED;
}

public AvisoOffside(id) {
new msg[121]
set_hudmessage(255, 225, 128, POS_X, 0.4, 1, 1.0, 1.5, 0.1, 0.1, 2)

if(!is_offside[id])
{
new msg[121]
set_hudmessage(255, 225, 128, POS_X, 0.4, 1, 1.0, 1.5, 0.1, 0.1, 2)
format(msg,120," ")
show_hudmessage(id,"%s",msg)
return PLUGIN_CONTINUE;
}

format(msg,120,"Ты попал в оффсайд!^nКогда кто-нибудь каснется мяча, ты сможешь двигаться!")
show_hudmessage(id, "%s", msg)
set_task(1.0,"AvisoOffside", id)

return PLUGIN_CONTINUE
}

Paralize(id) {

if(is_user_foul[id])
{
set_user_godmode(id, 1);

play_wav(id, OFFSIDE);

message_begin(MSG_ONE, gmsgScreenFade, _, id);
write_short(~0); // duration
write_short(~0); // hold time
write_short(0x0004); // flags: FFADE_STAYOUT
write_byte(0); // red
write_byte(200); // green
write_byte(50); // blue
write_byte(100); // alpha
message_end();

if (pev(id, pev_flags) & FL_ONGROUND)
set_pev(id, pev_gravity, 999999.9) // set really high
else
set_pev(id, pev_gravity, 0.000001) // no gravity
}
else if(is_offside[id])
{
set_user_godmode(id, 1);

play_wav(id, OFFSIDE);

message_begin(MSG_ONE, gmsgScreenFade, _, id);
write_short(~0); // duration
write_short(~0); // hold time
write_short(0x0004); // flags: FFADE_STAYOUT
write_byte(0); // red
write_byte(200); // green
write_byte(50); // blue
write_byte(100); // alpha
message_end();

if (pev(id, pev_flags) & FL_ONGROUND)
set_pev(id, pev_gravity, 999999.9) // set really high
else
set_pev(id, pev_gravity, 0.000001) // no gravity
}
else {
if(!g_sprint[id])
set_speedchange(id)
}
}

public go_player(id) {
if (is_user_foul[id] || is_offside[id]) {
set_pev(id, pev_velocity, Float:{0.0,0.0,0.0}) // stop motion
set_pev(id, pev_maxspeed, 1.0) // prevent from moving
}
else {
if(!g_sprint[id])
set_speedchange(id)
}
}

Offside(id) {
new RestUser = 0, alive = 0, teamoff
new origin_x[3], PossCancha[MAX_PLAYER + 1][3]

for(new x = 1; x <= MAX_PLAYER; x++)
{
if(is_user_alive(x) && !is_user_bot(x) && !is_user_hltv(x) && is_user_connected(x))
{
alive++
get_user_origin(x, origin_x)
teamoff = get_user_team(x)
PossCancha[x - RestUser][0] = x
PossCancha[x - RestUser][1] = origin_x[0]
PossCancha[x - RestUser][2] = teamoff
}
else
RestUser++
}

if(alive >= 3)
{
new pateoteam = get_user_team(ballowner)
new auxiliar0, auxiliar1, auxiliar2, finish
if(pateoteam == 1)
{
do
{
finish = 0
for(new x = 1; x <= alive; x++)
{
if(PossCancha[x][1] > PossCancha[x + 1][1])
{
auxiliar0 = PossCancha[x][0]
PossCancha[x][0] = PossCancha[x + 1][0]
PossCancha[x + 1][0] = auxiliar0

auxiliar1 = PossCancha[x][1]
PossCancha[x][1] = PossCancha[x + 1][1]
PossCancha[x + 1][1] = auxiliar1

auxiliar2 = PossCancha[x][2]
PossCancha[x][2] = PossCancha[x + 1][2]
PossCancha[x + 1][2] = auxiliar2

finish = 1
}
}
}
while(finish)
}
else if(pateoteam == 2)
{
do
{
finish = 0
for(new x = 1; x <= alive; x++)
{
if(PossCancha[x][1] < PossCancha[x + 1][1])
{
auxiliar0 = PossCancha[x][0]
PossCancha[x][0] = PossCancha[x + 1][0]
PossCancha[x + 1][0] = auxiliar0

auxiliar1 = PossCancha[x][1]
PossCancha[x][1] = PossCancha[x + 1][1]
PossCancha[x + 1][1] = auxiliar1

auxiliar2 = PossCancha[x][2]
PossCancha[x][2] = PossCancha[x + 1][2]
PossCancha[x + 1][2] = auxiliar2

finish = 1
}
}
}
while(finish)
}

if(pateoteam != PossCancha[1][2])
return false;

if(id == PossCancha[1][0])
return false;

if((pateoteam == PossCancha[1][2]) && (pateoteam != PossCancha[2][2]))
{
SentenceOffside(PossCancha[1][0], PossCancha[2][0], PossCancha[1][1], PossCancha[2][1])
}
else if((pateoteam == PossCancha[1][2]) && (pateoteam == PossCancha[2][2]) && (pateoteam != PossCancha[3][2]))
{
SentenceOffside(PossCancha[1][0], PossCancha[3][0], PossCancha[1][1], PossCancha[3][1])
}
else if((pateoteam == PossCancha[1][2]) && (pateoteam == PossCancha[2][2]) && (pateoteam == PossCancha[3][2]) && (pateoteam != PossCancha[4][2]))
{
SentenceOffside(PossCancha[1][0], PossCancha[4][0], PossCancha[1][1], PossCancha[4][1])
}
else
return false;
}
else
return false;

return true;
}

public SentenceOffside(idoff, idhabil, originoff, originhabil) {

if(stats_enable == 1) {
UserData[idoff][gPoints] -= get_pcvar_num(g_pOffside)
UserData[idoff][gOffside] += 1
}

off_1 = idoff
is_offside[idoff] = true
create_line_off_red(originoff)
create_line_off_green(originhabil)
PrintOffside(idoff)
AvisoOffside(idoff)
Paralize(idoff)
}

public PrintOffside(idoff) {
new name_off1[MAX_PLAYER + 1]
get_user_name(idoff,name_off1, MAX_PLAYER)

PrintChatColor(0, _, "%L", LANG_PLAYER, "SJ_OFFSIDE", name_off1)
}

public niOffSide() {
if(off_1 > 0)
{
if(is_offside[off_1])
{
is_offside[off_1] = false
remove_offside(off_1)
}
}
}

remove_offside(id)
{
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25)
set_user_godmode(id, 0)

set_pev(id, pev_gravity, 1.0)

message_begin(MSG_ONE, gmsgScreenFade, _, id);
write_short(0); // duration
write_short(0); // hold time
write_short(0); // flags
write_byte(0); // red
write_byte(0); // green
write_byte(0); // blue
write_byte(0); // alpha
message_end();

return PLUGIN_CONTINUE;
}

public create_line_off_red(number)
{
if(is_offside[off_1])
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(0) //TE_BEAMPOINTS
write_coord(number) //centerpoint
write_coord(Coord_Off_Y + 3000) //left top corner
write_coord(Coord_Off_Z) //horizontal height
write_coord(number) //centerpoint
write_coord(Coord_Off_Y - 3000) //left right corner
write_coord(Coord_Off_Z) //horizontal height
write_short(offbeam) //sprite to use
write_byte(1) // framestart
write_byte(1) // framerate
write_byte(10) // life in 0.1's 42
write_byte(15) // width
write_byte(0) // noise
write_byte(255) // red
write_byte(0) // green
write_byte(0) // blue
write_byte(210) // brightness
write_byte(0) // speed
message_end()

set_task(1.0,"create_line_off_red", number)
}

return PLUGIN_CONTINUE;
}

public create_line_off_green(number)
{
if(is_offside[off_1])
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(0) //TE_BEAMPOINTS
write_coord(number) //centerpoint
write_coord(Coord_Off_Y + 3000) //left top corner
write_coord(Coord_Off_Z) //horizontal height
write_coord(number) //centerpoint
write_coord(Coord_Off_Y - 3000) //left right corner
write_coord(Coord_Off_Z) //horizontal height
write_short(offbeam) //sprite to use
write_byte(1) // framestart
write_byte(1) // framerate
write_byte(10) // life in 0.1's 42
write_byte(15) // width
write_byte(0) // noise
write_byte(0) // red
write_byte(255) // green
write_byte(0) // blue
write_byte(210) // brightness
write_byte(0) // speed
message_end()

set_task(1.0,"create_line_off_green", number)
}
}

public IsFoul(attacker)
{
new button = entity_get_int(attacker, EV_INT_button)
if( attacker != ballholder && (button & IN_ATTACK || button & IN_ATTACK2))
{
static Float:maxdistancia
static Float:maxdistancia2
static referencia
static referencia2
new team_at = get_user_team(attacker)

referencia2 = Mascots[team_at]
maxdistancia2 = get_pcvar_float(CVAR_KILLNEARAREA)

if(ballholder > 0)
{
referencia = ballholder
maxdistancia = 200.0
}
else
{
referencia = aball
maxdistancia = 400.0
}

if(entity_range(attacker, referencia2) > maxdistancia2 && is_user_connected(attacker) && is_user_connected(referencia2))
{
if(entity_range(attacker, referencia) > maxdistancia)
{
is_user_foul[attacker] = true;
user_foul_count[attacker] = 5;
AvisoFoul(attacker)
Paralize(attacker)

new name_foul[MAX_PLAYER + 1]
get_user_name(attacker, name_foul, MAX_PLAYER)
PrintChatColor(0, _, "%L", LANG_PLAYER, "SJ_FOUL", name_foul)

if(stats_enable == 1) {
UserData[attacker][gPoints] -= get_pcvar_num(g_pFoul)
UserData[attacker][gFoul] += 1
}
}
}
}
return PLUGIN_CONTINUE;
}

/*====================================================================================================
[Keeper System]

Purpose: $$

Comment: $$

====================================================================================================*/

public cmdKeeper(id) {
if(!is_user_keeper[id]) {
static next_ct, next_tt
new systime = get_systime()
new remaining_ct = next_ct - systime
new remaining_tt = next_tt - systime
timer[id] = 10

if( cs_get_user_team(id) == CS_TEAM_CT && remaining_ct > 0 ) {
PrintChatColor(id, _, "%L", LANG_PLAYER, "SJ_BLOCK", remaining_ct)
return PLUGIN_HANDLED
}

if( cs_get_user_team(id) == CS_TEAM_T && remaining_tt > 0 ) {
PrintChatColor(id, _, "%L", LANG_PLAYER, "SJ_BLOCK", remaining_tt)
return PLUGIN_HANDLED
}

if(PlayerUpgrades[id][DEX] < 4) {
PrintChatColor(id, _, "%L", LANG_PLAYER, "SJ_DEX")
} else {
new name[MAX_PLAYER + 1]
get_user_name(id, name, MAX_PLAYER)

if(cs_get_user_team(id) == CS_TEAM_CT && gkct == 0) {
CT_keeper[id] = true
is_user_keeper[id] = true
gkct = 1
set_pev(id, pev_origin, soccerjamct)

next_ct = systime + 90

PrintChatColor(0, _, "%L", LANG_PLAYER, "SJ_GKC", name)
}
else if(cs_get_user_team(id) == CS_TEAM_T && gktt == 0) {
T_keeper[id] = true
is_user_keeper[id] = true
gktt = 1
set_pev(id, pev_origin, soccerjamtt)

next_tt = systime + 90

PrintChatColor(0, _, "%L", LANG_PLAYER, "SJ_GKT", name)
}
else {
PrintChatColor(0, _, "%L", LANG_PLAYER, "SJ_JGK")
}
}
}

return PLUGIN_HANDLED
}

public cmdUnKeeper(id) {
if(is_user_keeper[id]) {
new name[MAX_PLAYER + 1]
get_user_name(id, name, MAX_PLAYER)

if(timer[id] > 0) {
nogkblock(id)
PrintChatColor(id, _, "%L", LANG_PLAYER, "SJ_NOBLOCK", timer[id])
return PLUGIN_HANDLED
}

if(cs_get_user_team(id) == CS_TEAM_CT) {
CT_keeper[id] = false
is_user_keeper[id] = false
gkct = 0

PrintChatColor(0, _, "%L", LANG_PLAYER, "SJ_NOGK", name)
}
else if(cs_get_user_team(id) == CS_TEAM_T) {
T_keeper[id] = false
is_user_keeper[id] = false
gktt = 0

PrintChatColor(0, _, "%L", LANG_PLAYER, "SJ_NOGK", name)
}
}
return PLUGIN_HANDLED
}

public nogkblock(id) {
if(timer[id] >= 0) {
timer[id] --
set_task(2.0, "nogkblock", id, _, _,"b")
}
else {
cmdUnKeeper(id)
remove_task(id)
}
}

public fw_touch(zone, player) {
if (!pev_valid(zone) || !is_user_connected(player))
return FMRES_IGNORED

static classname[33]
pev(player, pev_classname, classname, 32)
if (!equal(classname, "player"))
return FMRES_IGNORED

pev(zone, pev_classname, classname, 32)
if (!equal(classname, "gkzone"))
return FMRES_IGNORED

KeeperZone(player, zone)

return FMRES_IGNORED
}

public KeeperZone(player, zone) {
if(!pev_valid(zone))
return;

if(is_user_keeper[player]) {
if(cs_get_user_team(player) == CS_TEAM_T)
set_pev(player, pev_origin, soccerjamtt)
else if(cs_get_user_team(player) == CS_TEAM_CT)
set_pev(player, pev_origin, soccerjamct)
else
return;
}
}

public CreateZone(Float:position[3], Float:mins[3], Float:maxs[3]) {
new entity = fm_create_entity("info_target")
set_pev(entity, pev_classname, "gkzone")
fm_entity_set_model(entity, "models/gib_skull.mdl")
fm_entity_set_origin(entity, position)

set_pev(entity, pev_movetype, MOVETYPE_FLY)
set_pev(entity, pev_solid, SOLID_TRIGGER)

fm_entity_set_size(entity, mins, maxs)

fm_set_entity_visibility(entity, 0)

return entity
}

public LoadWGZ() {
new zonefile[200]
new mapname[50]

get_configsdir(zonefile, 199)
format(zonefile, 199, "%s/gkzone", zonefile)

get_mapname(mapname, 49)
format(zonefile, 199, "%s/%s.wgz", zonefile, mapname)

if (!file_exists(zonefile))
{
log_amx("no zone-file found")
return
}

new input[1000], line = 0, len

while( (line = read_file(zonefile , line , input , 127 , len) ) != 0 )
{
if (!strlen(input) || (input[0] == ';')) continue;

new data[20]
new Float:mins[3], Float:maxs[3], Float:pos[3]

strbreak(input, data, 20, input, 999); pos[0] = str_to_float(data);
strbreak(input, data, 20, input, 999); pos[1] = str_to_float(data);
strbreak(input, data, 20, input, 999); pos[2] = str_to_float(data);

strbreak(input, data, 20, input, 999); mins[0] = str_to_float(data);
strbreak(input, data, 20, input, 999); mins[1] = str_to_float(data);
strbreak(input, data, 20, input, 999); mins[2] = str_to_float(data);
strbreak(input, data, 20, input, 999); maxs[0] = str_to_float(data);
strbreak(input, data, 20, input, 999); maxs[1] = str_to_float(data);
strbreak(input, data, 20, input, 999); maxs[2] = str_to_float(data);

CreateZone(pos, mins, maxs);
}

FindAllZones()
HideAllZones()
}

public HideAllZones() {
for(new i = 0; i < maxzones; i++)
{
set_pev(zone[i], pev_solid, SOLID_TRIGGER)
remove_task(TASK_BASIS_SHOWZONES + zone[i])
}
}

public FindAllZones() {
new entity = -1
maxzones = 0
while( (entity = fm_find_ent_by_class(entity, "gkzone")) )
{
zone[maxzones] = entity
maxzones++
}
}

stock fm_find_ent_by_class(index, const classname[])
return engfunc(EngFunc_FindEntityByString, index, "classname", classname)

stock fm_entity_set_size(index, const Float:mins[3], const Float:maxs[3])
return engfunc(EngFunc_SetSize, index, mins, maxs)

stock fm_entity_set_model(index, const model[])
return engfunc(EngFunc_SetModel, index, model)

stock fm_create_entity(const classname[])
return engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, classname))

stock fm_entity_set_origin(index, const Float:origin[3]) {
new Float:mins[3], Float:maxs[3]
pev(index, pev_mins, mins)
pev(index, pev_maxs, maxs)
engfunc(EngFunc_SetSize, index, mins, maxs)

return engfunc(EngFunc_SetOrigin, index, origin)
}

stock fm_set_entity_visibility(index, visible = 1) {
set_pev(index, pev_effects, visible == 1 ? pev(index, pev_effects) & ~EF_NODRAW : pev(index, pev_effects) | EF_NODRAW)

return 1
}

/*====================================================================================================
[Warn System]

Purpose: $$

Comment: $$

====================================================================================================*/
public warnmenu(id) {
new i_Menu = menu_create("\rВыдать варнинг:", "warnmenu_handler")

new s_Players[32], i_Num, i_Player
new s_Name[32], s_Player[10]

new msg[128]

get_players(s_Players, i_Num)

for (new i; i < i_Num; i++) {
i_Player = s_Players[i]

get_user_name(i_Player, s_Name, charsmax(s_Name))
num_to_str(i_Player, s_Player, charsmax(s_Player))

format(msg, 127, "%s\r[\y%d\r]", s_Name, UserData[i_Player][gWarns])

menu_additem(i_Menu, msg, s_Player, 0)

}
menu_setprop(i_Menu, MPROP_NEXTNAME, "Дальше")
menu_setprop(i_Menu, MPROP_BACKNAME, "Назад")
menu_setprop(i_Menu, MPROP_EXITNAME, "Выход")
menu_display(id, i_Menu, 0)
}

public warnmenu_handler(id, menu, item) {
if (item == MENU_EXIT) {
menu_destroy(menu)
return PLUGIN_HANDLED
}

new s_Data[6], s_Name[64], i_Access, i_Callback
menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

bplayer = str_to_num(s_Data)
get_user_name(id, adm, 32)
get_user_name(bplayer, bp, 32)

warn(id)

menu_destroy(menu)
return PLUGIN_HANDLED
}

public warn(id) {
new menu = menu_create("\rМеню предупреждений:", "g_menu_handler")
menu_additem(menu, "Играть в пас", "1")
menu_additem(menu, "Гол в пустые", "2")
menu_additem(menu, "Оскорбление", "3")
menu_additem(menu, "Реклама", "4")
menu_additem(menu, "Флуд", "5")
menu_setprop(menu, MPROP_NEXTNAME, "Дальше")
menu_setprop(menu, MPROP_BACKNAME, "Назад")
menu_setprop(menu, MPROP_EXITNAME, "Выход")
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}

public g_menu_handler(id, menu, item) {
if (item == MENU_EXIT) {
menu_destroy(menu)
return PLUGIN_HANDLED
}

new s_Data[6], s_Name[64], i_Access, i_Callback
menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

set_dhudmessage(255, 255, 0, -1.0, -1.0, 2, 1.0, 5.0, 0.1, 1.0, false)

new Key = str_to_num(s_Data)

if(is_user_connected(bplayer)) {
switch(Key) {
case 1: show_dhudmessage(bplayer, "Убедительная просьба играть в пас!")
case 2: show_dhudmessage(bplayer, "Не забивайте в пустые ворота!")
case 3: show_dhudmessage(bplayer, "Прекратите оскорблять игроков!")
case 4: show_dhudmessage(bplayer, "Прекратите рассылать рекламу!")
case 5: show_dhudmessage(bplayer, "Прекратите флудить!")
}

client_cmd(bplayer, "spk buttons/bell1")
UserData[bplayer][gWarns] ++
PrintChatColor(0, _, "%L", LANG_PLAYER, "SJ_WARN", adm, bp, UserData[bplayer][gWarns])
}

if(UserData[bplayer][gWarns] == 3) {
if(is_user_keeper[bplayer])
cmdUnKeeper(id)

server_cmd("amx_ban ^"%s^" ^"30^" ^"Narushenie pravil^"", bp)
}

menu_destroy(menu)
return PLUGIN_HANDLED
}
Здравствуйте не получается скомпилировать плагин SoccerJam 3.2 помогите решить эту проблему если возможно, буду очень благодарен!

выдаёт вот это:

soccerjam.sma(1222) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(1921) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(1946) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(1947) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(2006) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(1986) : warning 204: symbol is assigned a value that is never used: "gainedxp"
soccerjam.sma(2154) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(2181) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(2219) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(2274) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(2275) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(2286) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(2287) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(2802) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(2804) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(2808) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(2826) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(2829) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(3125) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(3126) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(3135) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(3612) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(3595) : warning 204: symbol is assigned a value that is never used: "notes"
soccerjam.sma(3957) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(4087) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(4117) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(4122) : error 017: undefined symbol "PrintChatColor"
soccerjam.sma(4127) : error 017: undefined symbol "PrintChatColor"
 
В этой теме было размещено решение! Перейти к решению.

Вложения

Сообщения
3,331
Реакции
1,464
Помог
124 раз(а)
German, найти инклуд chatcolor, или переделать отправку сообщений в чат через стандартные функции AmxModX.
 
Сообщения
20
Реакции
6
Помог
3 раз(а)
sbelov020, Инклуд есть, но всё равно не компилируется. Переделал на стандартные сообщение, тоже не компилируется, скорее всего у меня руки немного кривые.
 
Сообщения
1,408
Реакции
182
Помог
2 раз(а)
Подключите вместо инклуда chatcolor, инклуд: <colorchat>

Потом когда нужно указать что где то должно появляться сообщение, в коде пишите:

client_print_color(id, 0, "текст") (совместимость, AMXX < 182 && AMXX > 182)

или

client_print_color(id, print_chat, "текст") (совместимость, AMXX < 182 || AMXX == 182)
 
Сообщения
1,419
Реакции
2,509
Помог
59 раз(а)
Подключите вместо инклуда chatcolor, инклуд: <colorchat>

Потом когда нужно указать что где то должно появляться сообщение, в коде пишите:

client_print_color(id, 0, "текст") (совместимость, AMXX < 182 && AMXX > 182)

или

client_print_color(id, print_chat, "текст") (совместимость, AMXX < 182 || AMXX == 182)
Ни 0 ни print_chat. Смотрим инклуд: print_team_default, print_team_grey, print_team_red, print_team_blue.
Сам инклуд: https://dev-cs.ru/threads/222/page-2#post-12669
 
Сообщения
1,408
Реакции
182
Помог
2 раз(а)
Ни 0 ни print_chat. Смотрим инклуд: print_team_default, print_team_grey, print_team_red, print_team_blue.
Сам инклуд: https://dev-cs.ru/threads/222/page-2#post-12669
Согласен, видел, так корректней?

А на сколько плохо предыдущий вариант?
8 Мар 2019
Просто видел, что так у многих авторов. В общем как написал я (скомпилируется без ошибок), но, как написал w0w, будет корректней!
8 Мар 2019
У него вот такой формат: PrintChatColor(id, _, "%L", LANG_PLAYER, "SJ_EXP", sz_name, sz_bname, sz_xp)

Тогда в самом lang файле ставишь в тексте ^1 (обычный) ^3 (цвет команды) ^4 (зеленый)
 
Сообщения
20
Реакции
6
Помог
3 раз(а)
wellasgood, w0w, sbelov020, Всем спасибо большое ребята, решение найдено, инклуд был не правильный #include <chatcolor> правильный был вот этот #include <WPMGPrintChatColor>

Ещё раз всем спасибо большое, что откликнулись! =)
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу