Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///Added Autojoin
- ///Added Semiclip
- ///Added Allchat (if have any other say plugin you must add upper then prokreedz in plugins.ini)
- ///Added Block Kill
- ///Added Block Change Team
- ///Added No Buyzone
- ///NonSpriteGlowfix
- ///Added Silencer Cvar kz_weapon_silencer
- ///Added Cvar kz_admin_check
- ///HudTextArgs Blocker
- ///Invis Fixed in Spec
- ///Hook Fixed through player
- ///Added /wr command uncomment DOWNLOAD_NEW_WR if Not Local demos.txt and demoz.txt
- ///Added Tp To Finish in Teleport menu
- ///Added Owner & BOT in aiming player
- ///Added Cvar Show WR Different Time kz_wr_diff (FIXED)
- ///Added Added Pro1 Show and Nub1 Show if SQL DEFINED (Finish Msg or WR or in spec).
- ///Added Description server cvar kz_gamename
- ///Added define KZ_DUEL and cvar kz_duel
- ///Delete Dropped Weapons or on death and when drop alive
- ///Fixed NVG on SPEC And Damage -HP on spec
- #include <amxmodx>
- #include <amxmisc> //cmd_access
- #include <cstrike>
- #include <colorchat>
- #include <fun>
- #include <fakemeta>
- #include <hamsandwich>
- #include <engine>
- #include <dhudmessage>
- #include <xs>
- #define USE_SQL
- //#define KZ_DUEL
- //#define CREATE_TABLES_1ST_TIME
- #if defined USE_SQL
- #include <sqlx>
- #include <geoip>
- #endif
- //===========================WR===============================//
- //#define DOWNLOAD_NEW_WR ////////////// if you want download (update) uncomment it
- #if defined DOWNLOAD_NEW_WR ///////////////////////////////////
- #include <sockets>
- new const g_szDemoFiles[][][] =
- {
- { "http://kreedz.uz/demos.txt", "demos.txt", "demos_last_update_xj.txt" },
- { "http://kreedz.uz/demoz.txt", "demoz.txt", "demos_last_update_cc.txt" }
- };
- enum _:RecordDemo
- {
- URLS,
- DEMOS,
- UPDATEDEMOS
- }
- new g_szDemosBuffer[25001];
- #else /////////////////////////////////////////////
- new const g_szDemoFiles[][][] =
- {
- { "demos.txt" },
- { "demoz.txt" }
- };
- enum _:RecordDemo
- {
- DEMOS
- }
- #endif //////////////////////////////////////////////
- new const g_szDirFile[] = "kzrecords";
- new Float:g_flWorldRecordTime[5];
- new Float:DiffWRTime[16];
- new g_szWorldRecordPlayer[5][32];
- new g_szDir[128];
- new g_szMapName[32];
- new g_iWorldRecordsNum;
- new norecord;
- new g_szWorldExt[5][20];
- new g_szWorldRecords[256];
- #if defined USE_SQL
- new proinfo[64], noobinfo[64], myproinfo[33][64], mynoobinfo[33][64]
- new bool:MyPosUpdated[33]
- new bool:TopUpdated
- new bool:FinishMsg
- #endif
- new g_entid[33]
- new g_maxents
- //===========================END OF WR===============================//
- #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 is_user(%1) (1 <= %1 <= get_maxplayers())
- #define TEAM_SELECT_VGUI_MENU_ID 2
- #define SCOREATTRIB_NONE 0
- #define SCOREATTRIB_DEAD ( 1 << 0 )
- #define SCOREATTRIB_BOMB ( 1 << 1 )
- #define SCOREATTRIB_VIP ( 1 << 2 )
- #define SEMICLIP_RENDERING_RADIUS 400.0
- const Float:SEMICLIP_RADIUS = SEMICLIP_RENDERING_RADIUS;
- #define TASK_INFO 12222
- #define TASK_INFO_KREEDZ 17232
- #define TASK_GETTOP 12583
- #define SHOW_POS_TASK 87631
- #define SHOW_BEACON 87632
- #define SHOW_BEACON1 87633
- #define WBOX "models/w_weaponbox.mdl"
- #define BOMB "models/w_backpack.mdl"
- #define SHLD "models/w_shield.mdl"
- ///=======================Measure ===============/////////////
- #define TASK_BEAM 45896
- new Float:g_vFirstLoc[33][3];
- new Float:g_vSecondLoc[33][3];
- new bool:g_bReturnFloat[33];
- new bool:g_bShowBeams[33];
- new bool:g_bDetailedResults[33];
- new bool:g_bAutoSetting[33];
- new id_spectated[33]
- new g_iColors[3] = { 255, 85, 0 };
- new g_flBeam;
- ////=====================Measure ======================///////////
- //////////////////////admin_check/////////////////////
- #define ADMIN_CHECK ADMIN_KICK
- static const COLOR[] = "^x01" //yellow
- // static const COLOR1[] = "^x03" //blue
- // static const COLOR2[] = "^x04" //green
- static const CONTACT[] = ""
- ///////////////////admin_check///////////////////////
- //////////////////////////hudtextargblock/////////////////
- const NextHudTextArgsOffset = 198 // ConnorMcLeod
- const HintMaxLen = 38
- new Hints[][HintMaxLen] =
- {
- "hint_win_round_by_killing_enemy",
- "hint_press_buy_to_purchase",
- "hint_spotted_an_enemy",
- "hint_use_nightvision",
- "hint_lost_money",
- "hint_removed_for_next_hostage_killed",
- "hint_careful_around_hostages",
- "hint_careful_around_teammates",
- "hint_reward_for_killing_vip",
- "hint_win_round_by_killing_enemy",
- "hint_try_not_to_injure_teammates",
- "hint_you_are_in_targetzone",
- "hint_hostage_rescue_zone",
- "hint_terrorist_escape_zone",
- "hint_ct_vip_zone",
- "hint_terrorist_vip_zone",
- "hint_cannot_play_because_tk",
- "hint_use_hostage_to_stop_him",
- "hint_lead_hostage_to_rescue_point",
- "hint_you_have_the_bomb",
- "hint_you_are_the_vip",
- "hint_out_of_ammo",
- "hint_spotted_a_friend",
- "hint_spotted_an_enemy",
- "hint_prevent_hostage_rescue",
- "hint_rescue_the_hostages",
- "hint_press_use_so_hostage_will_follow"
- }
- new HintsDefaultStatus[sizeof Hints] =
- {
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
- }
- new Trie:HintsStatus
- //////////////////////////hudtextargblock/////////////////
- new bool:isFalling[33]
- new bool:isMpbhop[33]
- new Float:vFallingStart[33][3]
- new Float:MpbhopOrigin[33][3]
- new Float:vFallingTime[33]
- new g_iPlayers[32], g_iNum
- new Float:hp_spec[33]
- 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_FINISHFILE[] = "finish.ini"
- new const KZ_FINISHFILE_TEMP[] = "temp_finish.ini"
- #if defined USE_SQL
- new bool:sqlconnected
- 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 max_players;
- new g_maxplayers;
- new Float:gCheckpointAngle[33][3];
- new Float:gLastCheckpointAngle[33][3];
- new Float:gCheckpointStartAngle[33][3];
- new Float:gLastCheckpointStartAngle[33][3];
- new Float:Checkpoints[33][2][3]
- new Float:InPauseCheckpoints[33][2][3]
- new Float:CheckpointStarts[33][2][3]
- new Float:timer_time[33]
- new Float:g_pausetime[33]
- new Float:antihookcheat[33]
- new Float:antidiestart[33]
- new g_iHookWallOrigin[33][3];
- new Float:antinoclipstart[33]
- new Float:antiteleport[33]
- new Float:SpecLoc[33][3]
- new Float:PauseOrigin[33][3]
- new Float:SavedStart[33][3]
- new Float:SavedStop[33][3]
- new hookorigin[33][3]
- new Float:DefaultStartPos[3]
- new Float:DefaultStopPos[3]
- new Float:SavedTime[33]
- new SavedChecks[33]
- new SavedGoChecks[33]
- new SavedScout[33]
- new SavedOrigins[33][3]
- new SavedVelocity[33][3]
- new Float:pausedvelocity[33][3]
- new bool:gCheckpoint[33];
- new bool:gCheckpointStart[33];
- new bool:g_bCpAlternate[33]
- new bool:g_bInPauseCpAlternate[33]
- new bool:g_bCpAlternateStart[33]
- new bool:timer_started[33]
- new bool:IsPaused[33]
- new bool:StartSound[33]
- new bool:WasPlayed[33]
- new bool:firstspawn[33]
- new bool:canusehook[33]
- new bool:ishooked[33]
- new bool:GoPosed[33]
- new bool:GoPosCp[33]
- new bool:GoPosHp[33]
- new bool:user_has_scout[33]
- new bool:spec_user[33]
- new bool:tphook_user[33]
- new bool:menushow[33]
- new bool:block_change[33]
- new bool:tptostart[33]
- new bool:NightVisionUse[33]
- new bool:HealsOnMap
- new bool:gViewInvisible[33]
- new bool:gWaterInvisible[33]
- new bool:gWaterEntity[MAX_ENTITYS]
- new bool:gWaterFound
- new bool:DefaultStart
- new bool:DefaultStop
- new bool:AutoStart[33]
- new bool:Autosavepos[33]
- new bool:tpfenabled[33]
- new bool:gc1[33]
- new Trie:g_tStarts
- new Trie:g_tStops;
- new checknumbers[33]
- new inpausechecknumbers[33]
- new gochecknumbers[33]
- new chatorhud[33]
- new MapName[64]
- new Kzdir[128]
- new SavePosDir[128]
- new prefix[33]
- #if !defined USE_SQL
- new Topdir[128]
- #endif
- new iconstatus
- new kz_help
- new kz_autosavepos
- new kz_gamename
- new kz_spawn_mainmenu
- new kz_duel
- new kz_admin_check
- new kz_hud_color
- new kz_chat_prefix
- new hud_message
- new kz_other_weapons
- new kz_maxspeedmsg
- new kz_weapon_silencer
- new kz_wr_diff
- new kz_drop_weapons
- new kz_pick_weapons
- new kz_use_radio
- new kz_hook_sound
- new kz_hook_speed
- new kz_nvg
- new kz_nvg_colors
- new kz_vip
- new kz_save_pos
- new kz_top15_authid
- new Sbeam = 0
- new my_sprite
- new g_msgid_SayText;
- new const textchannels[][] = {
- "#Cstrike_Chat_T",
- "#Cstrike_Chat_CT",
- "#Cstrike_Chat_Spec",
- "#Cstrike_Chat_All",
- "#Cstrike_Chat_AllSpec",
- "#Cstrike_Chat_AllDead",
- "#Cstrike_Chat_T_Dead",
- "#Cstrike_Chat_CT_Dead"
- };
- 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
- ////////////////////////////////////////////////////////////////
- const groupNone = 0;
- enum _:renderGroups ( <<= 1 )
- {
- groupRenderVisible = 0b1, // 0b1
- groupRenderInvisible, // 0b10
- }
- new const CLASS_PLAYER[] = "player";
- #define IsPlayer(%0) ( 1 <= (%0) <= g_iMaxPlayers )
- #define MaskEnt(%0) ( 1<<(%0 & 31) )
- new g_bitIsPlayerInSphere;
- #define MarkPlayerInSphere(%0) g_bitIsPlayerInSphere |= MaskEnt(%0)
- #define IsPlayerInSphere(%0) ( g_bitIsPlayerInSphere & MaskEnt(%0) )
- new g_bitIsPlayerAlive;
- #define MarkPlayerAlive(%0) g_bitIsPlayerAlive |= MaskEnt(%0)
- #define IsPlayerAlive(%0) ( g_bitIsPlayerAlive & MaskEnt(%0) )
- new g_bitBots;
- #define MarkPlayerBot(%0) g_bitBots |= MaskEnt(%0)
- #define ClearPlayerBot(%0) g_bitBots &= ~MaskEnt(%0)
- #define IsUserBot(%0) ( g_bitBots & MaskEnt(%0) )
- new g_iLastPlayerIndex;
- new HamHook:g_iHhPreThink, HamHook:g_iHhPreThinkPost;
- new g_iFhAddToFullPackPost;
- new bool:g_bPreThinkHooked;
- new bool:g_bReadPackets;
- new bool:g_bClientMessages;
- #if defined KZ_DUEL
- new bool:plr_nonsteam[33]
- native kz_player_duel_cp(id)
- native kz_player_in_duel(id)
- native kz_player_can_hook(id)
- #endif
- // =================================================================================================
- public plugin_init()
- {
- register_plugin("ProKreedz", VERSION, "Destroman Edited")
- register_clcmd("say /teleport", "Teleport")
- g_maxplayers = get_maxplayers()
- kz_autosavepos = register_cvar("kz_autosavepos","1")
- kz_spawn_mainmenu = register_cvar("kz_spawn_mainmenu", "1")
- kz_duel = register_cvar("kz_duel", "1")
- kz_gamename = register_cvar("kz_gamename", "KREEDZ")
- kz_admin_check = register_cvar("kz_admin_check", "1")
- kz_chat_prefix = register_cvar("kz_chat_prefix", "[KZ.M]")
- kz_hud_color = register_cvar("kz_hud_color", "0 100 255")
- kz_other_weapons = register_cvar("kz_other_weapons","1")
- kz_drop_weapons = register_cvar("kz_drop_weapons", "0")
- kz_pick_weapons = register_cvar("kz_pick_weapons", "0")
- kz_weapon_silencer = register_cvar("kz_weapon_silencer","1")
- kz_wr_diff = register_cvar("kz_wr_diff","1")
- kz_maxspeedmsg = register_cvar("kz_maxspeedmsg","1")
- kz_hook_sound = register_cvar("kz_hook_sound","1")
- kz_help = register_cvar("kz_help","1")
- kz_hook_speed = register_cvar("kz_hook_speed", "300.0")
- kz_use_radio = register_cvar("kz_use_radio", "0")
- kz_nvg = register_cvar("kz_nvg","1")
- kz_nvg_colors = register_cvar("kz_nvg_colors","248 248 255")
- kz_vip = register_cvar("kz_vip","1")
- kz_top15_authid = register_cvar("kz_top15_authid", "1")
- kz_save_pos = register_cvar("kz_save_pos", "1")
- iconstatus = get_user_msgid("StatusIcon");
- max_players=get_maxplayers()+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("/ss","CheckPointStart")
- register_clcmd("/help","cmd_help")
- register_clcmd("/cs","CheckPointStart")
- register_clcmd("drop", "BlockDrop")
- register_clcmd("/gc", "GoCheck")
- register_clcmd("/gcf", "GoCheck1")
- register_clcmd("+hook","hook_on",KZ_LEVEL)
- register_clcmd("-hook","hook_off",KZ_LEVEL)
- register_concmd("nightvision","ToggleNVG")
- register_clcmd("radio1", "BlockRadio")
- register_clcmd("radio2", "BlockRadio")
- register_clcmd("radio3", "BlockRadio")
- register_clcmd("stuck", "Stuck")
- register_clcmd("unstuck", "Stuck")
- register_clcmd("/tp","GoCheck")
- register_clcmd("/tpf","GoCheck1")
- register_clcmd("say menu","kz_menu", 0)
- register_clcmd("chooseteam", "HookCmdChooseTeam");
- register_concmd( "measure_color", "cmdChangeColor" );
- register_clcmd( "say /measure","cmdMeasure" );
- register_clcmd( "say /distance","cmdMeasure" );
- register_menucmd( register_menuid( "\rMeasure^n^n" ), 1023, "menuAction" );
- register_message(get_user_msgid("ShowMenu"), "message_show_menu")
- register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
- register_message(get_user_msgid("HudTextArgs"),"hudTextArgs")
- kz_register_saycmd("help","cmd_help",0)
- kz_register_saycmd("cp","CheckPoint",0)
- kz_register_saycmd("ss","CheckPointStart",0)
- kz_register_saycmd("cs","CheckPointStart",0)
- kz_register_saycmd("chatorhud", "ChatHud", 0)
- kz_register_saycmd("ct","ct",0)
- kz_register_saycmd("gc", "GoCheck",0)
- kz_register_saycmd("gcf", "GoCheck1",0)
- kz_register_saycmd("gocheck", "GoCheck",0)
- kz_register_saycmd("gocheckf", "GoCheck1",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("p", "Pause", 0)
- kz_register_saycmd("pause", "Pause", 0)
- kz_register_saycmd("unpause", "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("rs", "reset_checkpoints", 0)
- kz_register_saycmd("respawn", "goStart1", 0)
- kz_register_saycmd("scout", "cmdScout", 0)
- kz_register_saycmd("setstart", "setStart", KZ_LEVEL)
- kz_register_saycmd("setstop", "setStop", KZ_LEVEL)
- kz_register_saycmd("origin", "Origin", KZ_LEVEL)
- kz_register_saycmd("spec", "ct", 0)
- kz_register_saycmd("start", "goStart", 0)
- kz_register_saycmd("stop", "goFinish", 0)
- kz_register_saycmd("stuck", "Stuck", 0)
- kz_register_saycmd("unstuck", "Stuck", 0)
- kz_register_saycmd("teleport", "GoCheck", 0)
- kz_register_saycmd("top15", "top15menu",0)
- kz_register_saycmd("top10", "top15menu",0)
- kz_register_saycmd("tp", "GoCheck",0)
- kz_register_saycmd("tpf", "GoCheck1",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)
- #if defined USE_SQL
- kz_register_saycmd("prorecords", "ProRecs_show", 0)
- kz_register_saycmd("prorecs", "ProRecs_show", 0)
- #endif
- register_message( get_user_msgid( "StatusIcon" ), "Msg_StatusIcon" );
- 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)
- register_forward( FM_GetGameDescription,"Fwd_GameDesc" );
- ///////////////////////////////////////////////
- register_forward(FM_CmdStart, "OnCmdStart", false);
- DisableHamForward( g_iHhPreThink = RegisterHam(Ham_Player_PreThink, CLASS_PLAYER, "OnCBasePlayer_PreThink", false) );
- DisableHamForward( g_iHhPreThinkPost = RegisterHam(Ham_Player_PreThink, CLASS_PLAYER, "OnCBasePlayer_PreThink_P", true) );
- register_forward(FM_UpdateClientData, "OnUpdateClientData_P", true);
- /////////////////////////////////////////////////////
- register_forward(FM_PlayerPreThink, "fwdPlayerPreThink", 0)
- register_forward(FM_ClientKill, "Forward_ClientKill")
- RegisterHam( Ham_Use, "func_button", "fwdUse", 0)
- RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Pre")
- RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1)
- RegisterHam( Ham_Touch, "weaponbox", "FwdSpawnWeaponbox" )
- RegisterHam( Ham_Touch, "armoury_entity", "FwdSpawnWeaponbox" )
- RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 )
- RegisterHam( Ham_TakeDamage, "player", "eventHamPlayerDamage")
- RegisterHam( Ham_Touch, "worldspawn", "Ham_HookTouch", false);
- RegisterHam( Ham_Touch, "func_wall", "Ham_HookTouch", false);
- RegisterHam( Ham_Touch, "func_breakable", "Ham_HookTouch", false);
- RegisterHam( Ham_Touch, "player", "Ham_HookTouch", false);
- register_forward(FM_Think,"fw_ThinkEntity")
- new iEnt
- iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString , "info_target"))
- set_pev(iEnt, pev_classname, "kz_time_think")
- set_pev(iEnt, pev_nextthink, get_gametime() + 1.0)
- g_msgid_SayText = get_user_msgid("SayText");
- register_clcmd("say", "HandleSay");
- register_clcmd("say_team", "HandleSay");
- register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" )
- register_dictionary("prokreedz.txt")
- get_pcvar_string(kz_chat_prefix, prefix, 31)
- get_mapname(MapName, 63)
- set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
- 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
- get_mapname(g_szMapName, sizeof(g_szMapName) - 1);
- strtolower(g_szMapName);
- CheckRecords()
- new szModel[ 2 ],
- iMaxEntities = get_global_int( GL_maxEntities );
- while( ++g_maxplayers <= iMaxEntities ) {
- if( is_valid_ent( g_maxplayers ) && entity_get_int( g_maxplayers, EV_INT_rendermode ) == kRenderGlow ) {
- entity_get_string( g_maxplayers, EV_SZ_model, szModel, 1 );
- if( szModel[ 0 ] == '*' )
- entity_set_int( g_maxplayers, EV_INT_rendermode, kRenderNormal );
- }
- }
- 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 )
- }
- public plugin_precache()
- {
- hud_message = CreateHudSyncObj()
- RegisterHam( Ham_Spawn, "func_door", "FwdHamDoorSpawn", 1 )
- precache_sound("weapons/xbow_hit2.wav")
- Sbeam = precache_model("sprites/lgtning.spr")
- precache_sound("warcraft3/resurrecttarget.wav")
- precache_sound( "misc/mod_unstopable.wav" );
- my_sprite = precache_model("sprites/black_smoke1.spr")
- g_flBeam = precache_model( "sprites/zbeam4.spr" );
- }
- public plugin_cfg()
- {
- sqlconnected = false
- TopUpdated = true
- FinishMsg = false
- #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
- HintsStatus = TrieCreate()
- for(new i=0, statusString[2]; i<sizeof Hints; i++)
- {
- statusString[0] = HintsDefaultStatus[i] + 48
- if(get_pcvar_num(register_cvar(Hints[i],statusString)))
- TrieSetCell(HintsStatus,Hints[i][5],true)
- }
- new startcheck[100], data[1024], 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 stopcheck[100], data1[1024], map1[64], x1[13], y1[13], z1[13];
- formatex(stopcheck, 99, "%s/%s", Kzdir, KZ_FINISHFILE)
- new ff = fopen(stopcheck, "rt" )
- while( !feof( ff ) )
- {
- fgets( ff, data1, sizeof data1 - 1 )
- parse( data1, map1, 63, x1, 12, y1, 12, z1, 12)
- if( equali( map1, MapName ) )
- {
- DefaultStopPos[0] = str_to_float(x1)
- DefaultStopPos[1] = str_to_float(y1)
- DefaultStopPos[2] = str_to_float(z1)
- DefaultStop = true
- break;
- }
- }
- fclose(ff)
- 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 HookCmdChooseTeam(id)
- {
- return PLUGIN_HANDLED ;
- }
- public message_show_menu(msgid, dest, id) {
- if(block_change[id]) {
- return PLUGIN_HANDLED
- }
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), {0,0,0}, id)
- write_short(12288); // 8192 = 2 seconds
- write_short(512);
- write_short(0x0000);
- write_byte(0);
- write_byte(0);
- write_byte(0);
- write_byte(255);
- message_end();
- static team_select[] = "#Team_Select"
- static menu_text_code[sizeof team_select]
- get_msg_arg_string(4, menu_text_code, sizeof menu_text_code - 1)
- if (!equal(menu_text_code, team_select))
- return PLUGIN_CONTINUE
- set_force_team_join_task(id, msgid)
- block_change[id] = true
- return PLUGIN_HANDLED
- }
- public message_vgui_menu(msgid, dest, id) {
- if(block_change[id]) {
- return PLUGIN_HANDLED
- }
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), {0,0,0}, id)
- write_short(12288); // 8192 = 2 seconds
- write_short(512);
- write_short(0x0000);
- write_byte(0);
- write_byte(0);
- write_byte(0);
- write_byte(255);
- message_end();
- if (get_msg_arg_int(1) != TEAM_SELECT_VGUI_MENU_ID )
- return PLUGIN_CONTINUE
- set_force_team_join_task(id, msgid)
- block_change[id] = true
- return PLUGIN_HANDLED
- }
- set_force_team_join_task(id, menu_msgid) {
- static param_menu_msgid[2]
- param_menu_msgid[0] = menu_msgid
- set_task(0.1, "task_force_team_join", id, param_menu_msgid, sizeof param_menu_msgid)
- }
- public task_force_team_join(menu_msgid[], id) {
- if (get_user_team(id))
- return
- force_team_join(id, menu_msgid[0])
- }
- stock force_team_join(id, menu_msgid) {
- static jointeam[] = "jointeam"
- static msg_block, joinclass[] = "joinclass"
- msg_block = get_msg_block(menu_msgid)
- set_msg_block(menu_msgid, BLOCK_SET)
- engclient_cmd(id, jointeam, "2")
- engclient_cmd(id, joinclass, "5")
- set_msg_block(menu_msgid, msg_block)
- }
- //============================================================================= WR ============================================================//
- stock WRTimer(const Float:flRealTime, szOutPut[], const iSizeOutPut, bMiliSeconds = true, gametime = true)
- {
- static Float:flTime, iMinutes, iSeconds;
- if(gametime)
- {
- flTime = get_gametime() - flRealTime;
- }
- else
- {
- flTime = flRealTime;
- }
- if(flTime < 0.0)
- {
- flTime = 0.0;
- }
- iMinutes = floatround(flTime / 60, floatround_floor);
- iSeconds = floatround(flTime - (iMinutes * 60), floatround_floor);
- formatex(szOutPut, iSizeOutPut, "%02d:%02d", iMinutes, iSeconds);
- if(bMiliSeconds)
- {
- static iMiliSeconds;
- iMiliSeconds = floatround((flTime - (iMinutes * 60 + iSeconds)) * 100, floatround_round);
- format(szOutPut, iSizeOutPut, "%s.%02d", szOutPut, iMiliSeconds);
- }
- }
- stock LoadWorldRecord(map[], szWorldRecord[], iWRsize)
- {
- new g_iMapNameLen = strlen(map);
- new iRecords;
- new szFile[128];
- for(new i; i < 2; i++)
- {
- format(szFile, sizeof(szFile) - 1, "%s/%s", g_szDir, g_szDemoFiles[i][DEMOS]);
- if(file_exists(szFile))
- {
- new hFile = fopen(szFile, "r");
- new szData[128];
- new szMapName[64], szTime[14], szAuthor[32], szCountry[2], szExt[25], szCode[6];
- while(!feof(hFile))
- {
- fgets(hFile, szData, sizeof(szData) - 1);
- trim(szData);
- if(!szData[0] || szData[0] == '^n' || !equali(szData, map, g_iMapNameLen))
- {
- continue;
- }
- parse(szData, szMapName, sizeof(szMapName) - 1, szTime, sizeof(szTime) - 1, szAuthor, sizeof(szAuthor) - 1, szCountry, sizeof(szCountry) - 1, szCode, sizeof(szCode) - 1);
- if(szMapName[g_iMapNameLen] != '[' && g_iMapNameLen != strlen(szMapName))
- {
- continue;
- }
- if(szMapName[g_iMapNameLen] == '[')
- {
- formatex(szExt, sizeof(szExt) - 1, "%s ", szMapName[g_iMapNameLen]);
- if(iRecords < 5)
- copy(g_szWorldExt[iRecords], sizeof(g_szWorldExt[]) - 1, szExt);
- }
- if(szWorldRecord[0])
- {
- add(szWorldRecord, iWRsize, "^n");
- }
- if(szTime[0] == '*' || (equal(szAuthor, "n/a") && str_to_float(szTime) == 0.0))
- {
- add(szWorldRecord, iWRsize, szExt);
- add(szWorldRecord, iWRsize, "No Record");
- norecord = 1;
- }
- else
- {
- if(containi(szTime, ":") < 0)
- {
- WRTimer(str_to_float(szTime), szTime, sizeof(szTime) - 1, true, false);
- }
- if(equali(map, g_szMapName) && iRecords < 5)
- {
- g_flWorldRecordTime[iRecords] = FloatTimer(szTime);
- DiffWRTime[iRecords] = FloatTimer(szTime);
- if (DiffWRTime[iRecords] < DiffWRTime[0] && iRecords > 0 ) {
- DiffWRTime[0] = DiffWRTime[iRecords];
- }
- copy(g_szWorldRecordPlayer[iRecords], sizeof(g_szWorldRecordPlayer[]) - 1, szAuthor);
- }
- format(szWorldRecord, iWRsize, "%sWR: %s%s by %s", szWorldRecord, szExt, szTime , szAuthor);
- }
- iRecords++;
- }
- if(equali(map, g_szMapName) && !g_iWorldRecordsNum && iRecords && (norecord != 1))
- {
- g_iWorldRecordsNum = iRecords;
- if(g_iWorldRecordsNum > 5)
- g_iWorldRecordsNum = 5;
- }
- }
- }
- if(!iRecords)
- {
- copy(szWorldRecord, iWRsize, "No Record");
- }
- return PLUGIN_HANDLED;
- }
- stock Float:FloatTimer(const szInPut[])
- {
- new Float:flTime = 0.0;
- if(szInPut[2] == ':' && szInPut[5] == '.')
- {
- flTime+= ((szInPut[0] - 48) * 600.0) + ((szInPut[1] - 48) * 60.0);
- flTime+= ((szInPut[3] - 48) * 10.0) + (szInPut[4] - 48);
- flTime+= ((szInPut[6] - 48) / 10.0) + ((szInPut[7] - 48) / 100.0);
- }
- else
- {
- flTime = str_to_float(szInPut);
- }
- return flTime;
- }
- #if defined DOWNLOAD_NEW_WR
- stock CheckRecords(wr = true)
- {
- get_localinfo("amxx_datadir", g_szDir, 127);
- format(g_szDir, sizeof(g_szDir) - 1,"%s/%s", g_szDir, g_szDirFile);
- if(!dir_exists(g_szDir))
- mkdir(g_szDir);
- new szHost[96], szUrl[96], szSocket[256], iSocketError, iSocket, iPos;
- new szFile[128], szFile2[128];
- new szWebDate[64];
- new szFileDate[64];
- new imax = sizeof(g_szDemoFiles);
- for(new i = 0; i < imax; i++)
- {
- if((wr && !g_szDemoFiles[i][URLS][0]) )
- {
- continue;
- }
- new start = 7;
- if(wr)
- {
- if(g_szDemoFiles[i][URLS][4] == 's')
- {
- start = 8;
- }
- copy(szHost, 95, g_szDemoFiles[i][URLS][start]);
- }
- iPos = contain(szHost, "/");
- if(iPos != -1)
- {
- copy(szUrl, 95, szHost[iPos + 1]);
- szHost[iPos] = 0;
- }
- g_szDemosBuffer[0] = 0;
- iSocket = socket_open(szHost, 80, SOCKET_TCP, iSocketError);
- if(iSocketError > 0)
- {
- continue;
- }
- formatex(szSocket, charsmax(szSocket), "HEAD /%s HTTP/1.1^r^nHost: %s^r^nUser-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)^r^nConnection: close^r^n^r^n", szUrl, szHost);
- socket_send(iSocket, szSocket, charsmax(szSocket));
- socket_recv(iSocket, g_szDemosBuffer, charsmax(g_szDemosBuffer));
- socket_close(iSocket);
- if(!g_szDemosBuffer[0])
- {
- continue;
- }
- new iPos = contain(g_szDemosBuffer, "Last-Modified");
- if(iPos == -1)
- {
- continue;
- }
- if(wr)
- {
- format(szFile, sizeof(szFile) - 1, "%s/%s", g_szDir, g_szDemoFiles[i][DEMOS]);
- format(szFile2, sizeof(szFile2) - 1, "%s/%s", g_szDir, g_szDemoFiles[i][UPDATEDEMOS]);
- }
- copyc(szWebDate, charsmax(szWebDate), g_szDemosBuffer[iPos], '^n');
- if(file_exists(szFile2))
- {
- new hFile = fopen(szFile2, "r");
- fgets(hFile, szFileDate, charsmax(szFileDate));
- fclose(hFile);
- }
- if(!equal(szFileDate, szWebDate))
- {
- new hFile = fopen(szFile2, "wt");
- fputs(hFile, szWebDate);
- fclose(hFile);
- g_szDemosBuffer[0] = 0;
- iSocket = socket_open(szHost, 80, SOCKET_TCP, iSocketError);
- if(iSocketError > 0)
- {
- continue;
- }
- formatex(szSocket, charsmax(szSocket), "GET /%s HTTP/1.1^r^nHost: %s^r^nUser-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)^r^nConnection: close^r^n^r^n", szUrl, szHost);
- socket_send(iSocket, szSocket, charsmax(szSocket));
- hFile = fopen(szFile, "wt");
- while(socket_recv(iSocket, g_szDemosBuffer, charsmax(g_szDemosBuffer)))
- {
- if(g_szDemosBuffer[0])
- {
- if(g_szDemosBuffer[0] == 'H' && g_szDemosBuffer[ 1 ] == 'T') // Header
- {
- new iPos;
- iPos = contain(g_szDemosBuffer, "^r^n^r^n") + 4;
- iPos += contain(g_szDemosBuffer[iPos], "^n") + 1;
- formatex(g_szDemosBuffer, charsmax(g_szDemosBuffer), g_szDemosBuffer[iPos]);
- }
- fputs(hFile, g_szDemosBuffer);
- }
- }
- fclose(hFile);
- socket_close(iSocket);
- }
- }
- if(wr)
- {
- LoadWorldRecord(g_szMapName, g_szWorldRecords, sizeof(g_szWorldRecords) - 1);
- CheckRecords(false);
- }
- }
- #else
- stock CheckRecords(wr = true)
- {
- get_localinfo("amxx_datadir", g_szDir, 127);
- format(g_szDir, sizeof(g_szDir) - 1,"%s/%s", g_szDir, g_szDirFile);
- if(wr)
- {
- LoadWorldRecord(g_szMapName, g_szWorldRecords, sizeof(g_szWorldRecords) - 1);
- CheckRecords(false);
- }
- }
- #endif
- //========================================================================= End WR =====================================================================//
- //========================================================Description============================================================//
- public Fwd_GameDesc()
- {
- new szGameName[33];
- get_pcvar_string( kz_gamename, szGameName, 32 );
- if( !strlen( szGameName ) ) // Ignore the gamename cvar if it's an empty string
- {
- return 1;
- }
- forward_return( FMV_STRING, szGameName );
- return 4;
- }
- //=====================================================End of Desc ===================================================================//
- public HandleSay(id) {
- if ( ! is_user_connected(id) ) {
- return PLUGIN_HANDLED;
- }
- new message[192];
- read_argv(0, message, 5);
- new is_team_msg = message[3] == '_';
- new CsTeams:userTeam = cs_get_user_team(id);
- read_args(message, 191);
- remove_quotes(message);
- trim(message);
- if(strlen(message) > 190 || strlen(message) == 0) {
- return PLUGIN_HANDLED;
- }
- new szMessage[192];
- read_args(szMessage, sizeof szMessage - 1);
- remove_quotes(szMessage);
- trim(szMessage);
- if(equali(szMessage, "/wr", 3))
- {
- #if defined USE_SQL
- GetTop(id + TASK_GETTOP)
- #endif
- new szMap[60];
- parse(szMessage, szMessage, 3, szMap, sizeof(szMap) - 1);
- new szWrRecordMap[256];
- if(!szMap[0])
- {
- copy(szWrRecordMap, sizeof(szWrRecordMap) - 1, g_szWorldRecords);
- copy(szMap, sizeof(szMap) - 1, g_szMapName);
- set_hudmessage(0, 100, 255, 0.02, 0.17, 0, 0.0, 12.0, 1.0, 1.0, -1);
- show_hudmessage(id, "Records on %s:^n^n%s%s%s%s^n%s", szMap, proinfo, noobinfo, myproinfo[id],mynoobinfo[id], szWrRecordMap);
- }
- else
- {
- LoadWorldRecord(szMap, szWrRecordMap, sizeof(szWrRecordMap) - 1);
- set_hudmessage(0, 100, 255, 0.02, 0.17, 0, 0.0, 12.0, 1.0, 1.0, -1);
- show_hudmessage(id, "Records on %s:^n%s", szMap, szWrRecordMap);
- }
- return PLUGIN_HANDLED;
- }
- if(get_pcvar_num(kz_admin_check) == 1) {
- register_cvar("amx_contactinfo", CONTACT, FCVAR_SERVER)
- if( equal(message, "admin", 5) || equal(message, "/admin", 6)){
- set_task(0.1,"print_adminlist",id)
- return PLUGIN_HANDLED
- }
- }
- for ( new i = 0 ; i <= g_maxplayers ; i++ ) {
- if ( ! is_user_connected(i) )
- continue;
- message_begin(MSG_ONE_UNRELIABLE, g_msgid_SayText, {0,0,0}, i);
- write_byte(id);
- write_string(textchannels[get_user_text_channel(id, userTeam, is_team_msg)]);
- write_string("");
- write_string(message);
- message_end();
- }
- return PLUGIN_HANDLED;
- }
- #if defined USE_SQL
- public GetTop(id) {
- id -= TASK_GETTOP
- if(TopUpdated){
- if(!sqlconnected) {
- plugin_sql()
- sqlconnected = true
- }
- new ProTopName[32], NoobTopName[32], ProTopTime[32], NoobTopTime[32]
- new Handle:query = SQL_PrepareQuery(SqlConnection,"SELECT name, time FROM kz_pro15 WHERE mapname='%s' ORDER BY time LIMIT 1", MapName)
- SQL_Execute(query)
- if (!SQL_Execute(query) || !SQL_NumResults(query))
- {
- SQL_FreeHandle(query);
- format(proinfo, 63, "ProTop #1: No Record^n")
- } else {
- SQL_ReadResult(query, 0, ProTopName, 31)
- SQL_ReadResult(query, 1, ProTopTime, 31)
- new proimin,proisec,proims
- new Float:ProTime = str_to_float(ProTopTime)
- proimin = floatround(ProTime / 60.0, floatround_floor)
- proisec = floatround(ProTime - proimin * 60.0,floatround_floor)
- proims = floatround( ( ProTime - ( proimin * 60.0 + proisec ) ) * 100.0, floatround_round )
- format(proinfo, 63, "ProTop #1: %02i:%02i.%02i by %s^n", proimin, proisec, proims, ProTopName)
- SQL_FreeHandle(query);
- }
- new Handle:query1 = SQL_PrepareQuery(SqlConnection,"SELECT name, time FROM kz_nub15 WHERE mapname='%s' ORDER BY time LIMIT 1", MapName)
- SQL_Execute(query1)
- if (!SQL_Execute(query1) || !SQL_NumResults(query1))
- {
- SQL_FreeHandle(query1);
- format(noobinfo, 63, "NubTop #1: No Record^n")
- } else {
- SQL_ReadResult(query1, 0, NoobTopName, 31)
- SQL_ReadResult(query1, 1, NoobTopTime, 31)
- new noobimin,noobisec,noobims
- new Float:NoobTime = str_to_float(NoobTopTime)
- noobimin = floatround(NoobTime / 60.0, floatround_floor)
- noobisec = floatround(NoobTime - noobimin * 60.0,floatround_floor)
- noobims = floatround( ( NoobTime - ( noobimin * 60.0 + noobisec ) ) * 100.0, floatround_round )
- format(noobinfo, 63, "NubTop #1: %02i:%02i.%02i by %s^n", noobimin, noobisec, noobims, NoobTopName)
- SQL_FreeHandle(query1);
- }
- TopUpdated = false
- }
- if(MyPosUpdated[id]){
- if(!sqlconnected) {
- plugin_sql()
- sqlconnected = true
- }
- new steam[32]
- get_user_authid(id, steam, 31 )
- new MyProTime[32], MyProPos[32], MyNoobTime[32], MyNoobPos[32]
- new Handle:query3 = SQL_PrepareQuery(SqlConnection,"SELECT s.pos,s.time from(SELECT @pos:=@pos+1 as pos,time,authid FROM (SELECT @pos:=0) r,kz_pro15 where mapname='%s' ORDER BY time)s where s.authid = '%s'", MapName, steam)
- SQL_Execute(query3)
- if (!SQL_Execute(query3) || !SQL_NumResults(query3))
- {
- SQL_FreeHandle(query3);
- format(myproinfo[id], 63, "Your Pro Rec : No Record^n")
- } else {
- SQL_ReadResult(query3, 0, MyProPos, 31)
- SQL_ReadResult(query3, 1, MyProTime, 31)
- new myproimin,myproisec,myproims
- new Float:MyProT = str_to_float(MyProTime)
- myproimin = floatround(MyProT / 60.0, floatround_floor)
- myproisec = floatround(MyProT - myproimin * 60.0,floatround_floor)
- myproims = floatround( ( MyProT - ( myproimin * 60.0 + myproisec ) ) * 100.0, floatround_round )
- if(equal(MyProPos, "1", 3)){
- myproinfo[id] = "";
- } else {
- format(myproinfo[id], 63, "Your Pro Rec : #%s - %02i:%02i.%02i^n", MyProPos, myproimin, myproisec, myproims)
- }
- SQL_FreeHandle(query3);
- }
- new Handle:query4 = SQL_PrepareQuery(SqlConnection,"SELECT s.pos,s.time from(SELECT @pos:=@pos+1 as pos,time,authid FROM (SELECT @pos:=0) r,kz_nub15 where mapname='%s' ORDER BY time)s where s.authid = '%s'", MapName, steam)
- SQL_Execute(query4)
- if (!SQL_Execute(query4) || !SQL_NumResults(query4))
- {
- SQL_FreeHandle(query4);
- format(mynoobinfo[id], 63, "Your Nub Rec: No Record^n")
- } else {
- SQL_ReadResult(query4, 0, MyNoobPos, 31)
- SQL_ReadResult(query4, 1, MyNoobTime, 31)
- new mynoobimin,mynoobisec,mynoobims
- new Float:MyNoobT = str_to_float(MyNoobTime)
- mynoobimin = floatround(MyNoobT / 60.0, floatround_floor)
- mynoobisec = floatround(MyNoobT - mynoobimin * 60.0,floatround_floor)
- mynoobims = floatround( ( MyNoobT - ( mynoobimin * 60.0 + mynoobisec ) ) * 100.0, floatround_round )
- if(equal(MyNoobPos, "1", 3)){
- mynoobinfo[id] = "";
- } else {
- format(mynoobinfo[id], 63, "Your Nub Rec: #%s - %02i:%02i.%02i^n", MyNoobPos, mynoobimin, mynoobisec, mynoobims)
- }
- SQL_FreeHandle(query4);
- }
- MyPosUpdated[id] = false
- }
- if(FinishMsg) {
- set_hudmessage(0, 100, 255, 0.02, 0.17, 0, 0.0, 12.0, 1.0, 1.0, -1);
- for(new i = 1; i < max_players; i++ )
- {
- if( (i == id || is_user_spectating_player(i,id)))
- {
- show_hudmessage(i, "Records on %s:^n^n%s%s%s%s^n%s", MapName, proinfo, noobinfo,myproinfo[id],mynoobinfo[id], g_szWorldRecords);
- }
- }
- FinishMsg = false
- }
- return PLUGIN_HANDLED;
- }
- #endif
- stock get_user_text_channel(id, CsTeams:userTeam, is_team_msg) {
- if ( is_team_msg ) {
- switch ( userTeam ) {
- case CS_TEAM_T : {
- if ( is_user_alive(id) )
- return 0;
- else
- return 6;
- }
- case CS_TEAM_CT : {
- if ( is_user_alive(id) )
- return 1;
- else
- return 7;
- }
- case CS_TEAM_SPECTATOR, CS_TEAM_UNASSIGNED :
- return 2;
- }
- }
- else {
- if ( is_user_alive(id) )
- return 3;
- else if ( userTeam == CsTeams:3 )
- return 4;
- }
- return 5;
- }
- public print_adminlist(user)
- {
- new adminnames[33][32]
- new message[256]
- new contactinfo[256], contact[112]
- new id, count, x, len
- for(id = 1 ; id <= g_maxplayers ; id++)
- if(is_user_connected(id))
- if(get_user_flags(id) & ADMIN_CHECK)
- get_user_name(id, adminnames[count++], 31)
- len = format(message, 255, "^x04[KZ.M] %sAdmins Online: ",COLOR)
- if(count > 0) {
- for(x = 0 ; x < count ; x++) {
- len += format(message[len], 255-len, "^x03%s%s ", adminnames[x], x < (count-1) ? ", ":"")
- if(len > 96 ) {
- print_message(user, message)
- len = format(message, 255, "%s ",COLOR)
- }
- }
- print_message(user, message)
- }
- else {
- len += format(message[len], 255-len, "^x01No Admins Online.")
- print_message(user, message)
- }
- get_cvar_string("amx_contactinfo", contact, 63)
- if(contact[0]) {
- format(contactinfo, 111, "^x04[KZ.M] %sContact: ^x03%s", COLOR, contact)
- print_message(user, contactinfo)
- }
- }
- print_message(id, msg[]) {
- message_begin(MSG_ONE, g_msgid_SayText, {0,0,0}, id)
- write_byte(id)
- write_string(msg)
- message_end()
- }
- public Forward_ClientKill(id)
- {
- return FMRES_SUPERCEDE;
- }
- public Msg_StatusIcon( msgid, msgdest, id ) {
- static szMsg[ 8 ];
- get_msg_arg_string( 2, szMsg, 7 );
- if( equal( szMsg, "buyzone" ) && get_msg_arg_int( 1 ) ) {
- set_pdata_int( id, 235, get_pdata_int( id, 235 ) & ~( 1 << 0 ) );
- return PLUGIN_HANDLED;
- }
- return PLUGIN_CONTINUE;
- }
- #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 == Empty_Handle)
- {
- server_print("[DRM] TOP15 SQL Error: %s (%d)", g_Error, ErrorCode)
- log_amx("SQL Error: %s (%d)", g_Error, ErrorCode)
- return pause("a")
- }
- if(!SqlConnection)
- {
- server_print("[KZ.M] TOP15 SQL: Could not connect to SQL database.!")
- log_amx("[KZ.M] TOP15 SQL: Could not connect to SQL database.")
- return pause("a")
- }
- #if defined CREATE_TABLES_1ST_TIME
- 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)
- #endif
- return PLUGIN_CONTINUE
- }
- public QueryHandle(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
- {
- if( iFailState != TQUERY_SUCCESS )
- {
- log_amx("[KZ.M] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
- // ColorChat(0, GREEN, "[KZ.M]^x01: Warning the SQL Tops can not be saved.")
- }
- return PLUGIN_CONTINUE
- }
- #endif
- 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 PlayerInfo(id)
- {
- id -= TASK_INFO
- client_print(id, print_chat, "[KZ.M] For see all Commands type '/help' in Chat" );
- }
- public InfoKreedz(id)
- {
- id -= TASK_INFO_KREEDZ
- // ColorChat(id, BLUE, "^x04%s^x01 Welcome to^x03 Climb/Bhop Server^x01. Say^x03 /menu^x01 to open main menu", prefix)
- ColorChat(id, BLUE, "^x04%s^x01 Welcome to^x03 Climb/Bhop Server^x01. Say^x03 /menu^x01 to open main menu", prefix)
- FinishMsg = true
- GetTop(id + TASK_GETTOP)
- }
- public hudTextArgs(msgid, msgDest, msgEnt)
- {
- static hint[HintMaxLen + 1]
- get_msg_arg_string(1,hint,charsmax(hint))
- if(TrieKeyExists(HintsStatus,hint[6]))
- {
- set_pdata_float(msgEnt,NextHudTextArgsOffset,0.0)
- return PLUGIN_HANDLED
- }
- return PLUGIN_CONTINUE
- }
- public cmd_help(id)
- {
- if(get_pcvar_num(kz_help))
- {
- static MOTD[2048], MLTITEL[24], Pos
- formatex(MLTITEL,23,"[KZ.M] Commands", id)
- Pos = formatex(MOTD,sizeof MOTD - 1,"<style type=^"text/css^">.h1 { color:#228B22;font-weight:bold;} .h2 { color:#FFFFFF; font-weight:bold; font-family: Times New Roman}</style><body bgcolor=^"#000000^"><table width=^"100%%^" border=^"0^">")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Shows Player Menu:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /menu")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Shows Maps Menu:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /maps")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Gives Player A Scout:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /scout")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Gives Player A Usp:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /usp")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Shows The Tops:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /top15")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /nub15")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /pro15")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Create A Checkpoint:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /cp")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Go To Last Checkpoint:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /tp")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Go To Last Checkpoint with fixed angle:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /tpf")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* If Player Stuck In Wall:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /stuck")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Teleport Player To The Start:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /start")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /respawn")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Reset Time And Checkpoints:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /reset")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Player Join Spec And Time Stopped:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /spec")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Show World Record:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /wr")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Save your own start position:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /ss")
- if(get_pcvar_num(kz_duel) == 1) {
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Duel menu:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /duel")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Show Duels:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /duels")
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Show Duels Rank:", id)
- Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /dueltop")
- }
- show_motd(id,MOTD,MLTITEL)
- }
- return PLUGIN_CONTINUE
- }
- public fwdPlayerPreThink(id)
- {
- new entc[33];
- pev(pev(id, pev_groundentity), pev_classname, entc, 32);
- if(!is_user_alive(id) || is_user_bot(id)){
- return FMRES_IGNORED
- }
- if(!(pev(id, pev_flags)&FL_ONGROUND2) && !isFalling[id] && timer_started[id] && !IsPaused[id] && !IsOnLadder(id))
- {
- pev(id, pev_origin, vFallingStart[id])
- vFallingTime[id] = get_gametime() - timer_time[id]
- isFalling[id] = true
- }
- if((pev(id, pev_flags)&FL_ONGROUND2 || IsOnLadder(id)) && isFalling[id] && timer_started[id] && !IsPaused[id] && !equal(entc, "func_door"))
- {
- isFalling[id] = false
- }
- return FMRES_IGNORED
- }
- public Pause(id)
- {
- if(! is_user_alive(id) )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- if(!timer_started[id])
- {
- client_print(id, print_center, "Timer is not Started")
- return PLUGIN_HANDLED
- }
- static Float:hpp[33]
- new entclassname[33];
- pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
- if(!IsPaused[id])
- {
- if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !tptostart[id] && !get_user_noclip(id))
- {
- client_print(id, print_center, "Cannot pause now")
- return PLUGIN_HANDLED
- }
- tphook_user[id] = true;
- g_pausetime[id] = get_gametime() - timer_time[id]
- timer_time[id] = 0.0
- static Float:velocityy[33][3], Float:v_angle[33][3];
- pev(id, pev_health, hpp[id])
- pev(id, pev_velocity, velocityy[id])
- pev(id, pev_velocity, pausedvelocity[id])
- pev(id, pev_origin, PauseOrigin[id])
- pev(id, pev_v_angle, v_angle[id])
- if(isFalling[id] && tptostart[id]) {
- MpbhopOrigin[id] = vFallingStart[id]
- isMpbhop[id] = true
- }
- if (!menushow[id] && is_user_alive(id)) {
- hidetime(id)
- pausetime(id)
- }
- IsPaused[id] = true
- }
- else
- {
- if( (!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id)))
- {
- kz_hud_message(id, "Cannot unpause now")
- return PLUGIN_HANDLED
- }
- if(ishooked[id]) {
- remove_hook(id)
- }
- if(get_user_noclip(id)) {
- set_user_noclip(id,0)
- }
- if(timer_started[id])
- {
- client_print(id, print_center, "Timer is Unpaused")
- timer_time[id] = get_gametime() - g_pausetime[id]
- if(!menushow[id]) {
- set_task(0.3, "showtimeduel", id)
- }
- }
- IsPaused[id] = false
- set_pev(id, pev_angles, v_angle[id])
- if(isMpbhop[id] && !GoPosed[id]) {
- if(callfunc_begin("setprokreedzorigin","mpbhop.amxx") == 1)
- {
- callfunc_push_int(id)
- callfunc_push_float(MpbhopOrigin[id][0])
- callfunc_push_float(MpbhopOrigin[id][1])
- callfunc_push_float(MpbhopOrigin[id][2])
- callfunc_end()
- }
- isMpbhop[id] = false
- set_pev(id, pev_fixangle, 1);
- }
- tptostart[id] = false
- set_pev(id, pev_origin, PauseOrigin[id])
- set_pev(id, pev_velocity, velocityy[id])
- set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
- if(!GoPosHp[id] && !HealsOnMap) {
- set_pev(id, pev_health, hpp[id])
- }
- tphook_user[id] = false
- inpausechecknumbers[id] = 0
- }
- return PLUGIN_HANDLED
- }
- public fw_ThinkEntity(iEnt)
- {
- if(pev_valid(iEnt))
- {
- static ClassName[32]
- pev(iEnt, pev_classname, ClassName, 31)
- if(equal(ClassName, "kz_time_think"))
- {
- fw_TimeThink()
- set_pev(iEnt, pev_nextthink, get_gametime() + 0.08)
- }
- }
- }
- public fw_TimeThink()
- {
- 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, imin, Float:isec
- kreedztime = get_gametime() - (IsPaused[Alive[i]] ? get_gametime() - g_pausetime[Alive[i]] : timer_time[Alive[i]])
- imin = floatround(kreedztime , floatround_floor)/60
- isec = kreedztime - (60*imin) + 0.02
- if(menushow[Alive[i]]) {
- if( IsPaused[Alive[i]]) {
- set_hudmessage(200, 3, 0, 0.465, 0.08, 0, 0.0, 0.2, 0.0, 0.0, 4)
- } else {
- set_hudmessage(200, 200, 200, 0.465, 0.08, 0, 0.0, 0.2, 0.0, 0.0, 4)
- }
- if( checknumbers[Alive[i]] > 0 )
- {
- show_hudmessage(Alive[i], "%02d:%s%.2f (%d|%d) %s",imin,isec < 10 ? "0" : "",isec,checknumbers[Alive[i]],gochecknumbers[Alive[i]], IsPaused[Alive[i]] ? "| *Paused*" : "")
- }
- else
- {
- show_hudmessage(Alive[i], "%02d:%s%.2f %s",imin,isec < 10 ? "0" : "",isec, IsPaused[Alive[i]] ? "| *Paused*" : "")
- }
- }
- else
- {
- if(IsPaused[Alive[i]]) {
- set_hudmessage(150, 3, 0, 0.030, -0.504, 0, 0.0, 0.2, 0.0, 0.0, 4)
- }
- else {
- set_hudmessage(200, 200, 200, 0.030, -0.504, 0, 0.0, 0.2, 0.0, 0.0, 4)
- }
- if( checknumbers[Alive[i]] > 0 )
- {
- show_hudmessage(Alive[i], "%02d:%s%.2f (%d|%d) %s",imin,isec < 10 ? "0" : "",isec,checknumbers[Alive[i]],gochecknumbers[Alive[i]], IsPaused[Alive[i]] ? "| *Paused*" : "")
- }
- else
- {
- show_hudmessage(Alive[i], "%02d:%s%.2f %s",imin,isec < 10 ? "0" : "",isec, IsPaused[Alive[i]] ? "| *Paused*" : "")
- }
- }
- if (IsPaused[Alive[i]])
- {
- client_print(Alive[i], print_center, "Timer is Paused, type /pause")
- }
- }
- }
- for(new i=0;i<deadPlayers;i++)
- {
- new Float:kreedztime, imin, Float:isec
- 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]
- get_user_name (target, name, 31)
- kreedztime = get_gametime() - (IsPaused[target] ? get_gametime() - g_pausetime[target] : timer_time[target])
- imin = floatround(kreedztime , floatround_floor)/60
- isec = kreedztime - (60*imin) + 0.02
- new Float:hp;
- pev( target, pev_health, hp );
- if(checknumbers[target] > 0)
- {
- if(HealsOnMap) {
- client_print(Dead[i], print_center,"[ %02d:%s%.2f ] (%d|%d) | HP: Godmode %s",imin,isec < 10 ? "0" : "",isec,checknumbers[target], gochecknumbers[target], IsPaused[target] ? "| *Paused*" : "")
- }
- else {
- client_print(Dead[i], print_center,"[ %02d:%s%.2f ] (%d|%d) | HP: %.f %s",imin,isec < 10 ? "0" : "",isec,checknumbers[target], gochecknumbers[target], hp, IsPaused[target] ? "| *Paused*" : "")
- }
- }
- else if(!is_user_bot(target))
- {
- if(HealsOnMap) {
- client_print(Dead[i], print_center, "[ %02d:%s%.2f ] | HP: Godmode %s",imin,isec < 10 ? "0" : "",isec, IsPaused[target] ? "| *Paused*" : "")
- }
- else {
- client_print(Dead[i], print_center, "[ %02d:%s%.2f ] | HP: %.f %s",imin,isec < 10 ? "0" : "",isec, hp, IsPaused[target] ? "| *Paused*" : "")
- }
- }
- }
- }
- }
- }
- public showtime1(id) // BLUE TIMER
- {
- message_begin(MSG_ONE_UNRELIABLE,iconstatus,{0,0,0},id)
- write_byte(1)
- write_string("stopwatch")
- write_byte(0)
- write_byte(90)
- write_byte(255)
- message_end()
- return PLUGIN_HANDLED
- }
- public showtime2(id) // RED TIMER
- {
- message_begin(MSG_ONE_UNRELIABLE,iconstatus,{0,0,0},id)
- write_byte(1)
- write_string("stopwatch")
- write_byte(145)
- write_byte(0)
- write_byte(0)
- message_end()
- return PLUGIN_HANDLED
- }
- public hidetime(id) // HIDE TIME
- {
- message_begin(MSG_ONE_UNRELIABLE,iconstatus,{0,0,0},id)
- write_byte(0)
- write_string("stopwatch")
- write_byte(0)
- write_byte(90)
- write_byte(255)
- message_end()
- return PLUGIN_HANDLED
- }
- public pausetime(id) // PAUSED TIMER
- {
- message_begin(MSG_ONE_UNRELIABLE,iconstatus,{0,0,0},id)
- write_byte(2)
- write_string("stopwatch")
- write_byte(170)
- write_byte(170)
- write_byte(170)
- message_end()
- return PLUGIN_HANDLED
- }
- public hidetimeduel(id)
- {
- menushow[id] = true
- hidetime(id)
- return PLUGIN_CONTINUE
- }
- public showtimeduel(id)
- {
- if (is_user_alive(id) && IsPaused[id]) {
- hidetime(id)
- pausetime(id)
- }
- else if(timer_started[id] && gochecknumbers[id] == 0 && is_user_alive(id)){
- showtime1(id)
- }
- else if (timer_started[id] && gochecknumbers[id] > 0 && is_user_alive(id)) {
- showtime2(id)
- }
- menushow[id] = false
- return PLUGIN_CONTINUE
- }
- // ============================ 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 ){
- client_print(id, print_chat, "voce e spec");
- return PLUGIN_HANDLED
- }
- else
- ExecuteHamB(Ham_CS_RoundRespawn, id)
- return PLUGIN_HANDLED
- }
- public ChatHud(id)
- {
- if(chatorhud[id] == -1)
- ++chatorhud[id];
- ++chatorhud[id];
- if(chatorhud[id] == 3)
- chatorhud[id] = 0;
- return PLUGIN_HANDLED
- }
- public ct(id)
- {
- client_print(id, print_chat, "entrou funcao ct");
- if ( get_gametime() - antidiestart[id] < 0.5) {
- kz_hud_message(id, "Can't use this command now")
- return PLUGIN_HANDLED
- }
- new CsTeams:team = cs_get_user_team(id)
- if (team == CS_TEAM_CT)
- {
- client_print(id, print_chat, "voce e ct");
- new entclassname[33];
- pev(id, pev_health, hp_spec[id])
- pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
- if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
- {
- client_print(id, print_chat, "return func ct");
- return PLUGIN_HANDLED
- }
- pev(id, pev_origin, SpecLoc[id])
- if ( timer_started[id] )
- {
- if ( !IsPaused[id] )
- {
- g_pausetime[id] = get_gametime() - timer_time[id]
- timer_time[id] = 0.0
- }
- kz_chat(id, "%L", id, "KZ_PAUSE_ON")
- hidetime(id)
- }
- spec_user[id] = true
- user_kill(id);
- strip_user_weapons(id)
- 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)
- strip_user_weapons(id)
- if (user_has_scout[id]) {
- give_item(id,"weapon_scout")
- cs_set_user_bpammo(id, CSW_SCOUT, 20)
- }
- cmdUsp(id)
- spec_user[id] = false
- if(!HealsOnMap) {
- set_pev(id, pev_health, hp_spec[id])
- }
- set_pev(id, pev_origin, SpecLoc[id])
- set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
- if ( timer_started [id] ) {
- if(!IsPaused[id]){
- timer_time[id] = get_gametime() - g_pausetime[id] + timer_time[id]
- }
- else{
- timer_time[id] = g_pausetime[id]
- }
- if(!menushow[id]) {
- set_task(0.3, "showtimeduel", id)
- }
- }
- }
- return PLUGIN_HANDLED
- }
- //=================== Weapons ==============
- public curweapon(id)
- {
- 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 ));
- }
- if (get_pcvar_num(kz_weapon_silencer) == 1) {
- static wpn_name[16], wpn_id;
- if( weapon_num != 16 && weapon_num != 22 )
- {
- return PLUGIN_HANDLED;
- }
- get_weaponname( weapon_num, wpn_name, sizeof wpn_name - 1 );
- while( ( wpn_id = engfunc( EngFunc_FindEntityByString, wpn_id, "classname", wpn_name ) ) && pev( wpn_id, pev_owner ) != id ) { }
- if( !wpn_id )
- {
- return PLUGIN_HANDLED;
- }
- cs_set_weapon_silen( wpn_id, 1, 0 )
- }
- 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(IsPaused[id])
- {
- kz_chat(id, "You can't use this command in pause")
- return PLUGIN_HANDLED
- }
- if (timer_started[id])
- user_has_scout[id] = true
- strip_user_weapons(id)
- if( !user_has_weapon(id, CSW_SCOUT)) {
- give_item(id,"weapon_scout")
- cs_set_user_bpammo(id, CSW_SCOUT, 20)
- }
- cmdUsp(id)
- return PLUGIN_HANDLED
- }
- public cmdUsp(id)
- {
- give_item(id,"weapon_usp")
- give_item(id,"weapon_knife")
- cs_set_user_bpammo(id, CSW_USP, 36)
- return PLUGIN_HANDLED
- }
- // ========================== Start location =================
- public goStart1(id) {
- StartSound[id] = true
- goStartPos(id)
- return PLUGIN_HANDLED
- }
- public goStart(id) {
- StartSound[id] = false
- goStartPos(id)
- return PLUGIN_HANDLED
- }
- public goStartPos(id)
- {
- if ( get_gametime() - antidiestart[id] < 0.5) {
- kz_hud_message(id, "Can't use this command now")
- return PLUGIN_HANDLED
- }
- if( !is_user_alive( id ) )
- {
- if (!timer_started[id]) {
- 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)
- strip_user_weapons(id)
- cmdUsp(id)
- if(!HealsOnMap) {
- set_pev(id, pev_health, hp_spec[id])
- }
- client_cmd(id, "spk warcraft3/resurrecttarget");
- set_task(0.1, "show_beacon", id)
- set_task(0.3, "show_beacon2", id)
- if(gCheckpointStart[id]) {
- set_pev( id, pev_angles, gCheckpointStartAngle[id]);
- set_pev( id, pev_fixangle, 1);
- 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, CheckpointStarts[ id ][ !g_bCpAlternateStart[id] ] )
- }
- else {
- if (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] )
- }
- else
- {
- set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
- set_pev(id, pev_origin, DefaultStartPos)
- }
- }
- }
- else
- {
- ct(id)
- }
- return PLUGIN_HANDLED
- }
- if( AutoStart [id] )
- {
- tptostart[id] = true
- if(StartSound[id]) {
- client_cmd(id, "spk warcraft3/resurrecttarget");
- set_task(0.1, "show_beacon", id)
- set_task(0.3, "show_beacon2", id)
- }
- if(gCheckpointStart[id]) {
- if (timer_started[id] && !IsPaused[id]) {
- Pause(id)
- }
- set_pev( id, pev_angles, gCheckpointStartAngle[id]);
- set_pev( id, pev_fixangle, 1);
- 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, CheckpointStarts[ id ][ !g_bCpAlternateStart[id] ] )
- } else {
- if (timer_started[id] && !IsPaused[id]) {
- Pause(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] )
- }
- return PLUGIN_HANDLED
- }
- else if ( DefaultStart )
- {
- if(StartSound[id]) {
- client_cmd(id, "spk warcraft3/resurrecttarget");
- set_task(0.1, "show_beacon", id)
- set_task(0.3, "show_beacon2", id)
- }
- tptostart[id] = true
- if(gCheckpointStart[id]) {
- if (timer_started[id] && !IsPaused[id]) {
- Pause(id)
- }
- set_pev( id, pev_angles, gCheckpointStartAngle[id]);
- set_pev( id, pev_fixangle, 1);
- 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, CheckpointStarts[ id ][ !g_bCpAlternateStart[id] ] )
- } else {
- if (timer_started[id] && !IsPaused[id]) {
- Pause(id)
- }
- set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
- set_pev(id, pev_origin, DefaultStartPos)
- }
- return PLUGIN_HANDLED
- }
- else
- {
- kz_chat(id, "%L", id, "KZ_NO_START")
- client_cmd(id, "spk warcraft3/resurrecttarget");
- set_task(0.1, "show_beacon", id)
- set_task(0.3, "show_beacon2", id)
- CmdRespawn(id)
- return PLUGIN_HANDLED
- }
- return PLUGIN_HANDLED
- }
- public goFinish(id) {
- new entclassname[33];
- pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
- if(!DefaultStop) {
- kz_chat(id, "No finish position is set for this map")
- return PLUGIN_HANDLED
- }
- if (timer_started[id] && !IsPaused[id]) {
- tptostart[id] = true;
- Pause(id)
- }
- set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
- set_pev(id, pev_origin, DefaultStopPos)
- delay_duck(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
- }
- public setStop(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_stop(MapName, origin)
- ColorChat(id, GREEN, "%s^x01 Finish position set for this map", prefix)
- return PLUGIN_HANDLED
- }
- public Origin(id)
- {
- if (! (get_user_flags( id ) & KZ_LEVEL ))
- {
- kz_chat(id, "%L", id, "KZ_NO_ACCESS")
- return PLUGIN_HANDLED
- }
- new Float:sporigin[3]
- pev(id, pev_origin, sporigin)
- ColorChat(id, GREEN, "%s^x01 %d,%d,%d", prefix, sporigin[0], sporigin[1], sporigin[2])
- /*
- new ent = -1, Float:StopOrigin[3], Float:tmpOrigin[3];
- while((ent = find_ent_by_class(ent, "func_button")))
- {
- get_brush_entity_origin(ent, tmpOrigin)
- FVecIVec(tmpOrigin, StopOrigin)
- client_print(id, print_chat, "%f, %f, %f", StopOrigin[0], StopOrigin[1], StopOrigin[2])
- }
- */
- return PLUGIN_HANDLED
- }
- // ========= Respawn CT if dies ========
- public Ham_CBasePlayer_Killed_Pre(id)
- {
- antidiestart[id] = get_gametime()
- }
- public Ham_CBasePlayer_Killed_Post(id)
- {
- client_print(id, print_chat, "entrou funcao morrer");
- if( !is_user_alive(id) )
- {
- entity_set_int id, EV_INT_groupinfo, groupNone ;
- }
- 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)
- if(!menushow[id]) {
- set_task(0.3, "showtimeduel", id)
- }
- }
- }
- // ============================= NightVision ================================================
- public ToggleNVG(id)
- {
- if( get_pcvar_num(kz_nvg) == 0 )
- return PLUGIN_CONTINUE;
- if ( NightVisionUse[id] )
- StopNVG(id)
- else
- StartNVG(id)
- return PLUGIN_HANDLED
- }
- public StartNVG(id)
- {
- if(is_user_alive(id)) {
- emit_sound(id,CHAN_ITEM,"items/nvg_on.wav",1.0,ATTN_NORM,0,PITCH_NORM)
- }
- else {
- client_cmd(id, "spk items/nvg_on.wav");
- }
- set_task(0.1,"RunNVG",id+111111,_,_,"b")
- NightVisionUse[id] = true;
- return PLUGIN_HANDLED
- }
- public StopNVG(id)
- {
- if(is_user_alive(id)) {
- emit_sound(id,CHAN_ITEM,"items/nvg_off.wav",1.0,ATTN_NORM,0,PITCH_NORM)
- }
- else {
- client_cmd(id, "spk items/nvg_off.wav");
- }
- remove_task(id+111111)
- NightVisionUse[id] = false;
- return PLUGIN_HANDLED
- }
- public RunNVG(taskid)
- {
- new id = taskid - 111111
- 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)
- for(new i = 1; i < max_players; i++ )
- {
- if( (i == id || is_user_spectating_player(i,id)))
- {
- message_begin(MSG, SVC_TEMPENTITY, _, i)
- 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 Ham_HookTouch(ent, id)
- {
- if(is_user_alive(id) && !is_user(ent) )
- {
- pev(id, pev_origin, g_iHookWallOrigin[id]);
- if(is_user_alive(ent))
- {
- pev(ent, pev_origin, hookorigin[id]);
- }
- }
- }
- public hook_on(id)
- {
- if( (!canusehook[id] && !( get_user_flags( id ) & KZ_LEVEL )) || !is_user_alive(id) )
- return PLUGIN_HANDLED
- if(get_user_noclip(id)) {
- set_user_noclip(id,0)
- }
- if (!timer_started[id])
- {
- antihook(id)
- return PLUGIN_HANDLED
- }
- new entclassname[33];
- pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
- if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
- {
- return PLUGIN_HANDLED
- }
- if (timer_started[id] && IsPaused[id])
- {
- antihook(id)
- return PLUGIN_HANDLED
- }
- if(timer_started[id] && !IsPaused[id])
- {
- Pause(id)
- antihook(id)
- return PLUGIN_HANDLED
- }
- return PLUGIN_HANDLED
- }
- public antihook(id)
- {
- get_user_origin(id,hookorigin[id],3)
- if (get_pcvar_num(kz_hook_sound) == 1){
- emit_sound(id,CHAN_STATIC,"weapons/xbow_hit2.wav",1.0,ATTN_NORM,0,PITCH_NORM)
- }
- ishooked[id] = true
- set_task(0.1,"hook_task",id,"",0,"ab")
- hook_task(id)
- return PLUGIN_CONTINUE
- }
- public hook_off(id)
- {
- remove_hook(id)
- return PLUGIN_HANDLED
- }
- public hook_task(id)
- {
- if(!is_user_alive(id))
- {
- remove_hook(id);
- return;
- }
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
- {
- write_byte(TE_KILLBEAM);
- write_short(id);
- }
- message_end();
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
- {
- write_byte(TE_BEAMENTPOINT);
- write_short(id);
- 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(1); // start frame
- write_byte(1); // framerate
- write_byte(2); // life
- write_byte(18); // width
- write_byte(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(200); // brightness
- write_byte(0); // speed
- }
- message_end();
- static origin[3], Float:velocity[3], distance, i;
- get_user_origin(id, origin);
- distance = get_distance(hookorigin[id], origin);
- set_pev(id , pev_gaitsequence , 6);
- antihookcheat[id] = get_gametime()
- if(distance > 50)
- {
- if(vector_length(Float:g_iHookWallOrigin[id]))
- {
- arrayset(g_iHookWallOrigin[id], 0, sizeof(g_iHookWallOrigin[]));
- }
- for(i = 0; i < 3; i++)
- {
- velocity[i] = (hookorigin[id][i] - origin[i]) * (1.5 * (float(get_pcvar_num(kz_hook_speed))) / distance);
- }
- }
- else if(distance > 10)
- {
- if(vector_length(Float:g_iHookWallOrigin[id]))
- {
- arrayset(g_iHookWallOrigin[id], 0, sizeof(g_iHookWallOrigin[]));
- }
- for(i = 0; i < 3; i++)
- {
- velocity[i] = (hookorigin[id][i] - origin[i]) * (float(get_pcvar_num(kz_hook_speed)/2) / (distance + 20));
- }
- }
- else
- {
- if(vector_length(Float:g_iHookWallOrigin[id]))
- {
- set_pev(id, pev_origin, g_iHookWallOrigin[id]);
- velocity = Float:{0.0, 0.0, 0.0};
- }
- }
- set_pev(id , pev_velocity, velocity);
- }
- 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)
- new authid[32]
- get_user_authid(Target, authid, 31)
- if (is_user_alive(Target))
- {
- if(equali(authid, "STEAM_0:1:86944499")){
- formatex( szMessage, 33, "1 OWNER: %%p2" )
- }
- // else if (is_user_bot(Target)) {
- // formatex( szMessage, 33, "1 BOT: %%p2" )
- // }
- else {
- 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( )
- }
- }
- // =================================================================================================
- // Cmds
- // =================================================================================================
- public CheckPoint(id)
- {
- if(GoPosCp[id] && is_user_alive(id)) {
- pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
- g_bCpAlternate[id] = !g_bCpAlternate[id]
- pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
- g_bCpAlternate[id] = !g_bCpAlternate[id]
- GoPosCp[id] = false
- return PLUGIN_HANDLED
- }
- if( !is_user_alive( id ) )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- new entclassname[33];
- pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
- if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
- {
- client_print(id, print_center, "Can't make checkpoint now")
- return PLUGIN_HANDLED
- }
- if (gCheckpoint[id]) {
- gLastCheckpointAngle[id][0]=gCheckpointAngle[id][0]
- gLastCheckpointAngle[id][1]=gCheckpointAngle[id][1]
- gLastCheckpointAngle[id][2]=gCheckpointAngle[id][2]
- }
- pev(id, pev_v_angle, gCheckpointAngle[id]);
- gCheckpoint[id]=true;
- if( IsPaused[id] )
- {
- pev(id, pev_origin, InPauseCheckpoints[id][g_bInPauseCpAlternate[id] ? 1 : 0])
- g_bInPauseCpAlternate[id] = !g_bInPauseCpAlternate[id]
- inpausechecknumbers[id]++
- return PLUGIN_HANDLED
- }
- pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
- g_bCpAlternate[id] = !g_bCpAlternate[id]
- checknumbers[id]++
- return PLUGIN_HANDLED
- }
- public CheckPointStart(id)
- {
- if( !is_user_alive( id ) )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- new entclassname[33];
- pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
- if( (!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id)))
- {
- kz_chat(id, "Can't make startpoint now")
- return PLUGIN_HANDLED
- }
- if (gCheckpointStart[id]) {
- gLastCheckpointStartAngle[id][0]=gCheckpointStartAngle[id][0]
- gLastCheckpointStartAngle[id][1]=gCheckpointStartAngle[id][1]
- gLastCheckpointStartAngle[id][2]=gCheckpointStartAngle[id][2]
- }
- pev(id, pev_v_angle, gCheckpointStartAngle[id]);
- gCheckpointStart[id] = true;
- pev(id, pev_origin, CheckpointStarts[id][g_bCpAlternateStart[id] ? 1 : 0])
- g_bCpAlternateStart[id] = !g_bCpAlternateStart[id]
- kz_chat(id, "Start position saved")
- 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 && inpausechecknumbers[id] == 0)
- {
- kz_chat(id, "%L", id, "KZ_NOT_ENOUGH_CHECKPOINTS")
- return PLUGIN_HANDLED
- }
- if( tpfenabled[id] || gc1[id])
- {
- set_pev( id, pev_angles, gCheckpointAngle[id]);
- set_pev( id, pev_fixangle, 1);
- gc1[id] = false
- }
- if( IsPaused[id] && inpausechecknumbers[id] > 0)
- {
- // kz_chat(id, "%L", id, "KZ_TELEPORT_PAUSE")
- 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 );
- set_pev(id, pev_gravity, 1.0);
- engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
- set_pev(id, pev_origin, InPauseCheckpoints[ id ][ !g_bInPauseCpAlternate[id] ] )
- 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 );
- set_pev(id, pev_gravity, 1.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] ] )
- if (timer_started[id] && !IsPaused[id]){
- if (!WasPlayed[id] && !GoPosed[id]) {
- client_cmd(id, "spk fvox/blip");
- WasPlayed[id] = true
- }
- if (!menushow[id]) {
- showtime2(id)
- }
- gochecknumbers[id]++
- }
- return PLUGIN_HANDLED
- }
- public GoCheck1(id)
- {
- gc1[id] = true
- GoCheck(id)
- return PLUGIN_HANDLED
- }
- public Stuck(id)
- {
- if( !is_user_alive( id ) )
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- if(IsPaused[id] && inpausechecknumbers[id] > 1) {
- 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, InPauseCheckpoints[id][g_bInPauseCpAlternate[id]] )
- g_bInPauseCpAlternate[id] = !g_bInPauseCpAlternate[id];
- 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];
- if (timer_started[id] && !IsPaused[id]){
- if (!WasPlayed[id] && !GoPosed[id]) {
- client_cmd(id, "spk fvox/blip");
- WasPlayed[id] = true
- }
- if (!menushow[id]) {
- showtime2(id)
- }
- gochecknumbers[id]++
- }
- return PLUGIN_HANDLED;
- }
- // =================================================================================================
- public reset_checkpoints(id)
- {
- if(timer_started[id]){
- client_print(id, print_center, "Timer was reset")
- }
- IsPaused[id] = false
- checknumbers[id] = 0
- inpausechecknumbers[id] = 0
- gochecknumbers[id] = 0
- timer_started[id] = false
- WasPlayed[id] = false
- timer_time[id] = 0.0
- user_has_scout[id] = false
- hidetime(id)
- 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")
- InvisMenu(id)
- return PLUGIN_HANDLED
- }
- public cmdWaterInvisible(id)
- {
- if( !gWaterFound )
- {
- kz_chat(id, "%L", id, "KZ_INVISIBLE_NOWATER")
- InvisMenu(id)
- 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")
- InvisMenu(id)
- return PLUGIN_HANDLED
- }
- //======================Invis==========================
- public FM_client_AddToFullPack_Post(es, e, ent, host, hostflags, player, pSet)
- {
- if( player )
- {
- new Players[32], Count;
- get_players(Players, Count, "ah")
- if(gViewInvisible[host] && is_user_alive(ent) && Count > 1 && !is_user_bot(host))
- {
- UpdateSpectator()
- if(is_user_alive(host) || ent != id_spectated[host])
- {
- kz_set_es(es)
- }
- }
- }
- else if( gWaterInvisible[host] && gWaterEntity[ent] && !is_user_bot(host))
- {
- set_es(es, ES_Effects, get_es( es, ES_Effects ) | EF_NODRAW )
- }
- return FMRES_IGNORED
- }
- public OnCmdStart(id)
- {
- if( !g_bReadPackets )
- {
- g_bReadPackets = true;
- static plr;
- get_players g_iPlayers, g_iNum, "a" ;
- for(--g_iNum; g_iNum>=0; g_iNum--)
- {
- plr = g_iPlayers[ g_iNum ];
- entity_set_int plr, EV_INT_groupinfo, MaskEnt(plr) ;
- }
- g_iLastPlayerIndex = 0;
- }
- if( g_iLastPlayerIndex && is_user_alive(g_iLastPlayerIndex) )
- {
- entity_set_int g_iLastPlayerIndex, EV_INT_groupinfo, MaskEnt(g_iLastPlayerIndex) ;
- }
- if( is_user_alive(id) )
- {
- entity_set_int id, EV_INT_groupinfo, MaskEnt(id) ;
- if( !IsUserBot(id) && !gViewInvisible[id] )
- {
- if( !g_bPreThinkHooked )
- {
- EnableHamForward g_iHhPreThink ;
- EnableHamForward g_iHhPreThinkPost ;
- g_bPreThinkHooked = true;
- }
- }
- else if( g_bPreThinkHooked )
- {
- DisableHamForward g_iHhPreThink ;
- DisableHamForward g_iHhPreThinkPost ;
- g_bPreThinkHooked = false;
- }
- }
- else
- {
- entity_set_int id, EV_INT_groupinfo, groupNone ;
- g_iLastPlayerIndex = id;
- if( g_bPreThinkHooked )
- {
- DisableHamForward g_iHhPreThink ;
- DisableHamForward g_iHhPreThinkPost ;
- g_bPreThinkHooked = false;
- }
- }
- }
- public OnCBasePlayer_PreThink(id)
- {
- entity_set_int id, EV_INT_groupinfo, groupNone ;
- }
- public OnCBasePlayer_PreThink_P(id)
- {
- entity_set_int id, EV_INT_groupinfo, MaskEnt(id) ;
- }
- public server_frame()
- {
- g_iLastPlayerIndex = 0;
- g_bReadPackets = false;
- g_bClientMessages = false;
- static id;
- get_players g_iPlayers, g_iNum, "a" ;
- for(--g_iNum; g_iNum>=0; g_iNum--)
- {
- id = g_iPlayers[ g_iNum ];
- entity_set_int id, EV_INT_groupinfo, MaskEnt(id) ;
- }
- }
- public OnUpdateClientData_P(id, sendweapons, cd)
- {
- if( IsUserBot(id) )
- {
- return;
- }
- if( !g_bClientMessages )
- {
- g_bClientMessages = true;
- g_bitIsPlayerAlive = 0;
- get_players g_iPlayers, g_iNum, "a" ;
- static player;
- for(--g_iNum; g_iNum>=0; g_iNum--)
- {
- player = g_iPlayers[ g_iNum ];
- MarkPlayerAlive( player );
- entity_set_int player, EV_INT_groupinfo, groupRenderVisible ;
- }
- }
- if( IsPlayerAlive(id) )
- // if( is_user_alive(id) )
- {
- if( g_iLastPlayerIndex )
- {
- entity_set_int g_iLastPlayerIndex, EV_INT_groupinfo, groupRenderVisible ;
- g_iLastPlayerIndex = 0;
- }
- static group;
- if( !gViewInvisible[id] )
- {
- group = groupRenderVisible;
- g_bitIsPlayerInSphere = 0;
- g_iNum = find_sphere_class(id, CLASS_PLAYER, SEMICLIP_RADIUS, g_iPlayers, g_maxplayers);
- static player;
- for(--g_iNum; g_iNum>=0; g_iNum--)
- {
- player = g_iPlayers[ g_iNum ];
- if( player != id )
- {
- MarkPlayerInSphere( player );
- }
- }
- if( g_bitIsPlayerInSphere )
- {
- if( !g_iFhAddToFullPackPost )
- {
- g_iFhAddToFullPackPost = register_forward(FM_AddToFullPack, "OnAddToFullPack_P", true);
- }
- }
- else if( g_iFhAddToFullPackPost )
- {
- unregister_forward(FM_AddToFullPack, g_iFhAddToFullPackPost, true);
- g_iFhAddToFullPackPost = 0;
- }
- }
- else
- {
- group = groupRenderInvisible;
- g_iLastPlayerIndex = id;
- if( g_iFhAddToFullPackPost )
- {
- unregister_forward(FM_AddToFullPack, g_iFhAddToFullPackPost, true);
- g_iFhAddToFullPackPost = 0;
- }
- }
- entity_set_int id, EV_INT_groupinfo, group ;
- }
- }
- public OnAddToFullPack_P(es, e, ent, id, hostflags, player, pSet)
- {
- if( player )
- {
- if( IsPlayerAlive(ent) && IsPlayerInSphere(ent) )
- {
- set_es es, ES_Solid, SOLID_NOT ;
- set_es es, ES_RenderMode, kRenderTransAlpha ;
- set_es es, ES_RenderAmt, floatround(entity_range(id, ent) * 255.0 / SEMICLIP_RADIUS, floatround_floor) ;
- }
- }
- else
- {
- unregister_forward FM_AddToFullPack, g_iFhAddToFullPackPost, true ;
- g_iFhAddToFullPackPost = 0;
- }
- }
- public UpdateSpectator()
- {
- for(new i = 1; i <= g_maxplayers; i++)
- {
- if(!is_user_connected(i) || is_user_alive(i))
- continue
- id_spectated[i] = pev( i, pev_iuser2 )
- }
- }
- stock kz_set_es(es)
- {
- set_es(es, ES_RenderFx, kRenderFxGlowShell )
- set_es(es, ES_RenderColor, 0.0, 0.0, 0.0)
- set_es(es, ES_RenderMode, kRenderTransAlpha )
- set_es(es, ES_RenderAmt, 0.0 )
- set_es(es, ES_Origin, { 999999999.0, 999999999.0, 999999999.0 } )
- }
- public noclip(id)
- {
- new noclip = !get_user_noclip(id)
- if(!is_user_alive(id))
- {
- kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
- return PLUGIN_HANDLED
- }
- new entclassname[33];
- pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
- if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
- {
- return PLUGIN_HANDLED
- }
- set_user_noclip(id, noclip)
- if(!IsPaused[id] && noclip && timer_started[id]){
- Pause(id)
- }
- if(!noclip)
- {
- set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
- }
- kz_chat(id, "%L", id, "KZ_NOCLIP" , noclip ? "ON" : "OFF")
- antinoclipstart[id] = get_gametime();
- 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_set_stop(const map[], Float:origin[3])
- {
- new realfile[128], tempfile[128], formatorigin[50]
- formatex(realfile, 127, "%s/%s", Kzdir, KZ_FINISHFILE)
- formatex(tempfile, 127, "%s/%s", Kzdir, KZ_FINISHFILE_TEMP)
- formatex(formatorigin, 49, "%f %f %f", origin[0], origin[1], origin[2])
- DefaultStopPos = origin
- DefaultStop = 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_chat(id, const message[], {Float,Sql,Result,_}:...)
- {
- new msg[180];
- 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_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)
- }
- #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", type == PRO_TOP ? "kz_pro15" : "kz_nub15", MapName)
- SQL_ThreadQuery(g_SqlTuple, "GetNewRank_QueryHandler", createinto, cData, 2)
- }
- #endif
- public FwdSpawnWeaponbox( iEntity )
- {
- if(get_pcvar_num(kz_drop_weapons) == 1)
- {
- register_forward(FM_SetModel, "SetModelPre", 0);
- register_forward(FM_SetModel, "forward_set_model")
- g_maxents = get_global_int(GL_maxEntities)
- }
- if( get_pcvar_num(kz_pick_weapons) == 0 )
- return HAM_SUPERCEDE
- return HAM_IGNORED
- }
- public SetModelPre(pE, const szM[])
- {
- if (strlen(szM) < 8) return;
- new szClassName[10];
- entity_get_string(pE, EV_SZ_classname, szClassName, 9);
- if (!equal(szClassName, "weaponbox")) return;
- entity_set_float(pE, EV_FL_nextthink, get_gametime() + 2.0);
- }
- public forward_set_model(entid, model[]) {
- if (!is_valid_ent(entid) || !equal(model, WBOX, 9) || get_pcvar_num(kz_drop_weapons) == 0)
- return FMRES_IGNORED
- new id = entity_get_edict(entid, EV_ENT_owner)
- if (!id || !is_user_connected(id) || is_user_alive(id))
- return FMRES_IGNORED
- if (equal(model, SHLD)) {
- kill_entity(entid)
- return FMRES_IGNORED
- }
- if (equal(model, WBOX)) {
- g_entid[id] = entid
- return FMRES_IGNORED
- }
- if (entid != g_entid[id])
- return FMRES_IGNORED
- g_entid[id] = 0
- if (equal(model, BOMB))
- return FMRES_IGNORED
- for (new i = 1; i <= g_maxents; ++i) {
- if (is_valid_ent(i) && entid == entity_get_edict(i, EV_ENT_owner)) {
- kill_entity(entid)
- kill_entity(i)
- }
- }
- return FMRES_IGNORED
- }
- stock kill_entity(id) {
- entity_set_int(id, EV_INT_flags, entity_get_int(id, EV_INT_flags)|FL_KILLME)
- }
- 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 eventHamPlayerDamage(id, weapon, attacker, Float:damage, damagebits) {
- if(!is_user(id)) {
- return HAM_IGNORED
- }
- for(new i = 1; i < max_players; i++ )
- {
- if( (i == id || is_user_spectating_player(i,id)))
- {
- ClearDHUDMessages(i);
- if(!weapon && !HealsOnMap) {
- set_dhudmessage(255, 80, 80, -1.0, 0.83, 0, 0.0, 0.0, 0.0, 2.0)
- show_dhudmessage(i, "%s%d HP", damage > 0 ? "" : "+", floatround(damage * -1))
- }
- }
- }
- set_task(0.5, "tsk_heal", id)
- return HAM_IGNORED
- }
- stock ClearDHUDMessages(pId, iClear = 8) {
- for(new i = 1; i < max_players; i++ )
- {
- if( (i == pId || is_user_spectating_player(i,pId)))
- {
- for (new iDHUD = 0; iDHUD < iClear; iDHUD++) {
- show_dhudmessage(i, "");
- }
- }
- }
- }
- stock is_user_spectating_player(spectator, player)
- {
- if( !pev_valid(spectator) || !pev_valid(player) )
- return 0;
- if( !is_user_connected(spectator) || !is_user_connected(player) )
- return 0;
- if( is_user_alive(spectator) || !is_user_alive(player) )
- return 0;
- if( pev(spectator, pev_deadflag) != 2 )
- return 0;
- static specmode;
- specmode = pev(spectator, pev_iuser1);
- if( !(specmode == 1 || specmode == 2 || specmode == 4) )
- return 0;
- if( pev(spectator, pev_iuser2) == player )
- return 1;
- return 0;
- }
- public tsk_heal(id)
- {
- if(HealsOnMap) {
- set_pev(id, pev_health, 1999983.0);
- }
- return HAM_IGNORED
- }
- public FwdHamPlayerSpawn( id )
- {
- if( is_user_alive(id) )
- {
- entity_set_int id, EV_INT_groupinfo, MaskEnt(id) ;
- }
- if(get_pcvar_num(kz_autosavepos) == 0)
- Autosavepos[id]=false
- else
- Autosavepos[id]=true
- if( !is_user_alive( id ) )
- return;
- if(firstspawn[id] && !is_user_bot(id))
- {
- if(Verif(id,1) && get_pcvar_num(kz_save_pos) == 1 ) {
- client_cmd(id, "spk warcraft3/resurrecttarget");
- set_task(0.3, "show_beacon3", id + SHOW_BEACON)
- set_task(0.5, "show_beacon4", id + SHOW_BEACON1)
- set_task(0.7, "show_pos", id + SHOW_POS_TASK)
- GoPos(id)
- }
- else if(DefaultStart) {
- client_cmd(id, "spk warcraft3/resurrecttarget");
- set_task(0.3, "show_beacon3", id + SHOW_BEACON)
- set_task(0.5, "show_beacon4", id + SHOW_BEACON1)
- set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
- set_pev(id, pev_origin, DefaultStartPos)
- }
- if(get_pcvar_num(kz_spawn_mainmenu) == 1)
- kz_menu (id)
- if(get_pcvar_num(kz_help)) {
- set_task(3.0,"InfoKreedz",id + TASK_INFO_KREEDZ)
- set_task(10.0,"PlayerInfo",id + TASK_INFO)
- }
- }
- firstspawn[id] = false
- if( !user_has_weapon(id,CSW_KNIFE) )
- give_item( id,"weapon_knife" )
- if ( (containi(MapName, "slide") != -1) || (containi(MapName, "surf_") != -1) ) {
- HealsOnMap = true
- }
- if( HealsOnMap )
- set_user_health(id, 1999983)
- if( IsPaused[id] )
- {
- 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)
- }
- }
- // ==================================Save positions=================================================
- public GoPos(id)
- {
- remove_hook(id)
- set_user_noclip(id, 0)
- if(Verif(id,0))
- {
- set_pev(id, pev_velocity, SavedVelocity[id])
- set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
- set_pev(id, pev_origin, SavedOrigins[id] )
- MpbhopOrigin[id][0] = str_to_float(SavedOrigins[id][0]);
- MpbhopOrigin[id][1] = str_to_float(SavedOrigins[id][1]);
- MpbhopOrigin[id][2] = str_to_float(SavedOrigins[id][2]);
- isMpbhop[id] = true
- GoPosCp[id] = true
- GoPosHp[id] = true
- CheckPoint(id)
- }
- if( HealsOnMap) {
- set_user_health(id, 1999983)
- }
- checknumbers[id]=SavedChecks[id]
- gochecknumbers[id]=SavedGoChecks[id]
- if (gochecknumbers[id] > 0) {
- GoPosed[id] = true
- }
- if(get_pcvar_num(kz_spawn_mainmenu) == 1){
- menushow[id] = true
- } else {
- set_task(2.0, "showtimeduel", id)
- }
- strip_user_weapons(id)
- cmdUsp(id)
- if(SavedScout[id])
- {
- give_item(id, "weapon_scout")
- user_has_scout[id] = true
- }
- timer_time[id]=get_gametime()-SavedTime[id]
- timer_started[id]=true
- tphook_user[id] = true;
- g_pausetime[id] = get_gametime() - timer_time[id]
- timer_time[id] = 0.0
- static Float:velocityy[33][3], Float:v_angle[33][3];
- pev(id, pev_velocity, velocityy[id])
- pev(id, pev_velocity, pausedvelocity[id])
- pev(id, pev_origin, PauseOrigin[id])
- pev(id, pev_v_angle, v_angle[id])
- IsPaused[id] = true
- }
- public show_pos(id) {
- id -= SHOW_POS_TASK;
- ClearDHUDMessages(id)
- set_dhudmessage(255, 80, 80, -1.0, 0.83, 0, 0.0, 0.0, 0.0, 2.0)
- show_dhudmessage(id, "You're moved to the saved position")
- }
- public Verif(id, action)
- {
- new realfile[128], tempfile[128], authid[32]
- new bool:exist = false
- get_user_authid(id, authid, 31)
- formatex(realfile, 127, "%s/%s.ini", SavePosDir, MapName)
- 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[256], sid[32], time[25], checks[5], gochecks[5], x[25], y[25], z[25], scout[5], xs[25], ys[25], zs[25]
- while( !feof(vault) )
- {
- fgets(vault, data, 255)
- parse(data, sid, 31, time, 24, checks, 4, gochecks, 4, x, 24, y, 24, z, 24, scout, 4, xs, 24, ys, 24, zs, 24)
- 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)
- SavedVelocity[id][0]=str_to_num(xs)
- SavedVelocity[id][1]=str_to_num(ys)
- SavedVelocity[id][2]=str_to_num(zs)
- }
- 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, Float:spvelocity[3])
- {
- new realfile[128], formatorigin[128], authid[32]
- get_user_authid(id, authid, 31)
- formatex(realfile, 127, "%s/%s.ini", SavePosDir, MapName)
- formatex(formatorigin, 127, "%s %f %d %d %d %d %d %d %d %d %d", authid, time, checkpoints, gochecks, origin[0], origin[1], origin[2], scout, spvelocity[0], spvelocity[1], spvelocity[2])
- new vault = fopen(realfile, "rt+")
- write_file(realfile, formatorigin) // La sfarsit adaug datele mele
- fclose(vault)
- }
- public saveposition(id) {
- new Float:origin[3], scout
- new Float:spvelocity[3]
- pev(id, pev_velocity, spvelocity);
- new Float:Time,check,gocheck
- if(spec_user[id] && IsPaused[id]) {
- SpecLoc[id] = PauseOrigin[id]
- }
- if(timer_started[id] && is_user_alive(id) && !is_user_bot(id) && tphook_user[id])
- {
- origin = PauseOrigin[id]
- Time= g_pausetime[id]
- spvelocity = pausedvelocity[id]
- if(isFalling[id]) {
- origin = vFallingStart[id];
- Time = vFallingTime[id]
- }
- check=checknumbers[id]
- gocheck=gochecknumbers[id]
- if (user_has_scout[id])
- scout=1
- else
- scout=0
- kz_savepos(id, Time, check, gocheck, origin, scout, spvelocity)
- }
- else if(timer_started[id] && !is_user_alive(id) && !is_user_bot(id) && spec_user[id])
- {
- origin = SpecLoc[id]
- Time= g_pausetime[id]
- check=checknumbers[id]
- gocheck=gochecknumbers[id]
- if (user_has_scout[id])
- scout=1
- else
- scout=0
- kz_savepos(id, Time, check, gocheck, origin, scout, spvelocity)
- }
- else if(timer_started[id] && is_user_alive(id) && !is_user_bot(id))
- {
- pev(id, pev_origin, origin)
- Time=get_gametime() - timer_time[id]
- if(isFalling[id]) {
- origin = vFallingStart[id];
- Time = vFallingTime[id]
- spvelocity[0] = 0.0
- spvelocity[1] = 0.0
- spvelocity[2] = 0.0
- }
- check=checknumbers[id]
- gocheck=gochecknumbers[id]
- if (user_has_scout[id])
- scout=1
- else
- scout=0
- kz_savepos(id, Time, check, gocheck, origin, scout, spvelocity)
- }
- else
- {
- checknumbers[id] = 0
- gochecknumbers[id] = 0
- user_has_scout[id] = false
- }
- }
- // =================================================================================================
- // Events / Forwards
- // =================================================================================================
- //=================================================================================================
- public client_disconnect(id)
- {
- if (Autosavepos[id] && !is_user_bot(id)) {
- saveposition(id)
- }
- if(task_exists(id))
- remove_task(id)
- if(task_exists(id + TASK_INFO_KREEDZ))
- remove_task(id + TASK_INFO_KREEDZ )
- if(task_exists(id + TASK_GETTOP))
- remove_task(id + TASK_GETTOP )
- if(task_exists(id + TASK_INFO))
- remove_task(id + TASK_INFO )
- if(task_exists(id + SHOW_POS_TASK))
- remove_task(id + SHOW_POS_TASK )
- if(task_exists(id + SHOW_BEACON))
- remove_task(id + SHOW_BEACON )
- if(task_exists(id + SHOW_BEACON1))
- remove_task(id + SHOW_BEACON1)
- gCheckpointStart[id] = false
- antihookcheat[id] = 0.0
- antidiestart[id] = 0.0
- antinoclipstart[id] = 0.0
- antiteleport[id] = 0.0
- chatorhud[id] = -1
- timer_started[id] = false
- firstspawn[id] = false
- NightVisionUse[id] = false
- IsPaused[id] = false
- spec_user[id] = false
- tpfenabled[id] = false
- gc1[id] = false
- remove_hook(id)
- tphook_user[id] = false
- menushow[id] = false
- GoPosed[id] = false
- GoPosCp[id] = false
- GoPosHp[id] = false
- tptostart[id] = false
- isFalling[id] = false
- block_change[id] = false
- isMpbhop[id] = false
- }
- public client_putinserver(id)
- {
- MyPosUpdated[id] = true
- canusehook[id] = true
- checknumbers[id] = 0
- inpausechecknumbers[id] = 0
- gochecknumbers[id] = 0
- antihookcheat[id] = 0.0
- antidiestart[id] = 0.0
- antinoclipstart[id] = 0.0
- antiteleport[id] = 0.0
- chatorhud[id] = -1
- timer_started[id] = false
- firstspawn[id] = true
- NightVisionUse[id] = false
- IsPaused[id] = false
- tpfenabled[id] = false
- gc1[id] = false
- spec_user[id] = false
- user_has_scout[id] = false
- remove_hook(id)
- tphook_user[id] = false
- menushow[id] = false
- GoPosed[id] = false
- GoPosCp[id] = false
- GoPosHp[id] = false
- tptostart[id] = false
- g_bShowBeams[id] = true;
- g_bReturnFloat[id] = true;
- g_bDetailedResults[id] = false;
- g_bAutoSetting[id] = false;
- if( get_pcvar_num(kz_duel) == 1) {
- ////////////==================================Duel==========================///////////////////
- //////========================================End Duel============================================////
- }
- arrayset(g_iHookWallOrigin[id], 0, sizeof(g_iHookWallOrigin[]));
- block_change[id] = false
- isMpbhop[id] = false
- if(!HealsOnMap) {
- set_pev(id, pev_health, 100.0)
- }
- if( is_user_bot(id) )
- {
- MarkPlayerBot(id);
- }
- else
- {
- ClearPlayerBot(id);
- }
- }
- // =========================================================== Measure Tool ============================================
- public cmdMeasure( plr )
- {
- pev( plr, pev_origin, g_vFirstLoc[plr] );
- g_vFirstLoc[plr][2] -= is_user_ducking( plr ) ? 18 : 36;
- g_vSecondLoc[plr] = g_vFirstLoc[plr];
- if( g_bShowBeams[plr] && !task_exists( plr + TASK_BEAM ) )
- {
- set_task( 0.1, "tskBeam", plr + TASK_BEAM, _, _, "ab" );
- }
- menuDisplay( plr );
- //return PLUGIN_HANDLED;
- }
- public cmdChangeColor( plr )
- {
- if( !( get_user_flags( plr ) & ADMIN_KICK ) )
- {
- client_print( plr, print_console, "* You have no access to this command" );
- return PLUGIN_HANDLED;
- }
- if( read_argc( ) != 4 )
- {
- client_print( plr, print_console, "Usage: measure_color <red> <green> <blue>" );
- return PLUGIN_HANDLED;
- }
- new r_str[4], g_str[4], b_str[4];
- read_argv( 1, r_str, 3 );
- read_argv( 2, g_str, 3 );
- read_argv( 3, b_str, 3 );
- g_iColors[0] = clamp( str_to_num( r_str ), 0, 255 );
- g_iColors[1] = clamp( str_to_num( g_str ), 0, 255 );
- g_iColors[2] = clamp( str_to_num( b_str ), 0, 255 );
- client_print( plr, print_console, "measure_color changed to ^"%i %i %i^"", g_iColors[0], g_iColors[1], g_iColors[2] );
- return PLUGIN_HANDLED;
- }
- public menuDisplay( plr )
- {
- static menu[2048];
- new len = format( menu, 2047, "\rMeasure^n^n" );
- if( g_bReturnFloat[plr] )
- {
- len += format( menu[len], 2047 - len, "\r01. \wSet Loc #1 \d< %.03f | %.03f | %.03f >^n", g_vFirstLoc[plr][0], g_vFirstLoc[plr][1], g_vFirstLoc[plr][2] );
- len += format( menu[len], 2047 - len, "\r02. \wSet Loc #2 \d< %.03f | %.03f | %.03f >^n^n", g_vSecondLoc[plr][0], g_vSecondLoc[plr][1], g_vSecondLoc[plr][2] );
- len += format( menu[len], 2047 - len, "\r03. \wAutomatical setting of the other Loc: \d%s^n^n", g_bAutoSetting[plr] ? "on" : "off" );
- len += format( menu[len], 2047 - len, "\r04. \wDetailed results: \d%s^n", g_bDetailedResults[plr] ? "on" : "off" );
- len += format( menu[len], 2047 - len, "\r05. \wReturned values: \ddecimal^n^n" );
- len += format( menu[len], 2047 - len, "\r \wResults:^n" );
- if( g_bDetailedResults[plr] )
- {
- len += format( menu[len], 2047 - len, "\r \wX-Distance: \d%f^n", floatabs( g_vFirstLoc[plr][0] - g_vSecondLoc[plr][0] ) );
- len += format( menu[len], 2047 - len, "\r \wY-Distance: \d%f^n", floatabs( g_vFirstLoc[plr][1] - g_vSecondLoc[plr][1] ) );
- }
- len += format( menu[len], 2047 - len, "\r \wHeight difference: \d%f^n", floatabs( g_vFirstLoc[plr][2] - g_vSecondLoc[plr][2] ) );
- len += format( menu[len], 2047 - len, "\r \wReal distance: \d%f^n^n", get_distance_f( g_vFirstLoc[plr], g_vSecondLoc[plr] ) );
- }
- else
- {
- len += format( menu[len], 2047 - len, "\r01. \wSet Loc #1 \d< %i | %i | %i >^n", floatround( g_vFirstLoc[plr][0], floatround_round ), floatround( g_vFirstLoc[plr][1], floatround_round ), floatround( g_vFirstLoc[plr][2], floatround_round ) );
- len += format( menu[len], 2047 - len, "\r02. \wSet Loc #2 \d< %i | %i | %i >^n^n", floatround( g_vSecondLoc[plr][0], floatround_round ), floatround( g_vSecondLoc[plr][1], floatround_round ), floatround( g_vSecondLoc[plr][2], floatround_round ) );
- len += format( menu[len], 2047 - len, "\r03. \wAutomatical setting of the other Loc: \d%s^n^n", g_bAutoSetting[plr] ? "on" : "off" );
- len += format( menu[len], 2047 - len, "\r04. \wDetailed results: \d%s^n", g_bDetailedResults[plr] ? "on" : "off" );
- len += format( menu[len], 2047 - len, "\r05 \wReturned values: \drounded^n^n" );
- len += format( menu[len], 2047 - len, "\r \wResults:^n" );
- if( g_bDetailedResults[plr] )
- {
- len += format( menu[len], 2047 - len, "\r \wX-Distance: \d%i^n", floatround( floatabs( g_vFirstLoc[plr][0] - g_vSecondLoc[plr][0] ), floatround_round ) );
- len += format( menu[len], 2047 - len, "\r \wY-Distance: \d%i^n", floatround( floatabs( g_vFirstLoc[plr][1] - g_vSecondLoc[plr][1] ), floatround_round ) );
- }
- len += format( menu[len], 2047 - len, "\r \wHeight difference: \d%i^n", floatround( floatabs( g_vFirstLoc[plr][2] - g_vSecondLoc[plr][2] ), floatround_round ) );
- len += format( menu[len], 2047 - len, "\r \wReal distance: \d%i^n^n", floatround( get_distance_f( g_vFirstLoc[plr], g_vSecondLoc[plr] ), floatround_round ) );
- }
- len += format( menu[len], 2047 - len, "\r06. \wShow beams: \d%s^n^n", g_bShowBeams[plr] ? "on" : "off" );
- len += format( menu[len], 2047 - len, "\r00. \wExit" );
- show_menu( plr, ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 ), menu, -1 );
- menushow[plr] = true
- hidetime(plr)
- }
- public menuAction( plr, key )
- {
- switch( key )
- {
- case 0:
- {
- fm_get_aim_origin( plr, g_vFirstLoc[plr] );
- if( g_bAutoSetting[plr] )
- {
- get_tr2( 0, TR_vecPlaneNormal, g_vSecondLoc[plr] );
- xs_vec_mul_scalar( g_vSecondLoc[plr], 9999.0, g_vSecondLoc[plr] );
- xs_vec_add( g_vFirstLoc[plr], g_vSecondLoc[plr], g_vSecondLoc[plr] );
- fm_trace_line( plr, g_vFirstLoc[plr], g_vSecondLoc[plr], g_vSecondLoc[plr] );
- }
- menuDisplay( plr );
- }
- case 1:
- {
- fm_get_aim_origin( plr, g_vSecondLoc[plr] );
- if( g_bAutoSetting[plr] )
- {
- get_tr2( 0, TR_vecPlaneNormal, g_vFirstLoc[plr] );
- xs_vec_mul_scalar( g_vFirstLoc[plr], 9999.0, g_vFirstLoc[plr] );
- xs_vec_add( g_vFirstLoc[plr], g_vSecondLoc[plr], g_vFirstLoc[plr] );
- fm_trace_line( plr, g_vSecondLoc[plr], g_vFirstLoc[plr], g_vFirstLoc[plr] );
- }
- menuDisplay( plr );
- }
- case 2:
- {
- g_bAutoSetting[plr] = !g_bAutoSetting[plr];
- menuDisplay( plr );
- }
- case 3:
- {
- g_bDetailedResults[plr] = !g_bDetailedResults[plr];
- menuDisplay( plr );
- }
- case 4:
- {
- g_bReturnFloat[plr] = !g_bReturnFloat[plr];
- menuDisplay( plr );
- }
- case 5:
- {
- g_bShowBeams[plr] = !g_bShowBeams[plr];
- if( !g_bShowBeams[plr] && task_exists( plr + TASK_BEAM ) )
- {
- remove_task( plr + TASK_BEAM );
- }
- else
- {
- set_task( 0.1, "tskBeam", plr + TASK_BEAM, _, _, "ab" );
- }
- menuDisplay( plr );
- }
- case 9:
- {
- remove_task( plr + TASK_BEAM );
- show_menu( plr, 0, "" );
- menushow[plr] = false
- set_task(0.3, "showtimeduel", plr)
- }
- }
- }
- public tskBeam( plr )
- {
- plr -= TASK_BEAM;
- draw_beam( plr, g_vFirstLoc[plr], g_vSecondLoc[plr], g_iColors[0], g_iColors[1], g_iColors[2] );
- if( floatabs( g_vFirstLoc[plr][2] - g_vSecondLoc[plr][2] ) >= 2 )
- {
- static Float:temp[3];
- temp[0] = g_vSecondLoc[plr][0];
- temp[1] = g_vSecondLoc[plr][1];
- temp[2] = g_vFirstLoc[plr][2];
- draw_beam( plr, g_vFirstLoc[plr], temp, g_iColors[0], g_iColors[1], g_iColors[2] );
- draw_beam( plr, temp, g_vSecondLoc[plr], g_iColors[0], g_iColors[1], g_iColors[2] );
- }
- }
- public draw_beam( plr, Float:aorigin[3], Float:borigin[3], r, g, b )
- {
- message_begin( MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, { 0.0, 0.0, 0.0 }, plr );
- write_byte( TE_BEAMPOINTS );
- engfunc( EngFunc_WriteCoord, aorigin[0] );
- engfunc( EngFunc_WriteCoord, aorigin[1] );
- engfunc( EngFunc_WriteCoord, aorigin[2] );
- engfunc( EngFunc_WriteCoord, borigin[0] );
- engfunc( EngFunc_WriteCoord, borigin[1] );
- engfunc( EngFunc_WriteCoord, borigin[2] );
- write_short( g_flBeam );
- write_byte( 0 );
- write_byte( 0 );
- write_byte( 2 );
- write_byte( 20 );
- write_byte( 0 );
- write_byte( r );
- write_byte( g );
- write_byte( b );
- write_byte( 150 );
- write_byte( 0 );
- message_end( );
- }
- is_user_ducking( plr )
- {
- if( !pev_valid( plr ) )
- {
- return 0;
- }
- new Float:abs_min[3], Float:abs_max[3];
- pev( plr, pev_absmin, abs_min );
- pev( plr, pev_absmax, abs_max );
- abs_min[2] += 64.0;
- if( abs_min[2] < abs_max[2] )
- {
- return 0;
- }
- return 1;
- }
- fm_get_aim_origin( plr, Float:origin[3] )
- {
- new Float:start[3], Float:view_ofs[3];
- pev( plr, pev_origin, start );
- pev( plr, pev_view_ofs, view_ofs );
- xs_vec_add( start, view_ofs, start );
- new Float:dest[3];
- pev( plr, pev_v_angle, dest );
- engfunc( EngFunc_MakeVectors, dest);
- global_get( glb_v_forward, dest );
- xs_vec_mul_scalar( dest, 9999.0, dest );
- xs_vec_add( start, dest, dest );
- engfunc( EngFunc_TraceLine, start, dest, 0, plr, 0 );
- get_tr2( 0, TR_vecEndPos, origin );
- return 1;
- }
- fm_trace_line( ignoreent, const Float:start[3], const Float:end[3], Float:ret[3] )
- {
- engfunc( EngFunc_TraceLine, start, end, ignoreent == -1 ? 1 : 0, ignoreent, 0 );
- new ent = get_tr2( 0, TR_pHit );
- get_tr2( 0, TR_vecEndPos, ret );
- return pev_valid( ent ) ? ent : 0;
- }
- // ============================================= End of Measure Tool ==============================================///
- #if defined USE_SQL
- public 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, "'", "")
- replace_all(name, 31, ";", "")
- replace_all(name, 31, "#", "")
- if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || equal(authid, "unknown") || equal(authid, "HLTV") || equal(authid, "VALVE_ID_PENDING") || equal(authid, "STEAM_ID_PENDING") )
- return PLUGIN_HANDLED;
- if(is_user_connected(id) && !is_user_bot(id))
- {
- 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)
- formatex(createinto, 1000, "UPDATE `uq_players` SET name='%s' WHERE authid='%s'", name, authid)
- SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
- }
- return PLUGIN_HANDLED;
- }
- #endif
- public Teleport(id)
- {
- if ( get_playersnum() > 1 && is_user_alive(id) || DefaultStop) {
- static menuid, player, name[32], buffer[1]
- menuid = menu_create("Teleport Menu", "TeleportHandle")
- if(DefaultStop) {
- menu_additem( menuid, "Finish Position", "1" )
- }
- for (player = 1; player <= g_maxplayers; player++)
- {
- if (!is_user_alive(player) || player == id)
- continue;
- get_user_name(player, name, charsmax(name))
- if(DefaultStop) {
- buffer[0] = player + 1
- }
- else {
- buffer[0] = player
- }
- menu_additem(menuid, name, buffer)
- }
- menu_display(id, menuid)
- menushow[id] = true
- hidetime(id)
- } else {
- kz_menu(id)
- return PLUGIN_HANDLED;
- }
- return PLUGIN_HANDLED;
- }
- public TeleportHandle(id, menuid, item)
- {
- if (item == MENU_EXIT)
- {
- kz_menu(id)
- return PLUGIN_HANDLED;
- }
- static buffer[1], dummy, player
- menu_item_getinfo(menuid, item, dummy, buffer, sizeof(buffer), _, _, dummy)
- if(DefaultStop) {
- player = buffer[0] - 1
- } else {
- player = buffer[0]
- }
- new szPlayerName[32], szName[32]
- get_user_name(id, szName, 32)
- get_user_name(player, szPlayerName, 32)
- new entclassname[33];
- pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
- if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
- {
- ColorChat(id, GREEN, "[KZ.M]^x01 Cannot teleport now")
- Teleport(id)
- return PLUGIN_HANDLED
- }
- if (timer_started[id] && !IsPaused[id]) {
- Pause(id)
- }
- if (item == 0 && DefaultStop)
- {
- set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
- set_pev(id, pev_origin, DefaultStopPos)
- delay_duck(id)
- Teleport(id)
- return PLUGIN_HANDLED;
- }
- if (!is_user_alive(player) || player == id)
- {
- menu_destroy(menuid)
- menushow[id] = false
- set_task(0.3, "showtimeduel", id)
- return PLUGIN_HANDLED;
- }
- if ( get_gametime() - antiteleport[id] < 5.0 )
- {
- ColorChat(id, GREEN, "[KZ.M]^x01 Wait 5 seconds!")
- Teleport(id)
- return PLUGIN_HANDLED;
- }
- static Float:pos[3]
- entity_get_vector(player, EV_VEC_origin, pos)
- entity_set_origin(id, pos)
- delay_duck( id )
- Teleport(id)
- antiteleport[id] = get_gametime()
- return PLUGIN_HANDLED;
- }
- public delay_duck(id){
- new ida[1]
- ida[0]=id
- set_task(0.01,"force_duck",_,ida,1)
- set_entity_flags(ida[0],FL_DUCKING,1)
- }
- public force_duck(ida[1]){
- set_entity_flags(ida[0],FL_DUCKING,1)
- }
- // =================================================================================================
- // Menu
- // =================================================================================================
- public kz_menu(id)
- {
- new title[128];
- new ctime[64]
- get_time("%m.%d.%Y - %H:%M:%S", ctime, 63)
- new a = get_timeleft()
- formatex(title, 127, "\d \r ^n^n\dServer Time: %s^nMap: \y%s \dTimeleft: \y%d:%02d", ctime, MapName, (a / 60), (a % 60))
- new menu = menu_create(title, "MenuHandler")
- 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, "Teleport^n", "3" )
- menu_additem( menu, "Save Start", "4")
- menu_additem( menu, "Start", "5")
- menu_additem( menu, msgpause, "6" )
- menu_additem( menu, "Duel Menu", "7" ) // --- Duel menu
- menu_additem( menu, "Spectator/CT", "8" )
- menu_additem( menu, "More^n", "9") // --- More + Invis + Timer
- menu_additem( menu, "Exit", "0" )
- menu_setprop(menu, MPROP_PERPAGE, 0)
- menu_display(id, menu, 0)
- menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
- menushow[id] = true
- hidetime(id)
- return PLUGIN_HANDLED
- }
- public MenuHandler(id , menu, item)
- {
- if( item == MENU_EXIT ) {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- switch(item) {
- case 0:{
- CheckPoint(id)
- kz_menu(id)
- }
- case 1:{
- GoCheck(id)
- kz_menu(id)
- }
- case 2:{
- new Playersnum[32], playerscount
- get_players(Playersnum, playerscount, "ah")
- if(playerscount > 1 || DefaultStop){
- Teleport(id)
- } else {
- kz_menu(id)
- }
- }
- case 3:{
- CheckPointStart(id)
- kz_menu(id)
- }
- case 4:{
- goStart1(id)
- kz_menu(id)
- }
- case 5:{
- Pause(id)
- kz_menu(id)
- }
- case 6:{
- DuelMenu(id)
- }
- case 7:{
- ct(id)
- kz_menu(id)
- }
- case 8:{
- MoreMenu(id)
- }
- case 9:{
- menushow[id] = false
- set_task(0.3, "showtimeduel", id)
- }
- }
- return PLUGIN_HANDLED
- }
- public DuelMenu(id)
- {
- new menu = menu_create("\yDuel Menu\w", "DuelMenuHandler")
- menu_additem( menu, "Duel", "1" )
- menu_additem( menu, "Show Duels", "2" )
- menu_additem( menu, "Duel Top^n", "3" )
- menu_additem( menu, "Back", "4" )
- menu_display(id, menu, 0)
- menushow[id] = true
- hidetime(id)
- return PLUGIN_HANDLED
- }
- public DuelMenuHandler (id, menu, item)
- {
- if( item == MENU_EXIT )
- {
- menu_destroy(menu)
- menushow[id] = false
- set_task(0.3, "showtimeduel", id)
- return PLUGIN_HANDLED
- }
- if(get_pcvar_num(kz_duel) == 0){
- return PLUGIN_HANDLED;
- }
- switch(item)
- {
- case 0:
- {
- if(callfunc_begin("duel_start","duel.amxx") == 1)
- {
- callfunc_push_int(id)
- callfunc_end()
- }
- }
- case 1:
- {
- if(callfunc_begin("show_duels","duel.amxx") == 1)
- {
- callfunc_push_int(id)
- callfunc_end()
- }
- DuelMenu(id)
- }
- case 2:
- {
- if(callfunc_begin("show_top","duel.amxx") == 1)
- {
- callfunc_push_int(id)
- callfunc_end()
- }
- DuelMenu(id)
- }
- case 3:
- {
- kz_menu(id)
- }
- }
- return PLUGIN_HANDLED
- }
- public GocheckMode(id)
- {
- if(!tpfenabled[id])
- {
- tpfenabled[id] = true
- kz_chat(id, "Checkpoint Angle Fix Enabled")
- }
- else
- {
- tpfenabled[id] = false
- kz_chat(id, "Checkpoint Angle Fix Disabled")
- }
- return PLUGIN_HANDLED
- }
- public MoreMenu(id)
- {
- new menu = menu_create("\yMore Options\w", "MoreMenuHandler")
- new msgtpf[64]
- formatex(msgtpf, 63, "Chekpoint Mode - %s^n", tpfenabled[id] ? "\yOn" : "\rOff" )
- menu_additem( menu, "Top 15", "1" )
- menu_additem( menu, "Invisible Menu", "2" )
- menu_additem( menu, msgtpf, "3" )
- menu_additem( menu, "Measure Tool", "4" )
- menu_additem( menu, "Back", "4" )
- menu_display(id, menu, 0)
- menushow[id] = true
- hidetime(id)
- return PLUGIN_HANDLED
- }
- public MoreMenuHandler (id, menu, item)
- {
- if( item == MENU_EXIT )
- {
- menu_destroy(menu)
- menushow[id] = false
- set_task(0.3, "showtimeduel", id)
- return PLUGIN_HANDLED
- }
- switch(item)
- {
- case 0:
- {
- top15menu(id)
- }
- case 1:
- {
- InvisMenu(id)
- }
- case 2:
- {
- GocheckMode(id)
- MoreMenu(id)
- }
- case 3:
- {
- cmdMeasure(id)
- }
- case 4:
- {
- 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, "Back", "3" )
- menu_display(id, menu, 0)
- menushow[id] = true
- hidetime(id)
- return PLUGIN_HANDLED
- }
- public InvisMenuHandler (id, menu, item)
- {
- if( item == MENU_EXIT )
- {
- menu_destroy(menu)
- menushow[id] = false
- set_task(0.3, "showtimeduel", id)
- return PLUGIN_HANDLED
- }
- switch(item)
- {
- case 0:
- {
- cmdInvisible(id)
- InvisMenu(id)
- }
- case 1:
- {
- cmdWaterInvisible(id)
- InvisMenu(id)
- }
- case 2:
- {
- MoreMenu(id)
- }
- }
- return PLUGIN_HANDLED
- }
- public top15menu(id)
- {
- new menu = menu_create("\rProKreedz \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, "My Results","3")
- menu_additem(menu, "Players Rank^n","4")
- menu_additem(menu, "Last 10 Pro", "5")
- menu_additem(menu, "Maps","6")
- menu_additem(menu, "Back", "7")
- #else
- menu_additem(menu, "\wBack", "3", 0)
- #endif
- menu_display(id, menu, 0);
- menushow[id] = true
- hidetime(id)
- return PLUGIN_HANDLED;
- }
- public top15handler(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- menu_destroy(menu)
- menushow[id] = false
- set_task(0.3, "showtimeduel", id)
- 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:
- {
- MoreMenu(id)
- }
- }
- #else
- switch(item)
- {
- case 0:
- {
- ProTop_show(id)
- }
- case 1:
- {
- NoobTop_show(id)
- }
- case 2:
- {
- kz_menu(id)
- }
- }
- #endif
- return PLUGIN_HANDLED;
- }
- // =================================================================================================
- //
- // Timersystem
- // =================================================================================================
- public fwdUse(ent, id)
- {
- if( is_user_bot(id) )
- {
- return HAM_IGNORED;
- }
- 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) && get_gametime() - antinoclipstart[id] < 3.0) || get_user_noclip(id)) {
- kz_hud_message( id, "Wait 3 seconds after using noclip." );
- return PLUGIN_HANDLED
- }
- if ( get_gametime() - antihookcheat[id] < 3.0 || ishooked[id])
- {
- kz_hud_message( id, "%L", id, "KZ_HOOK_PROTECTION" );
- return PLUGIN_HANDLED
- }
- if ( reset_checkpoints(id) && !timer_started[id] )
- {
- start_climb(id)
- if( get_user_health(id) < 100 )
- set_user_health(id, 100)
- pev(id, pev_origin, SavedStart[id])
- 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 (tphook_user[id])
- return PLUGIN_HANDLED
- if( timer_started[id] )
- {
- if(get_user_noclip(id))
- return PLUGIN_HANDLED
- pev(id, pev_origin, SavedStop[id])
- if( !DefaultStop )
- {
- kz_set_stop(MapName, SavedStop[id])
- }
- finish_climb(id)
- }
- else
- kz_hud_message(id, "%L", id, "KZ_TIMER_NOT_STARTED")
- }
- return HAM_IGNORED
- }
- public start_climb(id)
- {
- reset_checkpoints(id)
- client_print(id, print_center, "Timer Started")
- new wpn
- wpn = get_user_weapon(id)
- if (wpn != CSW_KNIFE || wpn != CSW_USP) {
- strip_user_weapons(id)
- }
- if( !user_has_weapon(id, CSW_USP) ){
- give_item(id,"weapon_usp")
- cs_set_user_bpammo(id, CSW_USP, 36)
- }
- if( !user_has_weapon(id, CSW_KNIFE) ){
- give_item(id,"weapon_knife")
- }
- if( wpn == CSW_KNIFE ){
- strip_user_weapons(id)
- cmdUsp(id)
- engclient_cmd(id,"weapon_knife")
- }
- if( wpn == CSW_SCOUT )
- {
- if( !user_has_weapon(id, CSW_SCOUT) ){
- give_item(id,"weapon_scout")
- cs_set_user_bpammo(id, CSW_SCOUT, 20)
- }
- user_has_scout[id]=true
- }
- set_pev(id, pev_gravity, 1.0);
- set_pev(id, pev_movetype, MOVETYPE_WALK)
- IsPaused[id] = false
- timer_started[id] = true
- timer_time[id] = get_gametime()
- tphook_user[id] = false
- WasPlayed[id] = false
- if(user_has_scout[id]) {
- client_cmd(id, "spk fvox/blip");
- WasPlayed[id] = true
- }
- if(!menushow[id] && !user_has_scout[id]) {
- showtime1(id)
- }
- else if (!menushow[id] && user_has_scout[id]) {
- showtime2(id)
- }
- else {
- kz_menu(id)
- }
- GoPosed[id] = false
- GoPosCp[id] = false
- GoPosHp[id] = false
- tptostart[id] = false
- }
- public finish_climb(id)
- {
- if(!sqlconnected) {
- plugin_sql()
- sqlconnected = true
- }
- 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
- FinishMsg = true
- MyPosUpdated[id] = true
- set_task(0.5, "GetTop", id + TASK_GETTOP)
- new Float: time, wpn
- time = get_gametime() - timer_time[id]
- if (get_pcvar_num(kz_wr_diff) == 1 && gochecknumbers[id] == 0) {
- WrDiffShow(id)
- }
- else {
- show_finish_message(id, time)
- }
- 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 )
- new createinto[1001]
- new cData[192]
- cData[0] = id
- formatex(cData[2], charsmax(cData)-2, "^"%f^" ^"%d^" ^"%d^" ^"%d^"", time, wpn, checkpoints ,gocheck)
- 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)
- if (get_pcvar_num(kz_wr_diff) == 1 && gochecknumbers[id] == 0) {
- WrDiffShow(id)
- }
- else {
- show_finish_message(id, time)
- }
- if (gochecknumbers[id] == 0 && !user_has_scout[id] )
- ProTop_update(id, time)
- ( gochecknumbers[id] > 0 || user_has_scout[id] )
- NoobTop_update(id, time, checknumbers[id], gochecknumbers[id])
- #endif
- reset_checkpoints(id)
- }
- 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_round )
- ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x04 %02i:%02i.%02i ^x03(^x01 CPs: ^x04%d^x03 | ^x01 TPs: ^x04%d^x03 | ^x01 %L: ^x04%s^x03) ^x01 !", prefix, name, LANG_PLAYER, "KZ_FINISH_MSG", imin, isec, ims, checknumbers[id], gochecknumbers[id], LANG_PLAYER, "KZ_WEAPON", g_weaponsnames[wpn])
- }
- public WrDiffShow(id) {
- new Float:zClimbTime = get_gametime() - timer_time[id];
- new name[32]
- get_user_name(id, name, 31)
- new imin,isec,ims
- imin = floatround(zClimbTime / 60.0, floatround_floor)
- isec = floatround(zClimbTime - imin * 60.0,floatround_floor)
- ims = floatround( ( zClimbTime - ( imin * 60.0 + isec ) ) * 100.0, floatround_round )
- if (g_iWorldRecordsNum > 0) {
- if (zClimbTime < DiffWRTime[0]) {
- new Float:sDiffTime = DiffWRTime[0] - zClimbTime;
- new szDiffTime[16]
- WRTimer(sDiffTime, szDiffTime, sizeof(szDiffTime) - 1, true, false)
- ColorChat(0, RED, "%s^x04 %s^x01 finished in ^x04%02i:%02i.%02i ^x01(^x03WR -%s)", prefix, name, imin, isec, ims, szDiffTime);
- }
- else {
- new Float:sDiffTime = zClimbTime - DiffWRTime[0];
- new szDiffTime[16]
- WRTimer(sDiffTime, szDiffTime, sizeof(szDiffTime) - 1, true, false)
- ColorChat(0, GREEN, "%s^x04 %s^x01 finished in ^x04%02i:%02i.%02i ^x01(^x03WR +%s)", prefix, name, imin, isec, ims, szDiffTime);
- }
- }
- else if (!g_iWorldRecordsNum){
- show_finish_message(id, zClimbTime);
- }
- return PLUGIN_CONTINUE;
- }
- //==========================================================
- #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.M] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
- ColorChat(0, GREEN, "%s^x01 %F", prefix, LANG_PLAYER, "KZ_TOP15_SQL_ERROR")
- }
- 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], 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_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, "'", "")
- 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` (mapname,authid,country,name,time,date,weapon,server %s) VALUES('%s', '%s','%s','%s','%f','%s','%s','%s'%s%s)", style == PRO_TOP ? "kz_pro15" : "kz_nub15",style == PRO_TOP ? "" : ",checkpoints,gocheck", MapName, 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_round )
- ColorChat(id, GREEN, "[KZ.M]^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) > 19)
- 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_round )
- client_cmd(0, "spk fvox/bell");
- ColorChat(id, GREEN, "[KZ.M]^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++
- SQL_ReadResult(hQuery, 0, name, 31)
- SQL_ReadResult(hQuery, 0, authid, 31)
- if( equal(name, namez) || 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");
- if( (i + 1) == 2)
- {
- client_cmd(0, "spk misc/mod_unstopable");
- TopUpdated = true
- }
- else
- {
- client_cmd(0, "spk buttons/bell1");
- }
- break;
- }
- SQL_NextRow(hQuery)
- }
- set_task(0.1, "kz_update_plrname", id)
- 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) > 19)
- {
- 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)
- new player_namez[32]
- get_user_name(id, player_namez, 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?name=%s^"></head><body><p>LOADING...</p></body></html>", filepath, player_namez)
- }
- 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 misc/mod_unstopable");
- ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
- }
- else
- {
- client_cmd(0, "spk buttons/bell1");
- ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
- }
- }
- }
- else
- {
- if( (i + 1) == 1)
- {
- client_cmd(0, "spk misc/mod_unstopable");
- ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
- }
- else
- {
- client_cmd(0, "spk buttons/bell1");
- ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %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);
- client_cmd(0, "spk fvox/bell");
- 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 misc/mod_unstopable");
- ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
- }
- else
- {
- client_cmd(0, "spk buttons/bell1");
- ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
- }
- }
- }
- else
- {
- if( (i + 1) == 1)
- {
- client_cmd(0, "spk misc/mod_unstopable");
- ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
- }
- else
- {
- client_cmd(0, "spk buttons/bell1");
- ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %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);
- client_cmd(0, "spk fvox/bell");
- 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, "<meta charset=UTF-8><body bgcolor=#000000><table width=100%% cellpadding=2 cellspacing=0>")
- len += formatex(buffer[len], 2047-len, "<tr align=left bgcolor=#52697B><th width=5%%>#<th width=55%% align=left>Jumper<th width=25%%> Время<th width=20%%> Дата")
- for (new i = 0; i < 15; i++)
- {
- name = Pro_Names[i]
- if( Pro_Times[i] > 9999999.0 )
- {
- len += formatex(buffer[len], 2047-len, "<tr %s><td>%d<td>%s<td>%s<td>%s",((i%2)==0)?"bgcolor=#FFFFFF":"bgcolor=#A8A8A8",(i+1),"","","")
- }
- else
- {
- new minutos, Float:segundos
- minutos = floatround(Pro_Times[i], floatround_floor)/60
- segundos = Pro_Times[i] - (60*minutos)
- len += formatex(buffer[len], 2047-len, "<tr %s><td>%d<td>%s<td>%02d:%s%.2f<td>%s",((i%2)==0)?"bgcolor=#FFFFFF":"bgcolor=#A8A8A8",(i+1),Pro_Names[i],minutos,segundos<10?"0":"",segundos,Pro_Date[i])
- }
- }
- len += formatex(buffer[len], 2047-len, "</table></body>")
- len += formatex(buffer[len], 2047-len, "<tr><center><br><font color=white>Plugin created by Destroman™")
- show_motd(id, buffer, "Pro15 Jumpers")
- return PLUGIN_HANDLED
- }
- public NoobTop_show(id)
- {
- new buffer[2048], name[32], len
- len = formatex(buffer, 2047, "<meta charset=UTF-8><body bgcolor=#000000><table width=100%% cellpadding=2 cellspacing=0>")
- len += formatex(buffer[len], 2047-len, "<tr align=left bgcolor=#52697B><th width=5%%>#<th width=55%% align=left>Jumper<th width=25%%> Время<th width=20%%> Дата")
- for (new i = 0; i < 15; i++)
- {
- if( Noob_Tiempos[i] > 9999999.0 )
- {
- len += formatex(buffer[len], 2047-len, "<tr %s><td>%d<td>%s<td>%s<td>%s",((i%2)==0)?"bgcolor=#FFFFFF":"bgcolor=#A8A8A8",(i+1),"","","")
- }
- else
- {
- name = Noob_Names[i]
- new minutos, Float:segundos
- minutos = floatround(Noob_Tiempos[i], floatround_floor)/60
- segundos = Noob_Tiempos[i] - (60*minutos)
- len += formatex(buffer[len], 2047-len, "<tr %s><td>%d<td>%s<td>%02d:%s%.2f<td>%s",((i%2)==0)?"bgcolor=#FFFFFF":"bgcolor=#A8A8A8",(i+1),Noob_Names[i],minutos,segundos<10?"0":"",segundos,Noob_Date[i])
- }
- }
- len += formatex(buffer[len], 2047-len, "</table></body>")
- len += formatex(buffer[len], 2047-len, "<tr><center><br><font color=white>Plugin created by Destroman™")
- show_motd(id, buffer, "Noob15 Jumpers")
- return PLUGIN_HANDLED
- }
- #endif
- public show_beacon(id){
- static origin[3]
- // emit_sound(id, CHAN_ITEM, g_snd_path, 1.0, ATTN_NORM, 0, PITCH_NORM)
- get_user_origin(id, origin)
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_BEAMCYLINDER)
- write_coord(origin[0]) //position.x
- write_coord(origin[1]) //position.y
- write_coord(origin[2]-29) //position.z
- write_coord(origin[0]) //axis.x
- write_coord(origin[1]) //axis.y
- write_coord(origin[2]+200) //axis.z
- write_short(my_sprite) //sprite index
- write_byte(0) //starting frame
- write_byte(1) //frame rate in 0.1's
- write_byte(6) //life in 0.1's
- write_byte(10) //line width in 0.1's
- write_byte(1) //noise amplitude in 0.01's
- write_byte(0) //red
- write_byte(0) //green
- write_byte(255) //blue
- write_byte(200) //brightness
- write_byte(6) //scroll speed in 0.1's
- message_end();
- }
- public show_beacon2(id){
- static origin[3]
- get_user_origin(id, origin)
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_BEAMCYLINDER)
- write_coord(origin[0]) //position.x
- write_coord(origin[1]) //position.y
- write_coord(origin[2]-29) //position.z
- write_coord(origin[0]) //axis.x
- write_coord(origin[1]) //axis.y
- write_coord(origin[2]+200) //axis.z
- write_short(my_sprite) //sprite index
- write_byte(0) //starting frame
- write_byte(1) //frame rate in 0.1's
- write_byte(6) //life in 0.1's
- write_byte(10) //line width in 0.1's
- write_byte(1) //noise amplitude in 0.01's
- write_byte(0) //red
- write_byte(0) //green
- write_byte(255) //blue
- write_byte(200) //brightness
- write_byte(6) //scroll speed in 0.1's
- message_end();
- }
- public show_beacon3(id){
- id -= SHOW_BEACON
- static origin[3]
- // emit_sound(id, CHAN_ITEM, g_snd_path, 1.0, ATTN_NORM, 0, PITCH_NORM)
- get_user_origin(id, origin)
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_BEAMCYLINDER)
- write_coord(origin[0]) //position.x
- write_coord(origin[1]) //position.y
- write_coord(origin[2]-29) //position.z
- write_coord(origin[0]) //axis.x
- write_coord(origin[1]) //axis.y
- write_coord(origin[2]+200) //axis.z
- write_short(my_sprite) //sprite index
- write_byte(0) //starting frame
- write_byte(1) //frame rate in 0.1's
- write_byte(6) //life in 0.1's
- write_byte(10) //line width in 0.1's
- write_byte(1) //noise amplitude in 0.01's
- write_byte(0) //red
- write_byte(0) //green
- write_byte(255) //blue
- write_byte(200) //brightness
- write_byte(6) //scroll speed in 0.1's
- message_end();
- }
- public show_beacon4(id){
- id -= SHOW_BEACON1
- static origin[3]
- get_user_origin(id, origin)
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_BEAMCYLINDER)
- write_coord(origin[0]) //position.x
- write_coord(origin[1]) //position.y
- write_coord(origin[2]-29) //position.z
- write_coord(origin[0]) //axis.x
- write_coord(origin[1]) //axis.y
- write_coord(origin[2]+200) //axis.z
- write_short(my_sprite) //sprite index
- write_byte(0) //starting frame
- write_byte(1) //frame rate in 0.1's
- write_byte(6) //life in 0.1's
- write_byte(10) //line width in 0.1's
- write_byte(1) //noise amplitude in 0.01's
- write_byte(0) //red
- write_byte(0) //green
- write_byte(255) //blue
- write_byte(200) //brightness
- write_byte(6) //scroll speed in 0.1's
- message_end();
- }
- public plugin_end( )
- {
- if(g_SqlTuple)
- SQL_FreeHandle(g_SqlTuple)
- if(SqlConnection)
- SQL_FreeHandle(SqlConnection)
- for(new i = 1; i < max_players; i++ )
- {
- if(Autosavepos[i] && !is_user_bot(i)){
- saveposition(i)
- }
- }
- }
- // You reached the end of file
- // The original plugin was made by p4ddY
- // This plugin was edited by nucLeaR
- // Version 2.31
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement