- 听众
- 收听
- 积分
- 3894
- 主题
- 回帖
- 0
- 精华
注册时间2008-4-22
最后登录1970-1-1
该用户从未签到
|
发表于 2010-9-16 19:02:52
|
显示全部楼层
本帖最后由 SiMen.K. 于 2010-9-16 19:24 编辑
回复 7# GOoo
prokreedz + mpbhop + uq_jumpstats = u need
- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <engine>
- #include <fakemeta>
- #include <colorchat>
- #include <hamsandwich>
- #define KZ_LEVEL ADMIN_KICK
- #define MAX_ENTITYS 900+15*32
- #define SCOREATTRIB_NONE 0
- #define SCOREATTRIB_DEAD ( 1 << 0 )
- #define SCOREATTRIB_BOMB ( 1 << 1 )
- #define SCOREATTRIB_VIP ( 1 << 2 )
- #if cellbits == 32
- #define OFFSET_BUYZONE 235
- #else
- #define OFFSET_BUYZONE 268
- #endif
- new g_iPlayers[32], g_iNum, g_iPlayer
- new const g_szAliveFlags[] = "a"
- #define RefreshPlayersList() get_players(g_iPlayers, g_iNum, g_szAliveFlags)
- new const KZ_TOP15_DIR[] = "addons/amxmodx/configs/kz/top15"
- new Float:Pro_Times[24]
- new Pro_AuthIDS[24][32]
- new Pro_Names[24][32]
- new Pro_Date[24][32]
- new Float:Noob_Tiempos[24]
- new Noob_AuthIDS[24][32]
- new Noob_Names[24][32]
- new Noob_Date[24][32]
- new Noob_CheckPoints[24]
- new Noob_GoChecks[24]
- new Float:Checkpoints[33][2][3]
- new Float:timer_time[33]
- new Float:g_pausetime[33]
- new bool:g_bCpAlternate[33]
- new bool:timer_started[33]
- new bool:IsPaused[33]
- new bool:firstspawn[33]
- new bool:canusehook[33]
- new bool:ishooked[33]
- new bool:NightVisionUse[33]
- new bool:HealsOnMap
- new bool:Safe
- new bool:gViewInvisible[33]
- new bool:gMarkedInvisible[33] = { true, ...};
- new bool:gWaterInvisible[33]
- new bool:gWaterEntity[MAX_ENTITYS]
- new bool:gWaterFound
- new bool:AutoStart[33]
- new PauseOrigin[33][3]
- new Trie:g_tStarts
- new Trie:g_tStops;
- new checknumbers[33]
- new gochecknumbers[33]
- new g_WeaponUsed[33]
- new ShowTime[33]
- new g_Mapname[64]
- new g_Filename[128]
- new g_KzDir[128]
- new g_StartDir[128]
- new g_TopDir[128]
- new SpecLoc[33][3]
- new SavedStart[33][3]
- new kz_checkpoints
- new kz_godmode
- new kz_cheatdetect
- new kz_spawn_mainmenu
- new kz_show_timer
- new kz_chatorhud
- new kz_hud_color
- new hud_message
- new kz_other_weapons
- new kz_maxspeedmsg
- new kz_drop_weapons
- new kz_remove_drops
- new kz_strip_other_weapons
- new kz_use_radio
- new kz_hook_prize
- new kz_hook_sound
- new kz_pause
- new hookorigin[33][3]
- new kz_nvg
- new kz_nvg_colors
- new kz_vip
- new kz_respawn_ct
- new kz_semiclip
- new kz_spec_saves
- new kz_save_autostart
- new MaxPlayers
- new MsgStatusText
- new TeamInfo
- new const other_top_weapons[8] =
- {
- CSW_SCOUT, CSW_P90, CSW_FAMAS, CSW_SG552,
- CSW_M4A1, CSW_M249, CSW_AK47, CSW_AWP
- }
- // Sprites
- new Sbeam = 0
- // =================================================================================================
- public plugin_init()
- {
- register_plugin("ProKreedz","2.0w","p4ddY & Diggz & nucLeaR")
- register_cvar("prokreedz_version","2.0w",FCVAR_SERVER)
- kz_checkpoints = register_cvar("kz_checkpoints","1")
- kz_godmode = register_cvar("kz_godmode","1")
- kz_cheatdetect = register_cvar("kz_cheatdetect","1")
- kz_spawn_mainmenu = register_cvar("kz_spawn_mainmenu", "1")
- kz_show_timer = register_cvar("kz_show_timer", "1")
- kz_chatorhud = register_cvar("kz_chatorhud", "2")
- kz_hud_color = register_cvar("kz_hud_color", "12 122 221")
- kz_other_weapons = register_cvar("kz_other_weapons","1")
- kz_drop_weapons = register_cvar("kz_drop_weapons", "0")
- kz_remove_drops = register_cvar("kz_remove_drops", "1")
- kz_strip_other_weapons = register_cvar("kz_strip_other_weapons", "1")
- kz_maxspeedmsg = register_cvar("kz_maxspeedmsg","1")
- kz_hook_prize = register_cvar("kz_hook_prize","1")
- kz_hook_sound = register_cvar("kz_hook_sound","1")
- kz_use_radio = register_cvar("kz_use_radio", "0")
- kz_pause = register_cvar("kz_pause", "1")
- kz_nvg = register_cvar("kz_nvg","1")
- kz_nvg_colors = register_cvar("kz_nvg_colors","5 0 255")
- kz_vip = register_cvar("kz_vip","1")
- kz_respawn_ct = register_cvar("kz_respawn_ct", "1")
- kz_semiclip = register_cvar("kz_semiclip", "1")
- kz_spec_saves = register_cvar("kz_spec_saves", "1")
- kz_save_autostart = register_cvar("kz_save_autostart", "1")
- register_clcmd("say .kreedz","kz_menu")
- register_clcmd("say /kreedz","kz_menu")
- register_clcmd("say .menu","kz_menu")
- register_clcmd("say /menu","kz_menu")
- register_clcmd("say /timer", "ShowTimer_Task" )
- register_clcmd( "say_team /timer", "ShowTimer_Task" );
- register_clcmd("say /showtimer", "ShowTimer_Task")
-
- register_clcmd("cp","CheckPoint")
- register_clcmd("/cp","CheckPoint")
- register_clcmd(".cp","CheckPoint")
- register_clcmd("say /cp","CheckPoint")
- register_clcmd("say /checkpoint","CheckPoint")
- register_clcmd("tp","GoCheck")
- register_clcmd("/tp","GoCheck")
- register_clcmd(".tp","GoCheck")
- register_clcmd("say /tp", "GoCheck")
- register_clcmd("say /teleport", "GoCheck")
- register_clcmd("gc","GoCheck")
- register_clcmd("/gc","GoCheck")
- register_clcmd(".gc","GoCheck")
- register_clcmd("say /gc", "GoCheck")
- register_clcmd("say /gocheck", "GoCheck")
- register_clcmd("stuck","Stuck")
- register_clcmd("/stuck","Stuck")
- register_clcmd(".stuck", "Stuck")
- register_clcmd("say .stuck","Stuck")
- register_clcmd("say /stuck","Stuck")
- register_clcmd("say .reset","reset_checkpoints")
- register_clcmd("say /reset","reset_checkpoints")
-
- register_clcmd("say .noclip","noclip")
- register_clcmd("say /noclip","noclip")
- register_clcmd("say /nc","noclip")
- register_clcmd("say /spec","ct")
- register_clcmd("say /ct","ct")
- register_clcmd("say /pause", "Pause")
- register_clcmd("say /invis", "InvisMenu")
- register_clcmd("say /winvis", "cmdWaterInvisible")
- register_clcmd("say /pinvis", "cmdInvisible")
-
- register_concmd("kz_hook","give_hook",KZ_LEVEL,"<name|#userid|steamid|@ALL> <on/off>")
- register_concmd("nightvision","ToggleNVG")
- register_clcmd("say .top15","top15menu")
- register_clcmd("say /top15","top15menu")
- register_clcmd("say .top10","top15menu")
- register_clcmd("say /top10","top15menu")
- register_clcmd("say .noob10","NoobTop_show")
- register_clcmd("say /noob10","NoobTop_show")
- register_clcmd("say .noob15","NoobTop_show")
- register_clcmd("say /noob15","NoobTop_show")
- register_clcmd("say .nub10","NoobTop_show")
- register_clcmd("say /nub10","NoobTop_show")
- register_clcmd("say .nub15","NoobTop_show")
- register_clcmd("say /nub15","NoobTop_show")
- register_clcmd("say .pro10","ProTop_show")
- register_clcmd("say /pro10","ProTop_show")
- register_clcmd("say .pro15","ProTop_show")
- register_clcmd("say /pro15","ProTop_show")
-
- register_clcmd("say /weapons","weapons")
- register_clcmd("say /scout", "cmdScout")
- register_clcmd("say /usp", "cmdUsp")
- register_clcmd("say /knife", "cmdUsp")
- register_clcmd("say /start", "goStart");
- register_clcmd("/start", "goStart");
- register_clcmd("say /respawn", "goStart");
- register_clcmd("/respawn", "goStart");
- register_clcmd("say /setstart", "setStart", KZ_LEVEL, "")
- register_clcmd("say /delstart", "delStart", KZ_LEVEL, "")
- register_clcmd("+hook","hook_on",KZ_LEVEL)
- register_clcmd("-hook","hook_off",KZ_LEVEL)
- register_clcmd("say /demo", "Demo_CVars", KZ_LEVEL, "")
- register_clcmd("say /record", "Demo_CVars", KZ_LEVEL, "")
- register_clcmd("say /public", "Public_CVars", KZ_LEVEL, "")
- register_clcmd("say /pub", "Public_CVars", KZ_LEVEL, "")
- register_event("ResetHUD","resethud","be")
- register_event("CurWeapon","curweapon","be")
- register_event( "StatusValue", "EventStatusValue", "b", "1>0", "2>0" );
- register_forward(FM_StartFrame, "fw_StartFrame")
- register_forward(FM_AddToFullPack, "FM_client_AddToFullPack_Post", 1)
- RegisterHam( Ham_Player_PreThink, "player", "Ham_CBasePlayer_PreThink_Post", 1)
- RegisterHam( Ham_Use, "func_button", "fwdUse", 0)
- RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1)
- RegisterHam( Ham_Spawn, "weaponbox", "FwdSpawnWeaponbox", 1 )
- RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 )
- RegisterHam( Ham_Touch, "weaponbox", "GroundWeapon_Touch")
- register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" )
- register_message( get_user_msgid( "StatusIcon" ), "msgStatusIcon" );
- TeamInfo = get_user_msgid("TeamInfo")
- MsgStatusText = get_user_msgid( "StatusText" )
- hud_message = CreateHudSyncObj()
- MaxPlayers = get_maxplayers()
- set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
- set_task(0.5,"timer_task",2000,"",0,"ab")
- new cfgdir[64]
- get_configsdir(cfgdir,64)
- formatex(g_KzDir, 127, "%s/kz",cfgdir)
- if( !dir_exists(g_KzDir) )
- mkdir(g_KzDir)
- formatex(g_StartDir, 127, "%s/start",g_KzDir)
- if( !dir_exists(g_StartDir) )
- mkdir(g_StartDir)
- formatex(g_TopDir, 127, "%s/top15",g_KzDir)
- if( !dir_exists(g_TopDir) )
- mkdir(g_TopDir)
- get_mapname(g_Mapname, 63);
- formatex(g_Filename, 127, "%s/%s.txt", g_StartDir, g_Mapname)
-
- new kreedz_cfg[128]
- formatex(kreedz_cfg,128,"%s/kz/kreedz.cfg",cfgdir)
-
- if( file_exists( kreedz_cfg ) )
- {
- server_exec()
- server_cmd("exec %s",kreedz_cfg)
- }
- g_tStarts = TrieCreate( )
- g_tStops = TrieCreate( )
- new const szStarts[ ][ ] =
- {
- "counter_start", "clockstartbutton", "firsttimerelay", "but_start", "counter_start_button",
- "multi_start", "timer_startbutton", "start_timer_emi", "gogogo"
- }
- new const szStops[ ][ ] =
- {
- "counter_off", "clockstopbutton", "clockstop", "but_stop", "counter_stop_button",
- "multi_stop", "stop_counter", "m_counter_end_emi"
- }
- for( new i = 0; i < sizeof szStarts; i++ )
- TrieSetCell( g_tStarts, szStarts[ i ], 1 )
- for( new i = 0; i < sizeof szStops; i++ )
- TrieSetCell( g_tStops, szStops[ i ], 1 )
- }
- public plugin_end( )
- {
- TrieDestroy( g_tStarts )
- TrieDestroy( g_tStops )
- }
- public plugin_precache()
- {
- RegisterHam( Ham_Spawn, "func_door", "FwdHamDoorSpawn", 1 )
- precache_sound("weapons/xbow_hit2.wav")
- Sbeam = precache_model("sprites/laserbeam.spr")
- }
- public plugin_cfg()
- {
- new ent = -1;
- while( ( ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_water") ) != 0 )
- {
- if( !gWaterFound )
- {
- gWaterFound = true;
- }
- gWaterEntity[ent] = true;
- }
- ent = -1;
- while( ( ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_illusionary") ) != 0 )
- {
- if( pev( ent, pev_skin ) == CONTENTS_WATER )
- {
- if( !gWaterFound )
- {
- gWaterFound = true;
- }
- gWaterEntity[ent] = true;
- }
- }
- ent = -1;
- while( ( ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_conveyor") ) != 0 )
- {
- if( pev( ent, pev_spawnflags ) == 3 )
- {
- if( !gWaterFound )
- {
- gWaterFound = true;
- }
- gWaterEntity[ent] = true;
- }
- }
- for (new i = 0 ; i < 15; ++i)
- {
- Pro_Times[i] = 999999999.00000;
- Noob_Tiempos[i] = 999999999.00000;
- }
- read_pro15()
- read_Noob15()
- }
- // =================================================================================================
- // Global Functions
- // =================================================================================================
- public Pause(id)
- {
- if (get_pcvar_num(kz_pause) == 0)
- {
- kz_hud_message(id, "Pause is disabled")
- return PLUGIN_HANDLED
- }
- if(! timer_started[id])
- {
- kz_hud_message(id, "Timer is not started")
- return PLUGIN_HANDLED
- }
- if(! is_user_alive(id) )
- {
- kz_hud_message(id, "You must be alive to use this command")
- return PLUGIN_HANDLED
- }
- new Float:velocity[3]
- entity_get_vector(id,EV_VEC_velocity,velocity)
- if( velocity[2] == 0 )
- {
- if(!IsPaused[id])
- {
- g_pausetime[id] = thetime() - timer_time[id]
- timer_time[id] = 0.0
- IsPaused[id] = true
- kz_hud_message(id, "Your timer has been paused")
- set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
- pev(id, pev_origin, PauseOrigin[id])
- }
- else
- {
- timer_time[id] = thetime() - g_pausetime[id] + timer_time[id]
- IsPaused[id] = false
- kz_hud_message(id, "Your timer has been unpaused")
- set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
- }
- }
- else
- kz_hud_message(id, "You must be on ground to get paused")
- return PLUGIN_HANDLED
- }
- public ShowTimer_Task(id)
- {
- if (get_pcvar_num(kz_show_timer) == 0 )
- {
- kz_hud_message(id, "HUD Timer is disabled by CVar")
- return PLUGIN_HANDLED
- }
- ShowTime[id] = ShowTime[id] ? false : true
- kz_hud_message( id, "You have %sabled your timer", ShowTime[ id ] ? "en" : "dis" )
- return PLUGIN_HANDLED
- }
- public timer_task()
- {
- if (get_pcvar_num(kz_show_timer) == 1 )
- {
- for(new i=1;i<=MaxPlayers;i++)
- {
- if ( ShowTime[i] )
- {
- if (is_user_alive(i))
- {
- if( is_user_connected(i) && timer_started[i])
- {
- new Float:kreedztime = thetime() - (IsPaused[i] ? thetime() - g_pausetime[i] : timer_time[i])
- new imin = floatround(kreedztime / 60.0,floatround_floor)
- new isec = floatround(kreedztime - imin * 60.0,floatround_floor)
-
- new colors[12], r[4], g[4], b[4];
- get_pcvar_string(kz_hud_color, colors, 11)
- parse(colors, r, 3, g, 3, b, 4)
- set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), 0.40, 0.10, 0, 0.0, 1.0, 0.0, 0.0, 1)
- show_hudmessage(i, "Time: %02d:%02d | CPs: %d | TPs: %d ",imin, isec,checknumbers[i], gochecknumbers[i])
- }
- }
- else
- {
- new specmode = pev(i, pev_iuser1)
- if(specmode == 2 || specmode == 4)
- {
- new target = pev(i, pev_iuser2)
- if(target != i)
- if(is_user_alive(target) && timer_started[target])
- {
- new name[32], colors[12], r[4], g[4], b[4];
- get_user_name (target, name, 31)
- new Float:kreedztime = thetime() - (IsPaused[target] ? thetime() - g_pausetime[target] : timer_time[target])
- new imin = floatround(kreedztime / 60.0,floatround_floor)
- new isec = floatround(kreedztime - imin * 60.0,floatround_floor)
- get_pcvar_string(kz_hud_color, colors, 11)
- parse(colors, r, 3, g, 3, b, 4)
- set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), 0.40, 0.10, 0, 0.0, 1.0, 0.0, 0.0, 1)
- show_hudmessage(i, "Time: %02d:%02d | CPs: %d | TPs: %d %s ",imin, isec, checknumbers[target], gochecknumbers[target], IsPaused[target] ? "| *Paused*" : "")
- }
- }
- }
- }
- }
- }
- }
- // ============================ Block Commands ================================
- public client_command(id)
- {
- static szCmd[13]
- read_argv(0, szCmd, 12)
- static const commands_block[][] =
- {
- "radio1", "radio2", "radio3",
- "coverme", "takepoint", "holdpos",
- "regroup", "followme", "takingfire",
- "go", "fallback", "sticktog",
- "getinpos", "stormfront", "report",
- "roger", "enemyspot", "needbackup",
- "sectorclear", "inposition", "reportingin",
- "getout", "negative", "enemydown",
- "chooseteam", "jointeam 1"
- }
-
- static const drop_weapons[][] =
- {
- "drop"
- }
- if (get_pcvar_num(kz_use_radio) == 0)
- for ( new i = 0 ; i < sizeof( commands_block ) ; i++ )
- {
- if(equal(szCmd, commands_block[i]))
- return PLUGIN_HANDLED;
- }
- else
- return PLUGIN_CONTINUE
- if (get_pcvar_num(kz_drop_weapons) == 0)
- for ( new i = 0 ; i < sizeof( drop_weapons ) ; i++ )
- {
- if(equal(szCmd, drop_weapons[i]))
- return PLUGIN_HANDLED
- }
- else
- return PLUGIN_CONTINUE
- return PLUGIN_CONTINUE
- }
- public msgStatusIcon( const iMsgId, const iMsgDest, const iPlayer )
- {
- static szMsg[ 8 ];
- get_msg_arg_string( 2, szMsg, 7 );
- if( equal( szMsg, "buyzone" ) )
- {
- set_pdata_int( iPlayer, OFFSET_BUYZONE, get_pdata_int( iPlayer, OFFSET_BUYZONE ) & ~( 1<<0 ) )
- return PLUGIN_HANDLED
- }
- return PLUGIN_CONTINUE
- }
- public CmdRespawn(id)
- {
- if ( get_user_team(id) == 3 )
- return PLUGIN_HANDLED
- else
- ExecuteHamB(Ham_CS_RoundRespawn, id)
- return PLUGIN_HANDLED
- }
- public ct(id)
- {
- new CsTeams:team = cs_get_user_team(id)
- if (team == CS_TEAM_CT)
- {
- new Float:velocity[3]
- entity_get_vector(id,EV_VEC_velocity,velocity)
- if ( velocity[ 2 ] != 0 && timer_started[id] )
- return PLUGIN_HANDLED
- if (get_pcvar_num(kz_spec_saves) == 1)
- {
- pev(id, pev_origin, SpecLoc[id])
- if ( timer_started[id] )
- {
- if ( IsPaused[id] )
- Pause(id)
- g_pausetime[id] = thetime() - timer_time[id]
- timer_time[id] = 0.0
- ColorChat(id, GREEN, "[XJ]^x03 Your timer has been paused.")
- }
- }
- if(gViewInvisible[id])
- gViewInvisible[id] = false
- entity_set_int(id,EV_INT_deadflag,DEAD_DISCARDBODY)
- cs_set_user_team(id,CS_TEAM_SPECTATOR)
- }
- else
- {
- cs_set_user_team(id,CS_TEAM_CT)
- cs_user_spawn(id)
- fm_give_item(id,"weapon_knife")
- fm_give_item(id,"weapon_usp")
- fm_give_item(id,"weapon_usp")
- fm_give_item(id,"weapon_usp")
- if (get_pcvar_num(kz_spec_saves) == 1)
- {
- set_pev(id, pev_origin, SpecLoc[id])
- if ( timer_started [id] )
- timer_time[id] = thetime() - g_pausetime[id] + timer_time[id]
- }
-
- CmdRespawn(id)
- }
- return PLUGIN_HANDLED
- }
- //=================== Weapons ==============
- public curweapon(id)
- {
- new WeaponNum = read_data(2)
- new WeaponActive = read_data(1)
- if ((WeaponNum != g_WeaponUsed[id]) && WeaponActive) // if weapon has changed and its the active weapon continue
- {
- g_WeaponUsed[id] = WeaponNum
-
- if(get_pcvar_num(kz_maxspeedmsg) == 1)
- {
- new clip, ammo, speed
- switch(get_user_weapon(id,clip,ammo))
- {
- case CSW_SCOUT: speed = 260
- case CSW_C4, CSW_P228, CSW_MAC10, CSW_MP5NAVY, CSW_USP, CSW_TMP, CSW_FLASHBANG, CSW_DEAGLE, CSW_GLOCK18, CSW_SMOKEGRENADE, CSW_ELITE, CSW_FIVESEVEN, CSW_UMP45, CSW_HEGRENADE, CSW_KNIFE: speed = 250
- case CSW_P90: speed = 245
- case CSW_XM1014, CSW_AUG, CSW_GALIL, CSW_FAMAS: speed = 240
- case CSW_SG552: speed = 235
- case CSW_M3, CSW_M4A1: speed= 230
- case CSW_AK47: speed = 221
- case CSW_M249: speed = 220
- case CSW_G3SG1, CSW_SG550, CSW_AWP: speed = 210
- }
- kz_hud_message(id,"This weapons maxspeed is %d",speed)
- }
- }
- return PLUGIN_HANDLED
- }
- public weapons(id)
- {
- if (!timer_started[id])
- {
- if(get_pcvar_num(kz_other_weapons) == 1)
- {
- if(is_user_alive(id))
- {
- new bool:weaponsgiven
- if(!user_has_weapon(id,CSW_KNIFE))
- fm_give_item(id,"weapon_knife")
- if(!user_has_weapon(id,CSW_USP)) {
- fm_give_item(id,"weapon_usp")
- }
- if(!user_has_weapon(id,CSW_SCOUT)) {
- fm_give_item(id, "weapon_scout")
- weaponsgiven = true
- }
- if(!user_has_weapon(id,CSW_P90)) {
- fm_give_item(id, "weapon_p90")
- weaponsgiven = true
- }
- if(!user_has_weapon(id,CSW_FAMAS)) {
- fm_give_item(id, "weapon_famas")
- weaponsgiven = true
- }
- if(!user_has_weapon(id,CSW_SG552)) {
- fm_give_item(id, "weapon_sg552")
- weaponsgiven = true
- }
- if(!user_has_weapon(id,CSW_M4A1)) {
- fm_give_item(id, "weapon_m4a1")
- weaponsgiven = true
- }
- if(!user_has_weapon(id,CSW_M249)) {
- fm_give_item(id, "weapon_m249")
- weaponsgiven = true
- }
- if(!user_has_weapon(id,CSW_AK47)) {
- fm_give_item(id, "weapon_ak47")
- weaponsgiven = true
- }
- if(!user_has_weapon(id,CSW_AWP)) {
- fm_give_item(id, "weapon_awp")
- weaponsgiven = true
- }
- if(weaponsgiven)
- kz_hud_message(id, "You were given some weapons with different speed")
- }
- else
- kz_hud_message(id, "You have to be alive to use this function")
- }
- else
- kz_hud_message(id, "Different weapons are disabled")
- }
- else
- kz_hud_message(id, "You can not get different weapons during a run, type /reset")
- return PLUGIN_HANDLED
- }
- // ========================= Scout =======================
- public cmdScout(id)
- {
- fm_give_item(id,"weapon_scout")
- return PLUGIN_HANDLED
- }
- public cmdUsp(id)
- {
- fm_give_item(id,"weapon_usp")
- fm_give_item(id,"weapon_knife")
- return PLUGIN_HANDLED
- }
- // ========================== Start location =================
- public goStart(id)
- {
- if( !is_user_alive( id ) )
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 You must be alive to use this command.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You must be alive to use this command")
- return PLUGIN_HANDLED
- }
- if (IsPaused[id])
- {
- kz_hud_message(id, "You can't teleport in pause")
- return PLUGIN_HANDLED
- }
- if (file_exists(g_Filename))
- {
- if(get_pcvar_num(kz_save_autostart) == 1 && AutoStart [id] )
- {
- set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
- set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
- set_pev(id, pev_origin, SavedStart [id] )
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 You have been teleported to the start button.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You have been teleported to the start button")
- }
- else
- {
- new data[64], pos[3], str1[13], str2[13], str3[13]
- new file = fopen(g_Filename, "rt+")
- while(!feof(file))
- {
- fgets(file, data, 63)
- parse(data, str1, 12, str2, 12, str3, 12)
-
- pos[0] = str_to_num(str1)
- pos[1] = str_to_num(str2)
- pos[2] = str_to_num(str3)
-
- set_pev( id, pev_velocity, Float:{ 0.0, 0.0, 0.0 } )
- set_pev( id, pev_gravity, 1.0 )
- engfunc(EngFunc_SetOrigin, id, pos)
- }
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 You have been teleported to the start button.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You have been teleported to the start button")
- fclose(file)
- }
- }
- else
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 No start position set for this map.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "No start position set for this map")
- CmdRespawn(id)
- }
- return PLUGIN_HANDLED
- }
- public setStart(id, level, cid)
- {
- if (!cmd_access(id, level, cid, 1))
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 You have no acces to that command.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You have no acces to that command")
-
- return PLUGIN_HANDLED
- }
-
- if (file_exists(g_Filename))
- delete_file(g_Filename)
- new i[3], data[128]
- pev(id, pev_origin, i)
- formatex(data, 127, "%d %d %d", i[0], i[1], i[2])
- write_file(g_Filename, data, 1)
- ColorChat(id, GREEN, "[XJ]^x01 Start position set for this map")
- return PLUGIN_HANDLED
- }
- public delStart(id, level, cid)
- {
- if (!cmd_access(id, level, cid, 1))
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 You have no acces to that command.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You have no acces to that command")
- return PLUGIN_HANDLED
- }
-
- if (file_exists(g_Filename))
- {
- delete_file(g_Filename);
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 Start position deleted.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "Start position deleted")
- }
- else
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 No start position set for this map.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "No start position set for this map")
- }
- return PLUGIN_HANDLED
- }
- // ========= Respawn CT if dies ========
- public Ham_CBasePlayer_Killed_Post(id)
- {
- if(get_pcvar_num(kz_respawn_ct) == 1)
- {
- if( get_pdata_int(id, 114) == 2 )
- {
- set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
- fm_set_user_deaths(id, 0)
- fm_set_user_frags(id, 0)
- }
- }
- }
- // ============================= NightVision ================================================
- public ToggleNVG(id)
- {
- if(get_pcvar_num(kz_nvg) == 0)
- return PLUGIN_CONTINUE;
-
- if ( NightVisionUse[id] || !is_user_alive(id) )
- StopNVG(id)
- else
- StartNVG(id)
- return PLUGIN_HANDLED;
- }
- public StartNVG(id)
- {
-
- emit_sound(id,CHAN_ITEM,"items/nvg_on.wav",1.0,ATTN_NORM,0,PITCH_NORM)
-
- set_task(0.1,"RunNVG",id+111111,_,_,"b")
-
- NightVisionUse[id] = true;
-
- return PLUGIN_HANDLED
- }
- public StopNVG(id)
- {
- emit_sound(id,CHAN_ITEM,"items/nvg_off.wav",1.0,ATTN_NORM,0,PITCH_NORM)
- remove_task(id+111111)
-
- NightVisionUse[id] = false;
- return PLUGIN_HANDLED;
- }
- public RunNVG(taskid)
- {
- new id = taskid - 111111
-
- if (!is_user_alive(id)) return
-
- new origin[3]
- get_user_origin(id,origin,3)
-
- new color[17];
- get_pcvar_string(kz_nvg_colors,color,16);
-
- new iRed[5], iGreen[7], iBlue[5]
- parse(color,iRed,4,iGreen,6,iBlue,4)
-
- message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
- write_byte(TE_DLIGHT)
- write_coord(origin[0])
- write_coord(origin[1])
- write_coord(origin[2])
- write_byte(80)
- write_byte(str_to_num(iRed))
- write_byte(str_to_num(iGreen))
- write_byte(str_to_num(iBlue))
- write_byte(2)
- write_byte(0)
- message_end()
- }
- // ============================ Hook ==============================================================
- public give_hook(id,level,cid)
- {
- if (!cmd_access(id,level,cid,3) )
- return PLUGIN_HANDLED
- new szarg1[32], szarg2[8], bool:mode
- read_argv(1,szarg1,32)
- read_argv(2,szarg2,32)
- if(equal(szarg2,"on"))
- mode = true
-
- if(equal(szarg1,"@ALL"))
- {
- for(new i=1;i<=MaxPlayers;i++)
- {
- if(is_user_connected(i) && is_user_alive(i))
- {
- canusehook[i] = mode
- if(mode)
- {
- ColorChat(i, GREEN, "[XJ]^x01 Hook has been enabled, bind any key '+hook' to use it.")
- }
- }
- }
- }
- else
- {
- new pid = cmd_target(id,szarg1,2)
- if(pid > 0)
- {
- canusehook[pid] = mode
- if(mode)
- {
- ColorChat(pid, GREEN, "[XJ]^x01 Hook has been enabled, bind any key '+hook' to use it.")
- }
- }
- }
- return PLUGIN_HANDLED
- }
- // =================================================================================================
- public hook_on(id,level,cid)
- {
- if( !canusehook[id] && !cmd_access(id,level,cid,1) || !is_user_alive(id) )
- return PLUGIN_HANDLED
- if (IsPaused[id])
- {
- kz_hud_message(id, "You can't use hook while paused")
- return PLUGIN_HANDLED
- }
- get_user_origin(id,hookorigin[id],3)
- detect_cheat(id,"Hook")
- ishooked[id] = true
- if (get_pcvar_num(kz_hook_sound) == 1)
- emit_sound(id,CHAN_STATIC,"weapons/xbow_hit2.wav",1.0,ATTN_NORM,0,PITCH_NORM)
- set_task(0.1,"hook_task",id,"",0,"ab")
- hook_task(id)
- return PLUGIN_HANDLED
- }
- // =================================================================================================
- public is_hooked(id) {
- return ishooked[id]
- }
- // =================================================================================================
- public hook_off(id) {
- remove_hook(id)
- return PLUGIN_HANDLED
- }
- // =================================================================================================
- public hook_task(id)
- {
- if(!is_user_connected(id) || !is_user_alive(id))
- remove_hook(id)
- remove_beam(id)
- draw_hook(id)
- new origin[3], Float:velocity[3]
- get_user_origin(id,origin)
- new distance = get_distance(hookorigin[id],origin)
- if(distance > 25)
- {
- velocity[0] = (hookorigin[id][0] - origin[0]) * (2.0 * 300 / distance)
- velocity[1] = (hookorigin[id][1] - origin[1]) * (2.0 * 300 / distance)
- velocity[2] = (hookorigin[id][2] - origin[2]) * (2.0 * 300 / distance)
-
- entity_set_vector(id,EV_VEC_velocity,velocity)
- }
- else
- {
- entity_set_vector(id,EV_VEC_velocity,Float:{0.0,0.0,0.0})
- remove_hook(id)
- }
- }
- // =================================================================================================
- public draw_hook(id) {
- message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte(1) // TE_BEAMENTPOINT
- write_short(id) // entid
- write_coord(hookorigin[id][0]) // origin
- write_coord(hookorigin[id][1]) // origin
- write_coord(hookorigin[id][2]) // origin
- write_short(Sbeam) // sprite index
- write_byte(0) // start frame
- write_byte(0) // framerate
- write_byte(random_num(1,100)) // life
- write_byte(random_num(1,20)) // width
- write_byte(random_num(1,0)) // noise
- if(get_user_team(id) == 1) // Terrorist
- {
- write_byte(random_num(1,255)) // r
- write_byte(random_num(1,255)) // g
- write_byte(random_num(1,255)) // b
- }
- else // Counter-Terrorist
- {
- write_byte(random_num(1,255)) // r
- write_byte(random_num(1,255)) // g
- write_byte(random_num(1,255)) // b
- }
- write_byte(random_num(1,500)) // brightness
- write_byte(random_num(1,200)) // speed
- message_end()
- }
- public remove_hook(id)
- {
- if(task_exists(id))
- remove_task(id)
- remove_beam(id)
- ishooked[id] = false
- }
- public remove_beam(id)
- {
- message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte(99) // TE_KILLBEAM
- write_short(id)
- message_end()
- }
- public Demo_CVars(id, level, cid)
- {
- if (!cmd_access(id, level, cid, 1))
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 You have no acces to that command.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You have no acces to that command")
-
- return PLUGIN_HANDLED
- }
- set_cvar_num("kz_respawn_ct", 0)
- set_cvar_num("kz_drop_weapons", 1)
- set_cvar_num("kz_show_timer", 0)
- set_cvar_num("kz_remove_drops", 0)
- set_cvar_num("kz_drop_weapons", 1)
- set_cvar_num("kz_other_weapons", 1)
- set_cvar_num("kz_use_radio", 1)
- set_cvar_num("kz_pause", 0)
- set_cvar_num("kz_semiclip", 0)
- set_cvar_num("kz_save_autostart", 0)
- Safe = true
- ColorChat(id, GREEN, "[XJ]^x01 Plugin is now ^x03safe^x01 for recording.")
- return PLUGIN_HANDLED
- }
- public Public_CVars(id, level, cid)
- {
- if (!cmd_access(id, level, cid, 1))
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 You have no acces to that command.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You have no acces to that command")
-
- return PLUGIN_HANDLED
- }
- new kreedz_cfg[128], cfgdir[64]
- get_configsdir(cfgdir,64)
- formatex(kreedz_cfg,128,"%s/kz/kreedz.cfg",cfgdir)
-
- if( file_exists( kreedz_cfg ) )
- {
- server_cmd("exec %s",kreedz_cfg)
- Safe = false
- }
- else
- {
- set_cvar_num("kz_respawn_ct", 0)
- set_cvar_num("kz_drop_weapons", 0)
- set_cvar_num("kz_show_timer", 1)
- set_cvar_num("kz_remove_drops", 1)
- set_cvar_num("kz_drop_weapons", 0)
- set_cvar_num("kz_use_radio", 0)
- set_cvar_num("kz_pause", 1)
- set_cvar_num("kz_semiclip", 1)
- set_cvar_num("kz_save_autostart", 1)
- Safe = false
- }
- if (!Safe)
- ColorChat(id, GREEN, "[XJ]^x01 Plugin is now ^x03not safe^x01 for recording.")
- return PLUGIN_HANDLED
- }
- public EventStatusValue( const id )
- {
-
- new szMessage[ 34 ], Target, aux
- get_user_aiming(id, Target, aux)
- formatex( szMessage, 33, "1 %s: %%p2", get_user_flags( Target ) & KZ_LEVEL ? "VIP" : "Player" )
-
- message_begin( MSG_ONE_UNRELIABLE, MsgStatusText, _, id )
- write_byte( 0 )
- write_string( szMessage )
- message_end( )
- }
- //============================ VIP In ScoreBoard =================================================
- public MessageScoreAttrib( iMsgID, iDest, iReceiver )
- {
- if( get_pcvar_num(kz_vip) )
- {
- new iPlayer = get_msg_arg_int( 1 )
- if( is_user_connected( iPlayer ) && ( get_user_flags( iPlayer ) & KZ_LEVEL ) )
- {
- set_msg_arg_int( 2, ARG_BYTE, is_user_alive( iPlayer ) ? SCOREATTRIB_VIP : SCOREATTRIB_DEAD );
- }
- }
- }
- // =================================================================================================
- public detect_cheat(id,reason[]) { // I saw this feature in kz_multiplugin :o
- if(timer_started[id] && get_pcvar_num(kz_cheatdetect) == 1)
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 %s detected. Timer resetted.",reason)
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "%s detected. Timer resetted.",reason)
- timer_started[id] = false
- }
- }
- // =================================================================================================
- // Cmds
- // =================================================================================================
- public CheckPoint(id)
- {
- if(get_pcvar_num(kz_checkpoints) == 1)
- {
- new Float:velocity[3]
- entity_get_vector(id,EV_VEC_velocity,velocity)
- if( !is_user_alive( id ) )
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 You must be alive to use this command.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You must be alive to use this command")
- return PLUGIN_HANDLED
- }
- if ( velocity[2]!=0 )
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 You can't make a checkpoint in the air.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You can't make a checkpoint in the air")
- return PLUGIN_HANDLED
- }
-
- if( IsPaused[id] )
- {
- if (get_pcvar_num(kz_chatorhud) == 1 )
- ColorChat(id, GREEN, "[XJ]^x01 You can't make a checkpoint in pause.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You can't make a checkpoint in pause")
-
- return PLUGIN_HANDLED
- }
-
- pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
- g_bCpAlternate[id] = !g_bCpAlternate[id]
- checknumbers[id]++
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 Checkpoint #%d created.",checknumbers[id])
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "Checkpoint #%d",checknumbers[id])
- }
- else
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 Checkpoints are off.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "Checkpoints are off")
- }
- return PLUGIN_HANDLED
- }
- public GoCheck(id)
- {
- if( !is_user_alive( id ) )
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 You must be alive to use this command.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You must be alive to use this command")
- return PLUGIN_HANDLED
- }
- if( checknumbers[id] == 0 )
- {
- if (get_pcvar_num(kz_chatorhud) == 1 )
- ColorChat(id, GREEN, "[XJ]^x01 You don't have enough Checkpoints.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You don't have enough Checkpoints")
- return PLUGIN_HANDLED
- }
- if( IsPaused[id] )
- {
- if (get_pcvar_num(kz_chatorhud) == 1 )
- ColorChat(id, GREEN, "[XJ]^x01 You can't teleport in pause.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You can't teleport in pause")
-
- return PLUGIN_HANDLED
- }
- set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
- set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
- set_pev( id, pev_fuser2, 0.0 );
- engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 18.0 } );
- set_pev(id, pev_origin, Checkpoints[ id ][ !g_bCpAlternate[id] ] )
- gochecknumbers[id]++
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 GoCheck #%d",gochecknumbers[id])
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "GoCheck #%d",gochecknumbers[id])
- return PLUGIN_HANDLED
- }
- public Stuck(id)
- {
- if( !is_user_alive( id ) )
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 You must be alive to use this command.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You must be alive to use this command")
- return PLUGIN_HANDLED
- }
- if( checknumbers[id] < 2 )
- {
- if (get_pcvar_num(kz_chatorhud) == 1 )
- ColorChat(id, GREEN, "[XJ]^x01 You don't have enough Checkpoints.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "You don't have enough Checkpoints")
- return PLUGIN_HANDLED
- }
- set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
- set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
- set_pev( id, pev_fuser2, 0.0 );
- engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 18.0 } );
- set_pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id]] )
- g_bCpAlternate[id] = !g_bCpAlternate[id];
- gochecknumbers[id]++
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 GoCheck #%d",gochecknumbers[id])
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "GoCheck #%d",gochecknumbers[id])
- return PLUGIN_HANDLED;
- }
- // =================================================================================================
- public reset_checkpoints(id)
- {
- checknumbers[id] = 0
- gochecknumbers[id] = 0
- timer_started[id] = false
- timer_time[id] = 0.0
- return PLUGIN_HANDLED
- }
- // =================================================================================================
- //===== Invis =======
- public cmdInvisible(id)
- {
- if(!gViewInvisible[id])
- {
- gViewInvisible[id] = true
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 Players are now ^x03invisible^x01")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "Players are now invisible")
- }
- else
- {
- gViewInvisible[id] = false
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 Players are now ^x03visible^x01")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "Players are now visible")
- }
- return PLUGIN_HANDLED
- }
- public cmdWaterInvisible(id)
- {
- if( gWaterFound )
- {
- if(!gWaterInvisible[id])
- {
- gWaterInvisible[id] = true
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 Water is now ^x03invisible^x01")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "Water is now invisible")
- }
- else
- {
- gWaterInvisible[id] = false
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 Water is now ^x03visible^x01")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "Water is now visible")
- }
- }
- else
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 There is no water on the map.")
- else if (get_pcvar_num(kz_chatorhud) == 2)
- kz_hud_message(id, "There is not water on the map")
- }
- return PLUGIN_HANDLED
- }
- public InvisMenu(id)
- {
- new menu = menu_create("\yInvis Menu\w", "InvisMenuHandler")
- menu_setprop(menu, MPROP_PERPAGE, 7)
- new msginvis[64], msgwaterinvis[64]
- formatex(msginvis, 63, "Players - %s", gViewInvisible[id] ? "\yON" : "\rOFF" )
- formatex(msgwaterinvis, 63, "Water - %s^n^n", gWaterInvisible[id] ? "\yON" : "\rOFF" )
- menu_additem( menu, msginvis, "1" )
- menu_additem( menu, msgwaterinvis, "2" )
- menu_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- public InvisMenuHandler (id, menu, item)
- {
- if( item == MENU_EXIT )
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
-
- new data[6]
- new access, callback
-
- menu_item_getinfo(menu, item, access, data, 5, _, _, callback)
-
- new key = str_to_num(data)
- switch(key)
- {
- case 1:
- {
- cmdInvisible(id)
- InvisMenu(id)
- }
- case 2:
- {
- cmdWaterInvisible(id)
- InvisMenu(id)
- }
- case 9:
- {
- show_menu(id,0,"")
- }
- }
- return PLUGIN_HANDLED
- }
- public FM_client_AddToFullPack_Post(es, e, ent, host, hostflags, player, pSet)
- {
- if( player )
- {
- if (get_pcvar_num(kz_semiclip) == 1)
- {
- if ( host != ent && get_orig_retval() && is_user_alive(host) )
- {
- set_es(es, ES_Solid, SOLID_NOT)
- set_es(es, ES_RenderMode, kRenderTransAlpha)
- set_es(es, ES_RenderAmt, 85)
- }
- }
- if(gMarkedInvisible[ent] && gViewInvisible[host])
- {
- set_es(es, ES_RenderMode, kRenderTransTexture)
- set_es(es, ES_RenderAmt, 0)
- set_es(es, ES_Origin, { 999999999.0, 999999999.0, 999999999.0 } )
- }
- }
- else
- if( gWaterInvisible[host] && gWaterEntity[ent] )
- {
- set_es(es, ES_Effects, get_es( es, ES_Effects ) | EF_NODRAW )
- }
- return FMRES_IGNORED
- }
- public Ham_CBasePlayer_PreThink_Post(id)
- {
- if( !is_user_alive(id) )
- {
- return
- }
- RefreshPlayersList()
- if (get_pcvar_num(kz_semiclip) == 1)
- {
- for(new i = 0; i<g_iNum; i++)
- {
- g_iPlayer = g_iPlayers[i]
- if( id != g_iPlayer )
- {
- set_pev(g_iPlayer, pev_solid, SOLID_NOT)
- }
- }
- }
- }
- public client_PostThink(id)
- {
- if( !is_user_alive(id) )
- return
- RefreshPlayersList()
- if (get_pcvar_num(kz_semiclip) == 1)
- for(new i = 0; i<g_iNum; i++)
- {
- g_iPlayer = g_iPlayers[i]
- if( g_iPlayer != id )
- set_pev(g_iPlayer, pev_solid, SOLID_SLIDEBOX)
- }
- }
- //=================================================================================================
- public noclip(id)
- {
- if(read_argc() == 1 || read_argc() == 2)
- {
- fm_set_user_noclip(id,fm_get_user_noclip(id) == 1 ? 0 : 1)
- if(fm_get_user_noclip(id) == 1)
- detect_cheat(id,"Noclip")
- }
-
- return PLUGIN_HANDLED
- }
- // =================================================================================================
- stock _fm_set_entity_flags(index, flag, onoff)
- {
- new flags = pev(index, pev_flags)
- if ((flags & flag) > 0)
- return onoff == 1 ? 2 : 1 + 0 * set_pev(index, pev_flags, flags - flag)
- else
- return onoff == 0 ? 2 : 1 + 0 * set_pev(index, pev_flags, flags + flag)
- return 0
- }
- stock fm_set_user_deaths(index, deaths) //fun
- {
- set_pdata_int(index, 444, deaths, 5)
- }
- stock Float:thetime()
- {
- return get_gametime()
- }
- stock fm_set_user_frags(index, frags) //fun
- {
- set_pev ( index, pev_frags, float(frags) )
- return 1
- }
- stock fix_score_team(id, const TEAM[])
- {
- emessage_begin(MSG_BROADCAST, TeamInfo );
- ewrite_byte(id);
- ewrite_string(TEAM);
- emessage_end();
- }
- stock fm_give_item(index, const item[])
- {
- if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
- return 0;
- new ent = fm_create_entity(item);
- if (!pev_valid(ent))
- return 0;
- new Float:origin[3];
- pev(index, pev_origin, origin);
- set_pev(ent, pev_origin, origin);
- set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
- dllfunc(DLLFunc_Spawn, ent);
- new save = pev(ent, pev_solid);
- dllfunc(DLLFunc_Touch, ent, index);
- if (pev(ent, pev_solid) != save)
- return ent;
- engfunc(EngFunc_RemoveEntity, ent);
- return -1;
- }
- stock fm_create_entity(const classname[]) // I dont like macros ;P
- return engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, classname))
- stock fm_strip_user_weapons(index)
- {
- new ent = fm_create_entity("player_weaponstrip");
- if( !pev_valid(ent) )
- return 0;
- set_pev(ent, pev_owner, index)
- dllfunc(DLLFunc_Spawn, ent);
- dllfunc(DLLFunc_Use, ent, index);
- engfunc(EngFunc_RemoveEntity, ent);
- return 1;
- }
- stock fm_set_user_godmode(index, godmode = 0)
- {
- set_pev(index, pev_takedamage, godmode == 1 ? 0.0 : 2.0)
- return 1;
- }
- stock fm_set_user_noclip(index, noclip = 0)
- {
- set_pev(index, pev_movetype, noclip == 1 ? MOVETYPE_NOCLIP : MOVETYPE_WALK);
- return 1;
- }
- stock fm_get_user_noclip(index)
- {
- return (pev(index, pev_movetype) == MOVETYPE_NOCLIP )
- }
- stock kz_hud_message(id, const message[], {Float,Sql,Result,_}:...)
- {
- static msg[192], colors[12], r[4], g[4], b[4];
- vformat(msg, 191, message, 3);
- get_pcvar_string(kz_hud_color, colors, 11)
- parse(colors, r, 3, g, 3, b, 4)
- set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), -1.0, 0.90, 0, 0.0, 2.0, 0.0, 1.0, -1);
- ShowSyncHudMsg(id, hud_message, msg);
- }
- public FwdSpawnWeaponbox( iEntity )
- {
- if(get_pcvar_num(kz_remove_drops) == 1)
- {
- set_pev( iEntity, pev_flags, FL_KILLME )
- dllfunc( DLLFunc_Think, iEntity )
- }
- return HAM_IGNORED
- }
- public FwdHamDoorSpawn( iEntity )
- {
- static const szNull[ ] = "common/null.wav";
- new Float:flDamage;
- pev( iEntity, pev_dmg, flDamage );
- if( flDamage < -999.0 ) {
- set_pev( iEntity, pev_noise1, szNull );
- set_pev( iEntity, pev_noise2, szNull );
- set_pev( iEntity, pev_noise3, szNull );
-
- if( !HealsOnMap )
- HealsOnMap = true
- }
- }
- public FwdHamPlayerSpawn( id )
- {
- if( !is_user_alive( id ) )
- return;
- if( HealsOnMap )
- set_pev( id, pev_health, 50175.0 )
-
- if( IsPaused[id] )
- {
- set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
- set_pev(id, pev_origin, PauseOrigin[id])
- }
- }
- public GroundWeapon_Touch(iWeapon, id)
- {
- if( is_user_alive(id) && timer_started[id] && !Safe )
- return HAM_SUPERCEDE
- return HAM_IGNORED
- }
- // =================================================================================================
- // Events / Forwards
- // =================================================================================================
- public resethud(id)
- {
- if( get_pcvar_num(kz_godmode) == 1 )
- fm_set_user_godmode(id,1)
- else
- fm_set_user_godmode(id,0)
-
- if( !user_has_weapon(id,CSW_KNIFE) )
- fm_give_item( id,"weapon_knife" )
-
-
- if(firstspawn[id])
- {
- ColorChat(id, GREEN, "[XJ]^x01 Welcome to ^x03nucLeaRKz.Idle.Ro ^x01")
- ColorChat(id, GREEN, "[XJ]^x01 Visit ^x03www.KZ-Romania.com ^x01")
- if(get_pcvar_num(kz_checkpoints) == 0)
- ColorChat(id, GREEN, "[XJ]^x01 Checkpoints are off.")
- if(get_pcvar_num(kz_spawn_mainmenu) == 1)
- kz_menu (id)
- }
- firstspawn[id] = false
- }
- //=================================================================================================
- public client_disconnect(id)
- {
- checknumbers[id] = 0
- gochecknumbers[id] = 0
- timer_started[id] = false
- ShowTime[id] = true
- firstspawn[id] = true
- NightVisionUse[id] = false
- IsPaused[id] = false
- remove_hook(id)
- }
- public client_putinserver(id)
- {
- checknumbers[id] = 0
- gochecknumbers[id] = 0
- timer_started[id] = false
- ShowTime[id] = true
- firstspawn[id] = true
- NightVisionUse[id] = false
- IsPaused[id] = false
- remove_hook(id)
- }
- // =================================================================================================
- // Menu
- // =================================================================================================
- public kz_menu(id)
- {
- new menu = menu_create("\yProKreedz Menu\w", "MenuHandler")
- menu_setprop(menu, MPROP_PERPAGE, 0)
- new msgcheck[64], msggocheck[64], msgshowtimer[64], msgpause[64]
- formatex(msgcheck, 63, "Checkpoint - \y#%i", checknumbers[id])
- formatex(msggocheck, 63, "Gocheck - \y#%i", gochecknumbers[id])
- formatex(msgshowtimer, 63, "Timer - %s", ShowTime[id] ? "\yON" : "\rOFF" )
- formatex(msgpause, 63, "Pause - %s^n", IsPaused[id] ? "\yON" : "\rOFF" )
- menu_additem( menu, msgcheck, "1" )
- menu_additem( menu, msggocheck, "2" )
- menu_additem( menu, "Top 15^n", "3")
- menu_additem( menu, "Start", "4")
- menu_additem( menu, msgshowtimer, "5" )
- menu_additem( menu, msgpause, "6" )
- menu_additem( menu, "Invisible Menu", "7" )
- menu_additem( menu, "Spectator/CT", "8" )
- menu_additem( menu, "Reset Time^n", "9")
- menu_additem( menu, "Exit", "*" )
- menu_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- public MenuHandler(id , menu, item)
- {
- if( item == MENU_EXIT ) {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
-
- new data[6], name[32]
- new access, callback
-
- menu_item_getinfo(menu, item, access, data, 5, _, _, callback)
-
- new key = str_to_num(data)
- get_user_name(id, name, 31)
- switch(key) {
- case 1:{
- CheckPoint(id)
- kz_menu(id)
- }
- case 2:{
- GoCheck(id)
- kz_menu(id)
- }
- case 3:{
- top15menu(id)
- }
- case 4:{
- goStart(id)
- kz_menu(id)
- }
- case 5:{
- ShowTimer_Task(id)
- kz_menu(id)
- }
- case 6:{
- Pause(id)
- kz_menu(id)
- }
- case 7:{
- InvisMenu(id)
- }
- case 8:{
- ct(id)
-
- }
- case 9:{
- reset_checkpoints(id)
- kz_menu(id)
- }
- case '*':{
- }
- }
- return PLUGIN_HANDLED
- }
- public top15menu(id)
- {
- new menu = menu_create("\r[nucLeaR-Kz] \yTop15 \w", "top15handler")
- menu_additem(menu, "\wPro 15", "1", 0)
- menu_additem(menu, "\wNoob 15^n^n", "2", 0)
- menu_additem(menu, "\wMain Menu", "5", 0)
- menu_display(id, menu, 0);
- return PLUGIN_HANDLED;
- }
- public top15handler(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- new data[6], iName[64]
- new iaccess, callback
- menu_item_getinfo(menu, item, iaccess, data,5, iName, 63, callback)
- new key = str_to_num(data);
- switch(key)
- {
- case 1:
- {
- ProTop_show(id)
- }
- case 2:
- {
- NoobTop_show(id)
- }
- case 5:
- {
- kz_menu(id)
- }
- case 9:
- {
- show_menu(id,0,"")
- }
- }
- return PLUGIN_HANDLED;
- }
- // =================================================================================================
- //
- // Timersystem
- // =================================================================================================
- public fwdUse(ent, id)
- {
- if( !ent || id > 32 )
- {
- return HAM_IGNORED;
- }
- if( !is_user_alive(id) )
- {
- return HAM_IGNORED;
- }
- new name[32]
- get_user_name(id, name, 31)
- new szTarget[ 32 ];
- entity_get_string( ent, EV_SZ_target, szTarget, 31 );
- if( TrieKeyExists( g_tStarts, szTarget ) )
- {
- if ( reset_checkpoints(id) && !timer_started[id] && !ishooked[id] )
- {
- start_climb(id)
-
- if(get_pcvar_num(kz_strip_other_weapons) == 1)
- for(new i = 0; i < 8; i++)
- if( user_has_weapon(id, other_top_weapons[i]) )
- {
- fm_strip_user_weapons(id)
- fm_give_item(id,"weapon_knife")
- fm_give_item(id,"weapon_usp")
- set_pdata_int(id, 382, 24, 5)
- }
- if( pev(id, pev_health) < 100 )
- set_pev(id, pev_health, 100.0)
- if( !file_exists(g_Filename))
- {
- new i[3], data[128];
- pev(id, pev_origin, i);
- formatex(data, 127, "%d %d %d", i[0], i[1], i[2]);
- write_file(g_Filename, data, 1);
-
- ColorChat(id, GREEN, "[XJ]^x01 Start position set for this map." )
- }
-
- if(get_pcvar_num(kz_save_autostart) == 1)
- {
- AutoStart[id] = true;
- pev(id, pev_origin, SavedStart[id])
- }
- remove_hook(id)
- }
-
- }
- if( TrieKeyExists( g_tStops, szTarget ) )
- {
- if( timer_started[id] )
- {
- finish_climb(id)
- if(get_pcvar_num(kz_hook_prize) == 1 && !canusehook[id])
- {
- canusehook[id] = true
- ColorChat(id, GREEN, "[XJ]^x01 Hook has been enabled, bind any key '+hook' to use it.")
- }
- }
- else
- kz_hud_message(id, "You must press the start button first")
- }
- return HAM_IGNORED
- }
- public start_climb(id)
- {
- if (get_pcvar_num(kz_chatorhud) == 1)
- ColorChat(id, GREEN, "[XJ]^x01 Timer started.")
- else
- kz_hud_message(id, "Timer started")
- set_pev(id, pev_gravity, 1.0);
- if (get_pcvar_num(kz_godmode) == 0)
- set_pev(id, pev_takedamage, DAMAGE_AIM)
- set_pev(id, pev_movetype, MOVETYPE_WALK)
- reset_checkpoints(id)
- IsPaused[id] = false
- timer_started[id] = true
- timer_time[id] = thetime()
- }
- public finish_climb(id)
- {
- if (!is_user_alive (id))
- {
- return;
- }
- new Float: time
- time = thetime() - timer_time[id]
- show_finish_message(id, time)
- timer_started[id] = false
- if (gochecknumbers[id] == 0 && !user_has_weapon(id,CSW_SCOUT) )
- ProTop_update(id, time)
- if (gochecknumbers[id] > 0 || user_has_weapon(id,CSW_SCOUT) )
- NoobTop_update(id, time, checknumbers[id], gochecknumbers[id])
- }
- public show_finish_message(id, Float:kreedztime)
- {
- new name[32]
- new imin,isec,ims
- get_user_name(id, name, 31)
- kreedztime = thetime() - timer_time[id]
- imin = floatround(kreedztime / 60.0, floatround_floor)
- isec = floatround(kreedztime - imin * 60.0,floatround_floor)
- ims = floatround( ( kreedztime - ( imin * 60.0 + isec ) ) * 100.0, floatround_floor )
- ColorChat(0, GREEN, "[XJ]^x01 ^x03%s^x01 finished the map in^x04 %02i:%02i.%02i ^x01(%d CP%s, %d TP%s) %s!",name,imin,isec,ims,checknumbers[id],checknumbers[id] == 1 ? "" : "s",gochecknumbers[id],gochecknumbers[id] == 1 ? "" : "s", user_has_weapon(id,CSW_SCOUT) ? "^x03using scout": "")
- }
- //==========================================================
- public ProTop_update(id, Float:time)
- {
- new authid[32], name[32], thetime[32];
- get_user_name(id, name, 31);
- get_user_authid(id, authid, 31);
- get_time(" %d/%m/%Y ", thetime, 31);
- new bool:Is_in_pro15
- Is_in_pro15 = false
- for(new i = 0; i < 15; i++)
- {
- if( equali(Pro_AuthIDS[i], authid) )
- {
- Is_in_pro15 = true
- }
- }
- for (new i = 0; i < 15; i++)
- {
- new Float:protiempo = Pro_Times[i]
-
- if( time < Pro_Times[i])
- {
- new pos = i
-
- while( !equal(Pro_AuthIDS[pos], authid) && pos < 15 )
- {
- pos++;
- }
-
- for (new j = pos; j > i; j--)
- {
- formatex(Pro_AuthIDS[j], 31, Pro_AuthIDS[j-1]);
- formatex(Pro_Names[j], 31, Pro_Names[j-1]);
- formatex(Pro_Date[j], 31, Pro_Date[j-1])
- Pro_Times[j] = Pro_Times[j-1];
- }
-
- formatex(Pro_AuthIDS[i], 31, authid);
- formatex(Pro_Names[i], 31, name);
- formatex(Pro_Date[i], 31, thetime)
- Pro_Times[i] = time
-
- //No olvidarse !! Aca poner para que lo Grabe :D
- save_pro15()
-
- if( Is_in_pro15 )
- {
- if( time < protiempo )
- {
-
- if( (i + 1) == 1)
- {
- client_cmd(0, "spk woop");
- ColorChat(0, GREEN, "[XJ]^x01 ^x03%s^x01 is now ^x03Leet^x01 in ^x04Pro 15^x01" , name);
- }
- else
- {
- client_cmd(0, "spk buttons/bell1");
- ColorChat(0, GREEN, "[XJ]^x01 ^x03%s^x01 is now on place ^x03%d^x01 in ^x04Pro 15^x01" , name , (i+1));
- }
- }
- }
- else
- {
- if( (i + 1) == 1)
- {
- client_cmd(0, "spk woop");
- ColorChat(0, GREEN, "[XJ]^x01 ^x03%s^x01 is now ^x03Leet^x01 in ^x04Pro 15^x01" , name);
- }
- else
- {
- client_cmd(0, "spk buttons/bell1");
- ColorChat(0, GREEN, "[XJ]^x01 ^x03%s^x01 is now on place ^x03%d^x01 in ^x04Pro 15^x01" , name , (i+1));
- }
- }
-
- return;
- }
- if( equali(Pro_AuthIDS[i], authid) )
- {
- if( time > protiempo )
- {
- return;
- }
- }
-
- }
- }
- public save_pro15()
- {
- new mapname[33], profile[128]
- get_mapname(mapname, 32)
- formatex(profile, 127, "%s/pro_%s.cfg", KZ_TOP15_DIR, mapname)
- if( file_exists(profile) )
- {
- delete_file(profile)
- }
-
- new Data[256];
- new f = fopen(profile, "at")
- for(new i = 0; i < 15; i++)
- {
- formatex(Data, 255, "^"%.2f^" ^"%s^" ^"%s^" ^"%s^"^n", Pro_Times[i], Pro_AuthIDS[i], Pro_Names[i], Pro_Date[i])
- fputs(f, Data)
- }
- fclose(f);
- }
- public read_pro15()
- {
- new mapname[33], profile[128], prodata[256]
- get_mapname(mapname, 32)
- formatex(profile, 127, "%s/pro_%s.cfg", KZ_TOP15_DIR, mapname)
- new f = fopen(profile, "rt" )
- new i = 0
- while( !feof(f) && i < 16)
- {
- fgets(f, prodata, 255)
- new totime[25]
- parse(prodata, totime, 24, Pro_AuthIDS[i], 31, Pro_Names[i], 31, Pro_Date[i], 31)
- Pro_Times[i] = str_to_float(totime)
- i++;
- }
- fclose(f)
- }
- //==================================================================================================
- public NoobTop_update(id, Float:time, checkpoints, gochecks)
- {
- new authid[32], name[32], thetime[32];
- get_user_name(id, name, 31);
- get_user_authid(id, authid, 31);
- get_time(" %d/%m/%Y ", thetime, 31);
- new bool:Is_in_noob15
- Is_in_noob15 = false
- for(new i = 0; i < 15; i++)
- {
- if( equali(Noob_AuthIDS[i], authid) )
- {
- Is_in_noob15 = true
- }
- }
- for (new i = 0; i < 15; i++)
- {
- new Float:noobtiempo = Noob_Tiempos[i]
-
- if( time < Noob_Tiempos[i])
- {
- new pos = i
-
- while( !equal(Noob_AuthIDS[pos], authid) && pos < 15 )
- {
- pos++;
- }
-
- for (new j = pos; j > i; j--)
- {
- formatex(Noob_AuthIDS[j], 31, Noob_AuthIDS[j-1]);
- formatex(Noob_Names[j], 31, Noob_Names[j-1]);
- formatex(Noob_Date[j], 31, Noob_Date[j-1])
- Noob_Tiempos[j] = Noob_Tiempos[j-1]
- Noob_CheckPoints[j] = Noob_CheckPoints[j-1]
- Noob_GoChecks[j] = Noob_GoChecks[j-1]
- }
-
- formatex(Noob_AuthIDS[i], 31, authid);
- formatex(Noob_Names[i], 31, name);
- formatex(Noob_Date[i], 31, thetime)
- Noob_Tiempos[i] = time
- Noob_CheckPoints[i] = checkpoints
- Noob_GoChecks[i] = gochecks
-
- save_Noob15()
-
- if( Is_in_noob15 )
- {
- if( time < noobtiempo )
- {
- if( (i + 1) == 1)
- {
- client_cmd(0, "spk woop")
- ColorChat(0, GREEN, "[XJ]^x01 ^x03%s^x01 is now ^x03Leet^x01 in ^x04Noob 15^x01" , name);
- }
- else
- {
- client_cmd(0, "spk buttons/bell1")
- ColorChat(0, GREEN, "[XJ]^x01 ^x03%s^x01 is now on place ^x03%d^x01 in ^x04Noob 15^x01" , name , (i+1));
- }
- }
- }
- else
- {
- if( (i + 1) == 1)
- {
- client_cmd(0, "spk woop");
- ColorChat(0, GREEN, "[XJ]^x01 ^x03%s^x01 is now ^x03Leet^x01 in ^x04Noob 15^x01" , name);
- }
- else
- {
- client_cmd(0, "spk buttons/bell1");
- ColorChat(0, GREEN, "[XJ]^x01 ^x03%s^x01 is now on place ^x03%d^x01 in ^x04Noob 15^x01" , name , (i+1));
- }
- }
-
- return;
- }
- if( equali(Noob_AuthIDS[i], authid) )
- {
- if( time > noobtiempo )
- {
- return;
- }
- }
-
- }
- }
- public save_Noob15()
- {
- new mapname[33], profile[128]
- get_mapname(mapname, 32)
- formatex(profile, 127, "%s/Noob_%s.cfg", KZ_TOP15_DIR, mapname)
- if( file_exists(profile) )
- {
- delete_file(profile)
- }
-
- new Data[256];
- new f = fopen(profile, "at")
- for(new i = 0; i < 15; i++)
- {
- formatex(Data, 255, "^"%.2f^" ^"%s^" ^"%s^" ^"%i^" ^"%i^" ^"%s^" ^n", Noob_Tiempos[i], Noob_AuthIDS[i], Noob_Names[i],Noob_CheckPoints[i], Noob_GoChecks[i],Noob_Date[i])
- fputs(f, Data)
- }
- fclose(f);
- }
- public read_Noob15()
- {
- new mapname[33], profile[128], prodata[256]
- get_mapname(mapname, 32)
- formatex(profile, 127, "%s/Noob_%s.cfg", KZ_TOP15_DIR, mapname)
- new f = fopen(profile, "rt" )
- new i = 0
- while( !feof(f) && i < 16)
- {
- fgets(f, prodata, 255)
- new totime[25], checks[5], gochecks[5]
- parse(prodata, totime, 24, Noob_AuthIDS[i], 31, Noob_Names[i], 31, checks, 4, gochecks, 4, Noob_Date[i], 31)
- Noob_Tiempos[i] = str_to_float(totime)
- Noob_CheckPoints[i] = str_to_num(checks)
- Noob_GoChecks[i] = str_to_num(gochecks)
- i++;
- }
- fclose(f)
- }
- //==================================================================================================
- public ProTop_show(id)
- {
- new buffer[2048], len, name[32]
- len = formatex(buffer, 2047, "<body bgcolor=#000000><table width=100%% cellpadding=2 cellspacing=0 border=0>")
- len += formatex(buffer[len], 2047-len, "<tr align=center bgcolor=#52697B><th width=5%%> # <th width=30%% align=left> Player <th width=25%%> Time <th width=20%%> Date ")
-
- for (new i = 0; i < 15; i++)
- {
- name = Pro_Names[i]
-
- if( Pro_Times[i] > 9999999.0 )
- {
- len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s", ((i%2)==0) ? " bgcolor=#FFFFFF" : " bgcolor=#A8A8A8", (i+1), "", "", "")
- }
- else
- {
- new minutos, Float:segundos
- minutos = floatround(Pro_Times[i], floatround_floor)/60
- segundos = Pro_Times[i] - (60*minutos)
- len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %02d:%s%.2f <td> %s", ((i%2)==0) ? " bgcolor=#FFFFFF" : " bgcolor=#A8A8A8", (i+1), Pro_Names[i], minutos, segundos < 10 ? "0" : "", segundos, Pro_Date[i])
- }
- }
- len += formatex(buffer[len], 2047-len, "</table></body>")
-
- show_motd(id, buffer, "Pro15 Climbers")
- return PLUGIN_HANDLED
- }
- public NoobTop_show(id)
- {
- new buffer[2048], name[32], len
- len = formatex(buffer, 2047, "<body bgcolor=#000000><table width=100%% cellpadding=2 cellspacing=0 border=0>")
- len += formatex(buffer[len], 2047-len, "<tr align=center bgcolor=#52697B><th width=5%%> # <th width=25%% align=left> Player <th width=20%%> Time <th width=15%%> Checkpoints <th width=15%%> GoChecks <th width=20%%> Date ")
-
- for (new i = 0; i < 15; i++)
- {
- if( Noob_Tiempos[i] > 9999999.0 )
- {
- len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? " bgcolor=#FFFFFF" : " bgcolor=#A8A8A8", (i+1), "", "", "", "", "")
- }
- else
- {
- name = Noob_Names[i]
- new minutos, Float:segundos
- minutos = floatround(Noob_Tiempos[i], floatround_floor)/60
- segundos = Noob_Tiempos[i] - (60*minutos)
-
- len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %02d:%s%.2f <td> %d <td> %d <td> %s", ((i%2)==0) ? " bgcolor=#FFFFFF" : " bgcolor=#A8A8A8", (i+1), Noob_Names[i], minutos, segundos < 10 ? "0" : "", segundos, Noob_CheckPoints[i], Noob_GoChecks[i], Noob_Date[i])
- }
- }
- len += formatex(buffer[len], 2047-len, "</table></body>")
-
- show_motd(id, buffer, "Noob15 Climbers")
- return PLUGIN_HANDLED
- }
复制代码- /* Copyright ?2008, ConnorMcLeod
- func_door is free software;
- you can redistribute it and/or modify it under the terms of the
- GNU General Public License as published by the Free Software Foundation.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with func_door; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- */
- #include <amxmodx>
- #include <amxmisc>
- #include <fakemeta>
- #include <hamsandwich>
- #include <xs>
- #define VERSION "1.0.3"
- #pragma semicolon 1
- #define MAKE_DOORS_SILENT
- //#define MAKE_TELEPORT_FX
- #define MAX_PLAYERS 32
- #define MAX_ENTSARRAYS_SIZE 64
- #define SF_BUTTON_TOUCH_ONLY 256
- #define SetIdBits(%1,%2) %1 |= 1<<(%2 & 31)
- #define ClearIdBits(%1,%2) %1 &= ~( 1<<(%2 & 31) )
- #define GetIdBits(%1,%2) %1 & 1<<(%2 & 31)
- #define SetEntBits(%1,%2) %1[%2>>5] |= 1<<(%2 & 31)
- #define ClearEntBits(%1,%2) %1[%2>>5] &= ~( 1 << (%2 & 31) )
- #define GetEntBits(%1,%2) %1[%2>>5] & 1<<(%2 & 31)
- enum _:BlocksClasses
- {
- FUNC_DOOR,
- FUNC_WALL_TOGGLE,
- FUNC_BUTTON,
- TRIGGER_MULTIPLE
- }
- enum _:Colors {
- DONT_CHANGE,
- TERRORIST,
- CT,
- SPECTATOR
- }
- new g_bitPresentClass;
- const KEYS = ((1<<0)|(1<<1)|(1<<9));
- const FL_ONGROUND2 = (FL_ONGROUND | FL_PARTIALGROUND | FL_INWATER | FL_CONVEYOR | FL_FLOAT);
- new g_iBlock[MAX_PLAYERS+1];
- new Float:g_flFirstTouch[MAX_PLAYERS+1];
- new Float:g_flJumpOrigin[MAX_PLAYERS+1][3];
- new Float:g_flJumpAnglesGravity[MAX_PLAYERS+1][3];
- new g_bBlocks[MAX_ENTSARRAYS_SIZE], g_bBlocksByPlugin[MAX_ENTSARRAYS_SIZE];
- new g_bAlives, g_bOnGround, g_bTeleported, g_bAdmin;
- new bool:g_bBlockEntityTouch;
- new bool:g_bActive;
- new bool:g_bSafeInform = true;
- new g_iFhAddToFullPack;
- new g_iAdminDoor[MAX_PLAYERS+1];
- new szConfigFile[64];
- new Trie:g_iBlocksClass;
- new g_iMaxPlayers, g_iMaxEnts;
- #define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
- public plugin_init()
- {
- register_plugin("MultiPlayer Bhop", VERSION, "ConnorMcLeod");
- new pCvar = register_cvar("mp_bhop_version", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY);
- set_pcvar_string(pCvar, VERSION);
- new const szPossibleBlockClass[][] = {"func_door", "func_wall_toggle", "func_button", "trigger_multiple"};
- g_iBlocksClass = TrieCreate();
- for(new i; i<sizeof(szPossibleBlockClass); i++)
- {
- TrieSetCell(g_iBlocksClass, szPossibleBlockClass[i], i);
- }
- register_event("Health", "Event_Health", "b");
- register_event("ResetHUD", "Event_ResetHUD", "b");
- register_concmd("kz_mpbhop", "ConsoleCommand_MpBhop", ADMIN_CFG, "<0/1>");
- register_concmd("kz_mpbhop_entitytouch", "ConsoleCommand_EntityTouch", ADMIN_CFG, "<0/1>");
- register_concmd("kz_safe_inform", "ConsoleCommand_SafeInform", ADMIN_CFG, "<0/1>");
- register_clcmd("kz_mpbhopmenu", "ClientCommand_BhopMenu", ADMIN_CFG);
- register_clcmd("kz_showblocks", "ClientCommand_ShowBlocks", ADMIN_CFG);
- register_clcmd("fullupdate", "ClientCommand_FullUpdate");
- register_menucmd(register_menuid("MpBhop Menu"), KEYS ,"MpBhopMenuAction");
- g_iMaxPlayers = get_maxplayers();
- g_iMaxEnts = global_get(glb_maxEntities);
- Set_Doors();
- Set_Wall_Toggle();
- Set_Buttons();
- SetBlocksByFile();
- SetTriggerMultiple();
- }
- public ClientCommand_FullUpdate( id )
- {
- if( g_bSafeInform )
- {
- if( g_bActive )
- {
- client_print(id, print_console, "MpBhop is Activated, recording is NOT SAFE");
- ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop is ^4Activated^1, recording is ^3NOT SAFE");
- }
- else
- {
- client_print(id, print_console, "MpBhop is De-Activated, recording is SAFE");
- ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop is ^3De-Activated^1, recording is ^4SAFE");
- }
- }
- }
- public ConsoleCommand_SafeInform(id, lvl, cid)
- {
- if( cmd_access(id, lvl, cid, 2) )
- {
- new szStatus[2];
- read_argv(1, szStatus, charsmax(szStatus));
- g_bSafeInform = !!str_to_num(szStatus);
- }
- return PLUGIN_HANDLED;
- }
- public client_putinserver(id)
- {
- if( get_user_flags(id) & ADMIN_CFG )
- {
- SetIdBits(g_bAdmin, id);
- }
- else
- {
- ClearIdBits(g_bAdmin, id);
- }
- ClearIdBits(g_bAlives, id);
- ClearIdBits(g_bOnGround, id);
- ClearIdBits(g_bTeleported, id);
- }
- public client_disconnect(id)
- {
- ClearIdBits(g_bAdmin, id);
- ClearIdBits(g_bAlives, id);
- ClearIdBits(g_bOnGround, id);
- ClearIdBits(g_bTeleported, id);
- }
- public ClientCommand_ShowBlocks(id, level, cid)
- {
- if( cmd_access(id, level, cid, 2) )
- {
- new szStatus[2];
- read_argv(1, szStatus, charsmax(szStatus));
- if( szStatus[0] == '1' )
- {
- if( !g_iFhAddToFullPack )
- {
- g_iFhAddToFullPack = register_forward(FM_AddToFullPack, "AddToFullPack", 1);
- client_print(id, print_console, "Recording with this feature Activated is NOT SAFE");
- ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1Recording with this feature ^4Activated ^1is ^3NOT SAFE");
- }
- }
- else
- {
- if( g_iFhAddToFullPack )
- {
- unregister_forward(FM_AddToFullPack, g_iFhAddToFullPack, 1);
- g_iFhAddToFullPack = 0;
- }
- }
- }
- return PLUGIN_HANDLED;
- }
- public MpBhopMenuAction(id, iKey)
- {
- new iEnt = g_iAdminDoor[id];
- switch( iKey )
- {
- case 0:
- {
- if( GetEntBits(g_bBlocks, iEnt) )
- {
- ClearEntBits(g_bBlocks, iEnt);
- ColorChat(id, _, "^1 * ^4[MpBhop] ^1Block has been set ^4movable^1.");
- }
- else
- {
- ColorChat(id, _, "^1 * ^4[MpBhop] ^1Block is already ^4movable^1.");
- }
- }
- case 1:
- {
- if( GetEntBits(g_bBlocks, iEnt) )
- {
- ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1Block is already ^3unmovable^1.");
- }
- else
- {
- SetEntBits(g_bBlocks, iEnt);
- ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1Block has been set ^3unmovable^1.");
- }
- }
- }
- return PLUGIN_HANDLED;
- }
- ShowMpBhopMenu(id, bIsBlocked)
- {
- new szMenuBody[150];
- formatex(szMenuBody, charsmax(szMenuBody), "\rMpBhop Menu^n\dThis block is actually \
- \y%smovable \d:^n^n\r1\w. Mark this block as movable^n\r2\w. Mark this block as \
- unmovable^n^n\r0\w. Exit", bIsBlocked ? "un" : "");
- show_menu(id, KEYS, szMenuBody, _, "MpBhop Menu");
- }
- public ClientCommand_BhopMenu(id, level, cid)
- {
- if( cmd_access(id, level, cid, 1) )
- {
- new iEnt, crap, iClassType;
- get_user_aiming(id, iEnt, crap);
- if( iEnt && pev_valid(iEnt) )
- {
- new szClassName[32];
- pev(iEnt, pev_classname, szClassName, charsmax(szClassName));
- if( TrieGetCell(g_iBlocksClass, szClassName, iClassType) )
- {
- g_bitPresentClass |= 1<<iClassType;
- g_iAdminDoor[id] = iEnt;
- ShowMpBhopMenu(id, !!(GetEntBits(g_bBlocks, iEnt)));
- }
- }
- }
- return PLUGIN_HANDLED;
- }
- public AddToFullPack(es, e, iEnt, id, hostflags, player, pSet)
- {
- if( !player && GetIdBits(g_bAdmin, id) && GetEntBits(g_bBlocks, iEnt) )
- {
- set_es(es, ES_RenderMode, kRenderTransColor);
- set_es(es, ES_RenderAmt, 150);
- set_es(es, ES_RenderColor, {120,75,170});
- set_es(es, ES_RenderFx, kRenderFxGlowShell);
- }
- }
- public Event_Health(id)
- {
- if( is_user_alive(id) )
- {
- SetIdBits(g_bAlives, id);
- }
- else
- {
- ClearIdBits(g_bAlives, id);
- }
- }
- public Event_ResetHUD(id)
- {
- if( is_user_alive(id) )
- {
- SetIdBits(g_bAlives, id);
- }
- else
- {
- ClearIdBits(g_bAlives, id);
- }
- }
- public CBasePlayer_PreThink(id)
- {
- if( GetIdBits(g_bAlives, id) )
- {
- if( GetIdBits(g_bTeleported, id) )
- {
- ClearIdBits(g_bTeleported, id);
- set_pev(id, pev_velocity, 0);
- return;
- }
- static fFlags;
- fFlags = pev(id, pev_flags);
- if( fFlags & FL_ONGROUND )
- {
- static iEnt, Float:flVelocity[3], Float:flVecOrigin[3];
- iEnt = pev(id, pev_groundentity);
- if( !iEnt || !(GetEntBits(g_bBlocks, iEnt)) )
- {
- if( iEnt )
- {
- pev(iEnt, pev_velocity, flVelocity);
- if( flVelocity[0] || flVelocity[1] || flVelocity[2] )
- {
- ClearIdBits(g_bOnGround, id);
- return;
- }
- }
- if( fFlags & FL_DUCKING )
- {
- pev(id, pev_origin, flVecOrigin);
- flVecOrigin[2] += 18.0;
- engfunc(EngFunc_TraceHull, flVecOrigin, flVecOrigin, IGNORE_MONSTERS, HULL_HUMAN, id, 0);
- if( !get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen) )
- {
- flVecOrigin[2] -= 18.0;
- xs_vec_copy(flVecOrigin, g_flJumpOrigin[id]);
- SetIdBits(g_bOnGround, id);
- }
- else
- {
- ClearIdBits(g_bOnGround, id);
- return;
- }
- }
- else
- {
- pev(id, pev_origin, g_flJumpOrigin[id]);
- SetIdBits(g_bOnGround, id);
- }
- }
- else
- {
- ClearIdBits(g_bOnGround, id);
- }
- }
- else if( GetIdBits(g_bOnGround, id) )
- {
- ClearIdBits(g_bOnGround, id);
- pev(id, pev_v_angle, g_flJumpAnglesGravity[id]);
- pev(id, pev_gravity, g_flJumpAnglesGravity[id][2]);
- }
- }
- }
- public TriggerMultiple_Touch(iEnt, id)
- {
- if( (IsPlayer(id) || g_bBlockEntityTouch) && GetEntBits(g_bBlocks, iEnt) )
- {
- return HAM_SUPERCEDE;
- }
- return HAM_IGNORED;
- }
- public Touch_Block(iBlock, id)
- {
- if( !(GetEntBits(g_bBlocks, iBlock)) )
- {
- return HAM_IGNORED;
- }
- if( IsPlayer(id) )
- {
- if( ~GetIdBits(g_bAlives, id) )
- {
- return HAM_SUPERCEDE;
- }
- }
- else
- {
- return g_bBlockEntityTouch ? HAM_SUPERCEDE : HAM_IGNORED;
- }
- if( pev(id, pev_groundentity) != iBlock )
- {
- return HAM_SUPERCEDE;
- }
- if( g_iBlock[id] != iBlock )
- {
- g_iBlock[id] = iBlock;
- g_flFirstTouch[id] = get_gametime();
- return HAM_SUPERCEDE;
- }
- static Float:flTime;
- flTime = get_gametime();
- if( flTime - g_flFirstTouch[id] > 0.25 ) // 0.3 == exploit on cg_cbblebhop oO
- {
- if( flTime - g_flFirstTouch[id] > 0.7 )
- {
- g_flFirstTouch[id] = flTime;
- return HAM_SUPERCEDE;
- }
- #if defined MAKE_TELEPORT_FX
- new iOrigin[3];
- get_user_origin(id, iOrigin);
- message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin);
- write_byte(TE_TELEPORT);
- write_coord(iOrigin[0]);
- write_coord(iOrigin[1]);
- write_coord(iOrigin[2]);
- message_end();
- #endif
- static const Float:VEC_DUCK_HULL_MIN[3] = {-16.0, -16.0, -18.0 };
- static const Float:VEC_DUCK_HULL_MAX[3] = { 16.0, 16.0, 32.0 };
- static const Float:VEC_DUCK_VIEW[3] = { 0.0, 0.0, 12.0 };
- set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING);
- engfunc(EngFunc_SetSize, id, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX);
- engfunc(EngFunc_SetOrigin, id, g_flJumpOrigin[id]);
- set_pev(id, pev_view_ofs, VEC_DUCK_VIEW);
- set_pev(id, pev_v_angle, 0);
- set_pev(id, pev_velocity, 0);
- set_pev(id, pev_angles, g_flJumpAnglesGravity[id]);
- set_pev(id, pev_punchangle, 0);
- set_pev(id, pev_fixangle, 1);
- set_pev(id, pev_gravity, g_flJumpAnglesGravity[id][2]);
- SetIdBits(g_bTeleported, id);
- }
- return HAM_SUPERCEDE;
- }
- public ConsoleCommand_MpBhop(id, lvl, cid)
- {
- if( cmd_access(id, lvl, cid, 2) )
- {
- new szStatus[2];
- read_argv(1, szStatus, charsmax(szStatus));
- static HamHook:iHhPlayerPreThink;
- switch( szStatus[0] )
- {
- case '0':
- {
- if( !g_bActive )
- {
- return PLUGIN_HANDLED;
- }
- if( iHhPlayerPreThink )
- {
- DisableHamForward( iHhPlayerPreThink );
- }
- SetTouch( false );
- g_bActive = false;
- if( g_bSafeInform )
- {
- client_print(0, print_console, "MpBhop has been De-Activated, recording is now SAFE");
- ColorChat(0, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop has been ^3De-Activated^1, recording is now ^4SAFE");
- }
- }
- case '1':
- {
- if( g_bActive )
- {
- return PLUGIN_HANDLED;
- }
- if( !iHhPlayerPreThink )
- {
- RegisterHam(Ham_Player_PreThink, "player", "CBasePlayer_PreThink");
- }
- else
- {
- EnableHamForward( iHhPlayerPreThink );
- }
- SetTouch( true );
- g_bActive = true;
- if( g_bSafeInform )
- {
- client_print(0, print_console, "MpBhop has been Activated, recording is now NOT SAFE");
- ColorChat(0, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop has been ^4Activated^1, recording is now ^3NOT SAFE");
- }
- }
- default:
- {
- client_print(id, print_console, "Usage: kz_mpbhop <0/1>");
- }
- }
- }
- return PLUGIN_HANDLED;
- }
- public ConsoleCommand_EntityTouch(id, lvl, cid)
- {
- if( cmd_access(id, lvl, cid, 2) )
- {
- new szStatus[2];
- read_argv(1, szStatus, charsmax(szStatus));
- g_bBlockEntityTouch = !!str_to_num(szStatus);
- }
- return PLUGIN_HANDLED;
- }
- Set_Doors()
- {
- new iDoor = FM_NULLENT;
- new Float:flMovedir[3], szNoise[32], Float:flSize[3], Float:flDmg, Float:flSpeed;
- new const szNull[] = "common/null.wav";
- while( (iDoor = engfunc(EngFunc_FindEntityByString, iDoor, "classname", "func_door")) )
- {
- // definitly not a bhop block
- pev(iDoor, pev_dmg, flDmg);
- if( flDmg )
- {
- #if defined MAKE_DOORS_SILENT
- set_pev(iDoor, pev_noise1, szNull); // while here, set healing doors silent xD
- set_pev(iDoor, pev_noise2, szNull);
- set_pev(iDoor, pev_noise3, szNull);
- #endif
- continue;
- }
- // this func_door goes UP, not a bhop block ?
- // or bhop block but let them move up (kz_megabhop for example)
- pev(iDoor, pev_movedir, flMovedir);
- if( flMovedir[2] > 0.0 )
- {
- continue;
- }
-
- // too small : real door ? could this one be skipped ?
- pev(iDoor, pev_size, flSize);
- if( flSize[0] < 24.0 || flSize[1] < 24.0 )
- {
- continue;
- }
- // real door ? not all doors make sound though...
- pev(iDoor, pev_noise1, szNoise, charsmax(szNoise));
- if( szNoise[0] && !equal(szNoise, szNull) )
- {
- continue;
- }
- pev(iDoor, pev_noise2, szNoise, charsmax(szNoise));
- if( szNoise[0] && !equal(szNoise, szNull) )
- {
- continue;
- }
- // not a bhop block ? too slow // this at least detects the big ent on kzsca_sewerbhop
- pev(iDoor, pev_speed, flSpeed);
- if( flSpeed < 100.0 )
- {
- continue;
- }
- // Pray for this to be a bhop block
- SetEntBits(g_bBlocksByPlugin, iDoor);
- SetEntBits(g_bBlocks, iDoor);
- g_bitPresentClass |= 1<<FUNC_DOOR;
- }
- }
- Set_Wall_Toggle()
- {
- new iEnt = FM_NULLENT;
- while( (iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "func_wall_toggle")) )
- {
- g_bitPresentClass |= 1<<FUNC_WALL_TOGGLE;
- SetEntBits(g_bBlocksByPlugin, iEnt);
- SetEntBits(g_bBlocks, iEnt);
- }
- }
- Set_Buttons()
- {
- new const szStartStopButtons[][] = {"counter_start", "clockstartbutton", "firsttimerelay", "multi_start",
- "counter_start_button", "counter_off", "clockstop", "clockstopbutton", "multi_stop", "stop_counter" };
- new Trie:tButtons = TrieCreate();
- for(new i; i<sizeof(szStartStopButtons); i++)
- {
- TrieSetCell(tButtons, szStartStopButtons[i], 1);
- }
- new iEnt = FM_NULLENT, szTarget[32];
- while( (iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "func_button")) )
- {
- if( pev(iEnt, pev_spawnflags) & SF_BUTTON_TOUCH_ONLY )
- {
- pev(iEnt, pev_target, szTarget, charsmax(szTarget));
- if( !szTarget[0] || !TrieKeyExists(tButtons, szTarget))
- {
- pev(iEnt, pev_targetname, szTarget, charsmax(szTarget));
- if( !szTarget[0] || !TrieKeyExists(tButtons, szTarget))
- {
- g_bitPresentClass |= 1<<FUNC_BUTTON;
- SetEntBits(g_bBlocksByPlugin, iEnt);
- SetEntBits(g_bBlocks, iEnt);
- }
- }
- }
- }
- TrieDestroy(tButtons);
- }
- SetTouch(bool:bActive)
- {
- static HamHook:iHhBlockTouch[BlocksClasses];
- if( bActive )
- {
- static const szClassesAndHandlers[BlocksClasses][][] = {
- {"func_door", "Touch_Block"},
- {"func_wall_toggle", "Touch_Block"},
- {"func_button", "Touch_Block"},
- {"trigger_multiple", "TriggerMultiple_Touch"}
- };
- for(new i; i<sizeof(iHhBlockTouch); i++)
- {
- if( g_bitPresentClass & (1<<i) )
- {
- if( iHhBlockTouch[i] )
- {
- EnableHamForward( iHhBlockTouch[i] );
- }
- else
- {
- iHhBlockTouch[i] = RegisterHam(Ham_Touch, szClassesAndHandlers[i][0], szClassesAndHandlers[i][1]);
- }
- }
- }
- }
- else
- {
- for(new i; i<sizeof(iHhBlockTouch); i++)
- {
- if( g_bitPresentClass & (1<<i) && iHhBlockTouch[i] )
- {
- DisableHamForward( iHhBlockTouch[i] );
- }
- }
- }
- }
- SetBlocksByFile()
- {
- get_localinfo("amxx_datadir", szConfigFile, charsmax(szConfigFile));
- format(szConfigFile, charsmax(szConfigFile), "%s/mpbhop", szConfigFile);
- if( !dir_exists(szConfigFile) )
- {
- mkdir(szConfigFile);
- }
- new szMapName[32];
- get_mapname(szMapName, charsmax(szMapName));
- format(szConfigFile, charsmax(szConfigFile), "%s/%s.dat", szConfigFile, szMapName);
- new iFile = fopen(szConfigFile, "rt");
- if( iFile )
- {
- new szDatas[48], szBrushOrigin[3][13], szType[2], Float:flBrushOrigin[3], i, iEnt;
- new szClassName[32], iClassType;
- while( !feof(iFile) )
- {
- fgets(iFile, szDatas, charsmax(szDatas));
- trim(szDatas);
- if(!szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/'))
- {
- continue;
- }
- parse(szDatas, szBrushOrigin[0], 12, szBrushOrigin[1], 12, szBrushOrigin[2], 12, szType, charsmax(szType));
- for(i=0; i<3; i++)
- {
- flBrushOrigin[i] = str_to_float( szBrushOrigin[i] );
- }
- iEnt = FindEntByBrushOrigin( flBrushOrigin );
- if( iEnt )
- {
- if( szType[0] == '1' )
- {
- pev(iEnt, pev_classname, szClassName, charsmax(szClassName));
- if( TrieGetCell(g_iBlocksClass, szClassName, iClassType) )
- {
- g_bitPresentClass |= 1<<iClassType;
- }
- SetEntBits(g_bBlocks, iEnt);
- }
- else
- {
- ClearEntBits(g_bBlocks, iEnt);
- }
- }
- }
- fclose(iFile);
- }
- }
- FindEntByBrushOrigin(Float:flOrigin[3])
- {
- new Float:flBrushOrigin[3];
- for( new iEnt=g_iMaxPlayers+1; iEnt<=g_iMaxEnts; iEnt++ )
- {
- if( pev_valid(iEnt) )
- {
- fm_get_brush_entity_origin(iEnt, flBrushOrigin);
- if( xs_vec_nearlyequal(flBrushOrigin, flOrigin) )
- {
- return iEnt;
- }
- }
- }
- return 0;
- }
- fm_get_brush_entity_origin(ent, Float:orig[3])
- {
- new Float:Min[3], Float:Max[3];
- pev(ent, pev_origin, orig);
- pev(ent, pev_mins, Min);
- pev(ent, pev_maxs, Max);
- orig[0] += (Min[0] + Max[0]) * 0.5;
- orig[1] += (Min[1] + Max[1]) * 0.5;
- orig[2] += (Min[2] + Max[2]) * 0.5;
- return 1;
- }
- SetTriggerMultiple()
- {
- new iEnt = FM_NULLENT, szTarget[32], iBlock;
- while( (iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "trigger_multiple")) )
- {
- pev(iEnt, pev_target, szTarget, charsmax(szTarget));
- iBlock = engfunc(EngFunc_FindEntityByString, -1, "targetname", szTarget);
- if( iBlock && GetEntBits(g_bBlocks, iBlock) )
- {
- g_bitPresentClass |= 1<<TRIGGER_MULTIPLE;
- SetEntBits(g_bBlocksByPlugin, iEnt);
- SetEntBits(g_bBlocks, iEnt);
- }
- }
- }
- public plugin_end()
- {
- TrieDestroy(g_iBlocksClass);
- delete_file(szConfigFile);
- new iFile;
- new Float:flBrushOrigin[3], bool:bUnMovable;
- for(new iEnt=g_iMaxPlayers+1; iEnt<=g_iMaxEnts; iEnt++)
- {
- if( pev_valid(iEnt) )
- {
- bUnMovable = !!( GetEntBits(g_bBlocks, iEnt) );
- if( bUnMovable
- != !!( GetEntBits(g_bBlocksByPlugin, iEnt) ) )
- {
- if( !iFile )
- {
- iFile = fopen(szConfigFile, "wt");
- }
- fm_get_brush_entity_origin(iEnt, flBrushOrigin);
- fprintf(iFile, "%f %f %f %d^n",
- flBrushOrigin[0], flBrushOrigin[1], flBrushOrigin[2], bUnMovable);
- }
- }
- }
- if( iFile )
- {
- fclose( iFile );
- }
- }
- ColorChat(id, COLOR=DONT_CHANGE, fmt[], any:...)
- {
- new szMsg[192];
- szMsg[0] = 0x04;
- vformat(szMsg[1], charsmax(szMsg)-1, fmt, 4);
- new szTeam[11], MSG_DEST = id ? MSG_ONE : MSG_ALL;
- static const szTeamNames[Colors][] = {"", "TERRORIST", "CT", "SPECTATOR"};
- if( COLOR )
- {
- Send_TeamInfo(id, szTeamNames[COLOR], MSG_DEST);
- }
- static iSayText;
- if( iSayText || (iSayText = get_user_msgid("SayText")) )
- {
- message_begin(MSG_DEST, iSayText, _, id);
- {
- write_byte(id ? id : g_iMaxPlayers);
- write_string(szMsg);
- }
- message_end();
- }
- if( COLOR )
- {
- if( id || is_user_connected(g_iMaxPlayers) )
- {
- get_user_team(id ? id : g_iMaxPlayers, szTeam, charsmax(szTeam));
- Send_TeamInfo(id, szTeam, MSG_DEST);
- }
- else
- {
- Send_TeamInfo(0, "UNASSIGNED", MSG_DEST);
- }
- }
- }
- Send_TeamInfo(const id, const szTeam[], MSG_DEST)
- {
- static iTeamInfo;
- if( iTeamInfo || (iTeamInfo = get_user_msgid("TeamInfo")) )
- {
- message_begin(MSG_DEST, iTeamInfo, _, id);
- {
- write_byte(id ? id : g_iMaxPlayers);
- write_string(szTeam);
- }
- message_end();
- }
- }
复制代码
[code][/code] |
|