Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <cstrike>
- #include <colorchat>
- #include <fun>
- #include <fakemeta>
- #include <hamsandwich>
- //#define USE_SQL
- #if defined USE_SQL
- #include <sqlx>
- #include <geoip>
- #endif
- #define TASK_ID_MINISECOND 1330
- #define KZ_LEVEL ADMIN_KICK
- #define MSG MSG_ONE_UNRELIABLE
- #define MAX_ENTITYS 900+15*32
- #define IsOnLadder(%1) (pev(%1, pev_movetype) == MOVETYPE_FLY)
- #define VERSION "2.31"
- #define SCOREATTRIB_NONE 0
- #define SCOREATTRIB_DEAD ( 1 << 0 )
- #define SCOREATTRIB_BOMB ( 1 << 1 )
- #define SCOREATTRIB_VIP ( 1 << 2 )
- 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 FL_ONGROUND2 = ( FL_ONGROUND | FL_PARTIALGROUND | FL_INWATER | FL_CONVEYOR | FL_FLOAT )
- new const KZ_STARTFILE[] = "start.ini"
- new const KZ_STARTFILE_TEMP[] = "temp_start.ini"
- new const KZ_ENDFILE[] = "end.ini"
- new const KZ_ENDFILE_TEMP[] = "temp_end.ini"
- #if defined USE_SQL
- new Handle:g_SqlTuple
- new Handle:SqlConnection
- new g_Error[512]
- new kz_sql_host
- new kz_sql_user
- new kz_sql_pass
- new kz_sql_db
- new kz_sql_name
- new kz_sql_files
- #else
- 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 Noob_Weapon[24][32]
- #endif
- new Float:Checkpoints[33][2][3]
- new Float:timer_time[33]
- new Float:g_pausetime[33]
- new Float:antihookcheat[33]
- new Float:SpecLoc[33][3]
- new Float:NoclipPos[33][3]
- new Float:PauseOrigin[33][3]
- new Float:SavedStart[33][3]
- new hookorigin[33][3]
- new Float:DefaultStartPos[3]
- new Float:SavedEnd[33][3]
- new Float:DefaultEndPos[3]
- new Float:MyStartPos[33][3]
- new bool:MyStart[33]
- new Float:SavedTime[33]
- new SavedChecks[33]
- new SavedGoChecks[33]
- new SavedScout[33]
- new SavedOrigins[33][3]
- new bool:g_bCpAlternate[33]
- new bool:timer_started[33]
- new bool:IsPaused[33]
- new bool:WasPaused[33]
- new bool:firstspawn[33]
- new bool:canusehook[33]
- new bool:ishooked[33]
- new bool:user_has_scout[33]
- new bool:NightVisionUse[33]
- new bool:HealsOnMap
- new bool:gViewInvisible[33]
- new bool:gMarkedInvisible[33] = { true, ...};
- new bool:gWaterInvisible[33]
- new bool:gWaterEntity[MAX_ENTITYS]
- new bool:gWaterFound
- new bool:DefaultStart
- new bool:AutoStart[33]
- new bool:DefaultEnd
- new bool:AutoEnd[33]
- new Trie:g_tStarts
- new Trie:g_tStops;
- new checknumbers[33]
- new gochecknumbers[33]
- new chatorhud[33]
- new ShowTime[33]
- new MapName[64]
- new Kzdir[128]
- new SavePosDir[128]
- new prefix[33]
- #if !defined USE_SQL
- new Topdir[128]
- #endif
- new kz_checkpoints
- new kz_cheatdetect
- new kz_spawn_mainmenu
- new kz_show_timer
- new kz_chatorhud
- new kz_hud_color
- new kz_chat_prefix
- new hud_message
- new kz_other_weapons
- new kz_maxspeedmsg
- new kz_drop_weapons
- new kz_remove_drops
- new kz_pick_weapons
- new kz_reload_weapons
- new kz_use_radio
- new kz_hook_prize
- new kz_hook_sound
- new kz_hook_speed
- new kz_pause
- new kz_noclip_pause
- new kz_nvg
- new kz_nvg_colors
- new kz_vip
- new kz_respawn_ct
- new kz_save_pos
- new kz_save_pos_gochecks
- new kz_semiclip
- new kz_semiclip_transparency
- new kz_spec_saves
- new kz_save_autostart
- new kz_save_autoEnd
- new kz_top15_authid
- new Sbeam = 0
- new g_showkey[33];
- new g_hud_center;
- new g_idspecting[2][33]
- new givehook[33][32]
- new const Float:lj_position[46][3] =
- {
- {-1055.003051, 578.635498, -835.968750},
- {-1337.197631, 577.174560, -835.968750},
- {-1651.245117, 581.575073, -835.968750},
- {-1921.205322, 587.690368, -835.968750},
- {-2213.586669, 588.194885, -835.968750},
- {-2502.909179, 597.480102, -835.968750},
- {-2784.991210, 590.543945, -835.968750},
- {-3078.690673, 617.415283, -835.968750},
- {-3368.292236, 618.033691, -835.968750},
- {-3655.670166, 618.645690, -835.968750},
- {346.657379, -65.992279, -835.968750},
- {343.470245, -370.965698, -835.968750},
- {368.199707, -644.888305, -835.968750},
- {362.770263, -948.266723, -835.968750},
- {350.296752, -1231.697998, -835.968750},
- {342.843292, -1519.162109, -835.968750},
- {337.480926, -1804.483276, -835.968750},
- {349.853942, -2086.625244, -835.968750},
- {340.216217, -2378.290283, -835.968750},
- {329.746215, -2667.063964, -835.968750},
- {992.000000, 1344.000000, -835.968750},
- {1293.783691, 1325.809326, -835.968750},
- {1558.312500, 1325.479858, -835.968750},
- {1859.839111, 1332.097900, -835.968750},
- {2151.729492, 1329.970092, -835.968750},
- {2441.665771, 1327.857421, -835.968750},
- {2720.086914, 1337.539184, -835.968750},
- {3008.200195, 1337.607666, -835.968750},
- {3298.108154, 1340.810424, -835.968750},
- {3586.843750, 1342.000732, -835.968750},
- {352.000000, -64.000000, -1315.968750},
- {360.576812, -359.372985, -1315.968750},
- {359.121459, -646.579345, -1315.968750},
- {361.546752, -937.313232, -1315.968750},
- {361.411743, -1219.124267, -1315.968750},
- {361.272125, -1509.990844, -1315.968750},
- {362.045288, -1797.906250, -1315.968750},
- {362.804931, -2080.791015, -1315.968750},
- {363.589141, -2372.813232, -1315.968750},
- {364.382202, -2668.154785, -1315.968750},
- {-1056.000000, 576.000000, -1315.968750},
- {-1361.455688, 577.189392, -1315.968750},
- {-1636.939819, 581.278381, -1315.968750},
- {-1939.184692, 557.332946, -1315.968750},
- {-2225.302734, 563.066894, -1315.968750},
- {-2507.784423, 568.727539, -1315.968750}
- };
- new const Float:bhop_position[31][3] =
- {
- {-1112.000000, 856.000000, -2603.968750},
- {-1384.000000, 856.000000, -2603.968750},
- {-1656.000000, 856.000000, -2603.968750},
- {-1928.000000, 856.000000, -2603.968750},
- {-2200.000000, 856.000000, -2603.968750},
- {-2472.000000, 856.000000, -2603.968750},
- {-2744.000000, 856.000000, -2603.968750},
- {-3016.000000, 856.000000, -2603.968750},
- {-3288.000000, 856.000000, -2603.968750},
- {-3560.000000, 856.000000, -2603.968750},
- {276.000000, 216.000000, -2603.968750},
- {276.000000, -56.000000, -2603.968750},
- {276.000000, -328.000000, -2603.968750},
- {276.000000, -600.000000, -2603.968750},
- {276.000000, -872.000000, -2603.968750},
- {276.000000, -1144.000000, -2603.968750},
- {276.000000, -1416.000000, -2603.968750},
- {276.000000, -1688.000000, -2603.968750},
- {276.000000, -1960.000000, -2603.968750},
- {276.000000, -2232.000000, -2603.968750},
- {920.000000, 1604.000000, -2603.968750},
- {1192.000000, 1604.000000, -2603.968750},
- {1464.000000, 1604.000000, -2603.968750},
- {1736.000000, 1604.000000, -2603.968750},
- {2008.000000, 1604.000000, -2603.968750},
- {2280.000000, 1604.000000, -2603.968750},
- {2552.000000, 1604.000000, -2603.968750},
- {2824.000000, 1604.000000, -2603.968750},
- {3096.000000, 1604.000000, -2603.968750},
- {3368.000000, 1604.000000, -2603.968750},
- {3640.000000, 1604.000000, -2603.968750}
- };
- new const Float:cj_position[36][3] =
- {
- {510.419097, -570.309509, -1987.968750},
- {895.791259, -568.062133, -1987.968750},
- {1278.016967, -562.385681, -1987.968750},
- {1666.351440, -555.636962, -1987.968750},
- {2065.401367, -546.061279, -1987.968750},
- {2040.247924, -937.604553, -1987.968750},
- {1665.417480, -928.629760, -1987.968750},
- {1275.896606, -928.826965, -1987.968750},
- {892.463623, -917.491577, -1987.968750},
- {502.266082, -920.462524, -1987.968750},
- {-508.481475, -913.018859, -1987.968750},
- {-886.500610, -895.082397, -1987.968750},
- {-1288.920410, -892.894775, -1987.968750},
- {-1657.170654, -899.145629, -1987.968750},
- {-2049.642333, -921.599304, -1987.968750},
- {-2060.020996, -567.047363, -1987.968750},
- {-1666.292602, -567.379882, -1987.968750},
- {-1277.856201, -580.906982, -1987.968750},
- {-897.188049, -579.648559, -1987.968750},
- {-499.895538, -590.854248, -1987.968750},
- {-146.453659, 539.329589, -1987.968750},
- {-153.383697, 920.178405, -1987.968750},
- {-144.053710, 1307.472045, -1987.968750},
- {-147.273071, 1687.733276, -1987.968750},
- {-164.247619, 2066.548095, -1987.968750},
- {148.882644, 2073.309326, -1987.968750},
- {154.298782, 1683.728881, -1987.968750},
- {159.601821, 1302.276245, -1987.968750},
- {164.697799, 935.719665, -1987.968750},
- {170.312454, 536.241882, -1987.968750},
- {779.433044, -2107.653808, -1987.968750},
- {382.840240, -2114.206054, -1987.968750},
- {3.906657, -2098.052978, -1987.968750},
- {-372.657531, -2098.760986, -1987.968750},
- {-772.508483, -2103.706787, -1987.968750},
- {-1153.285888, -2091.457519, -1987.968750}
- };
- new const Float:hj_position[31][3] =
- {
- {-1106.355468, 878.013427, -3163.968750},
- {-1367.504028, 913.048767, -3163.968750},
- {-1647.023071, 908.966552, -3163.968750},
- {-1917.632080, 910.012084, -3163.968750},
- {-2182.140380, 911.779602, -3163.968750},
- {-2470.787353, 910.848754, -3163.968750},
- {-2722.177978, 914.569641, -3163.968750},
- {-3000.114501, 910.841430, -3163.981689},
- {-3281.111572, 912.804687, -3163.981689},
- {-3556.852294, 913.801147, -3163.968750},
- {240.000000, 216.000000, -3163.968750},
- {241.124816, -56.954338, -3163.968750},
- {239.805801, -340.236358, -3163.968750},
- {240.463912, -606.579223, -3163.968750},
- {238.570556, -880.856750, -3163.968750},
- {241.137466, -1151.218872, -3163.968750},
- {241.707733, -1414.711181, -3163.968750},
- {240.443603, -1703.864868, -3163.968750},
- {240.031265, -1949.415161, -3163.968750},
- {239.354141, -2221.444580, -3163.968750},
- {936.000000, 1616.000000, -3163.968750},
- {1228.001831, 1617.031494, -3163.968750},
- {1498.516601, 1616.019775, -3163.968750},
- {1767.118408, 1615.015380, -3163.968750},
- {2020.724975, 1614.067138, -3163.968750},
- {2308.373291, 1613.513305, -3163.968750},
- {2571.921875, 1614.751342, -3163.968750},
- {2856.849365, 1615.914428, -3163.968750},
- {3121.180664, 1613.757812, -3163.968750},
- {3393.780029, 1613.029541, -3163.968750},
- {3661.197998, 1615.132324, -3163.968750}
- };
- new const Float:ladder_position[21][3] =
- {
- {-857.883483, -416.029144, 612.031250},
- {-856.920715, -272.506286, 612.031250},
- {-855.968750, -130.703628, 612.031250},
- {-853.100952, 13.096566, 612.031250},
- {-850.177490, 159.679611, 612.031250},
- {-867.020446, 299.906280, 612.031250},
- {-864.290527, 446.658813, 612.031250},
- {-861.931030, 589.741088, 612.031250},
- {-859.532470, 735.175231, 612.031250},
- {-857.180053, 877.828247, 612.031250},
- {-682.690917, 1048.701904, 612.031250},
- {-533.808044, 1040.901000, 612.031250},
- {-389.494995, 1036.525024, 612.031250},
- {-247.663177, 1032.294921, 612.031250},
- {-104.602775, 1027.355712, 612.031250},
- {37.518779, 1013.453491, 612.031250},
- {183.952041, 1008.388732, 612.031250},
- {324.939300, 1008.444580, 612.031250},
- {471.211456, 1008.567443, 612.031250},
- {617.199951, 1008.176391, 612.031250},
- {761.598754, 1008.002502, 612.031250}
- }
- new const Float:place_position[5][3] =
- {
- {-32.000000, 1312.000000, -835.968750},
- {-96.000000, 1584.000000, -2603.968750},
- {0.000000, -40.000000, -1987.968750},
- {-80.000000, 1584.000000, -3163.968750},
- {-1168.000000, -656.000000, 740.031250}
- }
- //==============================================
- new const other_weapons[8] =
- {
- CSW_SCOUT, CSW_P90, CSW_FAMAS, CSW_SG552,
- CSW_M4A1, CSW_M249, CSW_AK47, CSW_AWP
- }
- new const other_weapons_name[8][] =
- {
- "weapon_scout", "weapon_p90", "weapon_famas", "weapon_sg552",
- "weapon_m4a1", "weapon_m249", "weapon_ak47", "weapon_awp"
- }
- new const g_weaponsnames[][] =
- {
- "", // NULL
- "p228", "shield", "scout", "hegrenade", "xm1014", "c4",
- "mac10", "aug", "smokegrenade", "elite", "fiveseven",
- "ump45", "sg550", "galil", "famas", "usp", "glock18",
- "awp", "mp5navy", "m249", "m3", "m4a1", "tmp", "g3sg1",
- "flashbang", "deagle", "sg552", "ak47", "knife", "p90",
- "glock", "elites", "fn57", "mp5", "vest", "vesthelm",
- "flash", "hegren", "sgren", "defuser", "nvgs", "primammo",
- "secammo", "km45", "9x19mm", "nighthawk", "228compact",
- "12gauge", "autoshotgun", "mp", "c90", "cv47", "defender",
- "clarion", "krieg552", "bullpup", "magnum", "d3au1",
- "krieg550"
- }
- new const g_block_commands[][]=
- {
- "buy", "buyammo1", "buyammo2", "buyequip",
- "cl_autobuy", "cl_rebuy", "cl_setautobuy", "cl_setrebuy"
- }
- #if defined USE_SQL
- enum
- {
- TOP_NULL,
- PRO_TOP,
- NUB_TOP,
- LAST_PRO10,
- PRO_RECORDS,
- PLAYERS_RANKING,
- MAPS_STATISTIC
- }
- #endif
- // =================================================================================================
- public plugin_init()
- {
- register_plugin("ProKreedz", VERSION, "f0rged")
- new mapita[32];
- get_mapname(mapita, 31);
- if(equali(mapita, "kz_longjumps2"))
- {
- register_clcmd("say", "hooksay");
- register_clcmd("say_team", "hooksay");
- }
- g_hud_center = CreateHudSyncObj();
- kz_checkpoints = register_cvar("kz_checkpoints","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_chat_prefix = register_cvar("kz_chat_prefix", "[KZ-Arg]")
- kz_hud_color = register_cvar("kz_hud_color", "255 255 255")
- 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_pick_weapons = register_cvar("kz_pick_weapons", "0")
- kz_reload_weapons = register_cvar("kz_reload_weapons", "0")
- 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_hook_speed = register_cvar("kz_hook_speed", "500.0")
- kz_use_radio = register_cvar("kz_use_radio", "0")
- kz_pause = register_cvar("kz_pause", "1")
- kz_noclip_pause = register_cvar("kz_noclip_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_semiclip_transparency = register_cvar ("kz_semiclip_transparency", "85")
- kz_spec_saves = register_cvar("kz_spec_saves", "1")
- kz_save_autostart = register_cvar("kz_save_autostart", "1")
- kz_save_autoEnd = register_cvar("kz_save_autoEnd", "1")
- kz_top15_authid = register_cvar("kz_top15_authid", "0")
- kz_save_pos = register_cvar("kz_save_pos", "1")
- kz_save_pos_gochecks = register_cvar("kz_save_pos_gochecks", "1")
- #if defined USE_SQL
- kz_sql_host = register_cvar("kz_sql_host", "") // Host of DB
- kz_sql_user = register_cvar("kz_sql_user", "") // Username of DB
- kz_sql_pass = register_cvar("kz_sql_pass", "", FCVAR_PROTECTED) // Password for DB user
- kz_sql_db = register_cvar("kz_sql_db", "") // DB Name for the top 15
- kz_sql_name = register_cvar("kz_sql_server", "") // Name of server
- kz_sql_files = register_cvar("kz_sql_files", "") // Path of the PHP files
- #endif
- register_clcmd("/cp","CheckPoint")
- register_clcmd("drop", "BlockDrop")
- register_clcmd("/gc", "GoCheck")
- register_clcmd("+hook","hook_on",KZ_LEVEL)
- register_clcmd("-hook","hook_off",KZ_LEVEL)
- register_concmd("kz_hook","give_hook", KZ_LEVEL, "<name|#userid|steamid|@ALL> <on/off>")
- register_concmd("nightvision","ToggleNVG")
- register_clcmd("radio1", "BlockRadio")
- register_clcmd("radio2", "BlockRadio")
- register_clcmd("radio3", "BlockRadio")
- register_clcmd("/tp","GoCheck")
- register_clcmd("chooseteam", "kz_menu")
- kz_register_saycmd("cp","CheckPoint",0)
- kz_register_saycmd("chatorhud", "ChatHud", 0)
- kz_register_saycmd("ct","ct",0)
- kz_register_saycmd("end", "goEnd", 0)
- kz_register_saycmd("gc", "GoCheck",0)
- kz_register_saycmd("gocheck", "GoCheck",0)
- kz_register_saycmd("god", "GodMode",0)
- kz_register_saycmd("godmode", "GodMode", 0)
- kz_register_saycmd("invis", "InvisMenu", 0)
- kz_register_saycmd("kz", "kz_menu", 0)
- kz_register_saycmd("menu","kz_menu", 0)
- kz_register_saycmd("nc", "noclip", 0)
- kz_register_saycmd("noclip", "noclip", 0)
- kz_register_saycmd("noob10", "NoobTop_show", 0)
- kz_register_saycmd("noob15", "NoobTop_show", 0)
- kz_register_saycmd("nub10", "NoobTop_show", 0)
- kz_register_saycmd("nub15", "NoobTop_show", 0)
- kz_register_saycmd("pause", "Pause", 0)
- kz_register_saycmd("pinvis", "cmdInvisible", 0)
- kz_register_saycmd("pro10", "ProTop_show", 0)
- kz_register_saycmd("pro15", "ProTop_show", 0)
- kz_register_saycmd("reset", "reset_checkpoints", 0)
- kz_register_saycmd("respawn", "goStart", 0)
- kz_register_saycmd("savepos", "SavePos", 0)
- kz_register_saycmd("scout", "cmdScout", 0)
- kz_register_saycmd("setend", "setEnd", KZ_LEVEL)
- kz_register_saycmd("setstart", "setStart", KZ_LEVEL)
- kz_register_saycmd("showtimer", "ShowTimer_Menu", 0)
- kz_register_saycmd("spec", "ct", 0)
- kz_register_saycmd("start", "goStart", 0)
- kz_register_saycmd("stuck", "Stuck", 0)
- kz_register_saycmd("teleport", "GoCheck", 0)
- kz_register_saycmd("timer", "ShowTimer_Menu", 0)
- kz_register_saycmd("top15", "top15menu",0)
- kz_register_saycmd("top10", "top15menu",0)
- kz_register_saycmd("tp", "GoCheck",0)
- kz_register_saycmd("usp", "cmdUsp", 0)
- kz_register_saycmd("weapons", "weapons", 0)
- kz_register_saycmd("guns", "weapons", 0)
- kz_register_saycmd("winvis", "cmdWaterInvisible", 0)
- kz_register_saycmd("showkeys", "cmdShowKey", 0)
- kz_register_saycmd("givehook", "set_hook", KZ_LEVEL)
- kz_register_saycmd("mystart", "customStart", 0)
- #if defined USE_SQL
- kz_register_saycmd("prorecords", "ProRecs_show", 0)
- kz_register_saycmd("prorecs", "ProRecs_show", 0)
- #endif
- register_event("CurWeapon", "curweapon", "be", "1=1")
- register_event( "StatusValue", "EventStatusValue", "b", "1>0", "2>0" );
- 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_Touch, "weaponbox", "FwdSpawnWeaponbox" )
- RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 )
- RegisterHam( Ham_Touch, "weaponbox", "GroundWeapon_Touch")
- register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" )
- register_dictionary("prokreedz.txt")
- get_pcvar_string(kz_chat_prefix, prefix, 32)
- get_mapname(MapName, 63)
- set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
- set_task(0.1,"timer_task",2000,"",0,"ab")
- #if defined USE_SQL
- set_task(0.2, "plugin_sql")
- #endif
- new kreedz_cfg[128], ConfigDir[64]
- get_configsdir( ConfigDir, 64)
- formatex(Kzdir,128, "%s/kz", ConfigDir)
- if( !dir_exists(Kzdir) )
- mkdir(Kzdir)
- #if !defined USE_SQL
- formatex(Topdir,128, "%s/top15", Kzdir)
- if( !dir_exists(Topdir) )
- mkdir(Topdir)
- #endif
- formatex(SavePosDir, 128, "%s/savepos", Kzdir)
- if( !dir_exists(SavePosDir) )
- mkdir(SavePosDir)
- formatex(kreedz_cfg,128,"%s/kreedz.cfg", Kzdir)
- if( file_exists( kreedz_cfg ) )
- {
- server_exec()
- server_cmd("exec %s",kreedz_cfg)
- }
- for(new i = 0; i < sizeof(g_block_commands) ; i++)
- register_clcmd(g_block_commands[i], "BlockBuy")
- 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 )
- }
- #if defined USE_SQL
- public plugin_sql()
- {
- new host[64], user[64], pass[64], db[64]
- get_pcvar_string(kz_sql_host, host, 63)
- get_pcvar_string(kz_sql_user, user, 63)
- get_pcvar_string(kz_sql_pass, pass, 63)
- get_pcvar_string(kz_sql_db, db, 63)
- g_SqlTuple = SQL_MakeDbTuple(host, user, pass, db)
- new ErrorCode
- SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
- if(!SqlConnection)
- {
- server_print("[KZ-Arg] TOP15 SQL: Could not connect to SQL database.!")
- log_amx("[KZ-Arg] TOP15 SQL: Could not connect to SQL database.")
- return pause("a")
- }
- new createinto[1001]
- formatex(createinto, 1000, "CREATE TABLE IF NOT EXISTS `kz_pro15` (`mapname` varchar(64) NOT NULL, `authid` varchar(64) NOT NULL, `countty` varchar(6) NOT NULL, `name` varchar(64) NOT NULL, `time` decimal(65,2) NOT NULL, `date` datetime NOT NULL, `weapon` varchar(64) NOT NULL, `server` varchar(64) NOT NULL)")
- SQL_ThreadQuery(g_SqlTuple,"QueryHandle", createinto)
- formatex(createinto, 1000, "CREATE TABLE IF NOT EXISTS `kz_nub15` (`mapname` varchar(64) NOT NULL, `authid` varchar(64) NOT NULL, `countty` varchar(6) NOT NULL, `name` varchar(64) NOT NULL, `time`decimal(65,2) NOT NULL, `date` datetime NOT NULL, `weapon` varchar(64) NOT NULL, `server` varchar(64) NOT NULL, `checkpoints` real NOT NULL, `gocheck` real NOT NULL)")
- SQL_ThreadQuery(g_SqlTuple,"QueryHandle", createinto)
- return PLUGIN_CONTINUE
- }
- public QueryHandle(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
- {
- if( iFailState != TQUERY_SUCCESS )
- {
- log_amx("[KZ-Arg] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
- ColorChat(0, GREEN, "[KZ-Arg]^x01: Warning the SQL Tops can not be saved.")
- }
- server_print("[KZ-Arg] Server Sending Info to SQL Server")
- return PLUGIN_CONTINUE
- }
- #endif
- public plugin_precache()
- {
- hud_message = CreateHudSyncObj()
- RegisterHam( Ham_Spawn, "func_door", "FwdHamDoorSpawn", 1 )
- precache_sound("weapons/xbow_hit2.wav")
- Sbeam = precache_model("sprites/laserbeam.spr")
- }
- public plugin_cfg()
- {
- #if !defined USE_SQL
- for (new i = 0 ; i < 15; ++i)
- {
- Pro_Times[i] = 999999999.00000;
- Noob_Tiempos[i] = 999999999.00000;
- }
- read_pro15()
- read_Noob15()
- #endif
- new endcheck[100], dataa[256], mapp[64], xx[13], yx[13], zx[13];
- formatex(endcheck, 99, "%s/%s", Kzdir, KZ_ENDFILE)
- new fx = fopen(endcheck, "rt" )
- while( !feof( fx ) )
- {
- fgets( fx, dataa, sizeof dataa - 1 )
- parse( dataa, mapp, 63, xx, 12, yx, 12, zx, 12)
- if( equali( mapp, MapName ) )
- {
- DefaultEndPos[0] = str_to_float(xx)
- DefaultEndPos[1] = str_to_float(yx)
- DefaultEndPos[2] = str_to_float(zx)
- DefaultEnd = true
- break;
- }
- }
- fclose(fx)
- new startcheck[100], data[256], map[64], x[13], y[13], z[13];
- formatex(startcheck, 99, "%s/%s", Kzdir, KZ_STARTFILE)
- new f = fopen(startcheck, "rt" )
- while( !feof( f ) )
- {
- fgets( f, data, sizeof data - 1 )
- parse( data, map, 63, x, 12, y, 12, z, 12)
- if( equali( map, MapName ) )
- {
- DefaultStartPos[0] = str_to_float(x)
- DefaultStartPos[1] = str_to_float(y)
- DefaultStartPos[2] = str_to_float(z)
- DefaultStart = true
- break;
- }
- }
- fclose(f)
- 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;
- }
- }
- }
- public client_command(id)
- {
- new sArg[13];
- if( read_argv(0, sArg, 12) > 11 )
- {
- return PLUGIN_CONTINUE;
- }
- for( new i = 0; i < sizeof(g_weaponsnames); i++ )
- {
- if( equali(g_weaponsnames[i], sArg, 0) )
- {
- return PLUGIN_HANDLED;
- }
- }
- return PLUGIN_CONTINUE;
- }
- // =================================================================================================
- // Global Functions
- // =================================================================================================
- public Pause(id)
- {
- if (get_pcvar_num(kz_pause) == 0)
- {
- kz_chat(id, "%L", id, "KZ_PAUSE_DISABLED")
- return PLUGIN_HANDLED
- }
- if(! is_user_alive(id) )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- if(!IsPaused[id])
- {
- if(! timer_started[id])
- {
- kz_chat(id, "%L", id, "KZ_TIMER_NOT_STARTED")
- return PLUGIN_HANDLED
- }
- g_pausetime[id] = get_gametime() - timer_time[id]
- timer_time[id] = 0.0
- IsPaused[id] = true
- kz_chat(id, "%L", id, "KZ_PAUSE_ON")
- set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
- pev(id, pev_origin, PauseOrigin[id])
- }
- else
- {
- if(timer_started[id])
- {
- kz_chat(id, "%L", id, "KZ_PAUSE_OFF")
- if(get_user_noclip(id))
- noclip(id)
- timer_time[id] = get_gametime() - g_pausetime[id]
- }
- IsPaused[id] = false
- set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
- }
- return PLUGIN_HANDLED
- }
- public timer_task()
- {
- if ( get_pcvar_num(kz_show_timer) > 0 )
- {
- new Alive[32], Dead[32], alivePlayers, deadPlayers;
- get_players(Alive, alivePlayers, "ach")
- get_players(Dead, deadPlayers, "bch")
- for(new i=0;i<alivePlayers;i++)
- {
- if( timer_started[Alive[i]])
- {
- new Float:kreedztime = get_gametime() - (IsPaused[Alive[i]] ? get_gametime() - g_pausetime[Alive[i]] : timer_time[Alive[i]])
- if( ShowTime[Alive[i]] == 1 )
- {
- new colors[12], r[4], g[4], b[4];
- new imin = floatround(kreedztime / 60.0,floatround_floor)
- new isec = floatround(kreedztime - imin * 60.0,floatround_floor)
- new ims = floatround( ( kreedztime - ( imin * 60.0 + isec ) ) * 100.0, floatround_floor )
- get_pcvar_string(kz_hud_color, colors, 11)
- parse(colors, r, 255, g, 255, b, 255)
- set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), -1.0, 0.02, 0, 0.0, 1.0, 0.0, 0.0, 1)
- show_hudmessage(Alive[i], "[ %02d:%02d.%02d ] %s",imin, isec, ims, IsPaused[Alive[i]] ? "" : "")
- }
- else
- if( ShowTime[Alive[i]] == 2 )
- {
- kz_showtime_roundtime(Alive[i], floatround(kreedztime))
- }
- }
- }
- for(new i=0;i<deadPlayers;i++)
- {
- new specmode = pev(Dead[i], pev_iuser1)
- if(specmode == 2 || specmode == 4)
- {
- new target = pev(Dead[i], pev_iuser2)
- if(target != Dead[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 = get_gametime() - (IsPaused[target] ? get_gametime() - g_pausetime[target] : timer_time[target])
- new imin = floatround(kreedztime / 60.0,floatround_floor)
- new isec = floatround(kreedztime - imin * 60.0,floatround_floor)
- new ims = floatround( ( kreedztime - ( imin * 60.0 + isec ) ) * 100.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), -1.0, 0.17, 0, 0.0, 1.0, 0.0, 0.0, 1)
- show_hudmessage(Dead[i], "%02d:%02d.%02d CPs: %d GCs: %d %s",imin, isec, ims, checknumbers[target], gochecknumbers[target], IsPaused[target] ? "Paused" : "")
- }
- }
- }
- }
- }
- // ============================ Block Commands ================================
- public BlockRadio(id)
- {
- if (get_pcvar_num(kz_use_radio) == 1)
- return PLUGIN_CONTINUE
- return PLUGIN_HANDLED
- }
- public BlockDrop(id)
- {
- if (get_pcvar_num(kz_drop_weapons) == 1)
- return PLUGIN_CONTINUE
- return PLUGIN_HANDLED
- }
- public BlockBuy(id)
- {
- return PLUGIN_HANDLED
- }
- public CmdRespawn(id)
- {
- if ( get_user_team(id) == 3 )
- return PLUGIN_HANDLED
- else
- ExecuteHamB(Ham_CS_RoundRespawn, id)
- return PLUGIN_HANDLED
- }
- public ChatHud(id)
- {
- if(get_pcvar_num(kz_chatorhud) == 0)
- {
- ColorChat(id, GREEN, "%s^x01 %L", id, "KZ_CHECKPOINT_OFF", prefix)
- return PLUGIN_HANDLED
- }
- if(chatorhud[id] == -1)
- ++chatorhud[id];
- ++chatorhud[id];
- if(chatorhud[id] == 3)
- chatorhud[id] = 0;
- else
- kz_chat(id, "%L", id, "KZ_CHATORHUD", chatorhud[id] == 1 ? "Chat" : "HUD")
- return PLUGIN_HANDLED
- }
- public ct(id)
- {
- new CsTeams:team = cs_get_user_team(id)
- if (team == CS_TEAM_CT)
- {
- if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) && 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)
- WasPaused[id]=true
- }
- g_pausetime[id] = get_gametime() - timer_time[id]
- timer_time[id] = 0.0
- kz_chat(id, "%L", id, "KZ_PAUSE_ON")
- }
- }
- if(gViewInvisible[id])
- gViewInvisible[id] = false
- cs_set_user_team(id,CS_TEAM_SPECTATOR)
- set_pev(id, pev_solid, SOLID_NOT)
- set_pev(id, pev_movetype, MOVETYPE_FLY)
- set_pev(id, pev_effects, EF_NODRAW)
- set_pev(id, pev_deadflag, DEAD_DEAD)
- }
- else
- {
- cs_set_user_team(id,CS_TEAM_CT)
- set_pev(id, pev_effects, 0)
- set_pev(id, pev_movetype, MOVETYPE_WALK)
- set_pev(id, pev_deadflag, DEAD_NO)
- set_pev(id, pev_takedamage, DAMAGE_AIM)
- CmdRespawn(id)
- give_item(id,"weapon_knife")
- give_item(id,"weapon_usp")
- cs_set_user_bpammo(id, CSW_USP, 36)
- if (get_pcvar_num(kz_spec_saves) == 1)
- {
- set_pev(id, pev_origin, SpecLoc[id])
- if ( timer_started [id] )
- timer_time[id] = get_gametime() - g_pausetime[id] + timer_time[id]
- if( WasPaused[id] )
- {
- Pause(id)
- WasPaused[id]=false
- }
- }
- }
- return PLUGIN_HANDLED
- }
- //=================== Weapons ==============
- public curweapon(id)
- {
- /*
- if(get_pcvar_num(kz_maxspeedmsg) == 1 && is_user_alive(id))
- {
- 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,"%L",id, "KZ_WEAPONS_SPEED",speed)
- }
- */
- static last_weapon[33];
- static weapon_active, weapon_num
- weapon_active = read_data(1)
- weapon_num = read_data(2)
- if( ( weapon_num != last_weapon[id] ) && weapon_active && get_pcvar_num(kz_maxspeedmsg) == 1)
- {
- last_weapon[id] = weapon_num;
- static Float:maxspeed;
- pev(id, pev_maxspeed, maxspeed );
- if( maxspeed < 0.0 )
- maxspeed = 250.0;
- kz_hud_message(id,"%L",id, "KZ_WEAPONS_SPEED",floatround( maxspeed, floatround_floor ));
- }
- return PLUGIN_HANDLED
- }
- public weapons(id)
- {
- if(!is_user_alive(id))
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- if(get_pcvar_num(kz_other_weapons) == 0)
- {
- kz_chat(id, "%L", id, "KZ_OTHER_WEAPONS_ZERO")
- return PLUGIN_HANDLED
- }
- if (timer_started[id])
- {
- kz_chat(id, "%L", id, "KZ_WEAPONS_IN_RUN")
- return PLUGIN_HANDLED
- }
- for(new i = 0; i < 8; i++)
- if( !user_has_weapon(id, other_weapons[i]) )
- {
- new item;
- item = give_item(id, other_weapons_name[i] );
- cs_set_weapon_ammo(item, 0);
- }
- if( !user_has_weapon(id, CSW_USP) )
- cmdUsp(id)
- return PLUGIN_HANDLED
- }
- // ========================= Scout =======================
- public cmdScout(id)
- {
- if (timer_started[id])
- user_has_scout[id] = true
- strip_user_weapons(id)
- give_item(id,"weapon_usp")
- give_item(id,"weapon_knife")
- if( !user_has_weapon(id, CSW_SCOUT))
- give_item(id,"weapon_scout")
- return PLUGIN_HANDLED
- }
- public cmdUsp(id)
- {
- give_item(id,"weapon_usp")
- give_item(id,"weapon_knife")
- return PLUGIN_HANDLED
- }
- // ========================== Show Keys ================
- public cmdShowKey(id)
- {
- g_showkey[id] = !g_showkey[id]
- if (g_showkey[id])
- set_task(0.1, "playersecondtask", id+TASK_ID_MINISECOND, _, _, "b");
- else
- remove_task(id+TASK_ID_MINISECOND);
- kz_chat(id, "%L", id, "KZ_SHOWKEYS", g_showkey[id] == 1 ? "has been enabled." : "has been disabled.");
- return PLUGIN_HANDLED
- }
- public playersecondtask(id)
- {
- id -= TASK_ID_MINISECOND
- if( !is_user_alive(id) && g_showkey[id])
- {
- new mode = pev(id, pev_iuser1)
- if( mode == 2 || mode == 4 )
- {
- new target = pev(id, pev_iuser2)
- g_idspecting[1][id] = target
- g_idspecting[0][id] = true
- if (g_showkey[id])
- {
- new target = pev(id, pev_iuser2)
- new button = pev(target, pev_button)
- // Credit of this --> cheap_suit
- static key[6][6]
- formatex(key[0], 5, "%s", (button & IN_FORWARD) && !(button & IN_BACK) ? " W " : " ")
- formatex(key[1], 5, "%s", (button & IN_BACK) && !(button & IN_FORWARD) ? " S " : " ")
- formatex(key[2], 5, "%s", (button & IN_MOVELEFT) && !(button & IN_MOVERIGHT) ? "A " : " ")
- formatex(key[3], 5, "%s", (button & IN_MOVERIGHT) && !(button & IN_MOVELEFT) ? " D" : " ")
- formatex(key[4], 5, "%s", (button & IN_DUCK) ? " DUCK " : " ")
- formatex(key[5], 5, "%s", (button & IN_JUMP) ? " JUMP " : " ")
- kz_hud_center(id, "%s^n%s %s^n%s^n%s^n%s", key[0], key[2], key[3], key[1], key[5], key[4])
- }
- }
- else
- {
- g_idspecting[0][id] = false
- }
- }
- return PLUGIN_CONTINUE
- }
- stock kz_hud_center(id, const message[], {Float,Sql,Result,_}:...)
- {
- static msg[192];
- vformat(msg, 191, message, 3);
- set_hudmessage(255, 255, 255, -1.0, 0.46, 0, _, 0.1, _, _, -1)
- ShowSyncHudMsg(id, g_hud_center, msg);
- }
- // ========================== End location =================
- public goEnd(id)
- {
- if(timer_started[id])
- {
- goend_menu(id)
- return PLUGIN_HANDLED
- }
- if(!timer_started[id])
- {
- kz_menu(id)
- }
- if( !is_user_alive( id ) )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- if (IsPaused[id])
- {
- kz_chat(id, "%L", id, "KZ_TELEPORT_PAUSE")
- return PLUGIN_HANDLED
- }
- if(get_pcvar_num(kz_save_autoEnd) == 1 && AutoEnd [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, SavedEnd [id] )
- kz_chat(id, "%L", id, "KZ_END")
- }
- else if ( DefaultEnd )
- {
- set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
- set_pev(id, pev_origin, DefaultEndPos)
- kz_chat(id, "%L", id, "KZ_END")
- }
- else
- {
- kz_chat(id, "%L", id, "KZ_NO_END")
- CmdRespawn(id)
- }
- return PLUGIN_HANDLED
- }
- public setEnd(id)
- {
- if (! (get_user_flags( id ) & KZ_LEVEL ))
- {
- kz_chat(id, "%L", id, "KZ_NO_ACCESS")
- return PLUGIN_HANDLED
- }
- new Float:origin[3]
- pev(id, pev_origin, origin)
- kz_set_End(MapName, origin)
- AutoEnd[id] = false;
- ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SET_END")
- return PLUGIN_HANDLED
- }
- // =================================================================================================
- stock kz_set_End(const map[], Float:origin[3])
- {
- new realfile[128], tempfile[128], formatorigin[50]
- formatex(realfile, 127, "%s/%s", Kzdir, KZ_ENDFILE)
- formatex(tempfile, 127, "%s/%s", Kzdir, KZ_ENDFILE_TEMP)
- formatex(formatorigin, 49, "%f %f %f", origin[0], origin[1], origin[2])
- DefaultEndPos = origin
- DefaultEnd = true
- new file = fopen(tempfile, "wt")
- new vault = fopen(realfile, "rt")
- new data[128], key[64]
- new bool:replaced = false
- while( !feof(vault) )
- {
- fgets(vault, data, 127)
- parse(data, key, 63)
- if( equal(key, map) && !replaced )
- {
- fprintf(file, "%s %s^n", map, formatorigin)
- replaced = true
- }
- else
- {
- fputs(file, data)
- }
- }
- if( !replaced )
- {
- fprintf(file, "%s %s^n", map, formatorigin)
- }
- fclose(file)
- fclose(vault)
- delete_file(realfile)
- while( !rename_file(tempfile, realfile, 1) ) {}
- }
- // ========================== Start location =================
- public goStart(id)
- {
- if( !is_user_alive( id ) )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- if (IsPaused[id])
- {
- kz_chat(id, "%L", id, "KZ_TELEPORT_PAUSE")
- return PLUGIN_HANDLED
- }
- if (MyStart[id])
- {
- timer_started[id] = false
- if(IsPaused[id])
- {
- set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
- IsPaused[id] = false
- }
- if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
- kz_showtime_roundtime(id, 0)
- 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, MyStartPos [id] )
- kz_chat(id, "%L", id, "KZ_START")
- }
- else 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] )
- kz_chat(id, "%L", id, "KZ_START")
- }
- else if ( DefaultStart )
- {
- set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
- set_pev(id, pev_origin, DefaultStartPos)
- kz_chat(id, "%L", id, "KZ_START")
- }
- else
- {
- kz_chat(id, "%L", id, "KZ_NO_START")
- CmdRespawn(id)
- }
- return PLUGIN_HANDLED
- }
- public setStart(id)
- {
- if (! (get_user_flags( id ) & KZ_LEVEL ))
- {
- kz_chat(id, "%L", id, "KZ_NO_ACCESS")
- return PLUGIN_HANDLED
- }
- new Float:origin[3]
- pev(id, pev_origin, origin)
- kz_set_start(MapName, origin)
- AutoStart[id] = false;
- ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SET_START")
- return PLUGIN_HANDLED
- }
- // ========= Respawn CT if dies ========
- public Ham_CBasePlayer_Killed_Post(id)
- {
- if(get_pcvar_num(kz_respawn_ct) == 1)
- {
- if( cs_get_user_team(id) == CS_TEAM_CT )
- {
- set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
- cs_set_user_deaths(id, 0)
- set_user_frags(id, 0)
- }
- }
- }
- // ============================= NightVision ================================================
- public ToggleNVG(id)
- {
- if( get_pcvar_num(kz_nvg) == 0 || !is_user_alive(id))
- return PLUGIN_CONTINUE;
- if ( NightVisionUse[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, 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)
- {
- if (!( get_user_flags( id ) & KZ_LEVEL ))
- 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"))
- {
- new Alive[32], alivePlayers
- get_players(Alive, alivePlayers, "ach")
- for(new i;i<alivePlayers;i++)
- {
- canusehook[i] = mode
- if(mode)
- ColorChat(i, GREEN, "%s^x01, %L", prefix, i, "KZ_HOOK")
- }
- }
- else
- {
- new pid = find_player("bl",szarg1);
- if(pid > 0)
- {
- canusehook[pid] = mode
- if(mode)
- {
- ColorChat(pid, GREEN, "%s^x01 %L", prefix, pid, "KZ_HOOK")
- }
- }
- }
- return PLUGIN_HANDLED
- }
- public hook_on(id)
- {
- if( !canusehook[id] && !( get_user_flags( id ) & KZ_LEVEL ) || !is_user_alive(id) )
- return PLUGIN_HANDLED
- if (IsPaused[id])
- {
- kz_chat(id, "%L", id, "KZ_HOOK_PAUSE")
- return PLUGIN_HANDLED
- }
- set_user_godmode(id, 1)
- detect_cheat(id,"Hook")
- get_user_origin(id,hookorigin[id],3)
- ishooked[id] = true
- antihookcheat[id] = get_gametime()
- 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 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)
- velocity[0] = (hookorigin[id][0] - origin[0]) * (2.0 * get_pcvar_num(kz_hook_speed) / distance)
- velocity[1] = (hookorigin[id][1] - origin[1]) * (2.0 * get_pcvar_num(kz_hook_speed) / distance)
- velocity[2] = (hookorigin[id][2] - origin[2]) * (2.0 * get_pcvar_num(kz_hook_speed) / distance)
- set_pev(id,pev_velocity,velocity)
- }
- 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
- 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()
- }
- //============================ VIP In ScoreBoard =================================================
- public MessageScoreAttrib( iMsgID, iDest, iReceiver )
- {
- if( get_pcvar_num(kz_vip) )
- {
- new iPlayer = get_msg_arg_int( 1 )
- if( is_user_alive( iPlayer ) && ( get_user_flags( iPlayer ) & KZ_LEVEL ) )
- {
- set_msg_arg_int( 2, ARG_BYTE, SCOREATTRIB_VIP );
- }
- }
- }
- public EventStatusValue( const id )
- {
- new szMessage[ 34 ], Target, aux
- get_user_aiming(id, Target, aux)
- if (is_user_alive(Target))
- {
- formatex( szMessage, 33, "1 %s: %%p2", get_user_flags( Target ) & KZ_LEVEL ? "VIP" : "Player" )
- message_begin( MSG, get_user_msgid( "StatusText" ) , _, id )
- write_byte( 0 )
- write_string( szMessage )
- message_end( )
- }
- }
- public detect_cheat(id,reason[])
- {
- if(timer_started[id] && get_pcvar_num(kz_cheatdetect) == 1)
- {
- timer_started[id] = false
- if(IsPaused[id])
- {
- set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
- IsPaused[id] = false
- }
- if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
- kz_showtime_roundtime(id, 0)
- ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_CHEAT_DETECT", reason)
- }
- }
- // =================================================================================================
- // Cmds
- // =================================================================================================
- public CheckPoint(id)
- {
- if( !is_user_alive( id ) )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- if(get_pcvar_num(kz_checkpoints) == 0)
- {
- kz_chat(id, "%L", id, "KZ_CHECKPOINT_OFF")
- return PLUGIN_HANDLED
- }
- if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id))
- {
- kz_chat(id, "%L", id, "KZ_CHECKPOINT_AIR")
- return PLUGIN_HANDLED
- }
- if( IsPaused[id] )
- {
- kz_chat(id, "%L", id, "KZ_CHECKPOINT_PAUSE")
- return PLUGIN_HANDLED
- }
- pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
- g_bCpAlternate[id] = !g_bCpAlternate[id]
- checknumbers[id]++
- kz_chat(id, "%L", id, "KZ_CHECKPOINT", checknumbers[id])
- return PLUGIN_HANDLED
- }
- public GoCheck(id)
- {
- if( !is_user_alive( id ) )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- if( checknumbers[id] == 0 )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ENOUGH_CHECKPOINTS")
- return PLUGIN_HANDLED
- }
- if( IsPaused[id] )
- {
- kz_chat(id, "%L", id, "KZ_TELEPORT_PAUSE")
- return PLUGIN_HANDLED
- }
- set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
- set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.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, 32.0 } );
- set_pev(id, pev_origin, Checkpoints[ id ][ !g_bCpAlternate[id] ] )
- gochecknumbers[id]++
- kz_chat(id, "%L", id, "KZ_GOCHECK", gochecknumbers[id])
- return PLUGIN_HANDLED
- }
- public Stuck(id)
- {
- if( !is_user_alive( id ) )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- if( checknumbers[id] < 2 )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ENOUGH_CHECKPOINTS")
- return PLUGIN_HANDLED
- }
- set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} )
- set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.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, 32.0 } )
- set_pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id]] )
- g_bCpAlternate[id] = !g_bCpAlternate[id];
- gochecknumbers[id]++
- kz_chat(id, "%L", id, "KZ_GOCHECK", gochecknumbers[id])
- return PLUGIN_HANDLED;
- }
- // =================================================================================================
- public reset_checkpoints(id)
- {
- checknumbers[id] = 0
- gochecknumbers[id] = 0
- timer_started[id] = false
- timer_time[id] = 0.0
- user_has_scout[id] = false
- if(IsPaused[id])
- {
- set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
- IsPaused[id] = false
- }
- if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
- kz_showtime_roundtime(id, 0)
- return PLUGIN_HANDLED
- }
- //===== Invis =======
- public cmdInvisible(id)
- {
- gViewInvisible[id] = !gViewInvisible[id]
- if(gViewInvisible[id])
- kz_chat(id, "%L", id, "KZ_INVISIBLE_PLAYERS_ON")
- else
- kz_chat(id, "%L", id, "KZ_INVISIBLE_PLAYERS_OFF")
- return PLUGIN_HANDLED
- }
- public cmdWaterInvisible(id)
- {
- if( !gWaterFound )
- {
- kz_chat(id, "%L", id, "KZ_INVISIBLE_NOWATER")
- return PLUGIN_HANDLED
- }
- gWaterInvisible[id] = !gWaterInvisible[id]
- if(gWaterInvisible[id])
- kz_chat(id, "%L", id, "KZ_INVISIBLE_WATER_ON")
- else
- kz_chat(id, "%L", id, "KZ_INVISIBLE_WATER_OFF")
- return PLUGIN_HANDLED
- }
- //======================Semiclip / Invis==========================
- 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, get_pcvar_num(kz_semiclip_transparency))
- }
- }
- 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(!is_user_alive(id))
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- new noclip = !get_user_noclip(id)
- set_user_noclip(id, noclip)
- if(IsPaused[id] && (get_pcvar_num(kz_noclip_pause) == 1))
- {
- if(noclip)
- {
- pev(id, pev_origin, NoclipPos[id])
- set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
- }
- else
- {
- set_pev(id, pev_origin, NoclipPos[id])
- set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
- }
- }
- else if(noclip)
- detect_cheat(id,"Noclip")
- kz_chat(id, "%L", id, "KZ_NOCLIP" , noclip ? "has been enabled." : "has been disabled.")
- return PLUGIN_HANDLED
- }
- public GodMode(id)
- {
- if(!is_user_alive(id))
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- new godmode = !get_user_godmode(id)
- set_user_godmode(id, godmode)
- if(godmode)
- detect_cheat(id,"God Mode")
- kz_chat(id, "%L", id, "KZ_GODMODE" , godmode ? "has been enabled." : "has been disabled.")
- return PLUGIN_HANDLED
- }
- // =================================================================================================
- stock kz_set_start(const map[], Float:origin[3])
- {
- new realfile[128], tempfile[128], formatorigin[50]
- formatex(realfile, 127, "%s/%s", Kzdir, KZ_STARTFILE)
- formatex(tempfile, 127, "%s/%s", Kzdir, KZ_STARTFILE_TEMP)
- formatex(formatorigin, 49, "%f %f %f", origin[0], origin[1], origin[2])
- DefaultStartPos = origin
- DefaultStart = true
- new file = fopen(tempfile, "wt")
- new vault = fopen(realfile, "rt")
- new data[128], key[64]
- new bool:replaced = false
- while( !feof(vault) )
- {
- fgets(vault, data, 127)
- parse(data, key, 63)
- if( equal(key, map) && !replaced )
- {
- fprintf(file, "%s %s^n", map, formatorigin)
- replaced = true
- }
- else
- {
- fputs(file, data)
- }
- }
- if( !replaced )
- {
- fprintf(file, "%s %s^n", map, formatorigin)
- }
- fclose(file)
- fclose(vault)
- delete_file(realfile)
- while( !rename_file(tempfile, realfile, 1) ) {}
- }
- stock kz_showtime_roundtime(id, time)
- {
- if( is_user_connected(id) )
- {
- message_begin(MSG, get_user_msgid( "RoundTime" ), _, id);
- write_short(time + 1);
- message_end();
- }
- }
- stock kz_chat(id, const message[], {Float,Sql,Result,_}:...)
- {
- new cvar = get_pcvar_num(kz_chatorhud)
- if(cvar == 0)
- return PLUGIN_HANDLED
- new msg[180], final[192]
- if (cvar == 1 && chatorhud[id] == -1 || chatorhud[id] == 1)
- {
- vformat(msg, 179, message, 3)
- formatex(final, 191, "%s^x01 %s", prefix, msg)
- kz_remplace_colors(final, 191)
- ColorChat(id, GREEN, "%s", final)
- }
- else if( cvar == 2 && chatorhud[id] == -1 || chatorhud[id] == 2)
- {
- vformat(msg, 179, message, 3)
- replace_all(msg, 191, "^x01", "")
- replace_all(msg, 191, "^x03", "")
- replace_all(msg, 191, "^x04", "")
- replace_all(msg, 191, ".", "")
- kz_hud_message(id, "%s", msg)
- }
- return 1
- }
- stock kz_print_config(id, const msg[])
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, id);
- write_byte(id);
- write_string(msg);
- message_end();
- }
- stock kz_remplace_colors(message[], len)
- {
- replace_all(message, len, "!g", "^x04")
- replace_all(message, len, "!t", "^x03")
- replace_all(message, len, "!y", "^x01")
- }
- 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);
- }
- stock kz_register_saycmd(const saycommand[], const function[], flags)
- {
- new temp[64]
- formatex(temp, 63, "say /%s", saycommand)
- register_clcmd(temp, function, flags)
- formatex(temp, 63, "say .%s", saycommand)
- register_clcmd(temp, function, flags)
- formatex(temp, 63, "say_team /%s", saycommand)
- register_clcmd(temp, function, flags)
- formatex(temp, 63, "say_team .%s", saycommand)
- register_clcmd(temp, function, flags)
- }
- stock get_configsdir(name[],len)
- {
- return get_localinfo("amxx_configsdir",name,len);
- }
- #if defined USE_SQL
- stock GetNewRank(id, type)
- {
- new createinto[1001]
- new cData[2]
- cData[0] = id
- cData[1] = type
- formatex(createinto, 1000, "SELECT authid FROM `%s` WHERE mapname='%s' ORDER BY time LIMIT 15", type == PRO_TOP ? "kz_pro15" : "kz_nub15", MapName)
- SQL_ThreadQuery(g_SqlTuple, "GetNewRank_QueryHandler", createinto, cData, 2)
- }
- stock kz_update_plrname(id)
- {
- new createinto[1001], authid[32], name[32]
- get_user_authid(id, authid, 31)
- get_user_name(id, name, 31)
- replace_all(name, 31, "\", "")
- replace_all(name, 31, "`", "")
- replace_all(name, 31, "'", "")
- if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || strlen(authid) > 18)
- return 0;
- else
- {
- formatex(createinto, 1000, "UPDATE `kz_pro15` SET name='%s' WHERE authid='%s'", name, authid)
- SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
- formatex(createinto, 1000, "UPDATE `kz_nub15` SET name='%s' WHERE authid='%s'", name, authid)
- SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
- }
- return 1
- }
- #endif
- 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(firstspawn[id])
- {
- ColorChat(id, GREEN, "%s^x01 Bienvenido a el^x04 Servidor Oficial^x01 de^x04 KZ-Argentina^x01!", prefix)
- if(get_pcvar_num(kz_checkpoints) == 0)
- ColorChat(id, GREEN, "%s^x01 %L", id, "KZ_CHECKPOINT_OFF", prefix)
- if(Verif(id,1) && get_pcvar_num(kz_save_pos) == 1)
- savepos_menu(id)
- else if(get_pcvar_num(kz_spawn_mainmenu) == 1)
- kz_menu (id)
- }
- firstspawn[id] = false
- if( !user_has_weapon(id,CSW_KNIFE) )
- give_item( id,"weapon_knife" )
- if( HealsOnMap )
- {
- set_user_godmode(id, 1)
- set_user_health(id, 5000)
- if(get_user_health(id) > 5000)
- set_user_health(id, 5000)
- }
- if( IsPaused[id] )
- {
- set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
- set_pev(id, pev_origin, PauseOrigin[id])
- }
- if(get_pcvar_num(kz_use_radio) == 0)
- {
- #define XO_PLAYER 5
- #define m_iRadiosLeft 192
- set_pdata_int(id, m_iRadiosLeft, 0, XO_PLAYER)
- }
- }
- public GroundWeapon_Touch(iWeapon, id)
- {
- if( is_user_alive(id) && timer_started[id] && get_pcvar_num(kz_pick_weapons) == 0 )
- return HAM_SUPERCEDE
- return HAM_IGNORED
- }
- // ==================================Save positions=================================================
- public SavePos(id)
- {
- new authid[33];
- get_user_authid(id, authid, 32)
- if(get_pcvar_num(kz_save_pos) == 0)
- {
- kz_chat(id, "%L", id, "KZ_SAVEPOS_DISABLED")
- return PLUGIN_HANDLED
- }
- if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || strlen(authid) > 18)
- {
- ColorChat (id, GREEN, "%s^x01 %L", prefix, id, "KZ_NO_STEAM")
- return PLUGIN_HANDLED
- }
- if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ON_GROUND")
- return PLUGIN_HANDLED
- }
- if(!timer_started[id])
- {
- kz_chat(id, "%L", id, "KZ_TIMER_NOT_STARTED")
- return PLUGIN_HANDLED
- }
- if(Verif(id,1))
- {
- ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SAVEPOS_ALREADY")
- savepos_menu(id)
- return PLUGIN_HANDLED
- }
- if(get_user_noclip(id))
- {
- ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SAVEPOS_NOCLIP")
- return PLUGIN_HANDLED
- }
- new Float:origin[3], scout
- pev(id, pev_origin, origin)
- new Float:Time,check,gocheck
- if(IsPaused[id])
- {
- Time = g_pausetime[id]
- Pause(id)
- }
- else
- Time=get_gametime() - timer_time[id]
- check=checknumbers[id]
- gocheck=gochecknumbers[id]
- ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SAVEPOS")
- if (user_has_scout[id])
- scout=1
- else
- scout=0
- kz_savepos(id, Time, check, gocheck, origin, scout)
- reset_checkpoints(id)
- return PLUGIN_HANDLED
- }
- public GoPos(id)
- {
- remove_hook(id)
- set_user_godmode(id, 0)
- set_user_noclip(id, 0)
- if(Verif(id,0))
- {
- 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, SavedOrigins[id] )
- }
- checknumbers[id]=SavedChecks[id]
- gochecknumbers[id]=SavedGoChecks[id]+((get_pcvar_num(kz_save_pos_gochecks)>0) ? 1 : 0)
- CheckPoint(id)
- CheckPoint(id)
- strip_user_weapons(id)
- give_item(id,"weapon_usp")
- give_item(id,"weapon_knife")
- if(SavedScout[id])
- {
- give_item(id, "weapon_scout")
- user_has_scout[id] = true
- }
- timer_time[id]=get_gametime()-SavedTime[id]
- timer_started[id]=true
- Pause(id)
- }
- public Verif(id, action)
- {
- new realfile[128], tempfile[128], authid[32], map[64]
- new bool:exist = false
- get_mapname(map, 63)
- get_user_authid(id, authid, 31)
- formatex(realfile, 127, "%s/%s.ini", SavePosDir, map)
- formatex(tempfile, 127, "%s/temp.ini", SavePosDir)
- if( !file_exists(realfile) )
- return 0
- new file = fopen(tempfile, "wt")
- new vault = fopen(realfile, "rt")
- new data[150], sid[32], time[25], checks[5], gochecks[5], x[25], y[25], z[25], scout[5]
- while( !feof(vault) )
- {
- fgets(vault, data, 149)
- parse(data, sid, 31, time, 24, checks, 4, gochecks, 4, x, 24, y, 24, z, 24, scout, 4)
- if( equal(sid, authid) && !exist) // ma aflu in fisier?
- {
- if(action == 1)
- fputs(file, data)
- exist= true
- SavedChecks[id] = str_to_num(checks)
- SavedGoChecks[id] = str_to_num(gochecks)
- SavedTime[id] = str_to_float(time)
- SavedOrigins[id][0]=str_to_num(x)
- SavedOrigins[id][1]=str_to_num(y)
- SavedOrigins[id][2]=str_to_num(z)
- SavedScout[id] = str_to_num(scout)
- }
- else
- {
- fputs(file, data)
- }
- }
- fclose(file)
- fclose(vault)
- delete_file(realfile)
- if(file_size(tempfile) == 0)
- delete_file(tempfile)
- else
- while( !rename_file(tempfile, realfile, 1) ) {}
- if(!exist)
- return 0
- return 1
- }
- public kz_savepos (id, Float:time, checkpoints, gochecks, Float:origin[3], scout)
- {
- new realfile[128], formatorigin[128], map[64], authid[32]
- get_mapname(map, 63)
- get_user_authid(id, authid, 31)
- formatex(realfile, 127, "%s/%s.ini", SavePosDir, map)
- formatex(formatorigin, 127, "%s %f %d %d %d %d %d %d", authid, time, checkpoints, gochecks, origin[0], origin[1], origin[2], scout)
- new vault = fopen(realfile, "rt+")
- write_file(realfile, formatorigin) // La sfarsit adaug datele mele
- fclose(vault)
- }
- // =================================================================================================
- // Events / Forwards
- // =================================================================================================
- //=================================================================================================
- public client_disconnect(id)
- {
- checknumbers[id] = 0
- gochecknumbers[id] = 0
- antihookcheat[id] = 0.0
- chatorhud[id] = -1
- remove_task(id+TASK_ID_MINISECOND);
- timer_started[id] = false
- ShowTime[id] = get_pcvar_num(kz_show_timer)
- firstspawn[id] = true
- NightVisionUse[id] = false
- IsPaused[id] = false
- WasPaused[id] = false
- user_has_scout[id] = false
- remove_hook(id)
- }
- public client_putinserver(id)
- {
- checknumbers[id] = 0
- gochecknumbers[id] = 0
- antihookcheat[id] = 0.0
- chatorhud[id] = -1
- g_showkey[id] = true
- set_task(0.1, "playersecondtask", id+TASK_ID_MINISECOND, _, _, "b");
- timer_started[id] = false
- ShowTime[id] = get_pcvar_num(kz_show_timer)
- firstspawn[id] = true
- NightVisionUse[id] = false
- IsPaused[id] = false
- WasPaused[id] = false
- user_has_scout[id] = false
- remove_hook(id)
- }
- // =================================================================================================
- // Menu
- // =================================================================================================
- public goend_menu(id)
- {
- new title[64]
- formatex(title, 63, "\rReset time and go to End?")
- new menu = menu_create(title, "goendHandler")
- menu_additem( menu, "Yes.", "1" )
- menu_additem( menu, "No.", "2" )
- menu_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- public goendHandler(id, menu, item)
- {
- switch(item){
- case 0:{
- reset_checkpoints(id)
- goEnd(id)
- kz_menu(id)
- }
- case 1:{
- others_menu(id)
- }
- }
- return PLUGIN_HANDLED
- }
- public others_menu(id)
- {
- new title[64]
- formatex(title, 63, "\yOther Commands")
- new menu = menu_create(title, "MenuHandler1")
- menu_additem( menu, "End Button", "1" )
- menu_additem( menu, "Top15", "2" )
- menu_additem( menu, "Info^n", "3" )
- menu_additem( menu, "Timer Menu", "4" )
- menu_additem( menu, "Invis Menu", "5" )
- menu_additem( menu, "Spectator/CT", "6" )
- menu_additem( menu, "Main Menu", "7" )
- menu_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- public MenuHandler1(id , menu, item)
- {
- if( item == MENU_EXIT ) {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- switch(item) {
- case 0:{
- goEnd(id)
- }
- case 1:{
- top15menu(id)
- }
- case 2:{
- PluginInfo(id)
- others_menu(id)
- }
- case 3:{
- ShowTimer_Menu(id)
- }
- case 4:{
- InvisMenu(id)
- }
- case 5:{
- ct(id)
- }
- case 6:{
- kz_menu(id)
- }
- }
- return PLUGIN_HANDLED
- }
- public kz_menu(id)
- {
- new title[64];
- new mapita[32];
- get_mapname(mapita, 31);
- if(equali(mapita, "kz_longjumps2"))
- {
- formatex(title, 63, "\rKZ-Argentina \wLongJumps")
- new menu = menu_create(title, "MenuHandler")
- new msgcheck[64], msggocheck[64]
- formatex(msgcheck, 63, "Checkpoint - \y[\r%i\y]", checknumbers[id])
- formatex(msggocheck, 63, "Gocheck - \y[\r%i\y]", gochecknumbers[id])
- menu_additem( menu, msgcheck, "1" )
- menu_additem( menu, msggocheck, "2" )
- menu_additem( menu, "Stuck^n", "3")
- menu_additem( menu, "Start", "4")
- menu_additem( menu, "Goto Menu", "5" )
- menu_additem( menu, "Spec/CT", "6" )
- menu_additem( menu, "Others", "7" )
- menu_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- else
- {
- formatex(title, 63, "\rKZ-Argentina \wMain Menu")
- new menu = menu_create(title, "MenuHandler")
- new msgcheck[64], msggocheck[64], msgpause[64]
- if(!timer_started[id]){
- formatex(msgcheck, 63, "Checkpoint - \y[\d%i\y]", checknumbers[id])
- formatex(msggocheck, 63, "Gocheck - \y[\d%i\y]", gochecknumbers[id])
- }
- else if(gochecknumbers[id] == 0){
- formatex(msgcheck, 63, "Checkpoint - \y[\d%i\y]", checknumbers[id])
- formatex(msggocheck, 63, "Gocheck - \y[\d%i\y]", gochecknumbers[id])
- }
- else{
- formatex(msgcheck, 63, "Checkpoint - \y[\r%i\y]", checknumbers[id])
- formatex(msggocheck, 63, "Gocheck - \y[\r%i\y]", gochecknumbers[id])
- }
- formatex(msgpause, 63, "Pause - %s^n", IsPaused[id] ? "\yON" : "\rOFF" )
- menu_additem( menu, msgcheck, "1" )
- menu_additem( menu, msggocheck, "2" )
- menu_additem( menu, "Stuck", "3")
- menu_additem( menu, msgpause, "4" )
- menu_additem( menu, "Start", "5")
- menu_additem( menu, "Others^n", "6" )
- menu_additem( menu, "Reset time", "7")
- menu_display(id, menu, 0)
- }
- return PLUGIN_HANDLED
- }
- public MenuHandler(id , menu, item)
- {
- if( item == MENU_EXIT ) {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- new mapita[32];
- get_mapname(mapita, 31);
- if(equali(mapita, "kz_longjumps2"))
- {
- switch(item) {
- case 0:{
- CheckPoint(id)
- kz_menu(id)
- }
- case 1:{
- GoCheck(id)
- kz_menu(id)
- }
- case 2:{
- Stuck(id)
- kz_menu(id)
- }
- case 3:{
- goStart(id)
- kz_menu(id)
- }
- case 4:{
- gotomenu(id)
- }
- case 5:{
- ct(id)
- }
- case 6:{
- others_menu(id)
- }
- }
- }
- else
- {
- switch(item) {
- case 0:{
- CheckPoint(id)
- kz_menu(id)
- }
- case 1:{
- GoCheck(id)
- kz_menu(id)
- }
- case 2:{
- Stuck(id)
- kz_menu(id)
- }
- case 3:{
- Pause(id)
- kz_menu(id)
- }
- case 4:{
- goStart(id)
- kz_menu(id)
- }
- case 5:{
- others_menu(id)
- }
- case 6:{
- reset_checkpoints(id)
- kz_menu(id)
- }
- }
- }
- return PLUGIN_HANDLED
- }
- public InvisMenu(id)
- {
- new menu = menu_create("\yInvis Menu\w", "InvisMenuHandler")
- 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_additem( menu, "Others Menu", "3" )
- menu_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- public InvisMenuHandler (id, menu, item)
- {
- if( item == MENU_EXIT )
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- switch(item)
- {
- case 0:
- {
- cmdInvisible(id)
- InvisMenu(id)
- }
- case 1:
- {
- cmdWaterInvisible(id)
- InvisMenu(id)
- }
- case 2:
- {
- others_menu(id)
- }
- }
- return PLUGIN_HANDLED
- }
- public ShowTimer_Menu(id)
- {
- if (get_pcvar_num(kz_show_timer) == 0 )
- {
- kz_chat(id, "%L", id, "KZ_TIMER_DISABLED")
- return PLUGIN_HANDLED
- }
- else
- {
- new menu = menu_create("\yTimer Menu\w", "TimerHandler")
- new roundtimer[64], hudtimer[64], notimer[64];
- formatex(roundtimer, 63, "Round Timer %s", ShowTime[id] == 2 ? "\y x" : "" )
- formatex(hudtimer, 63, "HUD Timer %s", ShowTime[id] == 1 ? "\y x" : "" )
- formatex(notimer, 63, "No Timer %s^n", ShowTime[id] == 0 ? "\y x" : "" )
- menu_additem( menu, roundtimer, "1" )
- menu_additem( menu, hudtimer, "2" )
- menu_additem( menu, notimer, "3" )
- menu_additem( menu, "Others Menu", "4" )
- menu_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- return PLUGIN_HANDLED
- }
- public TimerHandler (id, menu, item)
- {
- if( item == MENU_EXIT )
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- switch(item)
- {
- case 0:
- {
- ShowTime[id]= 2
- ShowTimer_Menu(id)
- }
- case 1:
- {
- ShowTime[id]= 1
- ShowTimer_Menu(id)
- if (timer_started[id])
- kz_showtime_roundtime(id, 0)
- }
- case 2:
- {
- ShowTime[id]= 0
- ShowTimer_Menu(id)
- if (timer_started[id])
- kz_showtime_roundtime(id, 0)
- }
- case 3:
- {
- others_menu(id)
- }
- }
- return PLUGIN_HANDLED
- }
- public savepos_menu(id)
- {
- new menu = menu_create("SavePos Menu", "SavePosHandler")
- menu_additem( menu, "Reload previous run", "1" )
- menu_additem( menu, "Start a new run", "2" )
- menu_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- public SavePosHandler(id, menu, item)
- {
- switch(item)
- {
- case 0:
- {
- GoPos(id)
- }
- case 1:
- {
- Verif(id,0)
- }
- }
- return PLUGIN_HANDLED
- }
- public top15menu(id)
- {
- new menu = menu_create("\rKZ \yTop15 \w", "top15handler")
- menu_additem(menu, "\wPro 15", "1", 0)
- menu_additem(menu, "\wNoob 15^n^n", "2", 0)
- #if defined USE_SQL
- menu_additem(menu, "Pro Records","3")
- menu_additem(menu, "Players Rankings^n","4")
- menu_additem(menu, "Last 10 Pro Entries", "5")
- menu_additem(menu, "Maps Statistic","6")
- menu_additem(menu, "Main Menu", "7")
- #else
- menu_additem(menu, "\wOthers Menu", "3", 0)
- #endif
- menu_display(id, menu, 0);
- return PLUGIN_HANDLED;
- }
- public top15handler(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- #if defined USE_SQL
- switch(item)
- {
- case 0:
- {
- ProTop_show(id)
- top15menu(id)
- }
- case 1:
- {
- NoobTop_show(id)
- top15menu(id)
- }
- case 2:
- {
- kz_showhtml_motd(id, PRO_RECORDS, "")
- top15menu(id)
- }
- case 3:
- {
- kz_showhtml_motd(id, PLAYERS_RANKING, "")
- top15menu(id)
- }
- case 4:
- {
- kz_showhtml_motd(id, LAST_PRO10, "")
- top15menu(id)
- }
- case 5:
- {
- kz_showhtml_motd(id, MAPS_STATISTIC, "")
- top15menu(id)
- }
- case 6:
- {
- others_menu(id)
- }
- }
- #else
- switch(item)
- {
- case 0:
- {
- ProTop_show(id)
- top15menu(id)
- }
- case 1:
- {
- NoobTop_show(id)
- top15menu(id)
- }
- case 2:
- {
- others_menu(id)
- }
- }
- #endif
- 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 ];
- pev(ent, pev_target, szTarget, 31);
- if( TrieKeyExists( g_tStarts, szTarget ) )
- {
- if(get_user_noclip(id))
- {
- if(!timer_started[id])
- kz_hud_message( id, "%L", id, "KZ_NOCLIP_TIMER")
- return PLUGIN_HANDLED
- }
- if(ishooked[id])
- return PLUGIN_HANDLED
- if ( get_gametime() - antihookcheat[id] < 3.0 )
- {
- kz_hud_message( id, "%L", id, "KZ_HOOK_PROTECTION" );
- return PLUGIN_HANDLED
- }
- if(Verif(id,1))
- {
- ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SAVEPOS_SAVED")
- savepos_menu(id)
- return HAM_IGNORED
- }
- if ( reset_checkpoints(id) && !timer_started[id] )
- {
- start_climb(id)
- new wpn=get_user_weapon(id)
- for(new i = 0; i < 8; i++)
- if( user_has_weapon(id, other_weapons[i]) )
- {
- strip_user_weapons(id)
- give_item(id,"weapon_knife")
- give_item(id,"weapon_usp")
- set_pdata_int(id, 382, 24, 5)
- if(wpn==CSW_SCOUT)
- {
- user_has_scout[id]=true
- give_item(id,"weapon_scout")
- }
- else
- user_has_scout[id]=false
- }
- if( get_user_health(id) < 100 )
- set_user_health(id, 100)
- pev(id, pev_origin, SavedStart[id])
- if(get_pcvar_num(kz_save_autostart) == 1)
- AutoStart[id] = true;
- if( !DefaultStart )
- {
- kz_set_start(MapName, SavedStart[id])
- ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SET_START")
- }
- remove_hook(id)
- }
- }
- if( TrieKeyExists( g_tStops, szTarget ) )
- {
- if( timer_started[id] )
- {
- if(get_user_noclip(id))
- return PLUGIN_HANDLED
- finish_climb(id)
- pev(id, pev_origin, SavedEnd[id])
- if(get_pcvar_num(kz_save_autoEnd) == 1)
- AutoEnd[id] = true;
- if( !DefaultEnd )
- {
- kz_set_End(MapName, SavedEnd[id])
- ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SET_END")
- }
- if(get_pcvar_num(kz_hook_prize) == 1 && !canusehook[id])
- {
- canusehook[id] = true
- ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_HOOK")
- }
- }
- else
- kz_hud_message(id, "%L", id, "KZ_TIMER_NOT_STARTED")
- }
- return HAM_IGNORED
- }
- public start_climb(id)
- {
- kz_chat(id, "%L", id, "KZ_START_CLIMB")
- if (get_pcvar_num(kz_reload_weapons) == 1)
- {
- strip_user_weapons(id)
- give_item(id,"weapon_knife")
- give_item(id,"weapon_usp")
- }
- if (ShowTime[id] == 2)
- kz_showtime_roundtime(id, 0)
- set_pev(id, pev_gravity, 1.0);
- set_pev(id, pev_movetype, MOVETYPE_WALK)
- reset_checkpoints(id)
- IsPaused[id] = false
- timer_started[id] = true
- timer_time[id] = get_gametime()
- if ( HealsOnMap )
- set_user_godmode(id, 1)
- else
- set_user_godmode(id, 0)
- }
- public finish_climb(id)
- {
- if (!is_user_alive (id))
- {
- return;
- }
- if ( (get_pcvar_num(kz_top15_authid) > 1) || (get_pcvar_num(kz_top15_authid) < 0) )
- {
- ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_TOP15_DISABLED")
- return;
- }
- #if defined USE_SQL
- new Float: time, wpn
- time = get_gametime() - timer_time[id]
- show_finish_message(id, time)
- timer_started[id] = false
- if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
- kz_showtime_roundtime(id, 0)
- new checkpoints=checknumbers[id]
- new gocheck=gochecknumbers[id]
- if(user_has_scout[id])
- wpn=CSW_SCOUT
- else
- wpn=get_user_weapon( id )
- new steam[32], name[32]
- get_user_name(id, name, 31)
- get_user_authid(id, steam, 31 )
- client_cmd(0, "spk buttons/bell1")
- new createinto[1001]
- new cData[192]
- cData[0] = id
- formatex(cData[2], charsmax(cData)-2, "^"%f^" ^"%d^" ^"%d^" ^"%d^"", time, wpn, checkpoints ,gocheck)
- if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 18)
- {
- if (gochecknumbers[id] == 0 && !user_has_scout[id] )
- {
- cData[1] = PRO_TOP
- formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_pro15` WHERE mapname='%s' AND name='%s'", MapName, name)
- SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
- }
- if (gochecknumbers[id] > 0 || user_has_scout[id] )
- {
- cData[1] = NUB_TOP
- formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_nub15` WHERE mapname='%s' AND name='%s'", MapName, name)
- SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
- }
- } else
- {
- if (gochecknumbers[id] == 0 && !user_has_scout[id] )
- {
- cData[1] = PRO_TOP
- formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_pro15` WHERE mapname='%s' AND authid='%s'", MapName, steam)
- SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
- }
- if (gochecknumbers[id] > 0 || user_has_scout[id] )
- {
- cData[1] = NUB_TOP
- formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_nub15` WHERE mapname='%s' AND authid='%s'", MapName, steam)
- SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
- }
- }
- #else
- new Float: time, authid[32]
- time = get_gametime() - timer_time[id]
- get_user_authid(id, authid, 31)
- show_finish_message(id, time)
- timer_started[id] = false
- if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2)
- kz_showtime_roundtime(id, 0)
- if (gochecknumbers[id] == 0 && !user_has_scout[id] )
- ProTop_update(id, time)
- if (gochecknumbers[id] > 0 || user_has_scout[id] )
- NoobTop_update(id, time, checknumbers[id], gochecknumbers[id])
- #endif
- user_has_scout[id] = false
- }
- public show_finish_message(id, Float:kreedztime)
- {
- new name[32]
- new imin,isec,ims, wpn
- if(user_has_scout[id])
- wpn=CSW_SCOUT
- else
- wpn=get_user_weapon( id )
- get_user_name(id, name, 31)
- 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, "%s^x01^x04 %s^x01 %L^x04 %02i:%02i.%02i ^x01with ^x04%d^x01 Gochecks^x04! ^x01(^x01%L: ^x04%s^x01)", prefix, name, LANG_PLAYER, "KZ_FINISH_MSG", imin, isec, ims, gochecknumbers[id], LANG_PLAYER, "KZ_WEAPON", g_weaponsnames[wpn])
- }
- //==================Plugin Info===================
- public PluginInfo(id)
- {
- ColorChat(id, GREEN, "%s^x01 ProKreedz edited by^x04 f0rged^x01.", prefix)
- }
- //==========================================================
- #if defined USE_SQL
- public Set_QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
- {
- new id = cData[0]
- new style = cData[1]
- if( iFailState != TQUERY_SUCCESS )
- {
- log_amx("[KZ-Arg] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
- ColorChat(0, GREEN, "%s^x01 %F", prefix, LANG_PLAYER, "KZ_TOP15_SQL_ERROR")
- }
- server_print("[KZ-Arg] Server Geting Info of SQL Server")
- new createinto[1001]
- new x1[16], x2[4], x3[5], x4[5]
- parse(cData[2], x1, 15, x2, 3, x3, 4, x4, 4)
- new dia[64], steam[32], name[32], ip[15], countty[3], checkpoints[32], gochecks[32]
- new Float:newtime = str_to_float(x1)
- new iMin, iSec, iMs, server[64]
- get_pcvar_string(kz_sql_name, server, 63)
- get_time("%Y%m%d%H%M%S", dia, sizeof dia - 1)
- get_user_authid(id, steam, 31)
- get_user_name(id, name, sizeof name - 1)
- get_user_ip (id, ip, sizeof ip - 1, 1)
- geoip_code2_ex( ip, countty)
- replace_all(name, 31, "\", "")
- replace_all(name, 31, "`", "")
- replace_all(name, 31, "'", "")
- if( SQL_NumResults(hQuery) == 0 )
- {
- formatex(checkpoints, 31, ", '%d'", str_to_num(x3))
- formatex(gochecks, 31, ", '%d'", str_to_num(x4))
- formatex( createinto, sizeof createinto - 1, "INSERT INTO `%s` VALUES('%s', '%s','%s','%s','%f','%s','%s','%s'%s%s)", style == PRO_TOP ? "kz_pro15" : "kz_nub15", MapName, steam, countty, name, newtime, dia, g_weaponsnames[str_to_num(x2)], server, style == PRO_TOP ? "" : checkpoints, style == PRO_TOP ? "" : gochecks)
- SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
- GetNewRank(id, style)
- }
- else
- {
- new Float:oldtime, Float:thetime
- SQL_ReadResult(hQuery, 0, oldtime)
- if(newtime < oldtime)
- {
- thetime = oldtime - newtime
- iMin = floatround(thetime / 60.0, floatround_floor)
- iSec = floatround(thetime - iMin * 60.0,floatround_floor)
- iMs = floatround( ( thetime - ( iMin * 60.0 + iSec ) ) * 100.0, floatround_floor )
- ColorChat(id, GREEN, "[KZ-Arg]^x01 %L^x03 %02i:%02i.%02i^x01 in ^x03%s", id, "KZ_IMPROVE", iMin, iSec, iMs, style == PRO_TOP ? "Pro 15" : "Noob 15")
- formatex(checkpoints, 31, ", checkpoints='%d'", str_to_num(x3))
- formatex(gochecks, 31, ", gocheck='%d'", str_to_num(x4))
- if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 18)
- formatex(createinto, sizeof createinto - 1, "UPDATE `%s` SET time='%f', weapon='%s', date='%s', server='%s'%s%s WHERE name='%s' AND mapname='%s'", style == PRO_TOP ? "kz_pro15" : "kz_nub15", newtime, g_weaponsnames[str_to_num(x2)], dia, server, style == PRO_TOP ? "" : gochecks, style == PRO_TOP ? "" : checkpoints, name, MapName)
- else
- formatex(createinto, sizeof createinto - 1, "UPDATE `%s` SET time='%f', weapon='%s', date='%s', server='%s'%s%s WHERE authid='%s' AND mapname='%s'", style == PRO_TOP ? "kz_pro15" : "kz_nub15", newtime, g_weaponsnames[str_to_num(x2)], dia, server, style == PRO_TOP ? "" : gochecks, style == PRO_TOP ? "" : checkpoints, steam, MapName)
- SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto )
- GetNewRank(id, style)
- }
- else
- {
- thetime = newtime - oldtime
- iMin = floatround(thetime / 60.0, floatround_floor)
- iSec = floatround(thetime - iMin * 60.0,floatround_floor)
- iMs = floatround( ( thetime - ( iMin * 60.0 + iSec ) ) * 100.0, floatround_floor )
- ColorChat(id, GREEN, "[KZ-Arg]^x01 %L^x03 %02i:%02i.%02i ^x01in ^x03%s", id, "KZ_SLOWER", iMin, iSec, iMs, style == PRO_TOP ? "Pro 15" : "Noob 15")
- }
- }
- return PLUGIN_CONTINUE
- }
- public GetNewRank_QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
- {
- new id = cData[0]
- if( iFailState != TQUERY_SUCCESS )
- {
- return log_amx("TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
- }
- new steam[32], authid[32], namez[32], name[32], i = 0
- get_user_authid(id, steam, 31)
- get_user_name(id, namez, 31)
- while( SQL_MoreResults(hQuery) )
- {
- i++
- if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 18)
- {
- SQL_ReadResult(hQuery, 0, name, 31)
- if( equal(name, namez) )
- {
- ColorChat(0, GREEN, "%s^x03 %s^x01 %L ^x03%d^x01 in^x03 %s^x01",prefix, namez, LANG_PLAYER, "KZ_PLACE", i, cData[1] == PRO_TOP ? "Pro 15" : "Noob 15");
- break;
- }
- }
- else
- {
- SQL_ReadResult(hQuery, 0, authid, 31)
- if( equal(authid, steam) )
- {
- ColorChat(0, GREEN, "%s^x03 %s^x01 %L ^x03%d^x01 in^x03 %s^x01",prefix, namez, LANG_PLAYER, "KZ_PLACE", i, cData[1] == PRO_TOP ? "Pro 15" : "Noob 15");
- break;
- }
- }
- SQL_NextRow(hQuery)
- }
- return PLUGIN_CONTINUE
- }
- public ProTop_show(id)
- {
- kz_showhtml_motd(id, PRO_TOP, MapName)
- return PLUGIN_HANDLED
- }
- public NoobTop_show(id)
- {
- kz_showhtml_motd(id, NUB_TOP, MapName)
- return PLUGIN_HANDLED
- }
- public ProRecs_show(id)
- {
- new authid[32]
- get_user_authid(id, authid, 31)
- if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || strlen(authid) > 18)
- {
- ColorChat (id, GREEN, "%s^x01 %L", prefix, id, "KZ_NO_STEAM")
- return PLUGIN_HANDLED
- }
- kz_showhtml_motd(id, PRO_RECORDS, MapName)
- return PLUGIN_HANDLED
- }
- stock kz_showhtml_motd(id, type, const map[])
- {
- new buffer[1001], namebuffer[64], filepath[96]
- get_pcvar_string(kz_sql_files, filepath, 95)
- new authid[32]
- get_user_authid(id, authid, 31)
- switch( type )
- {
- case PRO_TOP:
- {
- formatex(namebuffer, 63, "Pro 15 of %s", equal(map, "") ? "All Maps" : map)
- formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/pro15.php?map=%s^"></head><body><p>LOADING...</p></body></html>", filepath, map)
- }
- case NUB_TOP:
- {
- formatex(namebuffer, 63, "Noob 15 of %s", equal(map, "") ? "All Maps" : map)
- formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/nub15.php?map=%s^"></head><body><p>LOADING...</p></body></html>", filepath, map)
- }
- case PRO_RECORDS:
- {
- formatex(namebuffer, 63, "ProRecords and Rank")
- formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/player.php?authid=%s^"></head><body><p>LOADING...</p></body></html>", filepath, authid)
- }
- case PLAYERS_RANKING:
- {
- formatex(namebuffer, 63, "Players Ranking")
- formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/players.php^"></head><body><p>LOADING...</p></body></html>", filepath, authid)
- }
- case LAST_PRO10:
- {
- formatex(namebuffer, 63, "Last 10 Pro Entries")
- formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/lastpro.php^"></head><body><p>LOADING...</p></body></html>", filepath)
- }
- case MAPS_STATISTIC:
- {
- formatex(namebuffer, 63, "Maps Statistic")
- formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/map.php^"></head><body><p>LOADING...</p></body></html>", filepath)
- }
- }
- show_motd(id, buffer, namebuffer)
- }
- #else
- public ProTop_update(id, Float:time)
- {
- new authid[32], name[32], thetime[32], Float: slower, Float: faster, Float:protiempo
- 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_Names[i], name) && (get_pcvar_num(kz_top15_authid) == 0)) || (equali(Pro_AuthIDS[i], authid) && (get_pcvar_num(kz_top15_authid) == 1)) )
- {
- Is_in_pro15 = true
- slower = time - Pro_Times[i]
- faster = Pro_Times[i] - time
- protiempo = Pro_Times[i]
- }
- }
- for (new i = 0; i < 15; i++)
- {
- if( time < Pro_Times[i])
- {
- new pos = i
- if ( get_pcvar_num(kz_top15_authid) == 0 )
- while( !equal(Pro_Names[pos], name) && pos < 15 )
- {
- pos++;
- }
- else if ( get_pcvar_num(kz_top15_authid) == 1)
- 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
- save_pro15()
- if( Is_in_pro15 )
- {
- if( time < protiempo )
- {
- new min, Float:sec;
- min = floatround(faster, floatround_floor)/60;
- sec = faster - (60*min);
- ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_IMPROVE", min, sec < 10 ? "0" : "", sec);
- if( (i + 1) == 1)
- {
- client_cmd(0, "spk woop");
- ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #1^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
- }
- else
- {
- client_cmd(0, "spk buttons/bell1");
- ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #%d^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
- }
- }
- }
- else
- {
- if( (i + 1) == 1)
- {
- client_cmd(0, "spk woop");
- ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #1^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
- }
- else
- {
- client_cmd(0, "spk buttons/bell1");
- ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #%d^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
- }
- }
- return;
- }
- if( (equali(Pro_Names[i], name) && (get_pcvar_num(kz_top15_authid) == 0)) || (equali(Pro_AuthIDS[i], authid) && (get_pcvar_num(kz_top15_authid) == 1)) )
- {
- if( time > protiempo )
- {
- new min, Float:sec;
- min = floatround(slower, floatround_floor)/60;
- sec = slower - (60*min);
- ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_SLOWER", min, sec < 10 ? "0" : "", sec);
- return;
- }
- }
- }
- }
- public save_pro15()
- {
- new profile[128]
- formatex(profile, 127, "%s/pro_%s.cfg", Topdir, 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 profile[128], prodata[256]
- formatex(profile, 127, "%s/pro_%s.cfg", Topdir, 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], wpn, Float: slower, Float: faster, Float:noobtiempo
- 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
- if(user_has_scout[id])
- wpn=CSW_SCOUT
- else
- wpn=get_user_weapon(id)
- for(new i = 0; i < 15; i++)
- {
- if( (equali(Noob_Names[i], name) && (get_pcvar_num(kz_top15_authid) == 0)) || (equali(Noob_AuthIDS[i], authid) && (get_pcvar_num(kz_top15_authid) == 1)) )
- {
- Is_in_noob15 = true
- slower = time - Noob_Tiempos[i];
- faster = Noob_Tiempos[i] - time;
- noobtiempo = Noob_Tiempos[i]
- }
- }
- for (new i = 0; i < 15; i++)
- {
- if( time < Noob_Tiempos[i])
- {
- new pos = i
- if ( get_pcvar_num(kz_top15_authid) == 0 )
- while( !equal(Noob_Names[pos], name) && pos < 15 )
- {
- pos++;
- }
- else if ( get_pcvar_num(kz_top15_authid) == 1)
- 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])
- formatex(Noob_Weapon[j], 31, Noob_Weapon[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)
- formatex(Noob_Weapon[i], 31, g_weaponsnames[wpn])
- Noob_Tiempos[i] = time
- Noob_CheckPoints[i] = checkpoints
- Noob_GoChecks[i] = gochecks
- save_Noob15()
- if( Is_in_noob15 )
- {
- if( time < noobtiempo )
- {
- new min, Float:sec;
- min = floatround(faster, floatround_floor)/60;
- sec = faster - (60*min);
- ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_IMPROVE", min, sec < 10 ? "0" : "", sec);
- if( (i + 1) == 1)
- {
- client_cmd(0, "spk woop");
- ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #1^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
- }
- else
- {
- client_cmd(0, "spk buttons/bell1");
- ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #%d^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
- }
- }
- }
- else
- {
- if( (i + 1) == 1)
- {
- client_cmd(0, "spk woop");
- ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #1^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
- }
- else
- {
- client_cmd(0, "spk buttons/bell1");
- ColorChat(0, GREEN, "%s^x01^x04 %s^x01 %L^x04 #%d^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
- }
- }
- return;
- }
- if( (equali(Noob_Names[i], name) && (get_pcvar_num(kz_top15_authid) == 0)) || (equali(Noob_AuthIDS[i], authid) && (get_pcvar_num(kz_top15_authid) == 1)) )
- {
- if( time > noobtiempo )
- {
- new min, Float:sec;
- min = floatround(slower, floatround_floor)/60;
- sec = slower - (60*min);
- ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_SLOWER", min, sec < 10 ? "0" : "", sec);
- return;
- }
- }
- }
- }
- public save_Noob15()
- {
- new profile[128]
- formatex(profile, 127, "%s/Noob_%s.cfg", Topdir, 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^" ^"%s^" ^n", Noob_Tiempos[i], Noob_AuthIDS[i], Noob_Names[i], Noob_CheckPoints[i], Noob_GoChecks[i],Noob_Date[i],Noob_Weapon[i])
- fputs(f, Data)
- }
- fclose(f);
- }
- public read_Noob15()
- {
- new profile[128], prodata[256]
- formatex(profile, 127, "%s/Noob_%s.cfg", Topdir, 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_Weapon[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=#FFFFFF><table width=100%% cellpadding=2 cellspacing=0 border=0>")
- len += formatex(buffer[len], 2047-len, "<tr align=center bgcolor=#0052FF><th width=5%%> # <th width=45%% align=center> Player <th width=30%%> Time <th width=20%%> Date ")
- for (new i = 0; i < 10; 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=center> %s <td> %s <td> %s", ((i%2)==0) ? " bgcolor=#FFFFFF" : " bgcolor=#3399FF", (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=center> %s <td> <b>%02d:%s%.2f <td> %s", ((i%2)==0) ? " bgcolor=#FFFFFF" : " bgcolor=#3399FF", (i+1), Pro_Names[i], minutos, segundos < 10 ? "0" : "", segundos, Pro_Date[i])
- }
- }
- len += formatex(buffer[len], 2047-len, "</table></body>")
- len += formatex(buffer[len], 2047-len, "<tr><Center><b><BR>www.kz-arg.com")
- show_motd(id, buffer, "Pro10 Kreedz")
- return PLUGIN_HANDLED
- }
- public NoobTop_show(id)
- {
- new buffer[2048], name[32], len
- len = formatex(buffer, 2047, "<body bgcolor=#FFFFFF><table width=100%% cellpadding=2 cellspacing=0 border=0>")
- len += formatex(buffer[len], 2047-len, "<tr align=center bgcolor=#0052FF><th width=5%%> # <th width=35%% align=center> Player <th width=20%%> Time <th width=10%%> CPs <th width=10%%> TPs <th width=10%%> Date")
- for (new i = 0; i < 10; i++)
- {
- if( Noob_Tiempos[i] > 9999999.0 )
- {
- len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=center> %s <td> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? " bgcolor=#FFFFFF" : " bgcolor=#3399FF", (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=center> %s%s <td> <b>%02d:%s%.2f <td> %d <td> %d <td> %s", ((i%2)==0) ? " bgcolor=#FFFFFF" : " bgcolor=#3399FF", (i+1), Noob_Names[i], equal(Noob_Weapon[i],"scout") ? "(scout)" : "", minutos, segundos < 10 ? "0" : "", segundos, Noob_CheckPoints[i], Noob_GoChecks[i], Noob_Date[i], Noob_Weapon[i])
- }
- }
- len += formatex(buffer[len], 2047-len, "</table></body>")
- len += formatex(buffer[len], 2047-len, "<tr><Center><b><BR>www.kz-arg.com")
- show_motd(id, buffer, "Noob10 Kreedz")
- return PLUGIN_HANDLED
- }
- #endif
- public customStart (id)
- {
- if( !is_user_alive( id ) )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id))
- {
- kz_chat(id, "%L", id, "KZ_CHECKPOINT_AIR")
- return PLUGIN_HANDLED
- }
- if( IsPaused[id] )
- {
- kz_chat(id, "%L", id, "KZ_CHECKPOINT_PAUSE")
- return PLUGIN_HANDLED
- }
- pev(id, pev_origin, MyStartPos[id])
- MyStart[id] = true
- kz_chat(id, "Custom start position saved.")
- return PLUGIN_HANDLED
- }
- //=======================Give Hook by f0rged=======================
- public set_hook(id)
- {
- set_hook_menu(id, 0)
- return PLUGIN_HANDLED
- }
- stock set_hook_menu(id, page)
- {
- if( ! (get_user_flags( id ) & KZ_LEVEL ) )
- {
- ColorChat(id, GREEN, "%s Only admins can give hook.", prefix)
- return PLUGIN_HANDLED;
- }
- new menu = menu_create("\rKZ-Argentina \wGive Hook", "set_hook_show")
- new count = 0
- givehook[id][0] = 0
- for(new i = 1; i <= 32 ; i++)
- {
- if( is_user_connected(i) )
- {
- count++
- new showmsg[64], name[32], countt[4]
- get_user_name(i, name, 31)
- formatex(showmsg, 63, "\w %s - %s", name, !canusehook[i] && !(get_user_flags(i) & KZ_LEVEL) ? "\y[\dOFF\y]" : "\y[\rON\y]")
- num_to_str(count, countt, 3)
- menu_additem(menu, showmsg, countt, 0)
- givehook[id][count] = i
- }
- }
- menu_display(id, menu, page)
- return PLUGIN_HANDLED;
- }
- public set_hook_show(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- return PLUGIN_HANDLED
- }
- new lediohook[32]
- new data[6], iName[64]
- new access, callback
- menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
- new key = str_to_num(data)
- new LALA = floatround(str_to_float(data)/7.0001, floatround_floor)
- new i = givehook[id][key]
- canusehook[i] = !canusehook[i]
- set_hook_menu(id, LALA)
- lediohook[i] = true
- if(lediohook[i]){
- new name[32]
- get_user_name(i, name, 31)
- if(!(get_user_flags(i) & KZ_LEVEL))
- ColorChat(id, GREEN, "%s ^x01Hook ha sido %s a ^x04%s^x01.", prefix, canusehook[i] ? "habilitado" : "deshabilitado", name)
- }
- return PLUGIN_HANDLED
- }
- //============================ Goto Lj2 ==============================================
- public gotomenu(id)
- {
- new menu1 = menu_create("\rKZ-Argentina \wGoto Menu: Main", "menugoto");
- menu_additem(menu1, "Start", "1", 0);
- menu_additem(menu1, "Long Jumps", "2", 0);
- menu_additem(menu1, "Bhop Jumps", "3", 0);
- menu_additem(menu1, "Count Jumps", "4", 0);
- menu_additem(menu1, "High Jumps", "5", 0);
- menu_additem(menu1, "Ladder Jumps", "6", 0);
- menu_additem(menu1, "Secret Room", "7", 0);
- menu_display(id, menu1, 0);
- }
- public menugoto(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- return PLUGIN_HANDLED;
- }
- new data[6], iName[64];
- new access, callback;
- menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
- new key = str_to_num(data);
- switch(key)
- {
- case 1:
- {
- set_pev(id, pev_origin, {-4.830482, 2.784362, -27.968750});
- gotomenu(id);
- }
- case 2:
- {
- ljmenu(id, 0);
- }
- case 3:
- {
- bhopmenu(id, 0);
- }
- case 4:
- {
- cjmenu(id, 0);
- }
- case 5:
- {
- hjmenu(id, 0);
- }
- case 6:
- {
- laddermenu(id, 0);
- }
- case 7:
- {
- set_pev(id, pev_origin, {-778.922546, -1908.944580, 720.031250});
- gotomenu(id);
- }
- }
- return PLUGIN_HANDLED;
- }
- public ljmenu(id, page)
- {
- new menu2 = menu_create("\rKZ-Argentina \wGoto: Long Jumps", "menulj");
- new lala = 1, popo = 219;
- menu_additem(menu2, "\wLj Place ^n^n\yBlocks", "1", 0);
- for(new i = 0; i <= charsmax(lj_position); i++)
- {
- popo++;
- lala++;
- new lugar[5], ljblock[8];
- num_to_str(lala, lugar, 4);
- num_to_str(popo, ljblock, 7);
- menu_additem(menu2, ljblock, lugar, 0);
- }
- menu_setprop(menu2, MPROP_EXITNAME, "\wMain Menu");
- menu_display(id, menu2, page);
- }
- public menulj(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- gotomenu(id);
- return PLUGIN_HANDLED;
- }
- new data[6], iName[64];
- new access, callback;
- menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
- new key = str_to_num(data);
- new Float:floatkey = str_to_float(data);
- switch( key )
- {
- case 1:
- {
- set_pev(id, pev_origin, place_position[0]);
- ljmenu(id, 0);
- }
- default:
- {
- set_pev(id, pev_origin, lj_position[key-2]);
- ljmenu(id, floatround( floatkey/7.001, floatround_floor));
- }
- }
- return PLUGIN_HANDLED;
- }
- public bhopmenu(id, page)
- {
- new menu3 = menu_create("\rKZ-Argentina \wGoto: Bhop Jumps", "menubhop");
- new lala = 1, popo = 219;
- menu_additem(menu3, "\wBhop Place ^n^n\yBlocks", "1", 0);
- for(new i = 0; i <= charsmax(bhop_position); i++)
- {
- popo++;
- lala++;
- new lugar[5], ljblock[8];
- num_to_str(lala, lugar, 4);
- num_to_str(popo, ljblock, 7);
- menu_additem(menu3, ljblock, lugar, 0);
- }
- menu_setprop(menu3, MPROP_EXITNAME, "\wMain Menu");
- menu_display(id, menu3, page);
- }
- public menubhop(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- gotomenu(id);
- return PLUGIN_HANDLED;
- }
- new data[6], iName[64];
- new access, callback;
- menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
- new key = str_to_num(data);
- new Float:floatkey = str_to_float(data);
- switch( key )
- {
- case 1:
- {
- set_pev(id, pev_origin, place_position[1]);
- bhopmenu(id, 0);
- }
- default:
- {
- set_pev(id, pev_origin, bhop_position[key-2]);
- bhopmenu(id, floatround( floatkey/7.001, floatround_floor));
- }
- }
- return PLUGIN_HANDLED;
- }
- public cjmenu(id, page)
- {
- new menu4 = menu_create("\rKZ-Argentina \wGoto: Cj Jumps", "menucj");
- new lala = 1, popo = 239;
- menu_additem(menu4, "\wCj Place ^n^n\yBlocks", "1", 0);
- for(new i = 0; i <= charsmax(cj_position); i++)
- {
- popo++;
- lala++;
- new lugar[5], ljblock[8];
- num_to_str(lala, lugar, 4);
- num_to_str(popo, ljblock, 7);
- menu_additem(menu4, ljblock, lugar, 0);
- }
- menu_setprop(menu4, MPROP_EXITNAME, "\wMain Menu");
- menu_display(id, menu4, page);
- }
- public menucj(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- gotomenu(id);
- return PLUGIN_HANDLED;
- }
- new data[6], iName[64];
- new access, callback;
- menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
- new key = str_to_num(data);
- new Float:floatkey = str_to_float(data);
- switch( key )
- {
- case 1:
- {
- set_pev(id, pev_origin, place_position[2]);
- cjmenu(id, 0);
- }
- default:
- {
- set_pev(id, pev_origin, cj_position[key-2]);
- cjmenu(id, floatround( floatkey/7.001, floatround_floor));
- }
- }
- return PLUGIN_HANDLED;
- }
- public hjmenu(id, page)
- {
- new menu5 = menu_create("\rKZ-Argentina \wGoto: High Jumps", "menuhj");
- new lala = 1, popo = 219;
- menu_additem(menu5, "\wHj Place ^n^n\yBlocks", "1", 0);
- for(new i = 0; i <= charsmax(hj_position); i++)
- {
- popo++;
- lala++;
- new lugar[5], ljblock[8];
- num_to_str(lala, lugar, 4);
- num_to_str(popo, ljblock, 7);
- menu_additem(menu5, ljblock, lugar, 0);
- }
- menu_setprop(menu5, MPROP_EXITNAME, "\wMain Menu");
- menu_display(id, menu5, page);
- }
- public menuhj(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- gotomenu(id);
- return PLUGIN_HANDLED;
- }
- new data[6], iName[64];
- new access, callback;
- menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
- new key = str_to_num(data);
- new Float:floatkey = str_to_float(data);
- switch( key )
- {
- case 1:
- {
- set_pev(id, pev_origin, place_position[3]);
- hjmenu(id, 0);
- }
- default:
- {
- set_pev(id, pev_origin, hj_position[key-2]);
- hjmenu(id, floatround( floatkey/7.001, floatround_floor));
- }
- }
- return PLUGIN_HANDLED;
- }
- public laddermenu(id, page)
- {
- new menu6 = menu_create("\rKZ-Argentina \wGoto: Ladder Jumps", "menuladder");
- new lala = 1, popo = 149;
- menu_additem(menu6, "\wLadder Place ^n^n\yBlocks", "1", 0);
- for(new i = 0; i <= charsmax(ladder_position); i++)
- {
- popo++;
- lala++;
- new lugar[5], ljblock[8];
- num_to_str(lala, lugar, 4);
- num_to_str(popo, ljblock, 7);
- menu_additem(menu6, ljblock, lugar, 0);
- }
- menu_setprop(menu6, MPROP_EXITNAME, "\wMain Menu");
- menu_display(id, menu6, page);
- }
- public menuladder(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- gotomenu(id);
- return PLUGIN_HANDLED;
- }
- new data[6], iName[64];
- new access, callback;
- menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
- new key = str_to_num(data);
- new Float:floatkey = str_to_float(data);
- switch( key )
- {
- case 1:
- {
- set_pev(id, pev_origin, place_position[4]);
- laddermenu(id, 0);
- }
- default:
- {
- set_pev(id, pev_origin, ladder_position[key-2]);
- laddermenu(id, floatround( floatkey/7.001, floatround_floor));
- }
- }
- return PLUGIN_HANDLED;
- }
- public hooksay(id)
- {
- new args[64], commando[12], tipo[12], bloke[4];
- read_args(args, 63);
- remove_quotes(args);
- if( containi(args, "goto") == -1 && args[0] != '/' )
- return PLUGIN_CONTINUE;
- parse(args, commando, 11, tipo, 11, bloke, 3);
- if( equali(commando, "/goto", 4) && equali(tipo, "") )
- {
- gotomenu(id);
- return PLUGIN_CONTINUE;
- }
- else if( equali(commando, "/goto", 4) )
- {
- new lalin = str_to_num(bloke);
- if( equali(tipo, "lj") )
- {
- if( is_block_valid(lalin, 220, 265) )
- {
- set_pev(id, pev_origin, lj_position[lalin-220]);
- ColorChat(id, GREEN, "%s ^x01Moved to Lj Block: %i", prefix, lalin);
- }
- else
- {
- set_pev(id, pev_origin, place_position[0]);
- ColorChat(id, GREEN, "%s ^x01Moved to Long Jumps Place", prefix);
- }
- }
- else if( equali(tipo, "bhop") )
- {
- if( is_block_valid(lalin, 220, 250) )
- {
- set_pev(id, pev_origin, bhop_position[lalin-220]);
- ColorChat(id, GREEN, "%s ^x01Moved to Bhop Block: %i", prefix, lalin);
- }
- else
- {
- set_pev(id, pev_origin, place_position[1]);
- ColorChat(id, GREEN, "%s ^x01Moved to Bhop Place", prefix);
- }
- }
- else if( equali(tipo, "cj") )
- {
- if( is_block_valid(lalin, 240, 275) )
- {
- set_pev(id, pev_origin, cj_position[lalin-240]);
- ColorChat(id, GREEN, "%s ^x01Moved to Cj Block: %i", prefix, lalin);
- }
- else
- {
- set_pev(id, pev_origin, place_position[2]);
- ColorChat(id, GREEN, "%s ^x01Moved to Count Jumps Place", prefix);
- }
- }
- else if( equali(tipo, "hj") )
- {
- if( is_block_valid(lalin, 220, 250) )
- {
- set_pev(id, pev_origin, hj_position[lalin-220]);
- ColorChat(id, GREEN, "%s ^x01Moved to Hj Block: %i", prefix, lalin);
- }
- else
- {
- set_pev(id, pev_origin, place_position[3]);
- ColorChat(id, GREEN, "%s ^x01Moved to High Jumps Place", prefix);
- }
- }
- else if( equali(tipo, "ladder") )
- {
- if( is_block_valid(lalin, 150, 170) )
- {
- set_pev(id, pev_origin, ladder_position[lalin-150]);
- ColorChat(id, GREEN, "%s ^x01Moved to Ladder Block: %i", prefix, lalin);
- }
- else
- {
- set_pev(id, pev_origin, place_position[4]);
- ColorChat(id, GREEN, "%s ^x01Moved to Ladders Place", prefix);
- }
- }
- else if( equali(tipo, "start") )
- {
- set_pev(id, pev_origin, {-4.830482, 2.784362, -27.968750});
- ColorChat(id, GREEN, "%s ^x01Moved to Start Position", prefix);
- }
- else if( containi(tipo, "room") != -1 )
- {
- set_pev(id, pev_origin, {-778.922546, -1908.944580, 720.031250});
- ColorChat(id, GREEN, "%s ^x01Moved to Secret Room", prefix);
- }
- return PLUGIN_HANDLED;
- }
- return PLUGIN_CONTINUE;
- }
- stock is_block_valid(value, num1, num2)
- {
- if( value >= num1 && value <= num2 )
- return true;
- return false;
- }
- // You reached the end of file
- // The original plugin was made by p4ddY
- // This plugin was edited by f0rged
- // Version 2.31
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement