Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <cstrike>
- #include <fun>
- #include <colorchat>
- #include <fakemeta>
- #include <geoip>
- #include <hamsandwich>
- #include <sqlx>
- #define KZ_LEVEL ADMIN_KICK
- #define MAX_ENTITYS 900+15*32
- #define SCOREATTRIB_NONE 0
- #define SCOREATTRIB_DEAD ( 1 << 0 )
- #define SCOREATTRIB_BOMB ( 1 << 1 )
- #define SCOREATTRIB_VIP ( 1 << 2 )
- #if cellbits == 32
- #define OFFSET_BUYZONE 235
- #else
- #define OFFSET_BUYZONE 268
- #endif
- new g_iPlayers[32], g_iNum, g_iPlayer
- new const g_szAliveFlags[] = "a"
- #define RefreshPlayersList() get_players(g_iPlayers, g_iNum, g_szAliveFlags)
- new const FL_ONGROUND2 = ( FL_ONGROUND | FL_PARTIALGROUND | FL_INWATER | FL_CONVEYOR | FL_FLOAT )
- new const KZ_DIR[] = "addons/amxmodx/configs/kz"
- new const KZ_STARTFILE[] = "start.ini"
- new const KZ_STARTFILE_TEMP[] = "temp_start.ini"
- 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_file
- 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:PauseOrigin[33][3]
- new Float:SavedStart[33][3]
- new hookorigin[33][3]
- new Float:DefaultStartPos[3]
- new bool:g_bCpAlternate[33]
- new bool:timer_started[33]
- new bool:IsPaused[33]
- new bool:firstspawn[33]
- new bool:canusehook[33]
- new bool:ishooked[33]
- new bool:NightVisionUse[33]
- new bool:HealsOnMap
- new bool: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 Trie:g_tStarts
- new Trie:g_tStops;
- new checknumbers[33]
- new gochecknumbers[33]
- new g_WeaponUsed[33]
- new ShowTime[33]
- new kz_checkpoints
- new kz_cheatdetect
- new kz_spawn_mainmenu
- new kz_show_timer
- new kz_chatorhud
- new kz_hud_color
- new hud_message
- new kz_other_weapons
- new kz_maxspeedmsg
- new kz_drop_weapons
- new kz_remove_drops
- new kz_strip_other_weapons
- new kz_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_nvg
- new kz_nvg_colors
- new kz_vip
- new kz_respawn_ct
- new kz_semiclip
- new kz_spec_saves
- new kz_save_autostart
- new MaxPlayers
- new Sbeam = 0
- 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"
- }
- enum
- {
- TOP_NULL,
- PRO_TOP,
- NUB_TOP,
- LAST_PRO10,
- PRO_RECORDS,
- PLAYERS_RANKING,
- MAPS_STATISTIC
- }
- // =================================================================================================
- public plugin_init()
- {
- register_plugin("ProKreedz","2.0y","nucLeaR")
- 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", "2")
- kz_chatorhud = register_cvar("kz_chatorhud", "2")
- kz_hud_color = register_cvar("kz_hud_color", "12 122 221")
- kz_other_weapons = register_cvar("kz_other_weapons","1")
- kz_drop_weapons = register_cvar("kz_drop_weapons", "0")
- kz_remove_drops = register_cvar("kz_remove_drops", "1")
- kz_strip_other_weapons = register_cvar("kz_strip_other_weapons", "1")
- kz_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", "300.0")
- kz_use_radio = register_cvar("kz_use_radio", "0")
- kz_pause = register_cvar("kz_pause", "1")
- kz_nvg = register_cvar("kz_nvg","1")
- kz_nvg_colors = register_cvar("kz_nvg_colors","5 0 255")
- kz_vip = register_cvar("kz_vip","1")
- kz_respawn_ct = register_cvar("kz_respawn_ct", "1")
- kz_semiclip = register_cvar("kz_semiclip", "1")
- kz_spec_saves = register_cvar("kz_spec_saves", "1")
- kz_save_autostart = register_cvar("kz_save_autostart", "1")
- kz_sql_host = register_cvar("kz_sql_host", "127.0.0.1")
- kz_sql_user = register_cvar("kz_sql_user", "trickjumps")
- kz_sql_pass = register_cvar("kz_sql_pass", "", FCVAR_PROTECTED)
- kz_sql_db = register_cvar("kz_sql_db", "trickjumps")
- kz_sql_name = register_cvar("kz_sql_server", "TJ")
- kz_sql_file = register_cvar("kz_sql_file", "kz.evil.lv/top")
- register_clcmd("say .kreedz","kz_menu")
- register_clcmd("say /kreedz","kz_menu")
- register_clcmd("say .menu","kz_menu")
- register_clcmd("say /menu","kz_menu")
- register_clcmd("say /timer", "ShowTimer_Menu" )
- register_clcmd( "say_team /timer", "ShowTimer_Menu" );
- register_clcmd("say /showtimer", "ShowTimer_Menu")
- register_clcmd("cp","CheckPoint")
- register_clcmd("/cp","CheckPoint")
- register_clcmd(".cp","CheckPoint")
- register_clcmd("say /cp","CheckPoint")
- register_clcmd("say /checkpoint","CheckPoint")
- register_clcmd("tp","GoCheck")
- register_clcmd("/tp","GoCheck")
- register_clcmd(".tp","GoCheck")
- register_clcmd("say /tp", "GoCheck")
- register_clcmd("say /teleport", "GoCheck")
- register_clcmd("gc","GoCheck")
- register_clcmd("/gc","GoCheck")
- register_clcmd(".gc","GoCheck")
- register_clcmd("say /gc", "GoCheck")
- register_clcmd("say /gocheck", "GoCheck")
- register_clcmd("stuck","Stuck")
- register_clcmd("/stuck","Stuck")
- register_clcmd(".stuck", "Stuck")
- register_clcmd("say .stuck","Stuck")
- register_clcmd("say /stuck","Stuck")
- register_clcmd("say .reset","reset_checkpoints")
- register_clcmd("say /reset","reset_checkpoints")
- register_clcmd("say .noclip","noclip")
- register_clcmd("say /noclip","noclip")
- register_clcmd("say /nc","noclip")
- register_clcmd("say /godmode","GodMode")
- register_clcmd("say /god","GodMode")
- register_clcmd("say .god","GodMode")
- register_clcmd("say /spec","ct")
- register_clcmd("say /ct","ct")
- register_clcmd("say /pause", "Pause")
- register_clcmd("say /invis", "InvisMenu")
- register_clcmd("say /winvis", "cmdWaterInvisible")
- register_clcmd("say /pinvis", "cmdInvisible")
- register_concmd("kz_hook","give_hook", KZ_LEVEL, "<name|#userid|steamid|@ALL> <on/off>")
- register_concmd("nightvision","ToggleNVG")
- register_clcmd("say .top15","top15menu")
- register_clcmd("say /top15","top15menu")
- register_clcmd("say .top10","top15menu")
- register_clcmd("say /top10","top15menu")
- register_clcmd("say .noob10","NoobTop_show")
- register_clcmd("say /noob10","NoobTop_show")
- register_clcmd("say .noob15","NoobTop_show")
- register_clcmd("say /noob15","NoobTop_show")
- register_clcmd("say .nub10","NoobTop_show")
- register_clcmd("say /nub10","NoobTop_show")
- register_clcmd("say .nub15","NoobTop_show")
- register_clcmd("say /nub15","NoobTop_show")
- register_clcmd("say .pro10","ProTop_show")
- register_clcmd("say /pro10","ProTop_show")
- register_clcmd("say .pro15","ProTop_show")
- register_clcmd("say /pro15","ProTop_show")
- register_clcmd("say /prorecords", "ProRecs_show")
- register_clcmd("say /prorecs", "ProRecs_show")
- register_clcmd("say .prorecords", "ProRecs_show")
- register_clcmd("say /prorecs", "ProRecs_show")
- register_clcmd("say /weapons","weapons")
- register_clcmd("say /scout", "cmdScout")
- register_clcmd("say /usp", "cmdUsp")
- register_clcmd("say /knife", "cmdUsp")
- register_clcmd("say /start", "goStart");
- register_clcmd("/start", "goStart");
- register_clcmd("say /respawn", "goStart");
- register_clcmd("/respawn", "goStart");
- register_clcmd("say /setstart", "setStart", KZ_LEVEL, "")
- register_clcmd("+hook","hook_on",KZ_LEVEL)
- register_clcmd("-hook","hook_off",KZ_LEVEL)
- register_event("ResetHUD","resethud","be")
- register_event("CurWeapon","curweapon","be")
- register_event( "StatusValue", "EventStatusValue", "b", "1>0", "2>0" );
- register_forward(FM_StartFrame, "fw_StartFrame")
- register_forward(FM_AddToFullPack, "FM_client_AddToFullPack_Post", 1)
- RegisterHam( Ham_Player_PreThink, "player", "Ham_CBasePlayer_PreThink_Post", 1)
- RegisterHam( Ham_Use, "func_button", "fwdUse", 0)
- RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1)
- RegisterHam( Ham_Spawn, "weaponbox", "FwdSpawnWeaponbox", 1 )
- RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 )
- RegisterHam( Ham_Touch, "weaponbox", "GroundWeapon_Touch")
- register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" )
- register_message( get_user_msgid( "StatusIcon" ), "msgStatusIcon" );
- hud_message = CreateHudSyncObj()
- MaxPlayers = get_maxplayers()
- set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
- set_task(0.5,"timer_task",2000,"",0,"ab")
- set_task(0.2, "plugin_sql")
- if( !dir_exists(KZ_DIR) )
- mkdir(KZ_DIR)
- new kreedz_cfg[128]
- formatex(kreedz_cfg,128,"%s/kreedz.cfg",KZ_DIR)
- if( file_exists( kreedz_cfg ) )
- {
- server_exec()
- server_cmd("exec %s",kreedz_cfg)
- }
- g_tStarts = TrieCreate( )
- g_tStops = TrieCreate( )
- new const szStarts[ ][ ] =
- {
- "counter_start", "clockstartbutton", "firsttimerelay", "but_start", "counter_start_button",
- "multi_start", "timer_startbutton", "start_timer_emi", "gogogo"
- }
- new const szStops[ ][ ] =
- {
- "counter_off", "clockstopbutton", "clockstop", "but_stop", "counter_stop_button",
- "multi_stop", "stop_counter", "m_counter_end_emi"
- }
- for( new i = 0; i < sizeof szStarts; i++ )
- TrieSetCell( g_tStarts, szStarts[ i ], 1 )
- for( new i = 0; i < sizeof szStops; i++ )
- TrieSetCell( g_tStops, szStops[ i ], 1 )
- }
- public plugin_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("[XJ] TOP15 SQL: Could not connect to SQL database.!")
- log_amx("[XJ] 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, `country` 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, `country` 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("[XJ] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
- ColorChat(0, GREEN, "[XJ]^x01: Warring the SQL Tops can not be saved.")
- }
- server_print("[XJ] Server Sending Info to SQL Server")
- return PLUGIN_CONTINUE
- }
- public plugin_end( )
- {
- TrieDestroy( g_tStarts )
- TrieDestroy( g_tStops )
- }
- public plugin_precache()
- {
- RegisterHam( Ham_Spawn, "func_door", "FwdHamDoorSpawn", 1 )
- precache_sound("weapons/xbow_hit2.wav")
- Sbeam = precache_model("sprites/laserbeam.spr")
- }
- public plugin_cfg()
- {
- new startcheck[100], data[256], mapname[64], map[64], x[13], y[13], z[13];
- get_mapname( mapname, 63)
- formatex(startcheck, 99, "%s/%s", KZ_DIR, 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;
- }
- }
- }
- // =================================================================================================
- // Global Functions
- // =================================================================================================
- public Pause(id)
- {
- if (get_pcvar_num(kz_pause) == 0)
- {
- kz_hud_message(id, "Pause is disabled")
- return PLUGIN_HANDLED
- }
- if(! timer_started[id])
- {
- kz_hud_message(id, "Timer is not started")
- return PLUGIN_HANDLED
- }
- if(! is_user_alive(id) )
- {
- kz_hud_message(id, "You must be alive to use this command")
- return PLUGIN_HANDLED
- }
- if( ( pev( id, pev_flags ) & FL_ONGROUND2 ) )
- {
- if(!IsPaused[id])
- {
- g_pausetime[id] = get_gametime() - timer_time[id]
- timer_time[id] = 0.0
- IsPaused[id] = true
- kz_hud_message(id, "Your timer has been paused")
- set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
- pev(id, pev_origin, PauseOrigin[id])
- }
- else
- {
- timer_time[id] = get_gametime() - g_pausetime[id] + timer_time[id]
- IsPaused[id] = false
- kz_hud_message(id, "Your timer has been unpaused")
- set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
- }
- }
- else
- kz_hud_message(id, "You must be on ground to get paused")
- return PLUGIN_HANDLED
- }
- public timer_task()
- {
- for(new i=1;i<=MaxPlayers;i++)
- {
- if ( get_pcvar_num(kz_show_timer) > 0 )
- {
- if (is_user_alive(i))
- {
- if( is_user_connected(i) && timer_started[i])
- {
- new Float:kreedztime = get_gametime() - (IsPaused[i] ? get_gametime() - g_pausetime[i] : timer_time[i])
- if( ShowTime[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)
- get_pcvar_string(kz_hud_color, colors, 11)
- parse(colors, r, 3, g, 3, b, 4)
- set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), 0.40, 0.10, 0, 0.0, 1.0, 0.0, 0.0, 1)
- show_hudmessage(i, "Time: %02d:%02d | CPs: %d | TPs: %d ",imin, isec,checknumbers[i], gochecknumbers[i])
- }
- else
- if( ShowTime[i] == 2 )
- {
- kz_showtime_roundtime(i, floatround(kreedztime))
- }
- }
- }
- else
- {
- new specmode = pev(i, pev_iuser1)
- if(specmode == 2 || specmode == 4)
- {
- new target = pev(i, pev_iuser2)
- if(target != i)
- if(is_user_alive(target) && timer_started[target])
- {
- new name[32], colors[12], r[4], g[4], b[4];
- get_user_name (target, name, 31)
- new Float:kreedztime = 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)
- 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.46, 0, 0.0, 1.0, 0.0, 0.0, 1)
- show_hudmessage(i, "Time: %02d:%02d | CPs: %d | TPs: %d %s ",imin, isec, checknumbers[target], gochecknumbers[target], IsPaused[target] ? "| *Paused*" : "")
- }
- }
- }
- }
- }
- }
- // ============================ Block Commands ================================
- public client_command(id)
- {
- static szCmd[13]
- read_argv(0, szCmd, 12)
- static const commands_block[][] =
- {
- "radio1", "radio2", "radio3",
- "coverme", "takepoint", "holdpos",
- "regroup", "followme", "takingfire",
- "go", "fallback", "sticktog",
- "getinpos", "stormfront", "report",
- "roger", "enemyspot", "needbackup",
- "sectorclear", "inposition", "reportingin",
- "getout", "negative", "enemydown",
- "chooseteam", "jointeam 1"
- }
- static const drop_weapons[][] =
- {
- "drop"
- }
- if (get_pcvar_num(kz_use_radio) == 0)
- for ( new i = 0 ; i < sizeof( commands_block ) ; i++ )
- {
- if(equal(szCmd, commands_block[i]))
- return PLUGIN_HANDLED;
- }
- else
- return PLUGIN_CONTINUE
- if (get_pcvar_num(kz_drop_weapons) == 0)
- for ( new i = 0 ; i < sizeof( drop_weapons ) ; i++ )
- {
- if(equal(szCmd, drop_weapons[i]))
- return PLUGIN_HANDLED
- }
- else
- return PLUGIN_CONTINUE
- return PLUGIN_CONTINUE
- }
- public msgStatusIcon( const iMsgId, const iMsgDest, const iPlayer )
- {
- static szMsg[ 8 ];
- get_msg_arg_string( 2, szMsg, 7 );
- if( equal( szMsg, "buyzone" ) )
- {
- set_pdata_int( iPlayer, OFFSET_BUYZONE, get_pdata_int( iPlayer, OFFSET_BUYZONE ) & ~( 1<<0 ) )
- return PLUGIN_HANDLED
- }
- return PLUGIN_CONTINUE
- }
- public CmdRespawn(id)
- {
- if ( get_user_team(id) == 3 )
- return PLUGIN_HANDLED
- else
- ExecuteHamB(Ham_CS_RoundRespawn, id)
- return PLUGIN_HANDLED
- }
- public ct(id)
- {
- new CsTeams:team = cs_get_user_team(id)
- if (team == CS_TEAM_CT)
- {
- 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)
- g_pausetime[id] = get_gametime() - timer_time[id]
- timer_time[id] = 0.0
- ColorChat(id, GREEN, "[XJ]^x01 Your timer has been paused.")
- }
- }
- 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")
- give_item(id,"weapon_usp")
- give_item(id,"weapon_usp")
- if (get_pcvar_num(kz_spec_saves) == 1)
- {
- set_pev(id, pev_origin, SpecLoc[id])
- if ( timer_started [id] )
- timer_time[id] = get_gametime() - g_pausetime[id] + timer_time[id]
- }
- }
- return PLUGIN_HANDLED
- }
- //=================== Weapons ==============
- public curweapon(id)
- {
- new WeaponNum = read_data(2)
- new WeaponActive = read_data(1)
- if ((WeaponNum != g_WeaponUsed[id]) && WeaponActive) // if weapon has changed and its the active weapon continue
- {
- g_WeaponUsed[id] = WeaponNum
- if(get_pcvar_num(kz_maxspeedmsg) == 1)
- {
- new clip, ammo, speed
- switch(get_user_weapon(id,clip,ammo))
- {
- case CSW_SCOUT: speed = 260
- case CSW_C4, CSW_P228, CSW_MAC10, CSW_MP5NAVY, CSW_USP, CSW_TMP, CSW_FLASHBANG, CSW_DEAGLE, CSW_GLOCK18, CSW_SMOKEGRENADE, CSW_ELITE, CSW_FIVESEVEN, CSW_UMP45, CSW_HEGRENADE, CSW_KNIFE: speed = 250
- case CSW_P90: speed = 245
- case CSW_XM1014, CSW_AUG, CSW_GALIL, CSW_FAMAS: speed = 240
- case CSW_SG552: speed = 235
- case CSW_M3, CSW_M4A1: speed= 230
- case CSW_AK47: speed = 221
- case CSW_M249: speed = 220
- case CSW_G3SG1, CSW_SG550, CSW_AWP: speed = 210
- }
- kz_hud_message(id,"This weapons maxspeed is %d",speed)
- }
- }
- return PLUGIN_HANDLED
- }
- public weapons(id)
- {
- if (!timer_started[id])
- {
- if(get_pcvar_num(kz_other_weapons) == 1)
- {
- if(is_user_alive(id))
- {
- 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)
- }
- else
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You must be alive to use this function.")
- case 2: kz_hud_message(id, "You must be alive to use this function")
- }
- }
- else
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 Different weapons are disabled.")
- case 2: kz_hud_message(id, "Different weapons are disabled")
- }
- }
- else
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You can not get different weapons during a run, type /reset.")
- case 2: kz_hud_message(id, "You can not get different weapons during a run, type /reset")
- }
- return PLUGIN_HANDLED
- }
- // ========================= Scout =======================
- public cmdScout(id)
- {
- if (timer_started[id])
- {
- strip_user_weapons(id)
- if( !user_has_weapon(id, CSW_SCOUT))
- give_item(id,"weapon_scout")
- }
- return PLUGIN_HANDLED
- }
- public cmdUsp(id)
- {
- if (timer_started[id] && (user_has_weapon(id, CSW_SCOUT)))
- {
- ColorChat(id, GREEN, "[XJ]^x01 You need to reset your timer to get usp & knife.")
- return PLUGIN_CONTINUE
- }
- else
- {
- give_item(id,"weapon_usp")
- give_item(id,"weapon_knife")
- }
- return PLUGIN_HANDLED
- }
- // ========================== Start location =================
- public goStart(id)
- {
- if( !is_user_alive( id ) )
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You must be alive to use this command.")
- case 2: kz_hud_message(id, "You must be alive to use this command")
- }
- return PLUGIN_HANDLED
- }
- if (IsPaused[id])
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You can't teleport in pause.")
- case 2: kz_hud_message(id, "You can't teleport in pause")
- }
- return PLUGIN_HANDLED
- }
- 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] )
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You have been teleported to the start button.")
- case 2: kz_hud_message(id, "You have been teleported to the start button")
- }
- }
- else if ( DefaultStart )
- {
- set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
- set_pev(id, pev_origin, DefaultStartPos)
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You have been teleported to the start button.")
- case 2: kz_hud_message(id, "You have been teleported to the start button")
- }
- }
- else
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 No start position set for this map.")
- case 2: kz_hud_message(id, "No start position set for this map")
- }
- CmdRespawn(id)
- }
- return PLUGIN_HANDLED
- }
- public setStart(id)
- {
- if (! (get_user_flags( id ) & KZ_LEVEL ))
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You have no acces to that command.")
- case 2 : kz_hud_message(id, "You have no acces to that command")
- }
- return PLUGIN_HANDLED
- }
- new Float:origin[3], mapname[64]
- get_mapname(mapname, 63)
- pev(id, pev_origin, origin)
- kz_set_start(mapname, origin)
- AutoStart[id] = false;
- ColorChat(id, GREEN, "[XJ]^x01 Start position set for this map.")
- return PLUGIN_HANDLED
- }
- // ========= Respawn CT if dies ========
- public Ham_CBasePlayer_Killed_Post(id)
- {
- if(get_pcvar_num(kz_respawn_ct) == 1)
- {
- if( get_pdata_int(id, 114) == 2 )
- {
- set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
- 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_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
- write_byte(TE_DLIGHT)
- write_coord(origin[0])
- write_coord(origin[1])
- write_coord(origin[2])
- write_byte(80)
- write_byte(str_to_num(iRed))
- write_byte(str_to_num(iGreen))
- write_byte(str_to_num(iBlue))
- write_byte(2)
- write_byte(0)
- message_end()
- }
- // ============================ Hook ==============================================================
- public give_hook(id)
- {
- 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"))
- {
- for(new i=1;i<=MaxPlayers;i++)
- {
- if(is_user_connected(i) && is_user_alive(i))
- {
- canusehook[i] = mode
- if(mode)
- {
- ColorChat(i, GREEN, "[XJ]^x01 Hook has been enabled, bind any key '+hook' to use it.")
- }
- }
- }
- }
- else
- {
- new pid = find_player("bl",szarg1);
- if(pid > 0)
- {
- canusehook[pid] = mode
- if(mode)
- {
- ColorChat(pid, GREEN, "[XJ]^x01 Hook has been enabled, bind any key '+hook' to use it.")
- }
- }
- }
- return PLUGIN_HANDLED
- }
- // =================================================================================================
- public hook_on(id)
- {
- if( !canusehook[id] && !( get_user_flags( id ) & KZ_LEVEL ) || !is_user_alive(id) )
- return PLUGIN_HANDLED
- if (IsPaused[id])
- {
- kz_hud_message(id, "You can't use hook while paused")
- return PLUGIN_HANDLED
- }
- 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_connected( iPlayer ) && ( get_user_flags( iPlayer ) & KZ_LEVEL ) )
- {
- set_msg_arg_int( 2, ARG_BYTE, is_user_alive( iPlayer ) ? SCOREATTRIB_VIP : SCOREATTRIB_DEAD );
- }
- }
- }
- public EventStatusValue( const id )
- {
- new szMessage[ 34 ], Target, aux
- get_user_aiming(id, Target, aux)
- formatex( szMessage, 33, "1 %s: %%p2", get_user_flags( Target ) & KZ_LEVEL ? "VIP" : "Player" )
- message_begin( MSG_ONE_UNRELIABLE, 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
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 %s detected. Timer reseted.",reason)
- case 2: kz_hud_message(id, "%s detected. Timer reseted.",reason)
- }
- }
- }
- // =================================================================================================
- // Cmds
- // =================================================================================================
- public CheckPoint(id)
- {
- if(get_pcvar_num(kz_checkpoints) == 1)
- {
- if( !is_user_alive( id ) )
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You must be alive to use this command.")
- case 2: kz_hud_message(id, "You must be alive to use this command")
- }
- return PLUGIN_HANDLED
- }
- if( !( pev( id, pev_flags ) & FL_ONGROUND2 ) )
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You can't make a checkpoint in the air.")
- case 2: kz_hud_message(id, "You can't make a checkpoint in the air")
- }
- return PLUGIN_HANDLED
- }
- if( IsPaused[id] )
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You can't make a checkpoint in pause.")
- case 2: kz_hud_message(id, "You can't make a checkpoint in pause")
- }
- return PLUGIN_HANDLED
- }
- pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
- g_bCpAlternate[id] = !g_bCpAlternate[id]
- checknumbers[id]++
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 Checkpoint #%d created",checknumbers[id])
- case 2: kz_hud_message(id, "Checkpoint #%d",checknumbers[id])
- }
- }
- else
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 Checkpoints are off.")
- case 2: kz_hud_message(id, "Checkpoints are off")
- }
- }
- return PLUGIN_HANDLED
- }
- public GoCheck(id)
- {
- if( !is_user_alive( id ) )
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You must be alive to use this command.")
- case 2: kz_hud_message(id, "You must be alive to use this command")
- }
- return PLUGIN_HANDLED
- }
- if( checknumbers[id] == 0 )
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You don't have enough Checkpoints.")
- case 2: kz_hud_message(id, "You don't have enough Checkpoints")
- }
- return PLUGIN_HANDLED
- }
- if( IsPaused[id] )
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You can't teleport in pause.")
- case 2: kz_hud_message(id, "You can't teleport in pause")
- }
- return PLUGIN_HANDLED
- }
- set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} )
- set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
- set_pev( id, pev_fuser2, 0.0 )
- engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 18.0 } )
- set_pev(id, pev_origin, Checkpoints[ id ][ !g_bCpAlternate[id] ] )
- gochecknumbers[id]++
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 GoCheck #%d",gochecknumbers[id])
- case 2: kz_hud_message(id, "GoCheck #%d",gochecknumbers[id])
- }
- return PLUGIN_HANDLED
- }
- public Stuck(id)
- {
- if( !is_user_alive( id ) )
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You must be alive to use this command.")
- case 2: kz_hud_message(id, "You must be alive to use this command")
- }
- return PLUGIN_HANDLED
- }
- if( checknumbers[id] < 2 )
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 You don't have enough Checkpoints.")
- case 2: kz_hud_message(id, "You don't have enough Checkpoints")
- }
- return PLUGIN_HANDLED
- }
- set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} )
- set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
- set_pev( id, pev_fuser2, 0.0 )
- engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 18.0 } )
- set_pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id]] )
- g_bCpAlternate[id] = !g_bCpAlternate[id];
- gochecknumbers[id]++
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 GoCheck #%d",gochecknumbers[id])
- case 2: kz_hud_message(id, "GoCheck #%d",gochecknumbers[id])
- }
- return PLUGIN_HANDLED
- }
- // =================================================================================================
- public reset_checkpoints(id)
- {
- checknumbers[id] = 0
- gochecknumbers[id] = 0
- timer_started[id] = false
- timer_time[id] = 0.0
- if (get_pcvar_num(kz_show_timer) > 0 && ShowTime[id] == 2 )
- kz_showtime_roundtime(id, 0)
- return PLUGIN_HANDLED
- }
- //===== Invis =======
- public cmdInvisible(id)
- {
- if(!gViewInvisible[id])
- {
- gViewInvisible[id] = true
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 Players are now^x03 invisible^x01")
- case 2: kz_hud_message(id, "Players are now invisible")
- }
- }
- else
- {
- gViewInvisible[id] = false
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 Players are now^x03 visible^x01")
- case 2: kz_hud_message(id, "Players are now visible")
- }
- }
- return PLUGIN_HANDLED
- }
- public cmdWaterInvisible(id)
- {
- if( gWaterFound )
- {
- if(!gWaterInvisible[id])
- {
- gWaterInvisible[id] = true
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 Water is now^x03 invisible^x01")
- case 2: kz_hud_message(id, "Water is now invisible")
- }
- }
- else
- {
- gWaterInvisible[id] = false
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 Water is now^x03 visible^x01")
- case 2: kz_hud_message(id, "Water is now visible")
- }
- }
- }
- else
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 There is no water on the map.")
- case 2 : kz_hud_message(id, "There is not water on the map")
- }
- }
- 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, 85)
- }
- }
- if(gMarkedInvisible[ent] && gViewInvisible[host])
- {
- set_es(es, ES_RenderMode, kRenderTransTexture)
- set_es(es, ES_RenderAmt, 0)
- set_es(es, ES_Origin, { 999999999.0, 999999999.0, 999999999.0 } )
- }
- }
- else if( gWaterInvisible[host] && gWaterEntity[ent] )
- {
- set_es(es, ES_Effects, get_es( es, ES_Effects ) | EF_NODRAW )
- }
- return FMRES_IGNORED
- }
- public Ham_CBasePlayer_PreThink_Post(id)
- {
- if( !is_user_alive(id) )
- {
- return
- }
- RefreshPlayersList()
- if (get_pcvar_num(kz_semiclip) == 1)
- {
- for(new i = 0; i<g_iNum; i++)
- {
- g_iPlayer = g_iPlayers[i]
- if( id != g_iPlayer )
- {
- set_pev(g_iPlayer, pev_solid, SOLID_NOT)
- }
- }
- }
- }
- public client_PostThink(id)
- {
- if( !is_user_alive(id) )
- return
- RefreshPlayersList()
- if (get_pcvar_num(kz_semiclip) == 1)
- for(new i = 0; i<g_iNum; i++)
- {
- g_iPlayer = g_iPlayers[i]
- if( g_iPlayer != id )
- set_pev(g_iPlayer, pev_solid, SOLID_SLIDEBOX)
- }
- }
- // =================================================================================================
- public noclip(id)
- {
- set_user_noclip(id, get_user_noclip(id) == 1 ? 0 : 1)
- if(get_user_noclip(id) == 1)
- detect_cheat(id,"Noclip")
- ColorChat(id, GREEN, "[XJ]^x01 Noclip ^x03%s^x01", get_user_noclip(id) ? "ON" : "OFF")
- return PLUGIN_HANDLED
- }
- public GodMode(id)
- {
- set_user_godmode(id, get_user_godmode(id) == 1 ? 0 : 1)
- if(get_user_godmode(id) == 1)
- detect_cheat(id,"God Mode")
- ColorChat(id, GREEN, "[XJ]^x01 God Mode ^x03%s^x01", get_user_godmode(id) ? "ON" : "OFF")
- return PLUGIN_HANDLED
- }
- // =================================================================================================
- stock kz_set_start(const map[], Float:origin[3])
- {
- new realfile[128], tempfile[128], formatorigin[50]
- formatex(realfile, 127, "%s/%s", KZ_DIR, KZ_STARTFILE)
- formatex(tempfile, 127, "%s/%s", KZ_DIR, 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_ONE_UNRELIABLE, get_user_msgid( "RoundTime" ), _, id);
- write_short(time + 1);
- message_end();
- }
- }
- 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 GetNewRank(id, type)
- {
- new createinto[1001], mapname[64]
- get_mapname(mapname, 63)
- 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)
- 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
- }
- public FwdSpawnWeaponbox( iEntity )
- {
- if(get_pcvar_num(kz_remove_drops) == 1)
- {
- set_pev( iEntity, pev_flags, FL_KILLME )
- dllfunc( DLLFunc_Think, iEntity )
- }
- return HAM_IGNORED
- }
- public FwdHamDoorSpawn( iEntity )
- {
- static const szNull[ ] = "common/null.wav";
- new Float:flDamage;
- pev( iEntity, pev_dmg, flDamage );
- if( flDamage < -999.0 ) {
- set_pev( iEntity, pev_noise1, szNull );
- set_pev( iEntity, pev_noise2, szNull );
- set_pev( iEntity, pev_noise3, szNull );
- if( !HealsOnMap )
- HealsOnMap = true
- }
- }
- public FwdHamPlayerSpawn( id )
- {
- if( !is_user_alive( id ) )
- return;
- if( HealsOnMap )
- set_pev( id, pev_health, 50175.0 )
- if( IsPaused[id] )
- {
- set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
- set_pev(id, pev_origin, PauseOrigin[id])
- }
- }
- public GroundWeapon_Touch(iWeapon, id)
- {
- if( is_user_alive(id) && timer_started[id] && get_pcvar_num(kz_pick_weapons) == 0 )
- return HAM_SUPERCEDE
- return HAM_IGNORED
- }
- // =================================================================================================
- // Events / Forwards
- // =================================================================================================
- public resethud(id)
- {
- if( !user_has_weapon(id,CSW_KNIFE) )
- give_item( id,"weapon_knife" )
- if(firstspawn[id])
- {
- ColorChat(id, GREEN, "[XJ]^x01 Welcome to ^x03 kz.leet.ro ^x01")
- ColorChat(id, GREEN, "[XJ]^x01 Visit ^x03www.KZ-Romania.com ^x01. Plugin created by ^x03nucLeaR ^x01.")
- if(get_pcvar_num(kz_checkpoints) == 0)
- ColorChat(id, GREEN, "[XJ]^x01 Checkpoints are off.")
- if(get_pcvar_num(kz_spawn_mainmenu) == 1)
- kz_menu (id)
- kz_update_plrname(id)
- }
- firstspawn[id] = false
- return HAM_IGNORED
- }
- //=================================================================================================
- public client_disconnect(id)
- {
- checknumbers[id] = 0
- gochecknumbers[id] = 0
- antihookcheat[id] = 0.0
- timer_started[id] = false
- ShowTime[id] = get_pcvar_num(kz_show_timer)
- firstspawn[id] = true
- NightVisionUse[id] = false
- IsPaused[id] = false
- remove_hook(id)
- }
- public client_putinserver(id)
- {
- checknumbers[id] = 0
- gochecknumbers[id] = 0
- antihookcheat[id] = 0.0
- timer_started[id] = false
- ShowTime[id] = get_pcvar_num(kz_show_timer)
- firstspawn[id] = true
- NightVisionUse[id] = false
- IsPaused[id] = false
- remove_hook(id)
- }
- // =================================================================================================
- // Menu
- // =================================================================================================
- public kz_menu(id)
- {
- new menu = menu_create("\yProKreedz Menu\w", "MenuHandler")
- menu_setprop(menu, MPROP_PERPAGE, 0)
- new msgcheck[64], msggocheck[64], msgpause[64]
- formatex(msgcheck, 63, "Checkpoint - \y#%i", checknumbers[id])
- formatex(msggocheck, 63, "Gocheck - \y#%i", 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, "Top 15^n", "3")
- menu_additem( menu, "Start", "4")
- menu_additem( menu, "Timer Menu", "5" )
- menu_additem( menu, msgpause, "6" )
- menu_additem( menu, "Invisible Menu", "7" )
- menu_additem( menu, "Spectator/CT", "8" )
- menu_additem( menu, "Reset Time^n", "9")
- menu_additem( menu, "Exit", "*" )
- menu_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- public MenuHandler(id , menu, item)
- {
- if( item == MENU_EXIT ) {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- new data[6], name[32]
- new access, callback
- menu_item_getinfo(menu, item, access, data, 5, _, _, callback)
- new key = str_to_num(data)
- get_user_name(id, name, 31)
- switch(key) {
- case 1:{
- CheckPoint(id)
- kz_menu(id)
- }
- case 2:{
- GoCheck(id)
- kz_menu(id)
- }
- case 3:{
- top15menu(id)
- }
- case 4:{
- goStart(id)
- kz_menu(id)
- }
- case 5:{
- ShowTimer_Menu(id)
- }
- case 6:{
- Pause(id)
- kz_menu(id)
- }
- case 7:{
- InvisMenu(id)
- }
- case 8:{
- ct(id)
- }
- case 9:{
- reset_checkpoints(id)
- kz_menu(id)
- }
- case '*':{
- }
- }
- return PLUGIN_HANDLED
- }
- public 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_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- public InvisMenuHandler (id, menu, item)
- {
- if( item == MENU_EXIT )
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- new data[6]
- new access, callback
- menu_item_getinfo(menu, item, access, data, 5, _, _, callback)
- new key = str_to_num(data)
- switch(key)
- {
- case 1:
- {
- cmdInvisible(id)
- InvisMenu(id)
- }
- case 2:
- {
- cmdWaterInvisible(id)
- InvisMenu(id)
- }
- case 9:
- {
- show_menu(id,0,"")
- }
- }
- return PLUGIN_HANDLED
- }
- public ShowTimer_Menu(id)
- {
- if (get_pcvar_num(kz_show_timer) == 0 )
- {
- kz_hud_message(id, "Timer show is disabled by CVar")
- 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, "Main 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
- }
- new data[6]
- new access, callback
- menu_item_getinfo(menu, item, access, data, 5, _, _, callback)
- new key = str_to_num(data)
- switch(key)
- {
- case 1:
- {
- ShowTime[id]= 2
- ShowTimer_Menu(id)
- }
- case 2:
- {
- ShowTime[id]= 1
- ShowTimer_Menu(id)
- if (timer_started[id])
- kz_showtime_roundtime(id, 0)
- }
- case 3:
- {
- ShowTime[id]= 0
- ShowTimer_Menu(id)
- if (timer_started[id])
- kz_showtime_roundtime(id, 0)
- }
- case 4:
- {
- kz_menu(id)
- }
- case 9:
- {
- show_menu(id,0,"")
- }
- }
- return PLUGIN_HANDLED
- }
- public top15menu(id)
- {
- new menu = menu_create("\r[ProKreedz] \yTop15 \w", "menufunc")
- menu_additem(menu, "Pro 15", "1")
- menu_additem(menu, "Noob 15", "2")
- 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_display(id, menu, 0)
- return PLUGIN_HANDLED
- }
- public menufunc(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- new data[6], iName[64]
- new iaccess, callback
- menu_item_getinfo(menu, item, iaccess, data,5, iName, 63, callback)
- new key = str_to_num(data);
- switch(key)
- {
- case 1:
- {
- ProTop_show(id)
- }
- case 2:
- {
- NoobTop_show(id)
- }
- case 3:
- {
- kz_showhtml_motd(id, PRO_RECORDS, "")
- }
- case 4:
- {
- kz_showhtml_motd(id, PLAYERS_RANKING, "")
- }
- case 5:
- {
- kz_showhtml_motd(id, LAST_PRO10, "")
- }
- case 6:
- {
- kz_showhtml_motd(id, MAPS_STATISTIC, "")
- }
- case 9:
- {
- show_menu(id,0,"")
- }
- }
- return PLUGIN_HANDLED;
- }
- stock kz_showhtml_motd(id, type, const map[])
- {
- new buffer[1001], namebuffer[64], filepath[96]
- get_pcvar_string(kz_sql_file, 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/kz_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)
- }
- // 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_gametime() - antihookcheat[id] < 3.0 )
- {
- kz_hud_message( id, "Wait 3 seconds after using hook" );
- return PLUGIN_HANDLED
- }
- if ( reset_checkpoints(id) && !timer_started[id] )
- {
- start_climb(id)
- if(get_pcvar_num(kz_strip_other_weapons) == 1)
- for(new i = 0; i < 8; i++)
- if( user_has_weapon(id, other_weapons[i]) )
- {
- strip_user_weapons(id)
- give_item(id,"weapon_knife")
- give_item(id,"weapon_usp")
- set_pdata_int(id, 382, 24, 5)
- }
- if( pev(id, pev_health) < 100 )
- set_pev(id, pev_health, 100.0)
- pev(id, pev_origin, SavedStart[id])
- if(get_pcvar_num(kz_save_autostart) == 1)
- AutoStart[id] = true;
- if( !DefaultStart )
- {
- new mapname[64]
- get_mapname( mapname, 63)
- kz_set_start(mapname, SavedStart[id])
- ColorChat(id, GREEN, "[XJ]^x01 Start position set for this map.")
- }
- remove_hook(id)
- }
- }
- if( TrieKeyExists( g_tStops, szTarget ) )
- {
- if( timer_started[id] )
- {
- finish_climb(id)
- if(get_pcvar_num(kz_hook_prize) == 1 && !canusehook[id])
- {
- canusehook[id] = true
- ColorChat(id, GREEN, "[XJ]^x01 Hook has been enabled, bind any key '+hook' to use it.")
- }
- }
- else
- kz_hud_message(id, "You must press the start button first")
- }
- return HAM_IGNORED
- }
- public start_climb(id)
- {
- switch (get_pcvar_num(kz_chatorhud))
- {
- case 1: ColorChat(id, GREEN, "[XJ]^x01 Timer started.")
- case 2: kz_hud_message(id, "Timer started")
- }
- 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)
- set_user_godmode(id, 0)
- reset_checkpoints(id)
- IsPaused[id] = false
- timer_started[id] = true
- timer_time[id] = get_gametime()
- }
- public finish_climb(id)
- {
- if (!is_user_alive (id))
- {
- return;
- }
- new Float: time, weapon
- time = get_gametime() - timer_time[id]
- show_finish_message(id, time)
- timer_started[id] = false
- new checkpoints=checknumbers[id]
- new gocheck=gochecknumbers[id]
- if (user_has_weapon(id,CSW_SCOUT) )
- weapon = CSW_SCOUT
- else
- weapon=get_user_weapon(id)
- new map[64], steam[32], name[32]
- get_mapname(map, sizeof map - 1 )
- 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, weapon, checkpoints ,gocheck)
- if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 18)
- {
- if (gochecknumbers[id] == 0 && !user_has_weapon(id,CSW_SCOUT) )
- {
- cData[1] = PRO_TOP
- formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_pro15` WHERE mapname='%s' AND name='%s'", map, name)
- SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
- }
- if (gochecknumbers[id] > 0 || user_has_weapon(id,CSW_SCOUT) )
- {
- cData[1] = NUB_TOP
- formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_nub15` WHERE mapname='%s' AND name='%s'", map, name)
- SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
- }
- } else
- {
- if (gochecknumbers[id] == 0 && !user_has_weapon(id,CSW_SCOUT) )
- {
- cData[1] = PRO_TOP
- formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_pro15` WHERE mapname='%s' AND authid='%s'", map, steam)
- SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
- }
- if (gochecknumbers[id] > 0 || user_has_weapon(id,CSW_SCOUT) )
- {
- cData[1] = NUB_TOP
- formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_nub15` WHERE mapname='%s' AND authid='%s'", map, steam)
- SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
- }
- }
- }
- public show_finish_message(id, Float:kreedztime)
- {
- new name[32]
- new imin,isec,ims, wpn = get_user_weapon( id )
- get_user_name(id, name, 31)
- kreedztime = get_gametime() - timer_time[id]
- imin = floatround(kreedztime / 60.0, floatround_floor)
- isec = floatround(kreedztime - imin * 60.0,floatround_floor)
- ims = floatround( ( kreedztime - ( imin * 60.0 + isec ) ) * 100.0, floatround_floor )
- ColorChat(0, GREEN, "[XJ]^x01^x03 %s^x01 finished in^x04 %02i:%02i.%02i ^x03(^x01 CPs: ^x04%d^x03 | ^x01 TPs: ^x04%d^x03 | ^x01 Weapon: ^x04%s^x03) ^x01 !",name,imin,isec,ims, checknumbers[id], gochecknumbers[id], g_weaponsnames[wpn])
- }
- 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("[XJ] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
- ColorChat(0, GREEN, "[XJ]^x01: Warring the SQL Tops can not be saved.")
- }
- server_print("[XJ] 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], map[64], steam[32], name[32], ip[15], country[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_mapname(map, sizeof map - 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, country)
- 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", map, steam, country, 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, "[XJ]^x01 You improved your time by^x03 %02i:%02i.%02i^x01 in ^x03%s", 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, map)
- 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, map)
- 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, "[XJ]^x01 You failed your best time by^x03 %02i:%02i.%02i ^x01in ^x03%s", 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, "[XJ]^x03 %s^x01 is now on place ^x03%d^x01 in^x03 %s^x01", namez, i, cData[1] == PRO_TOP ? "Pro 15" : "Noob 15");
- break;
- }
- }
- else
- {
- SQL_ReadResult(hQuery, 0, authid, 31)
- if( equal(authid, steam) )
- {
- ColorChat(0, GREEN, "[XJ]^x03 %s^x01 is now on place ^x03%d^x01 in^x03 %s^x01", namez, i, cData[1] == PRO_TOP ? "Pro 15" : "Noob 15");
- break;
- }
- }
- SQL_NextRow(hQuery)
- }
- return PLUGIN_CONTINUE
- }
- public ProTop_show(id)
- {
- new mapname[64]
- get_mapname(mapname, 63)
- kz_showhtml_motd(id, PRO_TOP, mapname)
- return PLUGIN_HANDLED
- }
- public NoobTop_show(id)
- {
- new mapname[64]
- get_mapname(mapname, 63)
- kz_showhtml_motd(id, NUB_TOP, mapname)
- return PLUGIN_HANDLED
- }
- public ProRecs_show(id)
- {
- new mapname[64], authid[32]
- get_mapname(mapname, 63)
- get_user_authid(id, authid, 31)
- if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || strlen(authid) > 18)
- {
- ColorChat (id, GREEN, "[XJ]^x03 ProRecords function is available just for Steam users.")
- return PLUGIN_HANDLED
- }
- kz_showhtml_motd(id, PRO_RECORDS, mapname)
- return PLUGIN_HANDLED
- }
- // You reached the end of file
- // This plugin was made by p4ddY :)
- // This plugin was edited by nucLeaR
- // Version 2.0y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement