· 9 years ago · Feb 15, 2017, 01:24 AM
1///Added Autojoin
2///Added Semiclip
3///Added Allchat (if have any other say plugin you must add upper then prokreedz in plugins.ini)
4///Added Block Kill
5///Added Block Change Team
6///Added No Buyzone
7///NonSpriteGlowfix
8///Added Silencer Cvar kz_weapon_silencer
9///Added Cvar kz_admin_check
10///HudTextArgs Blocker
11///Invis Fixed in Spec
12///Hook Fixed through player
13///Added /wr command uncomment DOWNLOAD_NEW_WR if Not Local demos.txt and demoz.txt
14///Added Tp To Finish in Teleport menu
15///Added Owner & BOT in aiming player
16///Added Cvar Show WR Different Time kz_wr_diff (FIXED)
17///Added Added Pro1 Show and Nub1 Show if SQL DEFINED (Finish Msg or WR or in spec).
18///Added Description server cvar kz_gamename
19///Added define KZ_DUEL and cvar kz_duel
20///Delete Dropped Weapons or on death and when drop alive
21///Fixed NVG on SPEC And Damage -HP on spec
22
23#include <amxmodx>
24#include <amxmisc> //cmd_access
25#include <cstrike>
26#include <colorchat>
27#include <fun>
28#include <fakemeta>
29#include <hamsandwich>
30#include <engine>
31#include <dhudmessage>
32#include <xs>
33
34
35#define USE_SQL
36//#define KZ_DUEL
37//#define CREATE_TABLES_1ST_TIME
38
39#if defined USE_SQL
40 #include <sqlx>
41 #include <geoip>
42#endif
43
44//===========================WR===============================//
45
46//#define DOWNLOAD_NEW_WR ////////////// if you want download (update) uncomment it
47
48
49#if defined DOWNLOAD_NEW_WR ///////////////////////////////////
50
51#include <sockets>
52new const g_szDemoFiles[][][] =
53{
54 { "http://kreedz.uz/demos.txt", "demos.txt", "demos_last_update_xj.txt" },
55 { "http://kreedz.uz/demoz.txt", "demoz.txt", "demos_last_update_cc.txt" }
56};
57enum _:RecordDemo
58{
59 URLS,
60 DEMOS,
61 UPDATEDEMOS
62}
63
64new g_szDemosBuffer[25001];
65
66#else /////////////////////////////////////////////
67
68new const g_szDemoFiles[][][] =
69{
70 { "demos.txt" },
71 { "demoz.txt" }
72};
73enum _:RecordDemo
74{
75 DEMOS
76}
77#endif //////////////////////////////////////////////
78
79new const g_szDirFile[] = "kzrecords";
80
81new Float:g_flWorldRecordTime[5];
82new Float:DiffWRTime[16];
83new g_szWorldRecordPlayer[5][32];
84
85new g_szDir[128];
86new g_szMapName[32];
87new g_iWorldRecordsNum;
88new norecord;
89new g_szWorldExt[5][20];
90new g_szWorldRecords[256];
91
92#if defined USE_SQL
93
94new proinfo[64], noobinfo[64], myproinfo[33][64], mynoobinfo[33][64]
95new bool:MyPosUpdated[33]
96new bool:TopUpdated
97new bool:FinishMsg
98
99#endif
100
101new g_entid[33]
102new g_maxents
103
104//===========================END OF WR===============================//
105
106#define KZ_LEVEL ADMIN_KICK
107#define MSG MSG_ONE_UNRELIABLE
108#define MAX_ENTITYS 900+15*32
109#define IsOnLadder(%1) (pev(%1, pev_movetype) == MOVETYPE_FLY)
110#define VERSION "2.31"
111
112#define is_user(%1) (1 <= %1 <= get_maxplayers())
113
114#define TEAM_SELECT_VGUI_MENU_ID 2
115
116#define SCOREATTRIB_NONE 0
117#define SCOREATTRIB_DEAD ( 1 << 0 )
118#define SCOREATTRIB_BOMB ( 1 << 1 )
119#define SCOREATTRIB_VIP ( 1 << 2 )
120
121#define SEMICLIP_RENDERING_RADIUS 400.0
122const Float:SEMICLIP_RADIUS = SEMICLIP_RENDERING_RADIUS;
123
124#define TASK_INFO 12222
125#define TASK_INFO_KREEDZ 17232
126#define TASK_GETTOP 12583
127#define SHOW_POS_TASK 87631
128#define SHOW_BEACON 87632
129#define SHOW_BEACON1 87633
130
131#define WBOX "models/w_weaponbox.mdl"
132#define BOMB "models/w_backpack.mdl"
133#define SHLD "models/w_shield.mdl"
134
135///=======================Measure ===============/////////////
136#define TASK_BEAM 45896
137
138new Float:g_vFirstLoc[33][3];
139new Float:g_vSecondLoc[33][3];
140
141new bool:g_bReturnFloat[33];
142new bool:g_bShowBeams[33];
143new bool:g_bDetailedResults[33];
144new bool:g_bAutoSetting[33];
145new id_spectated[33]
146
147new g_iColors[3] = { 255, 85, 0 };
148
149new g_flBeam;
150
151////=====================Measure ======================///////////
152
153
154//////////////////////admin_check/////////////////////
155#define ADMIN_CHECK ADMIN_KICK
156
157static const COLOR[] = "^x01" //yellow
158// static const COLOR1[] = "^x03" //blue
159// static const COLOR2[] = "^x04" //green
160static const CONTACT[] = ""
161
162///////////////////admin_check///////////////////////
163
164//////////////////////////hudtextargblock/////////////////
165
166const NextHudTextArgsOffset = 198 // ConnorMcLeod
167
168const HintMaxLen = 38
169
170new Hints[][HintMaxLen] =
171{
172 "hint_win_round_by_killing_enemy",
173 "hint_press_buy_to_purchase",
174 "hint_spotted_an_enemy",
175 "hint_use_nightvision",
176 "hint_lost_money",
177 "hint_removed_for_next_hostage_killed",
178 "hint_careful_around_hostages",
179 "hint_careful_around_teammates",
180 "hint_reward_for_killing_vip",
181 "hint_win_round_by_killing_enemy",
182 "hint_try_not_to_injure_teammates",
183 "hint_you_are_in_targetzone",
184 "hint_hostage_rescue_zone",
185 "hint_terrorist_escape_zone",
186 "hint_ct_vip_zone",
187 "hint_terrorist_vip_zone",
188 "hint_cannot_play_because_tk",
189 "hint_use_hostage_to_stop_him",
190 "hint_lead_hostage_to_rescue_point",
191 "hint_you_have_the_bomb",
192 "hint_you_are_the_vip",
193 "hint_out_of_ammo",
194 "hint_spotted_a_friend",
195 "hint_spotted_an_enemy",
196 "hint_prevent_hostage_rescue",
197 "hint_rescue_the_hostages",
198 "hint_press_use_so_hostage_will_follow"
199}
200
201new HintsDefaultStatus[sizeof Hints] =
202{
203 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
204}
205
206new Trie:HintsStatus
207
208
209//////////////////////////hudtextargblock/////////////////
210
211new bool:isFalling[33]
212new bool:isMpbhop[33]
213new Float:vFallingStart[33][3]
214new Float:MpbhopOrigin[33][3]
215new Float:vFallingTime[33]
216
217new g_iPlayers[32], g_iNum
218new Float:hp_spec[33]
219
220
221new const FL_ONGROUND2 = ( FL_ONGROUND | FL_PARTIALGROUND | FL_INWATER | FL_CONVEYOR | FL_FLOAT )
222new const KZ_STARTFILE[] = "start.ini"
223new const KZ_STARTFILE_TEMP[] = "temp_start.ini"
224
225new const KZ_FINISHFILE[] = "finish.ini"
226new const KZ_FINISHFILE_TEMP[] = "temp_finish.ini"
227
228#if defined USE_SQL
229new bool:sqlconnected
230new Handle:g_SqlTuple
231new Handle:SqlConnection
232new g_Error[512]
233new kz_sql_host
234new kz_sql_user
235new kz_sql_pass
236new kz_sql_db
237new kz_sql_name
238new kz_sql_files
239#else
240new Float:Pro_Times[24]
241new Pro_AuthIDS[24][32]
242new Pro_Names[24][32]
243new Pro_Date[24][32]
244new Float:Noob_Tiempos[24]
245new Noob_AuthIDS[24][32]
246new Noob_Names[24][32]
247new Noob_Date[24][32]
248new Noob_CheckPoints[24]
249new Noob_GoChecks[24]
250new Noob_Weapon[24][32]
251#endif
252
253new max_players;
254new g_maxplayers;
255new Float:gCheckpointAngle[33][3];
256new Float:gLastCheckpointAngle[33][3];
257new Float:gCheckpointStartAngle[33][3];
258new Float:gLastCheckpointStartAngle[33][3];
259new Float:Checkpoints[33][2][3]
260new Float:InPauseCheckpoints[33][2][3]
261new Float:CheckpointStarts[33][2][3]
262new Float:timer_time[33]
263new Float:g_pausetime[33]
264new Float:antihookcheat[33]
265new Float:antidiestart[33]
266new g_iHookWallOrigin[33][3];
267new Float:antinoclipstart[33]
268new Float:antiteleport[33]
269new Float:SpecLoc[33][3]
270new Float:PauseOrigin[33][3]
271new Float:SavedStart[33][3]
272new Float:SavedStop[33][3]
273new hookorigin[33][3]
274new Float:DefaultStartPos[3]
275new Float:DefaultStopPos[3]
276
277new Float:SavedTime[33]
278new SavedChecks[33]
279new SavedGoChecks[33]
280new SavedScout[33]
281new SavedOrigins[33][3]
282new SavedVelocity[33][3]
283new Float:pausedvelocity[33][3]
284
285new bool:gCheckpoint[33];
286new bool:gCheckpointStart[33];
287new bool:g_bCpAlternate[33]
288new bool:g_bInPauseCpAlternate[33]
289new bool:g_bCpAlternateStart[33]
290new bool:timer_started[33]
291new bool:IsPaused[33]
292new bool:StartSound[33]
293new bool:WasPlayed[33]
294new bool:firstspawn[33]
295new bool:canusehook[33]
296new bool:ishooked[33]
297new bool:GoPosed[33]
298new bool:GoPosCp[33]
299new bool:GoPosHp[33]
300new bool:user_has_scout[33]
301new bool:spec_user[33]
302new bool:tphook_user[33]
303new bool:menushow[33]
304new bool:block_change[33]
305new bool:tptostart[33]
306new bool:NightVisionUse[33]
307new bool:HealsOnMap
308new bool:gViewInvisible[33]
309new bool:gWaterInvisible[33]
310new bool:gWaterEntity[MAX_ENTITYS]
311new bool:gWaterFound
312new bool:DefaultStart
313new bool:DefaultStop
314new bool:AutoStart[33]
315new bool:Autosavepos[33]
316new bool:tpfenabled[33]
317new bool:gc1[33]
318
319new Trie:g_tStarts
320new Trie:g_tStops;
321
322new checknumbers[33]
323new inpausechecknumbers[33]
324new gochecknumbers[33]
325new chatorhud[33]
326new MapName[64]
327new Kzdir[128]
328new SavePosDir[128]
329new prefix[33]
330#if !defined USE_SQL
331new Topdir[128]
332#endif
333
334new iconstatus
335new kz_help
336new kz_autosavepos
337new kz_gamename
338new kz_spawn_mainmenu
339new kz_duel
340new kz_admin_check
341new kz_hud_color
342new kz_chat_prefix
343new hud_message
344new kz_other_weapons
345new kz_maxspeedmsg
346new kz_weapon_silencer
347new kz_wr_diff
348new kz_drop_weapons
349new kz_pick_weapons
350new kz_use_radio
351new kz_hook_sound
352new kz_hook_speed
353new kz_nvg
354new kz_nvg_colors
355new kz_vip
356new kz_save_pos
357new kz_top15_authid
358new Sbeam = 0
359new my_sprite
360
361
362new g_msgid_SayText;
363
364new const textchannels[][] = {
365 "#Cstrike_Chat_T",
366 "#Cstrike_Chat_CT",
367 "#Cstrike_Chat_Spec",
368 "#Cstrike_Chat_All",
369 "#Cstrike_Chat_AllSpec",
370 "#Cstrike_Chat_AllDead",
371 "#Cstrike_Chat_T_Dead",
372 "#Cstrike_Chat_CT_Dead"
373};
374
375
376new const other_weapons[8] =
377{
378 CSW_SCOUT, CSW_P90, CSW_FAMAS, CSW_SG552,
379 CSW_M4A1, CSW_M249, CSW_AK47, CSW_AWP
380}
381
382new const other_weapons_name[8][] =
383{
384 "weapon_scout", "weapon_p90", "weapon_famas", "weapon_sg552",
385 "weapon_m4a1", "weapon_m249", "weapon_ak47", "weapon_awp"
386}
387
388new const g_weaponsnames[][] =
389{
390 "", // NULL
391 "p228", "shield", "scout", "hegrenade", "xm1014", "c4",
392 "mac10", "aug", "smokegrenade", "elite", "fiveseven",
393 "ump45", "sg550", "galil", "famas", "usp", "glock18",
394 "awp", "mp5navy", "m249", "m3", "m4a1", "tmp", "g3sg1",
395 "flashbang", "deagle", "sg552", "ak47", "knife", "p90",
396 "glock", "elites", "fn57", "mp5", "vest", "vesthelm",
397 "flash", "hegren", "sgren", "defuser", "nvgs", "primammo",
398 "secammo", "km45", "9x19mm", "nighthawk", "228compact",
399 "12gauge", "autoshotgun", "mp", "c90", "cv47", "defender",
400 "clarion", "krieg552", "bullpup", "magnum", "d3au1",
401 "krieg550"
402}
403
404new const g_block_commands[][]=
405{
406 "buy", "buyammo1", "buyammo2", "buyequip",
407 "cl_autobuy", "cl_rebuy", "cl_setautobuy", "cl_setrebuy"
408
409}
410
411#if defined USE_SQL
412enum
413{
414 TOP_NULL,
415 PRO_TOP,
416 NUB_TOP,
417 LAST_PRO10,
418 PRO_RECORDS,
419 PLAYERS_RANKING,
420 MAPS_STATISTIC
421}
422#endif
423
424////////////////////////////////////////////////////////////////
425
426const groupNone = 0;
427
428enum _:renderGroups ( <<= 1 )
429{
430 groupRenderVisible = 0b1, // 0b1
431 groupRenderInvisible, // 0b10
432}
433
434new const CLASS_PLAYER[] = "player";
435
436#define IsPlayer(%0) ( 1 <= (%0) <= g_iMaxPlayers )
437#define MaskEnt(%0) ( 1<<(%0 & 31) )
438
439new g_bitIsPlayerInSphere;
440#define MarkPlayerInSphere(%0) g_bitIsPlayerInSphere |= MaskEnt(%0)
441#define IsPlayerInSphere(%0) ( g_bitIsPlayerInSphere & MaskEnt(%0) )
442
443new g_bitIsPlayerAlive;
444#define MarkPlayerAlive(%0) g_bitIsPlayerAlive |= MaskEnt(%0)
445#define IsPlayerAlive(%0) ( g_bitIsPlayerAlive & MaskEnt(%0) )
446
447new g_bitBots;
448#define MarkPlayerBot(%0) g_bitBots |= MaskEnt(%0)
449#define ClearPlayerBot(%0) g_bitBots &= ~MaskEnt(%0)
450#define IsUserBot(%0) ( g_bitBots & MaskEnt(%0) )
451
452new g_iLastPlayerIndex;
453new HamHook:g_iHhPreThink, HamHook:g_iHhPreThinkPost;
454new g_iFhAddToFullPackPost;
455new bool:g_bPreThinkHooked;
456new bool:g_bReadPackets;
457new bool:g_bClientMessages;
458
459
460#if defined KZ_DUEL
461new bool:plr_nonsteam[33]
462native kz_player_duel_cp(id)
463native kz_player_in_duel(id)
464native kz_player_can_hook(id)
465#endif
466
467// =================================================================================================
468
469
470public plugin_init()
471{
472 register_plugin("ProKreedz", VERSION, "Destroman Edited")
473 register_clcmd("say /teleport", "Teleport")
474 g_maxplayers = get_maxplayers()
475 kz_autosavepos = register_cvar("kz_autosavepos","1")
476 kz_spawn_mainmenu = register_cvar("kz_spawn_mainmenu", "1")
477 kz_duel = register_cvar("kz_duel", "1")
478 kz_gamename = register_cvar("kz_gamename", "KREEDZ")
479 kz_admin_check = register_cvar("kz_admin_check", "1")
480 kz_chat_prefix = register_cvar("kz_chat_prefix", "[KZ.M]")
481 kz_hud_color = register_cvar("kz_hud_color", "0 100 255")
482 kz_other_weapons = register_cvar("kz_other_weapons","1")
483 kz_drop_weapons = register_cvar("kz_drop_weapons", "0")
484 kz_pick_weapons = register_cvar("kz_pick_weapons", "0")
485 kz_weapon_silencer = register_cvar("kz_weapon_silencer","1")
486 kz_wr_diff = register_cvar("kz_wr_diff","1")
487 kz_maxspeedmsg = register_cvar("kz_maxspeedmsg","1")
488 kz_hook_sound = register_cvar("kz_hook_sound","1")
489 kz_help = register_cvar("kz_help","1")
490 kz_hook_speed = register_cvar("kz_hook_speed", "300.0")
491 kz_use_radio = register_cvar("kz_use_radio", "0")
492 kz_nvg = register_cvar("kz_nvg","1")
493 kz_nvg_colors = register_cvar("kz_nvg_colors","248 248 255")
494 kz_vip = register_cvar("kz_vip","1")
495 kz_top15_authid = register_cvar("kz_top15_authid", "1")
496 kz_save_pos = register_cvar("kz_save_pos", "1")
497 iconstatus = get_user_msgid("StatusIcon");
498
499 max_players=get_maxplayers()+1;
500 #if defined USE_SQL
501 kz_sql_host = register_cvar("kz_sql_host", "") // Host of DB
502 kz_sql_user = register_cvar("kz_sql_user", "") // Username of DB
503 kz_sql_pass = register_cvar("kz_sql_pass", "", FCVAR_PROTECTED) // Password for DB user
504 kz_sql_db = register_cvar("kz_sql_db", "") // DB Name for the top 15
505 kz_sql_name = register_cvar("kz_sql_server", "") // Name of server
506 kz_sql_files = register_cvar("kz_sql_files", "") // Path of the PHP files
507 #endif
508 register_clcmd("/cp","CheckPoint")
509 register_clcmd("/ss","CheckPointStart")
510 register_clcmd("/help","cmd_help")
511 register_clcmd("/cs","CheckPointStart")
512 register_clcmd("drop", "BlockDrop")
513 register_clcmd("/gc", "GoCheck")
514 register_clcmd("/gcf", "GoCheck1")
515 register_clcmd("+hook","hook_on",KZ_LEVEL)
516 register_clcmd("-hook","hook_off",KZ_LEVEL)
517
518 register_concmd("nightvision","ToggleNVG")
519 register_clcmd("radio1", "BlockRadio")
520 register_clcmd("radio2", "BlockRadio")
521 register_clcmd("radio3", "BlockRadio")
522 register_clcmd("stuck", "Stuck")
523 register_clcmd("unstuck", "Stuck")
524 register_clcmd("/tp","GoCheck")
525 register_clcmd("/tpf","GoCheck1")
526 register_clcmd("say menu","kz_menu", 0)
527
528 register_clcmd("chooseteam", "HookCmdChooseTeam");
529
530 register_concmd( "measure_color", "cmdChangeColor" );
531 register_clcmd( "say /measure","cmdMeasure" );
532 register_clcmd( "say /distance","cmdMeasure" );
533 register_menucmd( register_menuid( "\rMeasure^n^n" ), 1023, "menuAction" );
534
535
536 register_message(get_user_msgid("ShowMenu"), "message_show_menu")
537 register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
538 register_message(get_user_msgid("HudTextArgs"),"hudTextArgs")
539
540
541 kz_register_saycmd("help","cmd_help",0)
542 kz_register_saycmd("cp","CheckPoint",0)
543 kz_register_saycmd("ss","CheckPointStart",0)
544 kz_register_saycmd("cs","CheckPointStart",0)
545 kz_register_saycmd("chatorhud", "ChatHud", 0)
546 kz_register_saycmd("ct","ct",0)
547 kz_register_saycmd("gc", "GoCheck",0)
548 kz_register_saycmd("gcf", "GoCheck1",0)
549 kz_register_saycmd("gocheck", "GoCheck",0)
550 kz_register_saycmd("gocheckf", "GoCheck1",0)
551 kz_register_saycmd("invis", "InvisMenu", 0)
552 kz_register_saycmd("kz", "kz_menu", 0)
553 kz_register_saycmd("menu","kz_menu", 0)
554 kz_register_saycmd("nc", "noclip", 0)
555 kz_register_saycmd("noclip", "noclip", 0)
556 kz_register_saycmd("noob10", "NoobTop_show", 0)
557 kz_register_saycmd("noob15", "NoobTop_show", 0)
558 kz_register_saycmd("nub10", "NoobTop_show", 0)
559 kz_register_saycmd("nub15", "NoobTop_show", 0)
560 kz_register_saycmd("p", "Pause", 0)
561 kz_register_saycmd("pause", "Pause", 0)
562 kz_register_saycmd("unpause", "Pause", 0)
563 kz_register_saycmd("pinvis", "cmdInvisible", 0)
564 kz_register_saycmd("pro10", "ProTop_show", 0)
565 kz_register_saycmd("pro15", "ProTop_show", 0)
566 kz_register_saycmd("reset", "reset_checkpoints", 0)
567 kz_register_saycmd("rs", "reset_checkpoints", 0)
568 kz_register_saycmd("respawn", "goStart1", 0)
569 kz_register_saycmd("scout", "cmdScout", 0)
570 kz_register_saycmd("setstart", "setStart", KZ_LEVEL)
571 kz_register_saycmd("setstop", "setStop", KZ_LEVEL)
572 kz_register_saycmd("origin", "Origin", KZ_LEVEL)
573 kz_register_saycmd("spec", "ct", 0)
574 kz_register_saycmd("start", "goStart", 0)
575 kz_register_saycmd("stop", "goFinish", 0)
576 kz_register_saycmd("stuck", "Stuck", 0)
577 kz_register_saycmd("unstuck", "Stuck", 0)
578 kz_register_saycmd("teleport", "GoCheck", 0)
579 kz_register_saycmd("top15", "top15menu",0)
580 kz_register_saycmd("top10", "top15menu",0)
581 kz_register_saycmd("tp", "GoCheck",0)
582 kz_register_saycmd("tpf", "GoCheck1",0)
583 kz_register_saycmd("usp", "cmdUsp", 0)
584 kz_register_saycmd("weapons", "weapons", 0)
585 kz_register_saycmd("guns", "weapons", 0)
586 kz_register_saycmd("winvis", "cmdWaterInvisible", 0)
587
588 #if defined USE_SQL
589 kz_register_saycmd("prorecords", "ProRecs_show", 0)
590 kz_register_saycmd("prorecs", "ProRecs_show", 0)
591 #endif
592
593 register_message( get_user_msgid( "StatusIcon" ), "Msg_StatusIcon" );
594
595
596 register_event("CurWeapon", "curweapon", "be", "1=1")
597 register_event( "StatusValue", "EventStatusValue", "b", "1>0", "2>0" );
598
599 register_forward(FM_AddToFullPack, "FM_client_AddToFullPack_Post", 1)
600 register_forward( FM_GetGameDescription,"Fwd_GameDesc" );
601
602///////////////////////////////////////////////
603 register_forward(FM_CmdStart, "OnCmdStart", false);
604 DisableHamForward( g_iHhPreThink = RegisterHam(Ham_Player_PreThink, CLASS_PLAYER, "OnCBasePlayer_PreThink", false) );
605 DisableHamForward( g_iHhPreThinkPost = RegisterHam(Ham_Player_PreThink, CLASS_PLAYER, "OnCBasePlayer_PreThink_P", true) );
606 register_forward(FM_UpdateClientData, "OnUpdateClientData_P", true);
607
608/////////////////////////////////////////////////////
609 register_forward(FM_PlayerPreThink, "fwdPlayerPreThink", 0)
610 register_forward(FM_ClientKill, "Forward_ClientKill")
611 RegisterHam( Ham_Use, "func_button", "fwdUse", 0)
612 RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Pre")
613 RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1)
614 RegisterHam( Ham_Touch, "weaponbox", "FwdSpawnWeaponbox" )
615 RegisterHam( Ham_Touch, "armoury_entity", "FwdSpawnWeaponbox" )
616 RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 )
617 RegisterHam( Ham_TakeDamage, "player", "eventHamPlayerDamage")
618 RegisterHam( Ham_Touch, "worldspawn", "Ham_HookTouch", false);
619 RegisterHam( Ham_Touch, "func_wall", "Ham_HookTouch", false);
620 RegisterHam( Ham_Touch, "func_breakable", "Ham_HookTouch", false);
621 RegisterHam( Ham_Touch, "player", "Ham_HookTouch", false);
622 register_forward(FM_Think,"fw_ThinkEntity")
623 new iEnt
624 iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString , "info_target"))
625 set_pev(iEnt, pev_classname, "kz_time_think")
626 set_pev(iEnt, pev_nextthink, get_gametime() + 1.0)
627
628 g_msgid_SayText = get_user_msgid("SayText");
629 register_clcmd("say", "HandleSay");
630 register_clcmd("say_team", "HandleSay");
631
632 register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" )
633 register_dictionary("prokreedz.txt")
634 get_pcvar_string(kz_chat_prefix, prefix, 31)
635 get_mapname(MapName, 63)
636 set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
637
638 new kreedz_cfg[128], ConfigDir[64]
639 get_configsdir( ConfigDir, 64)
640 formatex(Kzdir,128, "%s/kz", ConfigDir)
641 if( !dir_exists(Kzdir) )
642 mkdir(Kzdir)
643
644 #if !defined USE_SQL
645 formatex(Topdir,128, "%s/top15", Kzdir)
646 if( !dir_exists(Topdir) )
647 mkdir(Topdir)
648 #endif
649
650
651
652 get_mapname(g_szMapName, sizeof(g_szMapName) - 1);
653 strtolower(g_szMapName);
654 CheckRecords()
655
656 new szModel[ 2 ],
657 iMaxEntities = get_global_int( GL_maxEntities );
658
659 while( ++g_maxplayers <= iMaxEntities ) {
660 if( is_valid_ent( g_maxplayers ) && entity_get_int( g_maxplayers, EV_INT_rendermode ) == kRenderGlow ) {
661 entity_get_string( g_maxplayers, EV_SZ_model, szModel, 1 );
662
663 if( szModel[ 0 ] == '*' )
664 entity_set_int( g_maxplayers, EV_INT_rendermode, kRenderNormal );
665 }
666 }
667
668 formatex(SavePosDir, 128, "%s/savepos", Kzdir)
669 if( !dir_exists(SavePosDir) )
670 mkdir(SavePosDir)
671
672 formatex(kreedz_cfg,128,"%s/kreedz.cfg", Kzdir)
673
674 if( file_exists( kreedz_cfg ) )
675 {
676 server_exec()
677 server_cmd("exec %s",kreedz_cfg)
678 }
679
680 for(new i = 0; i < sizeof(g_block_commands) ; i++)
681 register_clcmd(g_block_commands[i], "BlockBuy")
682
683 g_tStarts = TrieCreate( )
684 g_tStops = TrieCreate( )
685
686 new const szStarts[ ][ ] =
687 {
688 "counter_start", "clockstartbutton", "firsttimerelay", "but_start", "counter_start_button",
689 "multi_start", "timer_startbutton", "start_timer_emi", "gogogo"
690 }
691
692 new const szStops[ ][ ] =
693 {
694 "counter_off", "clockstopbutton", "clockstop", "but_stop", "counter_stop_button",
695 "multi_stop", "stop_counter", "m_counter_end_emi"
696 }
697
698 for( new i = 0; i < sizeof szStarts; i++ )
699 TrieSetCell( g_tStarts, szStarts[ i ], 1 )
700
701 for( new i = 0; i < sizeof szStops; i++ )
702 TrieSetCell( g_tStops, szStops[ i ], 1 )
703
704}
705
706
707
708
709
710public plugin_precache()
711{
712 hud_message = CreateHudSyncObj()
713 RegisterHam( Ham_Spawn, "func_door", "FwdHamDoorSpawn", 1 )
714 precache_sound("weapons/xbow_hit2.wav")
715 Sbeam = precache_model("sprites/lgtning.spr")
716 precache_sound("warcraft3/resurrecttarget.wav")
717 precache_sound( "misc/mod_unstopable.wav" );
718 my_sprite = precache_model("sprites/black_smoke1.spr")
719 g_flBeam = precache_model( "sprites/zbeam4.spr" );
720}
721
722
723public plugin_cfg()
724{
725 sqlconnected = false
726 TopUpdated = true
727 FinishMsg = false
728 #if !defined USE_SQL
729 for (new i = 0 ; i < 15; ++i)
730 {
731 Pro_Times[i] = 999999999.00000;
732 Noob_Tiempos[i] = 999999999.00000;
733 }
734
735 read_pro15()
736 read_Noob15()
737 #endif
738
739 HintsStatus = TrieCreate()
740
741 for(new i=0, statusString[2]; i<sizeof Hints; i++)
742 {
743 statusString[0] = HintsDefaultStatus[i] + 48
744
745 if(get_pcvar_num(register_cvar(Hints[i],statusString)))
746 TrieSetCell(HintsStatus,Hints[i][5],true)
747 }
748
749 new startcheck[100], data[1024], map[64], x[13], y[13], z[13];
750 formatex(startcheck, 99, "%s/%s", Kzdir, KZ_STARTFILE)
751 new f = fopen(startcheck, "rt" )
752 while( !feof( f ) )
753 {
754 fgets( f, data, sizeof data - 1 )
755 parse( data, map, 63, x, 12, y, 12, z, 12)
756
757 if( equali( map, MapName ) )
758 {
759 DefaultStartPos[0] = str_to_float(x)
760 DefaultStartPos[1] = str_to_float(y)
761 DefaultStartPos[2] = str_to_float(z)
762
763 DefaultStart = true
764 break;
765 }
766 }
767 fclose(f)
768
769
770 new stopcheck[100], data1[1024], map1[64], x1[13], y1[13], z1[13];
771 formatex(stopcheck, 99, "%s/%s", Kzdir, KZ_FINISHFILE)
772 new ff = fopen(stopcheck, "rt" )
773 while( !feof( ff ) )
774 {
775 fgets( ff, data1, sizeof data1 - 1 )
776 parse( data1, map1, 63, x1, 12, y1, 12, z1, 12)
777
778 if( equali( map1, MapName ) )
779 {
780 DefaultStopPos[0] = str_to_float(x1)
781 DefaultStopPos[1] = str_to_float(y1)
782 DefaultStopPos[2] = str_to_float(z1)
783
784 DefaultStop = true
785 break;
786 }
787 }
788 fclose(ff)
789
790 new ent = -1;
791 while( ( ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_water") ) != 0 )
792 {
793 if( !gWaterFound )
794 {
795 gWaterFound = true;
796 }
797
798 gWaterEntity[ent] = true;
799 }
800
801 ent = -1;
802 while( ( ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_illusionary") ) != 0 )
803 {
804 if( pev( ent, pev_skin ) == CONTENTS_WATER )
805 {
806 if( !gWaterFound )
807 {
808 gWaterFound = true;
809 }
810
811 gWaterEntity[ent] = true;
812 }
813 }
814
815 ent = -1;
816 while( ( ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_conveyor") ) != 0 )
817 {
818 if( pev( ent, pev_spawnflags ) == 3 )
819 {
820 if( !gWaterFound )
821 {
822 gWaterFound = true;
823 }
824
825 gWaterEntity[ent] = true;
826 }
827 }
828}
829
830
831public HookCmdChooseTeam(id)
832{
833 return PLUGIN_HANDLED ;
834}
835
836public message_show_menu(msgid, dest, id) {
837 if(block_change[id]) {
838 return PLUGIN_HANDLED
839 }
840 message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), {0,0,0}, id)
841 write_short(12288); // 8192 = 2 seconds
842 write_short(512);
843 write_short(0x0000);
844 write_byte(0);
845 write_byte(0);
846 write_byte(0);
847 write_byte(255);
848 message_end();
849
850 static team_select[] = "#Team_Select"
851 static menu_text_code[sizeof team_select]
852 get_msg_arg_string(4, menu_text_code, sizeof menu_text_code - 1)
853 if (!equal(menu_text_code, team_select))
854 return PLUGIN_CONTINUE
855
856 set_force_team_join_task(id, msgid)
857 block_change[id] = true
858 return PLUGIN_HANDLED
859}
860
861public message_vgui_menu(msgid, dest, id) {
862 if(block_change[id]) {
863 return PLUGIN_HANDLED
864 }
865 message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), {0,0,0}, id)
866 write_short(12288); // 8192 = 2 seconds
867 write_short(512);
868 write_short(0x0000);
869 write_byte(0);
870 write_byte(0);
871 write_byte(0);
872 write_byte(255);
873 message_end();
874
875 if (get_msg_arg_int(1) != TEAM_SELECT_VGUI_MENU_ID )
876 return PLUGIN_CONTINUE
877
878 set_force_team_join_task(id, msgid)
879 block_change[id] = true
880 return PLUGIN_HANDLED
881}
882
883set_force_team_join_task(id, menu_msgid) {
884 static param_menu_msgid[2]
885 param_menu_msgid[0] = menu_msgid
886 set_task(0.1, "task_force_team_join", id, param_menu_msgid, sizeof param_menu_msgid)
887}
888
889public task_force_team_join(menu_msgid[], id) {
890 if (get_user_team(id))
891 return
892 force_team_join(id, menu_msgid[0])
893}
894
895stock force_team_join(id, menu_msgid) {
896 static jointeam[] = "jointeam"
897 static msg_block, joinclass[] = "joinclass"
898 msg_block = get_msg_block(menu_msgid)
899 set_msg_block(menu_msgid, BLOCK_SET)
900 engclient_cmd(id, jointeam, "2")
901 engclient_cmd(id, joinclass, "5")
902 set_msg_block(menu_msgid, msg_block)
903}
904
905//============================================================================= WR ============================================================//
906
907
908stock WRTimer(const Float:flRealTime, szOutPut[], const iSizeOutPut, bMiliSeconds = true, gametime = true)
909{
910 static Float:flTime, iMinutes, iSeconds;
911 if(gametime)
912 {
913 flTime = get_gametime() - flRealTime;
914 }
915 else
916 {
917 flTime = flRealTime;
918 }
919 if(flTime < 0.0)
920 {
921 flTime = 0.0;
922 }
923 iMinutes = floatround(flTime / 60, floatround_floor);
924 iSeconds = floatround(flTime - (iMinutes * 60), floatround_floor);
925 formatex(szOutPut, iSizeOutPut, "%02d:%02d", iMinutes, iSeconds);
926
927 if(bMiliSeconds)
928 {
929 static iMiliSeconds;
930 iMiliSeconds = floatround((flTime - (iMinutes * 60 + iSeconds)) * 100, floatround_round);
931 format(szOutPut, iSizeOutPut, "%s.%02d", szOutPut, iMiliSeconds);
932 }
933}
934
935
936
937stock LoadWorldRecord(map[], szWorldRecord[], iWRsize)
938{
939 new g_iMapNameLen = strlen(map);
940 new iRecords;
941
942 new szFile[128];
943 for(new i; i < 2; i++)
944 {
945 format(szFile, sizeof(szFile) - 1, "%s/%s", g_szDir, g_szDemoFiles[i][DEMOS]);
946 if(file_exists(szFile))
947 {
948 new hFile = fopen(szFile, "r");
949 new szData[128];
950 new szMapName[64], szTime[14], szAuthor[32], szCountry[2], szExt[25], szCode[6];
951 while(!feof(hFile))
952 {
953 fgets(hFile, szData, sizeof(szData) - 1);
954 trim(szData);
955
956 if(!szData[0] || szData[0] == '^n' || !equali(szData, map, g_iMapNameLen))
957 {
958 continue;
959 }
960
961
962 parse(szData, szMapName, sizeof(szMapName) - 1, szTime, sizeof(szTime) - 1, szAuthor, sizeof(szAuthor) - 1, szCountry, sizeof(szCountry) - 1, szCode, sizeof(szCode) - 1);
963
964 if(szMapName[g_iMapNameLen] != '[' && g_iMapNameLen != strlen(szMapName))
965 {
966 continue;
967 }
968
969 if(szMapName[g_iMapNameLen] == '[')
970 {
971 formatex(szExt, sizeof(szExt) - 1, "%s ", szMapName[g_iMapNameLen]);
972 if(iRecords < 5)
973 copy(g_szWorldExt[iRecords], sizeof(g_szWorldExt[]) - 1, szExt);
974 }
975
976 if(szWorldRecord[0])
977 {
978 add(szWorldRecord, iWRsize, "^n");
979 }
980 if(szTime[0] == '*' || (equal(szAuthor, "n/a") && str_to_float(szTime) == 0.0))
981 {
982 add(szWorldRecord, iWRsize, szExt);
983 add(szWorldRecord, iWRsize, "No Record");
984 norecord = 1;
985
986 }
987 else
988 {
989 if(containi(szTime, ":") < 0)
990 {
991 WRTimer(str_to_float(szTime), szTime, sizeof(szTime) - 1, true, false);
992
993 }
994 if(equali(map, g_szMapName) && iRecords < 5)
995 {
996 g_flWorldRecordTime[iRecords] = FloatTimer(szTime);
997 DiffWRTime[iRecords] = FloatTimer(szTime);
998 if (DiffWRTime[iRecords] < DiffWRTime[0] && iRecords > 0 ) {
999 DiffWRTime[0] = DiffWRTime[iRecords];
1000 }
1001 copy(g_szWorldRecordPlayer[iRecords], sizeof(g_szWorldRecordPlayer[]) - 1, szAuthor);
1002 }
1003 format(szWorldRecord, iWRsize, "%sWR: %s%s by %s", szWorldRecord, szExt, szTime , szAuthor);
1004 }
1005 iRecords++;
1006 }
1007 if(equali(map, g_szMapName) && !g_iWorldRecordsNum && iRecords && (norecord != 1))
1008 {
1009 g_iWorldRecordsNum = iRecords;
1010 if(g_iWorldRecordsNum > 5)
1011 g_iWorldRecordsNum = 5;
1012 }
1013 }
1014 }
1015
1016 if(!iRecords)
1017 {
1018 copy(szWorldRecord, iWRsize, "No Record");
1019 }
1020 return PLUGIN_HANDLED;
1021}
1022
1023stock Float:FloatTimer(const szInPut[])
1024{
1025 new Float:flTime = 0.0;
1026
1027 if(szInPut[2] == ':' && szInPut[5] == '.')
1028 {
1029 flTime+= ((szInPut[0] - 48) * 600.0) + ((szInPut[1] - 48) * 60.0);
1030 flTime+= ((szInPut[3] - 48) * 10.0) + (szInPut[4] - 48);
1031 flTime+= ((szInPut[6] - 48) / 10.0) + ((szInPut[7] - 48) / 100.0);
1032 }
1033 else
1034 {
1035 flTime = str_to_float(szInPut);
1036 }
1037 return flTime;
1038}
1039
1040
1041#if defined DOWNLOAD_NEW_WR
1042
1043stock CheckRecords(wr = true)
1044{
1045 get_localinfo("amxx_datadir", g_szDir, 127);
1046 format(g_szDir, sizeof(g_szDir) - 1,"%s/%s", g_szDir, g_szDirFile);
1047
1048 if(!dir_exists(g_szDir))
1049 mkdir(g_szDir);
1050
1051 new szHost[96], szUrl[96], szSocket[256], iSocketError, iSocket, iPos;
1052 new szFile[128], szFile2[128];
1053 new szWebDate[64];
1054 new szFileDate[64];
1055
1056 new imax = sizeof(g_szDemoFiles);
1057 for(new i = 0; i < imax; i++)
1058 {
1059 if((wr && !g_szDemoFiles[i][URLS][0]) )
1060 {
1061 continue;
1062 }
1063 new start = 7;
1064 if(wr)
1065 {
1066 if(g_szDemoFiles[i][URLS][4] == 's')
1067 {
1068 start = 8;
1069 }
1070 copy(szHost, 95, g_szDemoFiles[i][URLS][start]);
1071 }
1072
1073 iPos = contain(szHost, "/");
1074
1075 if(iPos != -1)
1076 {
1077 copy(szUrl, 95, szHost[iPos + 1]);
1078 szHost[iPos] = 0;
1079 }
1080
1081 g_szDemosBuffer[0] = 0;
1082 iSocket = socket_open(szHost, 80, SOCKET_TCP, iSocketError);
1083
1084 if(iSocketError > 0)
1085 {
1086 continue;
1087 }
1088
1089 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);
1090 socket_send(iSocket, szSocket, charsmax(szSocket));
1091
1092 socket_recv(iSocket, g_szDemosBuffer, charsmax(g_szDemosBuffer));
1093 socket_close(iSocket);
1094
1095 if(!g_szDemosBuffer[0])
1096 {
1097 continue;
1098 }
1099
1100 new iPos = contain(g_szDemosBuffer, "Last-Modified");
1101 if(iPos == -1)
1102 {
1103 continue;
1104 }
1105
1106 if(wr)
1107 {
1108 format(szFile, sizeof(szFile) - 1, "%s/%s", g_szDir, g_szDemoFiles[i][DEMOS]);
1109 format(szFile2, sizeof(szFile2) - 1, "%s/%s", g_szDir, g_szDemoFiles[i][UPDATEDEMOS]);
1110 }
1111
1112 copyc(szWebDate, charsmax(szWebDate), g_szDemosBuffer[iPos], '^n');
1113
1114 if(file_exists(szFile2))
1115 {
1116 new hFile = fopen(szFile2, "r");
1117
1118 fgets(hFile, szFileDate, charsmax(szFileDate));
1119 fclose(hFile);
1120 }
1121
1122 if(!equal(szFileDate, szWebDate))
1123 {
1124 new hFile = fopen(szFile2, "wt");
1125 fputs(hFile, szWebDate);
1126 fclose(hFile);
1127
1128 g_szDemosBuffer[0] = 0;
1129 iSocket = socket_open(szHost, 80, SOCKET_TCP, iSocketError);
1130
1131 if(iSocketError > 0)
1132 {
1133 continue;
1134 }
1135 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);
1136 socket_send(iSocket, szSocket, charsmax(szSocket));
1137
1138 hFile = fopen(szFile, "wt");
1139 while(socket_recv(iSocket, g_szDemosBuffer, charsmax(g_szDemosBuffer)))
1140 {
1141 if(g_szDemosBuffer[0])
1142 {
1143 if(g_szDemosBuffer[0] == 'H' && g_szDemosBuffer[ 1 ] == 'T') // Header
1144 {
1145 new iPos;
1146 iPos = contain(g_szDemosBuffer, "^r^n^r^n") + 4;
1147 iPos += contain(g_szDemosBuffer[iPos], "^n") + 1;
1148
1149 formatex(g_szDemosBuffer, charsmax(g_szDemosBuffer), g_szDemosBuffer[iPos]);
1150 }
1151 fputs(hFile, g_szDemosBuffer);
1152 }
1153 }
1154 fclose(hFile);
1155 socket_close(iSocket);
1156 }
1157 }
1158 if(wr)
1159 {
1160 LoadWorldRecord(g_szMapName, g_szWorldRecords, sizeof(g_szWorldRecords) - 1);
1161 CheckRecords(false);
1162 }
1163}
1164
1165#else
1166
1167stock CheckRecords(wr = true)
1168{
1169 get_localinfo("amxx_datadir", g_szDir, 127);
1170 format(g_szDir, sizeof(g_szDir) - 1,"%s/%s", g_szDir, g_szDirFile);
1171
1172 if(wr)
1173 {
1174 LoadWorldRecord(g_szMapName, g_szWorldRecords, sizeof(g_szWorldRecords) - 1);
1175 CheckRecords(false);
1176 }
1177}
1178#endif
1179
1180//========================================================================= End WR =====================================================================//
1181
1182//========================================================Description============================================================//
1183public Fwd_GameDesc()
1184{
1185 new szGameName[33];
1186 get_pcvar_string( kz_gamename, szGameName, 32 );
1187
1188 if( !strlen( szGameName ) ) // Ignore the gamename cvar if it's an empty string
1189 {
1190 return 1;
1191 }
1192
1193 forward_return( FMV_STRING, szGameName );
1194 return 4;
1195}
1196
1197//=====================================================End of Desc ===================================================================//
1198
1199public HandleSay(id) {
1200 if ( ! is_user_connected(id) ) {
1201 return PLUGIN_HANDLED;
1202 }
1203 new message[192];
1204 read_argv(0, message, 5);
1205 new is_team_msg = message[3] == '_';
1206 new CsTeams:userTeam = cs_get_user_team(id);
1207
1208 read_args(message, 191);
1209 remove_quotes(message);
1210 trim(message);
1211 if(strlen(message) > 190 || strlen(message) == 0) {
1212 return PLUGIN_HANDLED;
1213 }
1214
1215 new szMessage[192];
1216 read_args(szMessage, sizeof szMessage - 1);
1217 remove_quotes(szMessage);
1218 trim(szMessage);
1219
1220 if(equali(szMessage, "/wr", 3))
1221 {
1222 #if defined USE_SQL
1223 GetTop(id + TASK_GETTOP)
1224 #endif
1225
1226 new szMap[60];
1227 parse(szMessage, szMessage, 3, szMap, sizeof(szMap) - 1);
1228
1229 new szWrRecordMap[256];
1230 if(!szMap[0])
1231 {
1232 copy(szWrRecordMap, sizeof(szWrRecordMap) - 1, g_szWorldRecords);
1233 copy(szMap, sizeof(szMap) - 1, g_szMapName);
1234 set_hudmessage(0, 100, 255, 0.02, 0.17, 0, 0.0, 12.0, 1.0, 1.0, -1);
1235 show_hudmessage(id, "Records on %s:^n^n%s%s%s%s^n%s", szMap, proinfo, noobinfo, myproinfo[id],mynoobinfo[id], szWrRecordMap);
1236
1237 }
1238 else
1239 {
1240 LoadWorldRecord(szMap, szWrRecordMap, sizeof(szWrRecordMap) - 1);
1241 set_hudmessage(0, 100, 255, 0.02, 0.17, 0, 0.0, 12.0, 1.0, 1.0, -1);
1242 show_hudmessage(id, "Records on %s:^n%s", szMap, szWrRecordMap);
1243 }
1244
1245 return PLUGIN_HANDLED;
1246 }
1247 if(get_pcvar_num(kz_admin_check) == 1) {
1248 register_cvar("amx_contactinfo", CONTACT, FCVAR_SERVER)
1249
1250 if( equal(message, "admin", 5) || equal(message, "/admin", 6)){
1251 set_task(0.1,"print_adminlist",id)
1252 return PLUGIN_HANDLED
1253 }
1254 }
1255 for ( new i = 0 ; i <= g_maxplayers ; i++ ) {
1256
1257 if ( ! is_user_connected(i) )
1258 continue;
1259 message_begin(MSG_ONE_UNRELIABLE, g_msgid_SayText, {0,0,0}, i);
1260 write_byte(id);
1261 write_string(textchannels[get_user_text_channel(id, userTeam, is_team_msg)]);
1262 write_string("");
1263 write_string(message);
1264 message_end();
1265
1266 }
1267 return PLUGIN_HANDLED;
1268}
1269
1270#if defined USE_SQL
1271public GetTop(id) {
1272 id -= TASK_GETTOP
1273 if(TopUpdated){
1274 if(!sqlconnected) {
1275 plugin_sql()
1276 sqlconnected = true
1277 }
1278 new ProTopName[32], NoobTopName[32], ProTopTime[32], NoobTopTime[32]
1279
1280 new Handle:query = SQL_PrepareQuery(SqlConnection,"SELECT name, time FROM kz_pro15 WHERE mapname='%s' ORDER BY time LIMIT 1", MapName)
1281 SQL_Execute(query)
1282 if (!SQL_Execute(query) || !SQL_NumResults(query))
1283 {
1284 SQL_FreeHandle(query);
1285 format(proinfo, 63, "ProTop #1: No Record^n")
1286 } else {
1287 SQL_ReadResult(query, 0, ProTopName, 31)
1288 SQL_ReadResult(query, 1, ProTopTime, 31)
1289 new proimin,proisec,proims
1290 new Float:ProTime = str_to_float(ProTopTime)
1291 proimin = floatround(ProTime / 60.0, floatround_floor)
1292 proisec = floatround(ProTime - proimin * 60.0,floatround_floor)
1293 proims = floatround( ( ProTime - ( proimin * 60.0 + proisec ) ) * 100.0, floatround_round )
1294 format(proinfo, 63, "ProTop #1: %02i:%02i.%02i by %s^n", proimin, proisec, proims, ProTopName)
1295 SQL_FreeHandle(query);
1296 }
1297 new Handle:query1 = SQL_PrepareQuery(SqlConnection,"SELECT name, time FROM kz_nub15 WHERE mapname='%s' ORDER BY time LIMIT 1", MapName)
1298 SQL_Execute(query1)
1299 if (!SQL_Execute(query1) || !SQL_NumResults(query1))
1300 {
1301 SQL_FreeHandle(query1);
1302 format(noobinfo, 63, "NubTop #1: No Record^n")
1303 } else {
1304 SQL_ReadResult(query1, 0, NoobTopName, 31)
1305 SQL_ReadResult(query1, 1, NoobTopTime, 31)
1306 new noobimin,noobisec,noobims
1307 new Float:NoobTime = str_to_float(NoobTopTime)
1308 noobimin = floatround(NoobTime / 60.0, floatround_floor)
1309 noobisec = floatround(NoobTime - noobimin * 60.0,floatround_floor)
1310 noobims = floatround( ( NoobTime - ( noobimin * 60.0 + noobisec ) ) * 100.0, floatround_round )
1311
1312 format(noobinfo, 63, "NubTop #1: %02i:%02i.%02i by %s^n", noobimin, noobisec, noobims, NoobTopName)
1313 SQL_FreeHandle(query1);
1314 }
1315 TopUpdated = false
1316 }
1317
1318 if(MyPosUpdated[id]){
1319 if(!sqlconnected) {
1320 plugin_sql()
1321 sqlconnected = true
1322 }
1323 new steam[32]
1324 get_user_authid(id, steam, 31 )
1325 new MyProTime[32], MyProPos[32], MyNoobTime[32], MyNoobPos[32]
1326
1327 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)
1328 SQL_Execute(query3)
1329 if (!SQL_Execute(query3) || !SQL_NumResults(query3))
1330 {
1331 SQL_FreeHandle(query3);
1332 format(myproinfo[id], 63, "Your Pro Rec : No Record^n")
1333 } else {
1334 SQL_ReadResult(query3, 0, MyProPos, 31)
1335 SQL_ReadResult(query3, 1, MyProTime, 31)
1336 new myproimin,myproisec,myproims
1337 new Float:MyProT = str_to_float(MyProTime)
1338 myproimin = floatround(MyProT / 60.0, floatround_floor)
1339 myproisec = floatround(MyProT - myproimin * 60.0,floatround_floor)
1340 myproims = floatround( ( MyProT - ( myproimin * 60.0 + myproisec ) ) * 100.0, floatround_round )
1341 if(equal(MyProPos, "1", 3)){
1342 myproinfo[id] = "";
1343 } else {
1344 format(myproinfo[id], 63, "Your Pro Rec : #%s - %02i:%02i.%02i^n", MyProPos, myproimin, myproisec, myproims)
1345 }
1346
1347 SQL_FreeHandle(query3);
1348 }
1349 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)
1350 SQL_Execute(query4)
1351 if (!SQL_Execute(query4) || !SQL_NumResults(query4))
1352 {
1353 SQL_FreeHandle(query4);
1354 format(mynoobinfo[id], 63, "Your Nub Rec: No Record^n")
1355 } else {
1356 SQL_ReadResult(query4, 0, MyNoobPos, 31)
1357 SQL_ReadResult(query4, 1, MyNoobTime, 31)
1358 new mynoobimin,mynoobisec,mynoobims
1359 new Float:MyNoobT = str_to_float(MyNoobTime)
1360 mynoobimin = floatround(MyNoobT / 60.0, floatround_floor)
1361 mynoobisec = floatround(MyNoobT - mynoobimin * 60.0,floatround_floor)
1362 mynoobims = floatround( ( MyNoobT - ( mynoobimin * 60.0 + mynoobisec ) ) * 100.0, floatround_round )
1363 if(equal(MyNoobPos, "1", 3)){
1364 mynoobinfo[id] = "";
1365 } else {
1366 format(mynoobinfo[id], 63, "Your Nub Rec: #%s - %02i:%02i.%02i^n", MyNoobPos, mynoobimin, mynoobisec, mynoobims)
1367 }
1368 SQL_FreeHandle(query4);
1369 }
1370 MyPosUpdated[id] = false
1371 }
1372
1373 if(FinishMsg) {
1374 set_hudmessage(0, 100, 255, 0.02, 0.17, 0, 0.0, 12.0, 1.0, 1.0, -1);
1375 for(new i = 1; i < max_players; i++ )
1376 {
1377 if( (i == id || is_user_spectating_player(i,id)))
1378 {
1379 show_hudmessage(i, "Records on %s:^n^n%s%s%s%s^n%s", MapName, proinfo, noobinfo,myproinfo[id],mynoobinfo[id], g_szWorldRecords);
1380 }
1381 }
1382 FinishMsg = false
1383 }
1384 return PLUGIN_HANDLED;
1385}
1386#endif
1387
1388stock get_user_text_channel(id, CsTeams:userTeam, is_team_msg) {
1389 if ( is_team_msg ) {
1390 switch ( userTeam ) {
1391 case CS_TEAM_T : {
1392 if ( is_user_alive(id) )
1393 return 0;
1394 else
1395 return 6;
1396 }
1397 case CS_TEAM_CT : {
1398 if ( is_user_alive(id) )
1399 return 1;
1400 else
1401 return 7;
1402 }
1403 case CS_TEAM_SPECTATOR, CS_TEAM_UNASSIGNED :
1404 return 2;
1405 }
1406 }
1407 else {
1408 if ( is_user_alive(id) )
1409 return 3;
1410 else if ( userTeam == CsTeams:3 )
1411 return 4;
1412 }
1413 return 5;
1414}
1415
1416public print_adminlist(user)
1417{
1418 new adminnames[33][32]
1419 new message[256]
1420 new contactinfo[256], contact[112]
1421 new id, count, x, len
1422
1423 for(id = 1 ; id <= g_maxplayers ; id++)
1424 if(is_user_connected(id))
1425 if(get_user_flags(id) & ADMIN_CHECK)
1426 get_user_name(id, adminnames[count++], 31)
1427
1428 len = format(message, 255, "^x04[KZ.M] %sAdmins Online: ",COLOR)
1429 if(count > 0) {
1430 for(x = 0 ; x < count ; x++) {
1431 len += format(message[len], 255-len, "^x03%s%s ", adminnames[x], x < (count-1) ? ", ":"")
1432 if(len > 96 ) {
1433 print_message(user, message)
1434 len = format(message, 255, "%s ",COLOR)
1435 }
1436 }
1437 print_message(user, message)
1438 }
1439 else {
1440 len += format(message[len], 255-len, "^x01No Admins Online.")
1441 print_message(user, message)
1442 }
1443
1444 get_cvar_string("amx_contactinfo", contact, 63)
1445 if(contact[0]) {
1446 format(contactinfo, 111, "^x04[KZ.M] %sContact: ^x03%s", COLOR, contact)
1447 print_message(user, contactinfo)
1448 }
1449}
1450
1451print_message(id, msg[]) {
1452 message_begin(MSG_ONE, g_msgid_SayText, {0,0,0}, id)
1453 write_byte(id)
1454 write_string(msg)
1455 message_end()
1456}
1457
1458
1459
1460public Forward_ClientKill(id)
1461{
1462 return FMRES_SUPERCEDE;
1463}
1464
1465
1466public Msg_StatusIcon( msgid, msgdest, id ) {
1467 static szMsg[ 8 ];
1468 get_msg_arg_string( 2, szMsg, 7 );
1469
1470 if( equal( szMsg, "buyzone" ) && get_msg_arg_int( 1 ) ) {
1471 set_pdata_int( id, 235, get_pdata_int( id, 235 ) & ~( 1 << 0 ) );
1472 return PLUGIN_HANDLED;
1473 }
1474 return PLUGIN_CONTINUE;
1475}
1476
1477#if defined USE_SQL
1478public plugin_sql()
1479{
1480 new host[64], user[64], pass[64], db[64]
1481
1482 get_pcvar_string(kz_sql_host, host, 63)
1483 get_pcvar_string(kz_sql_user, user, 63)
1484 get_pcvar_string(kz_sql_pass, pass, 63)
1485 get_pcvar_string(kz_sql_db, db, 63)
1486
1487 g_SqlTuple = SQL_MakeDbTuple(host, user, pass, db)
1488
1489 new ErrorCode
1490 SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
1491
1492
1493 if(SqlConnection == Empty_Handle)
1494 {
1495 server_print("[DRM] TOP15 SQL Error: %s (%d)", g_Error, ErrorCode)
1496 log_amx("SQL Error: %s (%d)", g_Error, ErrorCode)
1497 return pause("a")
1498 }
1499
1500 if(!SqlConnection)
1501 {
1502 server_print("[KZ.M] TOP15 SQL: Could not connect to SQL database.!")
1503 log_amx("[KZ.M] TOP15 SQL: Could not connect to SQL database.")
1504 return pause("a")
1505 }
1506#if defined CREATE_TABLES_1ST_TIME
1507 new createinto[1001]
1508 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)")
1509 SQL_ThreadQuery(g_SqlTuple,"QueryHandle", createinto)
1510 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)")
1511 SQL_ThreadQuery(g_SqlTuple,"QueryHandle", createinto)
1512#endif
1513 return PLUGIN_CONTINUE
1514}
1515
1516public QueryHandle(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
1517{
1518 if( iFailState != TQUERY_SUCCESS )
1519 {
1520 log_amx("[KZ.M] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
1521// ColorChat(0, GREEN, "[KZ.M]^x01: Warning the SQL Tops can not be saved.")
1522 }
1523 return PLUGIN_CONTINUE
1524}
1525#endif
1526
1527
1528public client_command(id)
1529{
1530
1531 new sArg[13];
1532 if( read_argv(0, sArg, 12) > 11 )
1533 {
1534 return PLUGIN_CONTINUE;
1535 }
1536
1537 for( new i = 0; i < sizeof(g_weaponsnames); i++ )
1538 {
1539 if( equali(g_weaponsnames[i], sArg, 0) )
1540 {
1541 return PLUGIN_HANDLED;
1542 }
1543 }
1544 return PLUGIN_CONTINUE;
1545}
1546
1547// =================================================================================================
1548// Global Functions
1549// =================================================================================================
1550
1551public PlayerInfo(id)
1552{
1553 id -= TASK_INFO
1554 client_print(id, print_chat, "[KZ.M] For see all Commands type '/help' in Chat" );
1555}
1556
1557public InfoKreedz(id)
1558{
1559 id -= TASK_INFO_KREEDZ
1560// ColorChat(id, BLUE, "^x04%s^x01 Welcome to^x03 Climb/Bhop Server^x01. Say^x03 /menu^x01 to open main menu", prefix)
1561 ColorChat(id, BLUE, "^x04%s^x01 Welcome to^x03 Climb/Bhop Server^x01. Say^x03 /menu^x01 to open main menu", prefix)
1562 FinishMsg = true
1563 GetTop(id + TASK_GETTOP)
1564}
1565
1566public hudTextArgs(msgid, msgDest, msgEnt)
1567{
1568 static hint[HintMaxLen + 1]
1569 get_msg_arg_string(1,hint,charsmax(hint))
1570
1571 if(TrieKeyExists(HintsStatus,hint[6]))
1572 {
1573 set_pdata_float(msgEnt,NextHudTextArgsOffset,0.0)
1574 return PLUGIN_HANDLED
1575 }
1576 return PLUGIN_CONTINUE
1577}
1578
1579public cmd_help(id)
1580{
1581 if(get_pcvar_num(kz_help))
1582 {
1583 static MOTD[2048], MLTITEL[24], Pos
1584
1585 formatex(MLTITEL,23,"[KZ.M] Commands", id)
1586
1587 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^">")
1588 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Shows Player Menu:", id)
1589 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /menu")
1590 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Shows Maps Menu:", id)
1591 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /maps")
1592 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Gives Player A Scout:", id)
1593 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /scout")
1594 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Gives Player A Usp:", id)
1595 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /usp")
1596 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Shows The Tops:", id)
1597 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /top15")
1598 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /nub15")
1599 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /pro15")
1600 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Create A Checkpoint:", id)
1601 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /cp")
1602 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Go To Last Checkpoint:", id)
1603 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /tp")
1604 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Go To Last Checkpoint with fixed angle:", id)
1605 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /tpf")
1606 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* If Player Stuck In Wall:", id)
1607 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /stuck")
1608 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Teleport Player To The Start:", id)
1609 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /start")
1610 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /respawn")
1611 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Reset Time And Checkpoints:", id)
1612 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /reset")
1613 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Player Join Spec And Time Stopped:", id)
1614 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /spec")
1615 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Show World Record:", id)
1616 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /wr")
1617 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Save your own start position:", id)
1618 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /ss")
1619 if(get_pcvar_num(kz_duel) == 1) {
1620 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Duel menu:", id)
1621 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /duel")
1622 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Show Duels:", id)
1623 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /duels")
1624 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h1>* Show Duels Rank:", id)
1625 Pos += formatex(MOTD[Pos],sizeof MOTD - 1 - Pos,"<tr><td class=h2>say /dueltop")
1626 }
1627 show_motd(id,MOTD,MLTITEL)
1628 }
1629 return PLUGIN_CONTINUE
1630}
1631
1632
1633public fwdPlayerPreThink(id)
1634{
1635 new entc[33];
1636 pev(pev(id, pev_groundentity), pev_classname, entc, 32);
1637 if(!is_user_alive(id) || is_user_bot(id)){
1638 return FMRES_IGNORED
1639 }
1640 if(!(pev(id, pev_flags)&FL_ONGROUND2) && !isFalling[id] && timer_started[id] && !IsPaused[id] && !IsOnLadder(id))
1641 {
1642 pev(id, pev_origin, vFallingStart[id])
1643 vFallingTime[id] = get_gametime() - timer_time[id]
1644 isFalling[id] = true
1645 }
1646 if((pev(id, pev_flags)&FL_ONGROUND2 || IsOnLadder(id)) && isFalling[id] && timer_started[id] && !IsPaused[id] && !equal(entc, "func_door"))
1647 {
1648 isFalling[id] = false
1649 }
1650 return FMRES_IGNORED
1651}
1652
1653
1654public Pause(id)
1655{
1656 if(! is_user_alive(id) )
1657 {
1658 kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
1659 return PLUGIN_HANDLED
1660 }
1661 if(!timer_started[id])
1662 {
1663 client_print(id, print_center, "Timer is not Started")
1664 return PLUGIN_HANDLED
1665 }
1666 static Float:hpp[33]
1667 new entclassname[33];
1668 pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
1669
1670 if(!IsPaused[id])
1671 {
1672 if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !tptostart[id] && !get_user_noclip(id))
1673 {
1674 client_print(id, print_center, "Cannot pause now")
1675 return PLUGIN_HANDLED
1676 }
1677 tphook_user[id] = true;
1678
1679 g_pausetime[id] = get_gametime() - timer_time[id]
1680 timer_time[id] = 0.0
1681
1682 static Float:velocityy[33][3], Float:v_angle[33][3];
1683 pev(id, pev_health, hpp[id])
1684 pev(id, pev_velocity, velocityy[id])
1685 pev(id, pev_velocity, pausedvelocity[id])
1686 pev(id, pev_origin, PauseOrigin[id])
1687 pev(id, pev_v_angle, v_angle[id])
1688
1689 if(isFalling[id] && tptostart[id]) {
1690 MpbhopOrigin[id] = vFallingStart[id]
1691 isMpbhop[id] = true
1692 }
1693 if (!menushow[id] && is_user_alive(id)) {
1694 hidetime(id)
1695 pausetime(id)
1696 }
1697 IsPaused[id] = true
1698 }
1699 else
1700 {
1701 if( (!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id)))
1702 {
1703 kz_hud_message(id, "Cannot unpause now")
1704 return PLUGIN_HANDLED
1705 }
1706 if(ishooked[id]) {
1707 remove_hook(id)
1708 }
1709 if(get_user_noclip(id)) {
1710 set_user_noclip(id,0)
1711 }
1712 if(timer_started[id])
1713 {
1714 client_print(id, print_center, "Timer is Unpaused")
1715 timer_time[id] = get_gametime() - g_pausetime[id]
1716 if(!menushow[id]) {
1717 set_task(0.3, "showtimeduel", id)
1718 }
1719
1720 }
1721 IsPaused[id] = false
1722 set_pev(id, pev_angles, v_angle[id])
1723 if(isMpbhop[id] && !GoPosed[id]) {
1724 if(callfunc_begin("setprokreedzorigin","mpbhop.amxx") == 1)
1725 {
1726 callfunc_push_int(id)
1727 callfunc_push_float(MpbhopOrigin[id][0])
1728 callfunc_push_float(MpbhopOrigin[id][1])
1729 callfunc_push_float(MpbhopOrigin[id][2])
1730 callfunc_end()
1731 }
1732 isMpbhop[id] = false
1733 set_pev(id, pev_fixangle, 1);
1734 }
1735 tptostart[id] = false
1736 set_pev(id, pev_origin, PauseOrigin[id])
1737 set_pev(id, pev_velocity, velocityy[id])
1738 set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
1739
1740 if(!GoPosHp[id] && !HealsOnMap) {
1741 set_pev(id, pev_health, hpp[id])
1742 }
1743 tphook_user[id] = false
1744 inpausechecknumbers[id] = 0
1745 }
1746 return PLUGIN_HANDLED
1747}
1748
1749
1750
1751public fw_ThinkEntity(iEnt)
1752{
1753 if(pev_valid(iEnt))
1754 {
1755 static ClassName[32]
1756 pev(iEnt, pev_classname, ClassName, 31)
1757
1758 if(equal(ClassName, "kz_time_think"))
1759 {
1760 fw_TimeThink()
1761 set_pev(iEnt, pev_nextthink, get_gametime() + 0.08)
1762 }
1763 }
1764}
1765
1766
1767
1768
1769public fw_TimeThink()
1770{
1771 new Alive[32], Dead[32], alivePlayers, deadPlayers;
1772 get_players(Alive, alivePlayers, "ach")
1773 get_players(Dead, deadPlayers, "bch")
1774 for(new i=0;i<alivePlayers;i++)
1775 {
1776 if(timer_started[Alive[i]])
1777 {
1778 new Float:kreedztime, imin, Float:isec
1779 kreedztime = get_gametime() - (IsPaused[Alive[i]] ? get_gametime() - g_pausetime[Alive[i]] : timer_time[Alive[i]])
1780
1781 imin = floatround(kreedztime , floatround_floor)/60
1782 isec = kreedztime - (60*imin) + 0.02
1783
1784 if(menushow[Alive[i]]) {
1785 if( IsPaused[Alive[i]]) {
1786 set_hudmessage(200, 3, 0, 0.465, 0.08, 0, 0.0, 0.2, 0.0, 0.0, 4)
1787 } else {
1788 set_hudmessage(200, 200, 200, 0.465, 0.08, 0, 0.0, 0.2, 0.0, 0.0, 4)
1789 }
1790 if( checknumbers[Alive[i]] > 0 )
1791 {
1792 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*" : "")
1793 }
1794 else
1795 {
1796 show_hudmessage(Alive[i], "%02d:%s%.2f %s",imin,isec < 10 ? "0" : "",isec, IsPaused[Alive[i]] ? "| *Paused*" : "")
1797 }
1798 }
1799 else
1800 {
1801 if(IsPaused[Alive[i]]) {
1802 set_hudmessage(150, 3, 0, 0.030, -0.504, 0, 0.0, 0.2, 0.0, 0.0, 4)
1803 }
1804 else {
1805 set_hudmessage(200, 200, 200, 0.030, -0.504, 0, 0.0, 0.2, 0.0, 0.0, 4)
1806 }
1807 if( checknumbers[Alive[i]] > 0 )
1808 {
1809 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*" : "")
1810 }
1811 else
1812 {
1813 show_hudmessage(Alive[i], "%02d:%s%.2f %s",imin,isec < 10 ? "0" : "",isec, IsPaused[Alive[i]] ? "| *Paused*" : "")
1814 }
1815 }
1816 if (IsPaused[Alive[i]])
1817 {
1818 client_print(Alive[i], print_center, "Timer is Paused, type /pause")
1819 }
1820
1821 }
1822
1823 }
1824 for(new i=0;i<deadPlayers;i++)
1825 {
1826 new Float:kreedztime, imin, Float:isec
1827 new specmode = pev(Dead[i], pev_iuser1)
1828 if(specmode == 2 || specmode == 4)
1829 {
1830 new target = pev(Dead[i], pev_iuser2)
1831 if(target != Dead[i])
1832 if(is_user_alive(target) && timer_started[target])
1833 {
1834 new name[32]
1835 get_user_name (target, name, 31)
1836
1837 kreedztime = get_gametime() - (IsPaused[target] ? get_gametime() - g_pausetime[target] : timer_time[target])
1838 imin = floatround(kreedztime , floatround_floor)/60
1839 isec = kreedztime - (60*imin) + 0.02
1840
1841 new Float:hp;
1842 pev( target, pev_health, hp );
1843
1844 if(checknumbers[target] > 0)
1845 {
1846 if(HealsOnMap) {
1847 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*" : "")
1848 }
1849 else {
1850 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*" : "")
1851 }
1852 }
1853 else if(!is_user_bot(target))
1854 {
1855 if(HealsOnMap) {
1856 client_print(Dead[i], print_center, "[ %02d:%s%.2f ] | HP: Godmode %s",imin,isec < 10 ? "0" : "",isec, IsPaused[target] ? "| *Paused*" : "")
1857 }
1858 else {
1859 client_print(Dead[i], print_center, "[ %02d:%s%.2f ] | HP: %.f %s",imin,isec < 10 ? "0" : "",isec, hp, IsPaused[target] ? "| *Paused*" : "")
1860 }
1861 }
1862 }
1863 }
1864 }
1865}
1866
1867public showtime1(id) // BLUE TIMER
1868{
1869 message_begin(MSG_ONE_UNRELIABLE,iconstatus,{0,0,0},id)
1870 write_byte(1)
1871 write_string("stopwatch")
1872 write_byte(0)
1873 write_byte(90)
1874 write_byte(255)
1875 message_end()
1876 return PLUGIN_HANDLED
1877}
1878public showtime2(id) // RED TIMER
1879{
1880 message_begin(MSG_ONE_UNRELIABLE,iconstatus,{0,0,0},id)
1881 write_byte(1)
1882 write_string("stopwatch")
1883 write_byte(145)
1884 write_byte(0)
1885 write_byte(0)
1886 message_end()
1887 return PLUGIN_HANDLED
1888}
1889public hidetime(id) // HIDE TIME
1890{
1891 message_begin(MSG_ONE_UNRELIABLE,iconstatus,{0,0,0},id)
1892 write_byte(0)
1893 write_string("stopwatch")
1894 write_byte(0)
1895 write_byte(90)
1896 write_byte(255)
1897 message_end()
1898 return PLUGIN_HANDLED
1899}
1900
1901public pausetime(id) // PAUSED TIMER
1902{
1903 message_begin(MSG_ONE_UNRELIABLE,iconstatus,{0,0,0},id)
1904 write_byte(2)
1905 write_string("stopwatch")
1906 write_byte(170)
1907 write_byte(170)
1908 write_byte(170)
1909 message_end()
1910 return PLUGIN_HANDLED
1911}
1912
1913public hidetimeduel(id)
1914{
1915 menushow[id] = true
1916 hidetime(id)
1917 return PLUGIN_CONTINUE
1918}
1919
1920public showtimeduel(id)
1921{
1922 if (is_user_alive(id) && IsPaused[id]) {
1923 hidetime(id)
1924 pausetime(id)
1925 }
1926 else if(timer_started[id] && gochecknumbers[id] == 0 && is_user_alive(id)){
1927 showtime1(id)
1928 }
1929 else if (timer_started[id] && gochecknumbers[id] > 0 && is_user_alive(id)) {
1930 showtime2(id)
1931 }
1932 menushow[id] = false
1933 return PLUGIN_CONTINUE
1934}
1935
1936// ============================ Block Commands ================================
1937
1938
1939public BlockRadio(id)
1940{
1941 if (get_pcvar_num(kz_use_radio) == 1)
1942 return PLUGIN_CONTINUE
1943 return PLUGIN_HANDLED
1944}
1945
1946public BlockDrop(id)
1947{
1948 if (get_pcvar_num(kz_drop_weapons) == 1)
1949 return PLUGIN_CONTINUE
1950 return PLUGIN_HANDLED
1951}
1952
1953public BlockBuy(id)
1954{
1955 return PLUGIN_HANDLED
1956}
1957
1958public CmdRespawn(id)
1959{
1960 if ( get_user_team(id) == 3 ){
1961 client_print(id, print_chat, "voce e spec");
1962 return PLUGIN_HANDLED
1963 }
1964 else
1965 ExecuteHamB(Ham_CS_RoundRespawn, id)
1966
1967 return PLUGIN_HANDLED
1968}
1969
1970public ChatHud(id)
1971{
1972 if(chatorhud[id] == -1)
1973 ++chatorhud[id];
1974
1975 ++chatorhud[id];
1976
1977 if(chatorhud[id] == 3)
1978 chatorhud[id] = 0;
1979
1980 return PLUGIN_HANDLED
1981}
1982
1983public ct(id)
1984{
1985 client_print(id, print_chat, "entrou funcao ct");
1986 if ( get_gametime() - antidiestart[id] < 0.5) {
1987 kz_hud_message(id, "Can't use this command now")
1988 return PLUGIN_HANDLED
1989 }
1990 new CsTeams:team = cs_get_user_team(id)
1991 if (team == CS_TEAM_CT)
1992 {
1993 client_print(id, print_chat, "voce e ct");
1994 new entclassname[33];
1995 pev(id, pev_health, hp_spec[id])
1996 pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
1997 if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
1998 {
1999 client_print(id, print_chat, "return func ct");
2000 return PLUGIN_HANDLED
2001 }
2002 pev(id, pev_origin, SpecLoc[id])
2003
2004 if ( timer_started[id] )
2005 {
2006 if ( !IsPaused[id] )
2007 {
2008 g_pausetime[id] = get_gametime() - timer_time[id]
2009 timer_time[id] = 0.0
2010 }
2011 kz_chat(id, "%L", id, "KZ_PAUSE_ON")
2012 hidetime(id)
2013 }
2014 spec_user[id] = true
2015 user_kill(id);
2016 strip_user_weapons(id)
2017 cs_set_user_team(id,CS_TEAM_SPECTATOR)
2018 set_pev(id, pev_solid, SOLID_NOT)
2019 set_pev(id, pev_movetype, MOVETYPE_FLY)
2020 set_pev(id, pev_effects, EF_NODRAW)
2021 set_pev(id, pev_deadflag, DEAD_DEAD)
2022 }
2023 else
2024 {
2025 cs_set_user_team(id,CS_TEAM_CT)
2026 set_pev(id, pev_effects, 0)
2027 set_pev(id, pev_movetype, MOVETYPE_WALK)
2028 set_pev(id, pev_deadflag, DEAD_NO)
2029 set_pev(id, pev_takedamage, DAMAGE_AIM)
2030 CmdRespawn(id)
2031 strip_user_weapons(id)
2032 if (user_has_scout[id]) {
2033 give_item(id,"weapon_scout")
2034 cs_set_user_bpammo(id, CSW_SCOUT, 20)
2035 }
2036 cmdUsp(id)
2037 spec_user[id] = false
2038 if(!HealsOnMap) {
2039 set_pev(id, pev_health, hp_spec[id])
2040 }
2041 set_pev(id, pev_origin, SpecLoc[id])
2042 set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
2043 if ( timer_started [id] ) {
2044 if(!IsPaused[id]){
2045 timer_time[id] = get_gametime() - g_pausetime[id] + timer_time[id]
2046 }
2047 else{
2048 timer_time[id] = g_pausetime[id]
2049 }
2050 if(!menushow[id]) {
2051 set_task(0.3, "showtimeduel", id)
2052 }
2053 }
2054 }
2055 return PLUGIN_HANDLED
2056}
2057
2058
2059//=================== Weapons ==============
2060public curweapon(id)
2061{
2062 static last_weapon[33];
2063 static weapon_active, weapon_num
2064 weapon_active = read_data(1)
2065 weapon_num = read_data(2)
2066
2067 if ( ( weapon_num != last_weapon[id] ) && weapon_active && get_pcvar_num(kz_maxspeedmsg) == 1)
2068 {
2069 last_weapon[id] = weapon_num;
2070
2071 static Float:maxspeed;
2072 pev(id, pev_maxspeed, maxspeed );
2073
2074 if( maxspeed < 0.0 )
2075 maxspeed = 250.0;
2076
2077 kz_hud_message(id,"%L",id, "KZ_WEAPONS_SPEED",floatround( maxspeed, floatround_floor ));
2078 }
2079
2080 if (get_pcvar_num(kz_weapon_silencer) == 1) {
2081 static wpn_name[16], wpn_id;
2082 if( weapon_num != 16 && weapon_num != 22 )
2083 {
2084 return PLUGIN_HANDLED;
2085 }
2086 get_weaponname( weapon_num, wpn_name, sizeof wpn_name - 1 );
2087 while( ( wpn_id = engfunc( EngFunc_FindEntityByString, wpn_id, "classname", wpn_name ) ) && pev( wpn_id, pev_owner ) != id ) { }
2088 if( !wpn_id )
2089 {
2090 return PLUGIN_HANDLED;
2091 }
2092 cs_set_weapon_silen( wpn_id, 1, 0 )
2093 }
2094
2095 return PLUGIN_HANDLED
2096}
2097
2098public weapons(id)
2099{
2100 if(!is_user_alive(id))
2101 {
2102 kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
2103 return PLUGIN_HANDLED
2104 }
2105 if(get_pcvar_num(kz_other_weapons) == 0)
2106 {
2107 kz_chat(id, "%L", id, "KZ_OTHER_WEAPONS_ZERO")
2108 return PLUGIN_HANDLED
2109 }
2110
2111 if (timer_started[id])
2112 {
2113 kz_chat(id, "%L", id, "KZ_WEAPONS_IN_RUN")
2114 return PLUGIN_HANDLED
2115 }
2116
2117 for(new i = 0; i < 8; i++)
2118 if( !user_has_weapon(id, other_weapons[i]) )
2119 {
2120 new item;
2121 item = give_item(id, other_weapons_name[i] );
2122 cs_set_weapon_ammo(item, 0);
2123 }
2124
2125 if( !user_has_weapon(id, CSW_USP) )
2126 cmdUsp(id)
2127
2128 return PLUGIN_HANDLED
2129}
2130
2131
2132// ========================= Scout =======================
2133public cmdScout(id)
2134{
2135 if(IsPaused[id])
2136 {
2137 kz_chat(id, "You can't use this command in pause")
2138 return PLUGIN_HANDLED
2139 }
2140 if (timer_started[id])
2141 user_has_scout[id] = true
2142 strip_user_weapons(id)
2143 if( !user_has_weapon(id, CSW_SCOUT)) {
2144 give_item(id,"weapon_scout")
2145 cs_set_user_bpammo(id, CSW_SCOUT, 20)
2146 }
2147 cmdUsp(id)
2148
2149 return PLUGIN_HANDLED
2150}
2151
2152public cmdUsp(id)
2153{
2154 give_item(id,"weapon_usp")
2155 give_item(id,"weapon_knife")
2156 cs_set_user_bpammo(id, CSW_USP, 36)
2157
2158 return PLUGIN_HANDLED
2159}
2160
2161// ========================== Start location =================
2162public goStart1(id) {
2163 StartSound[id] = true
2164 goStartPos(id)
2165 return PLUGIN_HANDLED
2166}
2167
2168public goStart(id) {
2169 StartSound[id] = false
2170 goStartPos(id)
2171 return PLUGIN_HANDLED
2172}
2173
2174public goStartPos(id)
2175{
2176 if ( get_gametime() - antidiestart[id] < 0.5) {
2177 kz_hud_message(id, "Can't use this command now")
2178 return PLUGIN_HANDLED
2179 }
2180 if( !is_user_alive( id ) )
2181 {
2182 if (!timer_started[id]) {
2183 cs_set_user_team(id,CS_TEAM_CT)
2184 set_pev(id, pev_effects, 0)
2185 set_pev(id, pev_movetype, MOVETYPE_WALK)
2186 set_pev(id, pev_deadflag, DEAD_NO)
2187 set_pev(id, pev_takedamage, DAMAGE_AIM)
2188 CmdRespawn(id)
2189 strip_user_weapons(id)
2190 cmdUsp(id)
2191 if(!HealsOnMap) {
2192 set_pev(id, pev_health, hp_spec[id])
2193 }
2194 client_cmd(id, "spk warcraft3/resurrecttarget");
2195 set_task(0.1, "show_beacon", id)
2196 set_task(0.3, "show_beacon2", id)
2197
2198 if(gCheckpointStart[id]) {
2199 set_pev( id, pev_angles, gCheckpointStartAngle[id]);
2200 set_pev( id, pev_fixangle, 1);
2201
2202 set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
2203 set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 } );
2204 set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
2205 set_pev( id, pev_fuser2, 0.0 );
2206 engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
2207 set_pev(id, pev_origin, CheckpointStarts[ id ][ !g_bCpAlternateStart[id] ] )
2208 }
2209
2210 else {
2211 if (AutoStart[id]) {
2212 set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
2213 set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
2214 set_pev(id, pev_origin, SavedStart [id] )
2215 }
2216 else
2217 {
2218 set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
2219 set_pev(id, pev_origin, DefaultStartPos)
2220 }
2221 }
2222 }
2223 else
2224 {
2225 ct(id)
2226 }
2227 return PLUGIN_HANDLED
2228 }
2229 if( AutoStart [id] )
2230 {
2231 tptostart[id] = true
2232 if(StartSound[id]) {
2233 client_cmd(id, "spk warcraft3/resurrecttarget");
2234 set_task(0.1, "show_beacon", id)
2235 set_task(0.3, "show_beacon2", id)
2236 }
2237 if(gCheckpointStart[id]) {
2238 if (timer_started[id] && !IsPaused[id]) {
2239 Pause(id)
2240 }
2241 set_pev( id, pev_angles, gCheckpointStartAngle[id]);
2242 set_pev( id, pev_fixangle, 1);
2243
2244 set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
2245 set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 } );
2246 set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
2247 set_pev( id, pev_fuser2, 0.0 );
2248 engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
2249 set_pev(id, pev_origin, CheckpointStarts[ id ][ !g_bCpAlternateStart[id] ] )
2250
2251 } else {
2252 if (timer_started[id] && !IsPaused[id]) {
2253 Pause(id)
2254 }
2255 set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
2256 set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
2257 set_pev(id, pev_origin, SavedStart [id] )
2258 }
2259 return PLUGIN_HANDLED
2260 }
2261 else if ( DefaultStart )
2262 {
2263 if(StartSound[id]) {
2264 client_cmd(id, "spk warcraft3/resurrecttarget");
2265 set_task(0.1, "show_beacon", id)
2266 set_task(0.3, "show_beacon2", id)
2267 }
2268 tptostart[id] = true
2269 if(gCheckpointStart[id]) {
2270 if (timer_started[id] && !IsPaused[id]) {
2271 Pause(id)
2272 }
2273 set_pev( id, pev_angles, gCheckpointStartAngle[id]);
2274 set_pev( id, pev_fixangle, 1);
2275
2276 set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
2277 set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 } );
2278 set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
2279 set_pev( id, pev_fuser2, 0.0 );
2280 engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
2281 set_pev(id, pev_origin, CheckpointStarts[ id ][ !g_bCpAlternateStart[id] ] )
2282
2283 } else {
2284 if (timer_started[id] && !IsPaused[id]) {
2285 Pause(id)
2286 }
2287 set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
2288 set_pev(id, pev_origin, DefaultStartPos)
2289 }
2290 return PLUGIN_HANDLED
2291 }
2292 else
2293 {
2294 kz_chat(id, "%L", id, "KZ_NO_START")
2295 client_cmd(id, "spk warcraft3/resurrecttarget");
2296 set_task(0.1, "show_beacon", id)
2297 set_task(0.3, "show_beacon2", id)
2298 CmdRespawn(id)
2299
2300 return PLUGIN_HANDLED
2301 }
2302
2303 return PLUGIN_HANDLED
2304}
2305
2306public goFinish(id) {
2307 new entclassname[33];
2308 pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
2309 if(!DefaultStop) {
2310 kz_chat(id, "No finish position is set for this map")
2311 return PLUGIN_HANDLED
2312 }
2313 if (timer_started[id] && !IsPaused[id]) {
2314 tptostart[id] = true;
2315 Pause(id)
2316 }
2317 set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
2318 set_pev(id, pev_origin, DefaultStopPos)
2319 delay_duck(id)
2320 return PLUGIN_HANDLED;
2321}
2322
2323public setStart(id)
2324{
2325 if (! (get_user_flags( id ) & KZ_LEVEL ))
2326 {
2327 kz_chat(id, "%L", id, "KZ_NO_ACCESS")
2328 return PLUGIN_HANDLED
2329 }
2330
2331 new Float:origin[3]
2332 pev(id, pev_origin, origin)
2333 kz_set_start(MapName, origin)
2334 AutoStart[id] = false;
2335 ColorChat(id, GREEN, "%s^x01 %L.", prefix, id, "KZ_SET_START")
2336
2337 return PLUGIN_HANDLED
2338}
2339
2340
2341public setStop(id)
2342{
2343 if (! (get_user_flags( id ) & KZ_LEVEL ))
2344 {
2345 kz_chat(id, "%L", id, "KZ_NO_ACCESS")
2346 return PLUGIN_HANDLED
2347 }
2348
2349 new Float:origin[3]
2350 pev(id, pev_origin, origin)
2351 kz_set_stop(MapName, origin)
2352 ColorChat(id, GREEN, "%s^x01 Finish position set for this map", prefix)
2353
2354 return PLUGIN_HANDLED
2355}
2356
2357
2358public Origin(id)
2359{
2360 if (! (get_user_flags( id ) & KZ_LEVEL ))
2361 {
2362 kz_chat(id, "%L", id, "KZ_NO_ACCESS")
2363 return PLUGIN_HANDLED
2364 }
2365
2366 new Float:sporigin[3]
2367 pev(id, pev_origin, sporigin)
2368 ColorChat(id, GREEN, "%s^x01 %d,%d,%d", prefix, sporigin[0], sporigin[1], sporigin[2])
2369
2370/*
2371 new ent = -1, Float:StopOrigin[3], Float:tmpOrigin[3];
2372 while((ent = find_ent_by_class(ent, "func_button")))
2373 {
2374 get_brush_entity_origin(ent, tmpOrigin)
2375 FVecIVec(tmpOrigin, StopOrigin)
2376 client_print(id, print_chat, "%f, %f, %f", StopOrigin[0], StopOrigin[1], StopOrigin[2])
2377 }
2378*/
2379 return PLUGIN_HANDLED
2380}
2381
2382// ========= Respawn CT if dies ========
2383
2384public Ham_CBasePlayer_Killed_Pre(id)
2385{
2386 antidiestart[id] = get_gametime()
2387}
2388
2389public Ham_CBasePlayer_Killed_Post(id)
2390{
2391 client_print(id, print_chat, "entrou funcao morrer");
2392 if( !is_user_alive(id) )
2393 {
2394 entity_set_int id, EV_INT_groupinfo, groupNone ;
2395 }
2396 if( cs_get_user_team(id) == CS_TEAM_CT )
2397 {
2398 set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
2399 cs_set_user_deaths(id, 0)
2400 set_user_frags(id, 0)
2401 if(!menushow[id]) {
2402 set_task(0.3, "showtimeduel", id)
2403 }
2404 }
2405}
2406
2407
2408// ============================= NightVision ================================================
2409
2410public ToggleNVG(id)
2411{
2412
2413 if( get_pcvar_num(kz_nvg) == 0 )
2414 return PLUGIN_CONTINUE;
2415
2416 if ( NightVisionUse[id] )
2417 StopNVG(id)
2418 else
2419 StartNVG(id)
2420
2421 return PLUGIN_HANDLED
2422}
2423
2424public StartNVG(id)
2425{
2426 if(is_user_alive(id)) {
2427 emit_sound(id,CHAN_ITEM,"items/nvg_on.wav",1.0,ATTN_NORM,0,PITCH_NORM)
2428 }
2429 else {
2430 client_cmd(id, "spk items/nvg_on.wav");
2431 }
2432
2433 set_task(0.1,"RunNVG",id+111111,_,_,"b")
2434 NightVisionUse[id] = true;
2435
2436 return PLUGIN_HANDLED
2437}
2438
2439public StopNVG(id)
2440{
2441 if(is_user_alive(id)) {
2442 emit_sound(id,CHAN_ITEM,"items/nvg_off.wav",1.0,ATTN_NORM,0,PITCH_NORM)
2443 }
2444 else {
2445 client_cmd(id, "spk items/nvg_off.wav");
2446 }
2447 remove_task(id+111111)
2448 NightVisionUse[id] = false;
2449
2450 return PLUGIN_HANDLED
2451}
2452
2453
2454public RunNVG(taskid)
2455{
2456 new id = taskid - 111111
2457
2458 new origin[3]
2459 get_user_origin(id,origin,3)
2460
2461 new color[17];
2462 get_pcvar_string(kz_nvg_colors,color,16);
2463
2464 new iRed[5], iGreen[7], iBlue[5]
2465 parse(color,iRed,4,iGreen ,6,iBlue,4)
2466
2467 for(new i = 1; i < max_players; i++ )
2468 {
2469 if( (i == id || is_user_spectating_player(i,id)))
2470 {
2471 message_begin(MSG, SVC_TEMPENTITY, _, i)
2472 write_byte(TE_DLIGHT)
2473 write_coord(origin[0])
2474 write_coord(origin[1])
2475 write_coord(origin[2])
2476 write_byte(80)
2477 write_byte(str_to_num(iRed))
2478 write_byte(str_to_num(iGreen))
2479 write_byte(str_to_num(iBlue))
2480 write_byte(2)
2481 write_byte(0)
2482 message_end()
2483 }
2484 }
2485}
2486
2487// ============================ Hook ==============================================================
2488
2489public Ham_HookTouch(ent, id)
2490{
2491 if(is_user_alive(id) && !is_user(ent) )
2492 {
2493 pev(id, pev_origin, g_iHookWallOrigin[id]);
2494 if(is_user_alive(ent))
2495 {
2496 pev(ent, pev_origin, hookorigin[id]);
2497 }
2498 }
2499}
2500
2501public hook_on(id)
2502{
2503 if( (!canusehook[id] && !( get_user_flags( id ) & KZ_LEVEL )) || !is_user_alive(id) )
2504 return PLUGIN_HANDLED
2505
2506 if(get_user_noclip(id)) {
2507 set_user_noclip(id,0)
2508 }
2509 if (!timer_started[id])
2510 {
2511 antihook(id)
2512 return PLUGIN_HANDLED
2513 }
2514 new entclassname[33];
2515 pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
2516 if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
2517 {
2518 return PLUGIN_HANDLED
2519 }
2520 if (timer_started[id] && IsPaused[id])
2521 {
2522 antihook(id)
2523 return PLUGIN_HANDLED
2524 }
2525 if(timer_started[id] && !IsPaused[id])
2526 {
2527 Pause(id)
2528 antihook(id)
2529 return PLUGIN_HANDLED
2530 }
2531 return PLUGIN_HANDLED
2532}
2533
2534
2535public antihook(id)
2536{
2537 get_user_origin(id,hookorigin[id],3)
2538 if (get_pcvar_num(kz_hook_sound) == 1){
2539 emit_sound(id,CHAN_STATIC,"weapons/xbow_hit2.wav",1.0,ATTN_NORM,0,PITCH_NORM)
2540 }
2541 ishooked[id] = true
2542 set_task(0.1,"hook_task",id,"",0,"ab")
2543 hook_task(id)
2544 return PLUGIN_CONTINUE
2545}
2546
2547public hook_off(id)
2548{
2549 remove_hook(id)
2550 return PLUGIN_HANDLED
2551}
2552
2553public hook_task(id)
2554{
2555 if(!is_user_alive(id))
2556 {
2557 remove_hook(id);
2558 return;
2559 }
2560
2561 message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
2562 {
2563 write_byte(TE_KILLBEAM);
2564 write_short(id);
2565 }
2566 message_end();
2567
2568 message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
2569 {
2570 write_byte(TE_BEAMENTPOINT);
2571 write_short(id);
2572 write_coord(hookorigin[id][0]); // origin
2573 write_coord(hookorigin[id][1]); // origin
2574 write_coord(hookorigin[id][2]); // origin
2575 write_short(Sbeam); // sprite index
2576 write_byte(1); // start frame
2577 write_byte(1); // framerate
2578 write_byte(2); // life
2579 write_byte(18); // width
2580 write_byte(0); // noise
2581 write_byte(random_num(1,255)) // r
2582 write_byte(random_num(1,255)) // g
2583 write_byte(random_num(1,255)) // b
2584 write_byte(200); // brightness
2585 write_byte(0); // speed
2586 }
2587 message_end();
2588
2589 static origin[3], Float:velocity[3], distance, i;
2590 get_user_origin(id, origin);
2591 distance = get_distance(hookorigin[id], origin);
2592
2593 set_pev(id , pev_gaitsequence , 6);
2594
2595 antihookcheat[id] = get_gametime()
2596
2597
2598 if(distance > 50)
2599 {
2600 if(vector_length(Float:g_iHookWallOrigin[id]))
2601 {
2602 arrayset(g_iHookWallOrigin[id], 0, sizeof(g_iHookWallOrigin[]));
2603 }
2604 for(i = 0; i < 3; i++)
2605 {
2606 velocity[i] = (hookorigin[id][i] - origin[i]) * (1.5 * (float(get_pcvar_num(kz_hook_speed))) / distance);
2607 }
2608 }
2609 else if(distance > 10)
2610 {
2611 if(vector_length(Float:g_iHookWallOrigin[id]))
2612 {
2613 arrayset(g_iHookWallOrigin[id], 0, sizeof(g_iHookWallOrigin[]));
2614 }
2615 for(i = 0; i < 3; i++)
2616 {
2617 velocity[i] = (hookorigin[id][i] - origin[i]) * (float(get_pcvar_num(kz_hook_speed)/2) / (distance + 20));
2618 }
2619 }
2620 else
2621 {
2622 if(vector_length(Float:g_iHookWallOrigin[id]))
2623 {
2624 set_pev(id, pev_origin, g_iHookWallOrigin[id]);
2625 velocity = Float:{0.0, 0.0, 0.0};
2626 }
2627 }
2628 set_pev(id , pev_velocity, velocity);
2629}
2630
2631
2632
2633public remove_hook(id)
2634{
2635 if(task_exists(id))
2636 remove_task(id)
2637 remove_beam(id)
2638 ishooked[id] = false
2639}
2640
2641public remove_beam(id)
2642{
2643 message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
2644 write_byte(99) // TE_KILLBEAM
2645 write_short(id)
2646 message_end()
2647}
2648
2649
2650//============================ VIP In ScoreBoard =================================================
2651
2652public MessageScoreAttrib( iMsgID, iDest, iReceiver )
2653{
2654 if( get_pcvar_num(kz_vip) )
2655 {
2656 new iPlayer = get_msg_arg_int( 1 )
2657 if( is_user_alive( iPlayer ) && ( get_user_flags( iPlayer ) & KZ_LEVEL ) )
2658 {
2659 set_msg_arg_int( 2, ARG_BYTE, SCOREATTRIB_VIP );
2660 }
2661 }
2662}
2663
2664public EventStatusValue( const id )
2665{
2666
2667 new szMessage[ 34 ], Target, aux
2668 get_user_aiming(id, Target, aux)
2669 new authid[32]
2670 get_user_authid(Target, authid, 31)
2671
2672 if (is_user_alive(Target))
2673 {
2674 if(equali(authid, "STEAM_0:1:86944499")){
2675 formatex( szMessage, 33, "1 OWNER: %%p2" )
2676 }
2677// else if (is_user_bot(Target)) {
2678// formatex( szMessage, 33, "1 BOT: %%p2" )
2679// }
2680 else {
2681 formatex( szMessage, 33, "1 %s: %%p2", get_user_flags( Target ) & KZ_LEVEL ? "VIP" : "Player" )
2682 }
2683 message_begin( MSG, get_user_msgid( "StatusText" ) , _, id )
2684 write_byte( 0 )
2685 write_string( szMessage )
2686 message_end( )
2687 }
2688}
2689
2690
2691
2692// =================================================================================================
2693// Cmds
2694// =================================================================================================
2695
2696public CheckPoint(id)
2697{
2698
2699 if(GoPosCp[id] && is_user_alive(id)) {
2700 pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
2701 g_bCpAlternate[id] = !g_bCpAlternate[id]
2702 pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
2703 g_bCpAlternate[id] = !g_bCpAlternate[id]
2704 GoPosCp[id] = false
2705 return PLUGIN_HANDLED
2706 }
2707 if( !is_user_alive( id ) )
2708 {
2709 kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
2710 return PLUGIN_HANDLED
2711 }
2712 new entclassname[33];
2713 pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
2714 if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
2715 {
2716 client_print(id, print_center, "Can't make checkpoint now")
2717 return PLUGIN_HANDLED
2718 }
2719 if (gCheckpoint[id]) {
2720 gLastCheckpointAngle[id][0]=gCheckpointAngle[id][0]
2721 gLastCheckpointAngle[id][1]=gCheckpointAngle[id][1]
2722 gLastCheckpointAngle[id][2]=gCheckpointAngle[id][2]
2723 }
2724 pev(id, pev_v_angle, gCheckpointAngle[id]);
2725 gCheckpoint[id]=true;
2726 if( IsPaused[id] )
2727 {
2728 pev(id, pev_origin, InPauseCheckpoints[id][g_bInPauseCpAlternate[id] ? 1 : 0])
2729 g_bInPauseCpAlternate[id] = !g_bInPauseCpAlternate[id]
2730 inpausechecknumbers[id]++
2731 return PLUGIN_HANDLED
2732 }
2733 pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id] ? 1 : 0])
2734 g_bCpAlternate[id] = !g_bCpAlternate[id]
2735 checknumbers[id]++
2736 return PLUGIN_HANDLED
2737}
2738
2739public CheckPointStart(id)
2740{
2741 if( !is_user_alive( id ) )
2742 {
2743 kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
2744 return PLUGIN_HANDLED
2745 }
2746
2747 new entclassname[33];
2748 pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
2749 if( (!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id)))
2750 {
2751 kz_chat(id, "Can't make startpoint now")
2752 return PLUGIN_HANDLED
2753 }
2754 if (gCheckpointStart[id]) {
2755 gLastCheckpointStartAngle[id][0]=gCheckpointStartAngle[id][0]
2756 gLastCheckpointStartAngle[id][1]=gCheckpointStartAngle[id][1]
2757 gLastCheckpointStartAngle[id][2]=gCheckpointStartAngle[id][2]
2758 }
2759 pev(id, pev_v_angle, gCheckpointStartAngle[id]);
2760 gCheckpointStart[id] = true;
2761 pev(id, pev_origin, CheckpointStarts[id][g_bCpAlternateStart[id] ? 1 : 0])
2762 g_bCpAlternateStart[id] = !g_bCpAlternateStart[id]
2763 kz_chat(id, "Start position saved")
2764 return PLUGIN_HANDLED
2765}
2766
2767
2768
2769
2770
2771
2772
2773public GoCheck(id)
2774{
2775 if( !is_user_alive( id ) )
2776 {
2777 kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
2778 return PLUGIN_HANDLED
2779 }
2780 if( checknumbers[id] == 0 && inpausechecknumbers[id] == 0)
2781 {
2782 kz_chat(id, "%L", id, "KZ_NOT_ENOUGH_CHECKPOINTS")
2783 return PLUGIN_HANDLED
2784 }
2785 if( tpfenabled[id] || gc1[id])
2786 {
2787 set_pev( id, pev_angles, gCheckpointAngle[id]);
2788 set_pev( id, pev_fixangle, 1);
2789 gc1[id] = false
2790 }
2791 if( IsPaused[id] && inpausechecknumbers[id] > 0)
2792 {
2793// kz_chat(id, "%L", id, "KZ_TELEPORT_PAUSE")
2794 set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
2795 set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 } );
2796 set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
2797 set_pev( id, pev_fuser2, 0.0 );
2798 set_pev(id, pev_gravity, 1.0);
2799 engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
2800 set_pev(id, pev_origin, InPauseCheckpoints[ id ][ !g_bInPauseCpAlternate[id] ] )
2801 return PLUGIN_HANDLED
2802 }
2803 set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} );
2804 set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 } );
2805 set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
2806 set_pev( id, pev_fuser2, 0.0 );
2807 set_pev(id, pev_gravity, 1.0);
2808 engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } );
2809 set_pev(id, pev_origin, Checkpoints[ id ][ !g_bCpAlternate[id] ] )
2810 if (timer_started[id] && !IsPaused[id]){
2811 if (!WasPlayed[id] && !GoPosed[id]) {
2812 client_cmd(id, "spk fvox/blip");
2813 WasPlayed[id] = true
2814 }
2815 if (!menushow[id]) {
2816 showtime2(id)
2817 }
2818 gochecknumbers[id]++
2819 }
2820 return PLUGIN_HANDLED
2821}
2822
2823public GoCheck1(id)
2824{
2825 gc1[id] = true
2826 GoCheck(id)
2827 return PLUGIN_HANDLED
2828}
2829
2830public Stuck(id)
2831{
2832 if( !is_user_alive( id ) )
2833 {
2834 kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
2835 return PLUGIN_HANDLED
2836 }
2837 if(IsPaused[id] && inpausechecknumbers[id] > 1) {
2838 set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} )
2839 set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 })
2840 set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
2841 set_pev( id, pev_fuser2, 0.0 )
2842 engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } )
2843 set_pev(id, pev_origin, InPauseCheckpoints[id][g_bInPauseCpAlternate[id]] )
2844 g_bInPauseCpAlternate[id] = !g_bInPauseCpAlternate[id];
2845 return PLUGIN_HANDLED
2846 }
2847 if( checknumbers[id] < 2)
2848 {
2849 kz_chat(id, "%L", id, "KZ_NOT_ENOUGH_CHECKPOINTS")
2850 return PLUGIN_HANDLED
2851 }
2852
2853 set_pev( id, pev_velocity, Float:{0.0, 0.0, 0.0} )
2854 set_pev( id, pev_view_ofs, Float:{ 0.0, 0.0, 12.0 })
2855 set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
2856 set_pev( id, pev_fuser2, 0.0 )
2857 engfunc( EngFunc_SetSize, id, {-16.0, -16.0, -18.0 }, { 16.0, 16.0, 32.0 } )
2858 set_pev(id, pev_origin, Checkpoints[id][g_bCpAlternate[id]] )
2859 g_bCpAlternate[id] = !g_bCpAlternate[id];
2860 if (timer_started[id] && !IsPaused[id]){
2861 if (!WasPlayed[id] && !GoPosed[id]) {
2862 client_cmd(id, "spk fvox/blip");
2863 WasPlayed[id] = true
2864 }
2865 if (!menushow[id]) {
2866 showtime2(id)
2867 }
2868 gochecknumbers[id]++
2869 }
2870
2871
2872 return PLUGIN_HANDLED;
2873}
2874
2875// =================================================================================================
2876
2877public reset_checkpoints(id)
2878{
2879 if(timer_started[id]){
2880 client_print(id, print_center, "Timer was reset")
2881 }
2882 IsPaused[id] = false
2883 checknumbers[id] = 0
2884 inpausechecknumbers[id] = 0
2885 gochecknumbers[id] = 0
2886 timer_started[id] = false
2887 WasPlayed[id] = false
2888 timer_time[id] = 0.0
2889 user_has_scout[id] = false
2890 hidetime(id)
2891 return PLUGIN_HANDLED
2892}
2893
2894//===== Invis =======
2895
2896public cmdInvisible(id)
2897{
2898 gViewInvisible[id] = !gViewInvisible[id]
2899 if(gViewInvisible[id])
2900 kz_chat(id, "%L", id, "KZ_INVISIBLE_PLAYERS_ON")
2901 else
2902 kz_chat(id, "%L", id, "KZ_INVISIBLE_PLAYERS_OFF")
2903 InvisMenu(id)
2904 return PLUGIN_HANDLED
2905}
2906
2907public cmdWaterInvisible(id)
2908{
2909 if( !gWaterFound )
2910 {
2911 kz_chat(id, "%L", id, "KZ_INVISIBLE_NOWATER")
2912 InvisMenu(id)
2913 return PLUGIN_HANDLED
2914 }
2915
2916 gWaterInvisible[id] = !gWaterInvisible[id]
2917 if(gWaterInvisible[id])
2918 kz_chat(id, "%L", id, "KZ_INVISIBLE_WATER_ON")
2919 else
2920 kz_chat(id, "%L", id, "KZ_INVISIBLE_WATER_OFF")
2921 InvisMenu(id)
2922 return PLUGIN_HANDLED
2923}
2924
2925//======================Invis==========================
2926
2927public FM_client_AddToFullPack_Post(es, e, ent, host, hostflags, player, pSet)
2928{
2929 if( player )
2930 {
2931 new Players[32], Count;
2932 get_players(Players, Count, "ah")
2933 if(gViewInvisible[host] && is_user_alive(ent) && Count > 1 && !is_user_bot(host))
2934 {
2935 UpdateSpectator()
2936 if(is_user_alive(host) || ent != id_spectated[host])
2937 {
2938 kz_set_es(es)
2939 }
2940 }
2941 }
2942 else if( gWaterInvisible[host] && gWaterEntity[ent] && !is_user_bot(host))
2943 {
2944 set_es(es, ES_Effects, get_es( es, ES_Effects ) | EF_NODRAW )
2945 }
2946 return FMRES_IGNORED
2947}
2948
2949
2950
2951
2952public OnCmdStart(id)
2953{
2954 if( !g_bReadPackets )
2955 {
2956 g_bReadPackets = true;
2957 static plr;
2958 get_players g_iPlayers, g_iNum, "a" ;
2959 for(--g_iNum; g_iNum>=0; g_iNum--)
2960 {
2961 plr = g_iPlayers[ g_iNum ];
2962 entity_set_int plr, EV_INT_groupinfo, MaskEnt(plr) ;
2963 }
2964 g_iLastPlayerIndex = 0;
2965 }
2966
2967 if( g_iLastPlayerIndex && is_user_alive(g_iLastPlayerIndex) )
2968 {
2969 entity_set_int g_iLastPlayerIndex, EV_INT_groupinfo, MaskEnt(g_iLastPlayerIndex) ;
2970 }
2971
2972 if( is_user_alive(id) )
2973 {
2974 entity_set_int id, EV_INT_groupinfo, MaskEnt(id) ;
2975 if( !IsUserBot(id) && !gViewInvisible[id] )
2976 {
2977 if( !g_bPreThinkHooked )
2978 {
2979 EnableHamForward g_iHhPreThink ;
2980 EnableHamForward g_iHhPreThinkPost ;
2981 g_bPreThinkHooked = true;
2982 }
2983 }
2984 else if( g_bPreThinkHooked )
2985 {
2986 DisableHamForward g_iHhPreThink ;
2987 DisableHamForward g_iHhPreThinkPost ;
2988 g_bPreThinkHooked = false;
2989 }
2990 }
2991 else
2992 {
2993 entity_set_int id, EV_INT_groupinfo, groupNone ;
2994 g_iLastPlayerIndex = id;
2995 if( g_bPreThinkHooked )
2996 {
2997 DisableHamForward g_iHhPreThink ;
2998 DisableHamForward g_iHhPreThinkPost ;
2999 g_bPreThinkHooked = false;
3000 }
3001 }
3002}
3003
3004public OnCBasePlayer_PreThink(id)
3005{
3006 entity_set_int id, EV_INT_groupinfo, groupNone ;
3007}
3008
3009public OnCBasePlayer_PreThink_P(id)
3010{
3011 entity_set_int id, EV_INT_groupinfo, MaskEnt(id) ;
3012}
3013
3014
3015
3016public server_frame()
3017{
3018 g_iLastPlayerIndex = 0;
3019 g_bReadPackets = false;
3020 g_bClientMessages = false;
3021 static id;
3022 get_players g_iPlayers, g_iNum, "a" ;
3023 for(--g_iNum; g_iNum>=0; g_iNum--)
3024 {
3025 id = g_iPlayers[ g_iNum ];
3026 entity_set_int id, EV_INT_groupinfo, MaskEnt(id) ;
3027 }
3028}
3029
3030public OnUpdateClientData_P(id, sendweapons, cd)
3031{
3032 if( IsUserBot(id) )
3033 {
3034 return;
3035 }
3036
3037 if( !g_bClientMessages )
3038 {
3039 g_bClientMessages = true;
3040 g_bitIsPlayerAlive = 0;
3041 get_players g_iPlayers, g_iNum, "a" ;
3042 static player;
3043 for(--g_iNum; g_iNum>=0; g_iNum--)
3044 {
3045 player = g_iPlayers[ g_iNum ];
3046 MarkPlayerAlive( player );
3047 entity_set_int player, EV_INT_groupinfo, groupRenderVisible ;
3048 }
3049 }
3050
3051 if( IsPlayerAlive(id) )
3052 // if( is_user_alive(id) )
3053 {
3054 if( g_iLastPlayerIndex )
3055 {
3056 entity_set_int g_iLastPlayerIndex, EV_INT_groupinfo, groupRenderVisible ;
3057 g_iLastPlayerIndex = 0;
3058 }
3059 static group;
3060 if( !gViewInvisible[id] )
3061 {
3062 group = groupRenderVisible;
3063 g_bitIsPlayerInSphere = 0;
3064 g_iNum = find_sphere_class(id, CLASS_PLAYER, SEMICLIP_RADIUS, g_iPlayers, g_maxplayers);
3065 static player;
3066 for(--g_iNum; g_iNum>=0; g_iNum--)
3067 {
3068 player = g_iPlayers[ g_iNum ];
3069 if( player != id )
3070 {
3071 MarkPlayerInSphere( player );
3072 }
3073 }
3074 if( g_bitIsPlayerInSphere )
3075 {
3076 if( !g_iFhAddToFullPackPost )
3077 {
3078 g_iFhAddToFullPackPost = register_forward(FM_AddToFullPack, "OnAddToFullPack_P", true);
3079 }
3080 }
3081 else if( g_iFhAddToFullPackPost )
3082 {
3083 unregister_forward(FM_AddToFullPack, g_iFhAddToFullPackPost, true);
3084 g_iFhAddToFullPackPost = 0;
3085 }
3086 }
3087 else
3088 {
3089 group = groupRenderInvisible;
3090 g_iLastPlayerIndex = id;
3091 if( g_iFhAddToFullPackPost )
3092 {
3093 unregister_forward(FM_AddToFullPack, g_iFhAddToFullPackPost, true);
3094 g_iFhAddToFullPackPost = 0;
3095 }
3096 }
3097 entity_set_int id, EV_INT_groupinfo, group ;
3098 }
3099}
3100
3101public OnAddToFullPack_P(es, e, ent, id, hostflags, player, pSet)
3102{
3103 if( player )
3104 {
3105 if( IsPlayerAlive(ent) && IsPlayerInSphere(ent) )
3106 {
3107 set_es es, ES_Solid, SOLID_NOT ;
3108 set_es es, ES_RenderMode, kRenderTransAlpha ;
3109 set_es es, ES_RenderAmt, floatround(entity_range(id, ent) * 255.0 / SEMICLIP_RADIUS, floatround_floor) ;
3110 }
3111 }
3112 else
3113 {
3114 unregister_forward FM_AddToFullPack, g_iFhAddToFullPackPost, true ;
3115 g_iFhAddToFullPackPost = 0;
3116 }
3117}
3118
3119
3120
3121
3122
3123
3124
3125
3126public UpdateSpectator()
3127{
3128 for(new i = 1; i <= g_maxplayers; i++)
3129 {
3130 if(!is_user_connected(i) || is_user_alive(i))
3131 continue
3132
3133 id_spectated[i] = pev( i, pev_iuser2 )
3134 }
3135}
3136
3137
3138stock kz_set_es(es)
3139{
3140 set_es(es, ES_RenderFx, kRenderFxGlowShell )
3141 set_es(es, ES_RenderColor, 0.0, 0.0, 0.0)
3142 set_es(es, ES_RenderMode, kRenderTransAlpha )
3143 set_es(es, ES_RenderAmt, 0.0 )
3144 set_es(es, ES_Origin, { 999999999.0, 999999999.0, 999999999.0 } )
3145}
3146
3147public noclip(id)
3148{
3149 new noclip = !get_user_noclip(id)
3150 if(!is_user_alive(id))
3151 {
3152 kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
3153 return PLUGIN_HANDLED
3154 }
3155 new entclassname[33];
3156 pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
3157 if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
3158 {
3159 return PLUGIN_HANDLED
3160 }
3161
3162 set_user_noclip(id, noclip)
3163 if(!IsPaused[id] && noclip && timer_started[id]){
3164 Pause(id)
3165 }
3166 if(!noclip)
3167 {
3168 set_pev( id, pev_flags, pev(id, pev_flags) | FL_DUCKING );
3169 }
3170 kz_chat(id, "%L", id, "KZ_NOCLIP" , noclip ? "ON" : "OFF")
3171 antinoclipstart[id] = get_gametime();
3172
3173 return PLUGIN_HANDLED
3174}
3175
3176
3177// =================================================================================================
3178
3179
3180
3181stock kz_set_start(const map[], Float:origin[3])
3182{
3183 new realfile[128], tempfile[128], formatorigin[50]
3184 formatex(realfile, 127, "%s/%s", Kzdir, KZ_STARTFILE)
3185 formatex(tempfile, 127, "%s/%s", Kzdir, KZ_STARTFILE_TEMP)
3186 formatex(formatorigin, 49, "%f %f %f", origin[0], origin[1], origin[2])
3187
3188 DefaultStartPos = origin
3189 DefaultStart = true
3190
3191 new file = fopen(tempfile, "wt")
3192 new vault = fopen(realfile, "rt")
3193
3194 new data[128], key[64]
3195 new bool:replaced = false
3196
3197 while( !feof(vault) )
3198 {
3199 fgets(vault, data, 127)
3200 parse(data, key, 63)
3201
3202 if( equal(key, map) && !replaced )
3203 {
3204 fprintf(file, "%s %s^n", map, formatorigin)
3205
3206 replaced = true
3207 }
3208 else
3209 {
3210 fputs(file, data)
3211 }
3212 }
3213
3214 if( !replaced )
3215 {
3216 fprintf(file, "%s %s^n", map, formatorigin)
3217 }
3218
3219 fclose(file)
3220 fclose(vault)
3221
3222 delete_file(realfile)
3223 while( !rename_file(tempfile, realfile, 1) ) {}
3224}
3225
3226
3227
3228
3229stock kz_set_stop(const map[], Float:origin[3])
3230{
3231 new realfile[128], tempfile[128], formatorigin[50]
3232 formatex(realfile, 127, "%s/%s", Kzdir, KZ_FINISHFILE)
3233 formatex(tempfile, 127, "%s/%s", Kzdir, KZ_FINISHFILE_TEMP)
3234 formatex(formatorigin, 49, "%f %f %f", origin[0], origin[1], origin[2])
3235
3236 DefaultStopPos = origin
3237 DefaultStop = true
3238
3239 new file = fopen(tempfile, "wt")
3240 new vault = fopen(realfile, "rt")
3241
3242 new data[128], key[64]
3243 new bool:replaced = false
3244
3245 while( !feof(vault) )
3246 {
3247 fgets(vault, data, 127)
3248 parse(data, key, 63)
3249
3250 if( equal(key, map) && !replaced )
3251 {
3252 fprintf(file, "%s %s^n", map, formatorigin)
3253
3254 replaced = true
3255 }
3256 else
3257 {
3258 fputs(file, data)
3259 }
3260 }
3261
3262 if( !replaced )
3263 {
3264 fprintf(file, "%s %s^n", map, formatorigin)
3265 }
3266
3267 fclose(file)
3268 fclose(vault)
3269
3270 delete_file(realfile)
3271 while( !rename_file(tempfile, realfile, 1) ) {}
3272}
3273
3274
3275stock kz_chat(id, const message[], {Float,Sql,Result,_}:...)
3276{
3277 new msg[180];
3278 vformat(msg, 179, message, 3)
3279 replace_all(msg, 191, "^x01", "")
3280 replace_all(msg, 191, "^x03", "")
3281 replace_all(msg, 191, "^x04", "")
3282 replace_all(msg, 191, ".", "")
3283 kz_hud_message(id, "%s", msg)
3284 return 1
3285}
3286
3287stock kz_hud_message(id, const message[], {Float,Sql,Result,_}:...)
3288{
3289 static msg[192], colors[12], r[4], g[4], b[4];
3290 vformat(msg, 191, message, 3);
3291
3292 get_pcvar_string(kz_hud_color, colors, 11)
3293 parse(colors, r, 3, g, 3, b, 4)
3294
3295 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);
3296 ShowSyncHudMsg(id, hud_message, msg);
3297}
3298
3299stock kz_register_saycmd(const saycommand[], const function[], flags)
3300{
3301 new temp[64]
3302 formatex(temp, 63, "say /%s", saycommand)
3303 register_clcmd(temp, function, flags)
3304 formatex(temp, 63, "say .%s", saycommand)
3305 register_clcmd(temp, function, flags)
3306 formatex(temp, 63, "say_team /%s", saycommand)
3307 register_clcmd(temp, function, flags)
3308 formatex(temp, 63, "say_team .%s", saycommand)
3309 register_clcmd(temp, function, flags)
3310}
3311
3312
3313#if defined USE_SQL
3314stock GetNewRank(id, type)
3315{
3316 new createinto[1001]
3317
3318 new cData[2]
3319 cData[0] = id
3320 cData[1] = type
3321
3322 formatex(createinto, 1000, "SELECT authid FROM `%s` WHERE mapname='%s' ORDER BY time", type == PRO_TOP ? "kz_pro15" : "kz_nub15", MapName)
3323 SQL_ThreadQuery(g_SqlTuple, "GetNewRank_QueryHandler", createinto, cData, 2)
3324}
3325
3326
3327#endif
3328
3329public FwdSpawnWeaponbox( iEntity )
3330{
3331 if(get_pcvar_num(kz_drop_weapons) == 1)
3332 {
3333 register_forward(FM_SetModel, "SetModelPre", 0);
3334 register_forward(FM_SetModel, "forward_set_model")
3335 g_maxents = get_global_int(GL_maxEntities)
3336 }
3337 if( get_pcvar_num(kz_pick_weapons) == 0 )
3338 return HAM_SUPERCEDE
3339 return HAM_IGNORED
3340}
3341
3342public SetModelPre(pE, const szM[])
3343{
3344 if (strlen(szM) < 8) return;
3345 new szClassName[10];
3346 entity_get_string(pE, EV_SZ_classname, szClassName, 9);
3347 if (!equal(szClassName, "weaponbox")) return;
3348 entity_set_float(pE, EV_FL_nextthink, get_gametime() + 2.0);
3349}
3350
3351public forward_set_model(entid, model[]) {
3352 if (!is_valid_ent(entid) || !equal(model, WBOX, 9) || get_pcvar_num(kz_drop_weapons) == 0)
3353 return FMRES_IGNORED
3354
3355 new id = entity_get_edict(entid, EV_ENT_owner)
3356 if (!id || !is_user_connected(id) || is_user_alive(id))
3357 return FMRES_IGNORED
3358
3359 if (equal(model, SHLD)) {
3360 kill_entity(entid)
3361 return FMRES_IGNORED
3362 }
3363
3364 if (equal(model, WBOX)) {
3365 g_entid[id] = entid
3366 return FMRES_IGNORED
3367 }
3368
3369 if (entid != g_entid[id])
3370 return FMRES_IGNORED
3371
3372 g_entid[id] = 0
3373
3374 if (equal(model, BOMB))
3375 return FMRES_IGNORED
3376
3377 for (new i = 1; i <= g_maxents; ++i) {
3378 if (is_valid_ent(i) && entid == entity_get_edict(i, EV_ENT_owner)) {
3379 kill_entity(entid)
3380 kill_entity(i)
3381 }
3382 }
3383
3384 return FMRES_IGNORED
3385}
3386
3387stock kill_entity(id) {
3388 entity_set_int(id, EV_INT_flags, entity_get_int(id, EV_INT_flags)|FL_KILLME)
3389}
3390
3391
3392public FwdHamDoorSpawn( iEntity )
3393{
3394 static const szNull[ ] = "common/null.wav";
3395
3396 new Float:flDamage;
3397 pev( iEntity, pev_dmg, flDamage );
3398
3399 if( flDamage < -999.0 ) {
3400 set_pev( iEntity, pev_noise1, szNull );
3401 set_pev( iEntity, pev_noise2, szNull );
3402 set_pev( iEntity, pev_noise3, szNull );
3403
3404 if( !HealsOnMap )
3405 HealsOnMap = true
3406 }
3407}
3408
3409public eventHamPlayerDamage(id, weapon, attacker, Float:damage, damagebits) {
3410 if(!is_user(id)) {
3411 return HAM_IGNORED
3412 }
3413
3414 for(new i = 1; i < max_players; i++ )
3415 {
3416 if( (i == id || is_user_spectating_player(i,id)))
3417 {
3418 ClearDHUDMessages(i);
3419 if(!weapon && !HealsOnMap) {
3420 set_dhudmessage(255, 80, 80, -1.0, 0.83, 0, 0.0, 0.0, 0.0, 2.0)
3421 show_dhudmessage(i, "%s%d HP", damage > 0 ? "" : "+", floatround(damage * -1))
3422 }
3423 }
3424 }
3425 set_task(0.5, "tsk_heal", id)
3426 return HAM_IGNORED
3427}
3428
3429
3430stock ClearDHUDMessages(pId, iClear = 8) {
3431 for(new i = 1; i < max_players; i++ )
3432 {
3433 if( (i == pId || is_user_spectating_player(i,pId)))
3434 {
3435 for (new iDHUD = 0; iDHUD < iClear; iDHUD++) {
3436 show_dhudmessage(i, "");
3437 }
3438 }
3439 }
3440}
3441
3442
3443stock is_user_spectating_player(spectator, player)
3444{
3445 if( !pev_valid(spectator) || !pev_valid(player) )
3446 return 0;
3447 if( !is_user_connected(spectator) || !is_user_connected(player) )
3448 return 0;
3449 if( is_user_alive(spectator) || !is_user_alive(player) )
3450 return 0;
3451 if( pev(spectator, pev_deadflag) != 2 )
3452 return 0;
3453
3454 static specmode;
3455 specmode = pev(spectator, pev_iuser1);
3456 if( !(specmode == 1 || specmode == 2 || specmode == 4) )
3457 return 0;
3458
3459 if( pev(spectator, pev_iuser2) == player )
3460 return 1;
3461
3462 return 0;
3463}
3464
3465
3466public tsk_heal(id)
3467{
3468 if(HealsOnMap) {
3469 set_pev(id, pev_health, 1999983.0);
3470 }
3471 return HAM_IGNORED
3472}
3473public FwdHamPlayerSpawn( id )
3474{
3475 if( is_user_alive(id) )
3476 {
3477 entity_set_int id, EV_INT_groupinfo, MaskEnt(id) ;
3478 }
3479 if(get_pcvar_num(kz_autosavepos) == 0)
3480 Autosavepos[id]=false
3481 else
3482 Autosavepos[id]=true
3483 if( !is_user_alive( id ) )
3484 return;
3485
3486 if(firstspawn[id] && !is_user_bot(id))
3487 {
3488 if(Verif(id,1) && get_pcvar_num(kz_save_pos) == 1 ) {
3489 client_cmd(id, "spk warcraft3/resurrecttarget");
3490 set_task(0.3, "show_beacon3", id + SHOW_BEACON)
3491 set_task(0.5, "show_beacon4", id + SHOW_BEACON1)
3492 set_task(0.7, "show_pos", id + SHOW_POS_TASK)
3493 GoPos(id)
3494 }
3495 else if(DefaultStart) {
3496 client_cmd(id, "spk warcraft3/resurrecttarget");
3497 set_task(0.3, "show_beacon3", id + SHOW_BEACON)
3498 set_task(0.5, "show_beacon4", id + SHOW_BEACON1)
3499 set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
3500 set_pev(id, pev_origin, DefaultStartPos)
3501 }
3502 if(get_pcvar_num(kz_spawn_mainmenu) == 1)
3503 kz_menu (id)
3504 if(get_pcvar_num(kz_help)) {
3505 set_task(3.0,"InfoKreedz",id + TASK_INFO_KREEDZ)
3506 set_task(10.0,"PlayerInfo",id + TASK_INFO)
3507 }
3508 }
3509 firstspawn[id] = false
3510
3511
3512 if( !user_has_weapon(id,CSW_KNIFE) )
3513 give_item( id,"weapon_knife" )
3514 if ( (containi(MapName, "slide") != -1) || (containi(MapName, "surf_") != -1) ) {
3515 HealsOnMap = true
3516 }
3517 if( HealsOnMap )
3518 set_user_health(id, 1999983)
3519
3520 if( IsPaused[id] )
3521 {
3522 set_pev(id, pev_origin, PauseOrigin[id])
3523 }
3524
3525 if(get_pcvar_num(kz_use_radio) == 0)
3526 {
3527 #define XO_PLAYER 5
3528 #define m_iRadiosLeft 192
3529 set_pdata_int(id, m_iRadiosLeft, 0, XO_PLAYER)
3530 }
3531}
3532
3533
3534
3535// ==================================Save positions=================================================
3536
3537public GoPos(id)
3538{
3539 remove_hook(id)
3540 set_user_noclip(id, 0)
3541 if(Verif(id,0))
3542 {
3543 set_pev(id, pev_velocity, SavedVelocity[id])
3544 set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING )
3545 set_pev(id, pev_origin, SavedOrigins[id] )
3546 MpbhopOrigin[id][0] = str_to_float(SavedOrigins[id][0]);
3547 MpbhopOrigin[id][1] = str_to_float(SavedOrigins[id][1]);
3548 MpbhopOrigin[id][2] = str_to_float(SavedOrigins[id][2]);
3549 isMpbhop[id] = true
3550 GoPosCp[id] = true
3551 GoPosHp[id] = true
3552 CheckPoint(id)
3553 }
3554 if( HealsOnMap) {
3555 set_user_health(id, 1999983)
3556 }
3557 checknumbers[id]=SavedChecks[id]
3558 gochecknumbers[id]=SavedGoChecks[id]
3559 if (gochecknumbers[id] > 0) {
3560 GoPosed[id] = true
3561 }
3562 if(get_pcvar_num(kz_spawn_mainmenu) == 1){
3563 menushow[id] = true
3564 } else {
3565 set_task(2.0, "showtimeduel", id)
3566 }
3567 strip_user_weapons(id)
3568 cmdUsp(id)
3569 if(SavedScout[id])
3570 {
3571 give_item(id, "weapon_scout")
3572 user_has_scout[id] = true
3573 }
3574 timer_time[id]=get_gametime()-SavedTime[id]
3575 timer_started[id]=true
3576 tphook_user[id] = true;
3577 g_pausetime[id] = get_gametime() - timer_time[id]
3578 timer_time[id] = 0.0
3579 static Float:velocityy[33][3], Float:v_angle[33][3];
3580 pev(id, pev_velocity, velocityy[id])
3581 pev(id, pev_velocity, pausedvelocity[id])
3582 pev(id, pev_origin, PauseOrigin[id])
3583 pev(id, pev_v_angle, v_angle[id])
3584 IsPaused[id] = true
3585}
3586
3587public show_pos(id) {
3588 id -= SHOW_POS_TASK;
3589 ClearDHUDMessages(id)
3590 set_dhudmessage(255, 80, 80, -1.0, 0.83, 0, 0.0, 0.0, 0.0, 2.0)
3591 show_dhudmessage(id, "You're moved to the saved position")
3592}
3593
3594public Verif(id, action)
3595{
3596 new realfile[128], tempfile[128], authid[32]
3597 new bool:exist = false
3598
3599 get_user_authid(id, authid, 31)
3600 formatex(realfile, 127, "%s/%s.ini", SavePosDir, MapName)
3601 formatex(tempfile, 127, "%s/temp.ini", SavePosDir)
3602
3603 if( !file_exists(realfile) )
3604 return 0
3605
3606 new file = fopen(tempfile, "wt")
3607 new vault = fopen(realfile, "rt")
3608 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]
3609 while( !feof(vault) )
3610 {
3611 fgets(vault, data, 255)
3612 parse(data, sid, 31, time, 24, checks, 4, gochecks, 4, x, 24, y, 24, z, 24, scout, 4, xs, 24, ys, 24, zs, 24)
3613
3614 if( equal(sid, authid) && !exist) // ma aflu in fisier?
3615 {
3616 if(action == 1)
3617 fputs(file, data)
3618 exist= true
3619 SavedChecks[id] = str_to_num(checks)
3620 SavedGoChecks[id] = str_to_num(gochecks)
3621 SavedTime[id] = str_to_float(time)
3622 SavedOrigins[id][0]=str_to_num(x)
3623 SavedOrigins[id][1]=str_to_num(y)
3624 SavedOrigins[id][2]=str_to_num(z)
3625 SavedScout[id] = str_to_num(scout)
3626 SavedVelocity[id][0]=str_to_num(xs)
3627 SavedVelocity[id][1]=str_to_num(ys)
3628 SavedVelocity[id][2]=str_to_num(zs)
3629 }
3630 else
3631 {
3632 fputs(file, data)
3633 }
3634 }
3635
3636 fclose(file)
3637 fclose(vault)
3638
3639 delete_file(realfile)
3640 if(file_size(tempfile) == 0)
3641 delete_file(tempfile)
3642 else
3643 while( !rename_file(tempfile, realfile, 1) ) {}
3644
3645
3646 if(!exist)
3647 return 0
3648
3649 return 1
3650}
3651public kz_savepos (id, Float:time, checkpoints, gochecks, Float:origin[3], scout, Float:spvelocity[3])
3652{
3653 new realfile[128], formatorigin[128], authid[32]
3654 get_user_authid(id, authid, 31)
3655 formatex(realfile, 127, "%s/%s.ini", SavePosDir, MapName)
3656 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])
3657
3658 new vault = fopen(realfile, "rt+")
3659 write_file(realfile, formatorigin) // La sfarsit adaug datele mele
3660
3661 fclose(vault)
3662
3663}
3664
3665
3666public saveposition(id) {
3667
3668 new Float:origin[3], scout
3669 new Float:spvelocity[3]
3670 pev(id, pev_velocity, spvelocity);
3671 new Float:Time,check,gocheck
3672
3673 if(spec_user[id] && IsPaused[id]) {
3674 SpecLoc[id] = PauseOrigin[id]
3675 }
3676 if(timer_started[id] && is_user_alive(id) && !is_user_bot(id) && tphook_user[id])
3677 {
3678 origin = PauseOrigin[id]
3679 Time= g_pausetime[id]
3680 spvelocity = pausedvelocity[id]
3681 if(isFalling[id]) {
3682 origin = vFallingStart[id];
3683 Time = vFallingTime[id]
3684 }
3685 check=checknumbers[id]
3686 gocheck=gochecknumbers[id]
3687 if (user_has_scout[id])
3688 scout=1
3689 else
3690 scout=0
3691 kz_savepos(id, Time, check, gocheck, origin, scout, spvelocity)
3692 }
3693 else if(timer_started[id] && !is_user_alive(id) && !is_user_bot(id) && spec_user[id])
3694 {
3695 origin = SpecLoc[id]
3696 Time= g_pausetime[id]
3697 check=checknumbers[id]
3698 gocheck=gochecknumbers[id]
3699 if (user_has_scout[id])
3700 scout=1
3701 else
3702 scout=0
3703 kz_savepos(id, Time, check, gocheck, origin, scout, spvelocity)
3704 }
3705 else if(timer_started[id] && is_user_alive(id) && !is_user_bot(id))
3706 {
3707 pev(id, pev_origin, origin)
3708 Time=get_gametime() - timer_time[id]
3709 if(isFalling[id]) {
3710 origin = vFallingStart[id];
3711 Time = vFallingTime[id]
3712 spvelocity[0] = 0.0
3713 spvelocity[1] = 0.0
3714 spvelocity[2] = 0.0
3715 }
3716 check=checknumbers[id]
3717 gocheck=gochecknumbers[id]
3718 if (user_has_scout[id])
3719 scout=1
3720 else
3721 scout=0
3722
3723 kz_savepos(id, Time, check, gocheck, origin, scout, spvelocity)
3724 }
3725 else
3726 {
3727 checknumbers[id] = 0
3728 gochecknumbers[id] = 0
3729 user_has_scout[id] = false
3730 }
3731}
3732
3733
3734
3735// =================================================================================================
3736// Events / Forwards
3737// =================================================================================================
3738
3739//=================================================================================================
3740
3741public client_disconnect(id)
3742{
3743 if (Autosavepos[id] && !is_user_bot(id)) {
3744 saveposition(id)
3745 }
3746 if(task_exists(id))
3747 remove_task(id)
3748
3749 if(task_exists(id + TASK_INFO_KREEDZ))
3750 remove_task(id + TASK_INFO_KREEDZ )
3751 if(task_exists(id + TASK_GETTOP))
3752 remove_task(id + TASK_GETTOP )
3753 if(task_exists(id + TASK_INFO))
3754 remove_task(id + TASK_INFO )
3755 if(task_exists(id + SHOW_POS_TASK))
3756 remove_task(id + SHOW_POS_TASK )
3757 if(task_exists(id + SHOW_BEACON))
3758 remove_task(id + SHOW_BEACON )
3759 if(task_exists(id + SHOW_BEACON1))
3760 remove_task(id + SHOW_BEACON1)
3761
3762 gCheckpointStart[id] = false
3763 antihookcheat[id] = 0.0
3764 antidiestart[id] = 0.0
3765 antinoclipstart[id] = 0.0
3766 antiteleport[id] = 0.0
3767 chatorhud[id] = -1
3768 timer_started[id] = false
3769 firstspawn[id] = false
3770 NightVisionUse[id] = false
3771 IsPaused[id] = false
3772 spec_user[id] = false
3773 tpfenabled[id] = false
3774 gc1[id] = false
3775 remove_hook(id)
3776 tphook_user[id] = false
3777 menushow[id] = false
3778 GoPosed[id] = false
3779 GoPosCp[id] = false
3780 GoPosHp[id] = false
3781 tptostart[id] = false
3782 isFalling[id] = false
3783 block_change[id] = false
3784 isMpbhop[id] = false
3785}
3786
3787public client_putinserver(id)
3788{
3789 MyPosUpdated[id] = true
3790 canusehook[id] = true
3791 checknumbers[id] = 0
3792 inpausechecknumbers[id] = 0
3793 gochecknumbers[id] = 0
3794 antihookcheat[id] = 0.0
3795 antidiestart[id] = 0.0
3796 antinoclipstart[id] = 0.0
3797 antiteleport[id] = 0.0
3798 chatorhud[id] = -1
3799 timer_started[id] = false
3800 firstspawn[id] = true
3801 NightVisionUse[id] = false
3802 IsPaused[id] = false
3803 tpfenabled[id] = false
3804 gc1[id] = false
3805 spec_user[id] = false
3806 user_has_scout[id] = false
3807 remove_hook(id)
3808 tphook_user[id] = false
3809 menushow[id] = false
3810 GoPosed[id] = false
3811 GoPosCp[id] = false
3812 GoPosHp[id] = false
3813 tptostart[id] = false
3814
3815 g_bShowBeams[id] = true;
3816 g_bReturnFloat[id] = true;
3817 g_bDetailedResults[id] = false;
3818 g_bAutoSetting[id] = false;
3819 if( get_pcvar_num(kz_duel) == 1) {
3820 ////////////==================================Duel==========================///////////////////
3821 //////========================================End Duel============================================////
3822 }
3823 arrayset(g_iHookWallOrigin[id], 0, sizeof(g_iHookWallOrigin[]));
3824 block_change[id] = false
3825 isMpbhop[id] = false
3826 if(!HealsOnMap) {
3827 set_pev(id, pev_health, 100.0)
3828 }
3829 if( is_user_bot(id) )
3830 {
3831 MarkPlayerBot(id);
3832 }
3833 else
3834 {
3835 ClearPlayerBot(id);
3836 }
3837}
3838
3839// =========================================================== Measure Tool ============================================
3840
3841public cmdMeasure( plr )
3842{
3843 pev( plr, pev_origin, g_vFirstLoc[plr] );
3844 g_vFirstLoc[plr][2] -= is_user_ducking( plr ) ? 18 : 36;
3845 g_vSecondLoc[plr] = g_vFirstLoc[plr];
3846
3847 if( g_bShowBeams[plr] && !task_exists( plr + TASK_BEAM ) )
3848 {
3849 set_task( 0.1, "tskBeam", plr + TASK_BEAM, _, _, "ab" );
3850 }
3851
3852 menuDisplay( plr );
3853
3854 //return PLUGIN_HANDLED;
3855}
3856
3857
3858public cmdChangeColor( plr )
3859{
3860 if( !( get_user_flags( plr ) & ADMIN_KICK ) )
3861 {
3862 client_print( plr, print_console, "* You have no access to this command" );
3863 return PLUGIN_HANDLED;
3864 }
3865
3866 if( read_argc( ) != 4 )
3867 {
3868 client_print( plr, print_console, "Usage: measure_color <red> <green> <blue>" );
3869 return PLUGIN_HANDLED;
3870 }
3871
3872 new r_str[4], g_str[4], b_str[4];
3873 read_argv( 1, r_str, 3 );
3874 read_argv( 2, g_str, 3 );
3875 read_argv( 3, b_str, 3 );
3876
3877 g_iColors[0] = clamp( str_to_num( r_str ), 0, 255 );
3878 g_iColors[1] = clamp( str_to_num( g_str ), 0, 255 );
3879 g_iColors[2] = clamp( str_to_num( b_str ), 0, 255 );
3880
3881 client_print( plr, print_console, "measure_color changed to ^"%i %i %i^"", g_iColors[0], g_iColors[1], g_iColors[2] );
3882
3883 return PLUGIN_HANDLED;
3884}
3885public menuDisplay( plr )
3886{
3887 static menu[2048];
3888
3889 new len = format( menu, 2047, "\rMeasure^n^n" );
3890
3891 if( g_bReturnFloat[plr] )
3892 {
3893 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] );
3894 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] );
3895 len += format( menu[len], 2047 - len, "\r03. \wAutomatical setting of the other Loc: \d%s^n^n", g_bAutoSetting[plr] ? "on" : "off" );
3896 len += format( menu[len], 2047 - len, "\r04. \wDetailed results: \d%s^n", g_bDetailedResults[plr] ? "on" : "off" );
3897 len += format( menu[len], 2047 - len, "\r05. \wReturned values: \ddecimal^n^n" );
3898 len += format( menu[len], 2047 - len, "\r \wResults:^n" );
3899
3900 if( g_bDetailedResults[plr] )
3901 {
3902 len += format( menu[len], 2047 - len, "\r \wX-Distance: \d%f^n", floatabs( g_vFirstLoc[plr][0] - g_vSecondLoc[plr][0] ) );
3903 len += format( menu[len], 2047 - len, "\r \wY-Distance: \d%f^n", floatabs( g_vFirstLoc[plr][1] - g_vSecondLoc[plr][1] ) );
3904 }
3905
3906 len += format( menu[len], 2047 - len, "\r \wHeight difference: \d%f^n", floatabs( g_vFirstLoc[plr][2] - g_vSecondLoc[plr][2] ) );
3907 len += format( menu[len], 2047 - len, "\r \wReal distance: \d%f^n^n", get_distance_f( g_vFirstLoc[plr], g_vSecondLoc[plr] ) );
3908 }
3909 else
3910 {
3911 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 ) );
3912 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 ) );
3913 len += format( menu[len], 2047 - len, "\r03. \wAutomatical setting of the other Loc: \d%s^n^n", g_bAutoSetting[plr] ? "on" : "off" );
3914 len += format( menu[len], 2047 - len, "\r04. \wDetailed results: \d%s^n", g_bDetailedResults[plr] ? "on" : "off" );
3915 len += format( menu[len], 2047 - len, "\r05 \wReturned values: \drounded^n^n" );
3916 len += format( menu[len], 2047 - len, "\r \wResults:^n" );
3917
3918 if( g_bDetailedResults[plr] )
3919 {
3920 len += format( menu[len], 2047 - len, "\r \wX-Distance: \d%i^n", floatround( floatabs( g_vFirstLoc[plr][0] - g_vSecondLoc[plr][0] ), floatround_round ) );
3921 len += format( menu[len], 2047 - len, "\r \wY-Distance: \d%i^n", floatround( floatabs( g_vFirstLoc[plr][1] - g_vSecondLoc[plr][1] ), floatround_round ) );
3922 }
3923
3924 len += format( menu[len], 2047 - len, "\r \wHeight difference: \d%i^n", floatround( floatabs( g_vFirstLoc[plr][2] - g_vSecondLoc[plr][2] ), floatround_round ) );
3925 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 ) );
3926
3927 }
3928
3929 len += format( menu[len], 2047 - len, "\r06. \wShow beams: \d%s^n^n", g_bShowBeams[plr] ? "on" : "off" );
3930 len += format( menu[len], 2047 - len, "\r00. \wExit" );
3931
3932 show_menu( plr, ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 ), menu, -1 );
3933 menushow[plr] = true
3934 hidetime(plr)
3935}
3936
3937public menuAction( plr, key )
3938{
3939 switch( key )
3940 {
3941 case 0:
3942 {
3943 fm_get_aim_origin( plr, g_vFirstLoc[plr] );
3944
3945 if( g_bAutoSetting[plr] )
3946 {
3947 get_tr2( 0, TR_vecPlaneNormal, g_vSecondLoc[plr] );
3948
3949 xs_vec_mul_scalar( g_vSecondLoc[plr], 9999.0, g_vSecondLoc[plr] );
3950 xs_vec_add( g_vFirstLoc[plr], g_vSecondLoc[plr], g_vSecondLoc[plr] );
3951
3952 fm_trace_line( plr, g_vFirstLoc[plr], g_vSecondLoc[plr], g_vSecondLoc[plr] );
3953 }
3954
3955 menuDisplay( plr );
3956 }
3957 case 1:
3958 {
3959 fm_get_aim_origin( plr, g_vSecondLoc[plr] );
3960
3961 if( g_bAutoSetting[plr] )
3962 {
3963 get_tr2( 0, TR_vecPlaneNormal, g_vFirstLoc[plr] );
3964
3965 xs_vec_mul_scalar( g_vFirstLoc[plr], 9999.0, g_vFirstLoc[plr] );
3966 xs_vec_add( g_vFirstLoc[plr], g_vSecondLoc[plr], g_vFirstLoc[plr] );
3967
3968 fm_trace_line( plr, g_vSecondLoc[plr], g_vFirstLoc[plr], g_vFirstLoc[plr] );
3969 }
3970
3971 menuDisplay( plr );
3972 }
3973 case 2:
3974 {
3975 g_bAutoSetting[plr] = !g_bAutoSetting[plr];
3976 menuDisplay( plr );
3977 }
3978 case 3:
3979 {
3980 g_bDetailedResults[plr] = !g_bDetailedResults[plr];
3981 menuDisplay( plr );
3982 }
3983 case 4:
3984 {
3985 g_bReturnFloat[plr] = !g_bReturnFloat[plr];
3986 menuDisplay( plr );
3987 }
3988 case 5:
3989 {
3990 g_bShowBeams[plr] = !g_bShowBeams[plr];
3991
3992 if( !g_bShowBeams[plr] && task_exists( plr + TASK_BEAM ) )
3993 {
3994 remove_task( plr + TASK_BEAM );
3995 }
3996 else
3997 {
3998 set_task( 0.1, "tskBeam", plr + TASK_BEAM, _, _, "ab" );
3999 }
4000
4001 menuDisplay( plr );
4002 }
4003 case 9:
4004 {
4005 remove_task( plr + TASK_BEAM );
4006 show_menu( plr, 0, "" );
4007 menushow[plr] = false
4008 set_task(0.3, "showtimeduel", plr)
4009 }
4010 }
4011}
4012
4013public tskBeam( plr )
4014{
4015 plr -= TASK_BEAM;
4016
4017 draw_beam( plr, g_vFirstLoc[plr], g_vSecondLoc[plr], g_iColors[0], g_iColors[1], g_iColors[2] );
4018
4019 if( floatabs( g_vFirstLoc[plr][2] - g_vSecondLoc[plr][2] ) >= 2 )
4020 {
4021 static Float:temp[3];
4022 temp[0] = g_vSecondLoc[plr][0];
4023 temp[1] = g_vSecondLoc[plr][1];
4024 temp[2] = g_vFirstLoc[plr][2];
4025
4026 draw_beam( plr, g_vFirstLoc[plr], temp, g_iColors[0], g_iColors[1], g_iColors[2] );
4027 draw_beam( plr, temp, g_vSecondLoc[plr], g_iColors[0], g_iColors[1], g_iColors[2] );
4028 }
4029}
4030
4031public draw_beam( plr, Float:aorigin[3], Float:borigin[3], r, g, b )
4032{
4033
4034 message_begin( MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, { 0.0, 0.0, 0.0 }, plr );
4035 write_byte( TE_BEAMPOINTS );
4036 engfunc( EngFunc_WriteCoord, aorigin[0] );
4037 engfunc( EngFunc_WriteCoord, aorigin[1] );
4038 engfunc( EngFunc_WriteCoord, aorigin[2] );
4039 engfunc( EngFunc_WriteCoord, borigin[0] );
4040 engfunc( EngFunc_WriteCoord, borigin[1] );
4041 engfunc( EngFunc_WriteCoord, borigin[2] );
4042 write_short( g_flBeam );
4043 write_byte( 0 );
4044 write_byte( 0 );
4045 write_byte( 2 );
4046 write_byte( 20 );
4047 write_byte( 0 );
4048 write_byte( r );
4049 write_byte( g );
4050 write_byte( b );
4051 write_byte( 150 );
4052 write_byte( 0 );
4053 message_end( );
4054}
4055
4056
4057
4058is_user_ducking( plr )
4059{
4060 if( !pev_valid( plr ) )
4061 {
4062 return 0;
4063 }
4064
4065 new Float:abs_min[3], Float:abs_max[3];
4066 pev( plr, pev_absmin, abs_min );
4067 pev( plr, pev_absmax, abs_max );
4068
4069 abs_min[2] += 64.0;
4070
4071 if( abs_min[2] < abs_max[2] )
4072 {
4073 return 0;
4074 }
4075
4076 return 1;
4077}
4078
4079fm_get_aim_origin( plr, Float:origin[3] )
4080{
4081 new Float:start[3], Float:view_ofs[3];
4082 pev( plr, pev_origin, start );
4083 pev( plr, pev_view_ofs, view_ofs );
4084 xs_vec_add( start, view_ofs, start );
4085
4086 new Float:dest[3];
4087 pev( plr, pev_v_angle, dest );
4088 engfunc( EngFunc_MakeVectors, dest);
4089 global_get( glb_v_forward, dest );
4090 xs_vec_mul_scalar( dest, 9999.0, dest );
4091 xs_vec_add( start, dest, dest );
4092
4093 engfunc( EngFunc_TraceLine, start, dest, 0, plr, 0 );
4094 get_tr2( 0, TR_vecEndPos, origin );
4095
4096 return 1;
4097}
4098
4099fm_trace_line( ignoreent, const Float:start[3], const Float:end[3], Float:ret[3] )
4100{
4101 engfunc( EngFunc_TraceLine, start, end, ignoreent == -1 ? 1 : 0, ignoreent, 0 );
4102
4103 new ent = get_tr2( 0, TR_pHit );
4104 get_tr2( 0, TR_vecEndPos, ret );
4105
4106 return pev_valid( ent ) ? ent : 0;
4107}
4108
4109
4110// ============================================= End of Measure Tool ==============================================///
4111
4112
4113#if defined USE_SQL
4114public kz_update_plrname(id)
4115{
4116 new createinto[1001], authid[32], name[32]
4117 get_user_authid(id, authid, 31)
4118 get_user_name(id, name, 31)
4119 replace_all(name, 31, "\", "")
4120 replace_all(name, 31, "`", "")
4121 replace_all(name, 31, "'", "")
4122 replace_all(name, 31, ";", "")
4123 replace_all(name, 31, "#", "")
4124
4125 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") )
4126 return PLUGIN_HANDLED;
4127 if(is_user_connected(id) && !is_user_bot(id))
4128 {
4129 formatex(createinto, 1000, "UPDATE `kz_pro15` SET name='%s' WHERE authid='%s'", name, authid)
4130 SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
4131 formatex(createinto, 1000, "UPDATE `kz_nub15` SET name='%s' WHERE authid='%s'", name, authid)
4132 SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
4133 formatex(createinto, 1000, "UPDATE `uq_players` SET name='%s' WHERE authid='%s'", name, authid)
4134 SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
4135
4136 }
4137 return PLUGIN_HANDLED;
4138}
4139
4140
4141
4142#endif
4143
4144public Teleport(id)
4145{
4146 if ( get_playersnum() > 1 && is_user_alive(id) || DefaultStop) {
4147 static menuid, player, name[32], buffer[1]
4148 menuid = menu_create("Teleport Menu", "TeleportHandle")
4149 if(DefaultStop) {
4150 menu_additem( menuid, "Finish Position", "1" )
4151 }
4152 for (player = 1; player <= g_maxplayers; player++)
4153 {
4154 if (!is_user_alive(player) || player == id)
4155 continue;
4156
4157 get_user_name(player, name, charsmax(name))
4158 if(DefaultStop) {
4159 buffer[0] = player + 1
4160 }
4161 else {
4162 buffer[0] = player
4163 }
4164 menu_additem(menuid, name, buffer)
4165 }
4166
4167 menu_display(id, menuid)
4168 menushow[id] = true
4169 hidetime(id)
4170 } else {
4171 kz_menu(id)
4172 return PLUGIN_HANDLED;
4173 }
4174 return PLUGIN_HANDLED;
4175}
4176
4177
4178public TeleportHandle(id, menuid, item)
4179{
4180 if (item == MENU_EXIT)
4181 {
4182 kz_menu(id)
4183 return PLUGIN_HANDLED;
4184 }
4185 static buffer[1], dummy, player
4186 menu_item_getinfo(menuid, item, dummy, buffer, sizeof(buffer), _, _, dummy)
4187 if(DefaultStop) {
4188 player = buffer[0] - 1
4189 } else {
4190 player = buffer[0]
4191 }
4192 new szPlayerName[32], szName[32]
4193 get_user_name(id, szName, 32)
4194 get_user_name(player, szPlayerName, 32)
4195
4196 new entclassname[33];
4197 pev(pev(id, pev_groundentity), pev_classname, entclassname, 32);
4198 if( ((!( pev( id, pev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) || (equal(entclassname, "func_door") && !IsOnLadder(id))) && timer_started[id] && !IsPaused[id])
4199 {
4200 ColorChat(id, GREEN, "[KZ.M]^x01 Cannot teleport now")
4201 Teleport(id)
4202 return PLUGIN_HANDLED
4203 }
4204 if (timer_started[id] && !IsPaused[id]) {
4205 Pause(id)
4206 }
4207 if (item == 0 && DefaultStop)
4208 {
4209 set_pev(id, pev_velocity, Float:{0.0, 0.0, 0.0})
4210 set_pev(id, pev_origin, DefaultStopPos)
4211 delay_duck(id)
4212 Teleport(id)
4213 return PLUGIN_HANDLED;
4214 }
4215 if (!is_user_alive(player) || player == id)
4216 {
4217 menu_destroy(menuid)
4218 menushow[id] = false
4219 set_task(0.3, "showtimeduel", id)
4220
4221 return PLUGIN_HANDLED;
4222 }
4223 if ( get_gametime() - antiteleport[id] < 5.0 )
4224 {
4225 ColorChat(id, GREEN, "[KZ.M]^x01 Wait 5 seconds!")
4226 Teleport(id)
4227 return PLUGIN_HANDLED;
4228 }
4229 static Float:pos[3]
4230 entity_get_vector(player, EV_VEC_origin, pos)
4231 entity_set_origin(id, pos)
4232 delay_duck( id )
4233 Teleport(id)
4234
4235 antiteleport[id] = get_gametime()
4236 return PLUGIN_HANDLED;
4237}
4238
4239public delay_duck(id){
4240 new ida[1]
4241 ida[0]=id
4242 set_task(0.01,"force_duck",_,ida,1)
4243 set_entity_flags(ida[0],FL_DUCKING,1)
4244}
4245
4246public force_duck(ida[1]){
4247 set_entity_flags(ida[0],FL_DUCKING,1)
4248}
4249
4250
4251
4252
4253
4254
4255
4256// =================================================================================================
4257// Menu
4258// =================================================================================================
4259
4260
4261public kz_menu(id)
4262{
4263 new title[128];
4264 new ctime[64]
4265 get_time("%m.%d.%Y - %H:%M:%S", ctime, 63)
4266 new a = get_timeleft()
4267
4268
4269 formatex(title, 127, "\d \r ^n^n\dServer Time: %s^nMap: \y%s \dTimeleft: \y%d:%02d", ctime, MapName, (a / 60), (a % 60))
4270 new menu = menu_create(title, "MenuHandler")
4271
4272 new msgcheck[64], msggocheck[64], msgpause[64]
4273 formatex(msgcheck, 63, "Checkpoint - \y#%i", checknumbers[id])
4274 formatex(msggocheck, 63, "Gocheck - \y#%i", gochecknumbers[id])
4275 formatex(msgpause, 63, "Pause - %s^n", IsPaused[id] ? "\yOn" : "\rOff" )
4276
4277
4278 menu_additem( menu, msgcheck, "1" )
4279 menu_additem( menu, msggocheck, "2" )
4280 menu_additem( menu, "Teleport^n", "3" )
4281 menu_additem( menu, "Save Start", "4")
4282 menu_additem( menu, "Start", "5")
4283 menu_additem( menu, msgpause, "6" )
4284 menu_additem( menu, "Duel Menu", "7" ) // --- Duel menu
4285 menu_additem( menu, "Spectator/CT", "8" )
4286 menu_additem( menu, "More^n", "9") // --- More + Invis + Timer
4287 menu_additem( menu, "Exit", "0" )
4288
4289 menu_setprop(menu, MPROP_PERPAGE, 0)
4290 menu_display(id, menu, 0)
4291 menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
4292 menushow[id] = true
4293 hidetime(id)
4294 return PLUGIN_HANDLED
4295}
4296
4297public MenuHandler(id , menu, item)
4298{
4299 if( item == MENU_EXIT ) {
4300 menu_destroy(menu)
4301 return PLUGIN_HANDLED
4302 }
4303
4304
4305 switch(item) {
4306 case 0:{
4307 CheckPoint(id)
4308 kz_menu(id)
4309 }
4310 case 1:{
4311 GoCheck(id)
4312 kz_menu(id)
4313 }
4314 case 2:{
4315 new Playersnum[32], playerscount
4316 get_players(Playersnum, playerscount, "ah")
4317 if(playerscount > 1 || DefaultStop){
4318 Teleport(id)
4319 } else {
4320 kz_menu(id)
4321 }
4322
4323 }
4324 case 3:{
4325 CheckPointStart(id)
4326 kz_menu(id)
4327 }
4328 case 4:{
4329 goStart1(id)
4330 kz_menu(id)
4331 }
4332 case 5:{
4333 Pause(id)
4334 kz_menu(id)
4335 }
4336 case 6:{
4337 DuelMenu(id)
4338 }
4339 case 7:{
4340 ct(id)
4341 kz_menu(id)
4342 }
4343 case 8:{
4344 MoreMenu(id)
4345 }
4346 case 9:{
4347 menushow[id] = false
4348 set_task(0.3, "showtimeduel", id)
4349 }
4350 }
4351
4352 return PLUGIN_HANDLED
4353}
4354
4355
4356
4357public DuelMenu(id)
4358{
4359 new menu = menu_create("\yDuel Menu\w", "DuelMenuHandler")
4360
4361
4362 menu_additem( menu, "Duel", "1" )
4363 menu_additem( menu, "Show Duels", "2" )
4364 menu_additem( menu, "Duel Top^n", "3" )
4365 menu_additem( menu, "Back", "4" )
4366
4367 menu_display(id, menu, 0)
4368 menushow[id] = true
4369 hidetime(id)
4370 return PLUGIN_HANDLED
4371}
4372
4373public DuelMenuHandler (id, menu, item)
4374{
4375 if( item == MENU_EXIT )
4376 {
4377 menu_destroy(menu)
4378 menushow[id] = false
4379 set_task(0.3, "showtimeduel", id)
4380
4381 return PLUGIN_HANDLED
4382 }
4383 if(get_pcvar_num(kz_duel) == 0){
4384 return PLUGIN_HANDLED;
4385 }
4386 switch(item)
4387 {
4388 case 0:
4389 {
4390 if(callfunc_begin("duel_start","duel.amxx") == 1)
4391 {
4392 callfunc_push_int(id)
4393 callfunc_end()
4394 }
4395 }
4396 case 1:
4397 {
4398 if(callfunc_begin("show_duels","duel.amxx") == 1)
4399 {
4400 callfunc_push_int(id)
4401 callfunc_end()
4402 }
4403 DuelMenu(id)
4404 }
4405 case 2:
4406 {
4407 if(callfunc_begin("show_top","duel.amxx") == 1)
4408 {
4409 callfunc_push_int(id)
4410 callfunc_end()
4411 }
4412 DuelMenu(id)
4413 }
4414 case 3:
4415 {
4416 kz_menu(id)
4417 }
4418 }
4419 return PLUGIN_HANDLED
4420}
4421
4422
4423
4424
4425
4426
4427
4428
4429public GocheckMode(id)
4430{
4431 if(!tpfenabled[id])
4432 {
4433 tpfenabled[id] = true
4434 kz_chat(id, "Checkpoint Angle Fix Enabled")
4435 }
4436 else
4437 {
4438 tpfenabled[id] = false
4439 kz_chat(id, "Checkpoint Angle Fix Disabled")
4440 }
4441 return PLUGIN_HANDLED
4442}
4443
4444
4445
4446
4447public MoreMenu(id)
4448{
4449 new menu = menu_create("\yMore Options\w", "MoreMenuHandler")
4450 new msgtpf[64]
4451 formatex(msgtpf, 63, "Chekpoint Mode - %s^n", tpfenabled[id] ? "\yOn" : "\rOff" )
4452
4453 menu_additem( menu, "Top 15", "1" )
4454 menu_additem( menu, "Invisible Menu", "2" )
4455 menu_additem( menu, msgtpf, "3" )
4456 menu_additem( menu, "Measure Tool", "4" )
4457 menu_additem( menu, "Back", "4" )
4458
4459 menu_display(id, menu, 0)
4460 menushow[id] = true
4461 hidetime(id)
4462 return PLUGIN_HANDLED
4463}
4464
4465public MoreMenuHandler (id, menu, item)
4466{
4467 if( item == MENU_EXIT )
4468 {
4469 menu_destroy(menu)
4470 menushow[id] = false
4471 set_task(0.3, "showtimeduel", id)
4472
4473 return PLUGIN_HANDLED
4474 }
4475 switch(item)
4476 {
4477 case 0:
4478 {
4479 top15menu(id)
4480 }
4481 case 1:
4482 {
4483 InvisMenu(id)
4484 }
4485 case 2:
4486 {
4487 GocheckMode(id)
4488 MoreMenu(id)
4489 }
4490
4491 case 3:
4492 {
4493 cmdMeasure(id)
4494 }
4495 case 4:
4496 {
4497 kz_menu(id)
4498 }
4499 }
4500 return PLUGIN_HANDLED
4501}
4502
4503
4504
4505
4506public InvisMenu(id)
4507{
4508 new menu = menu_create("\yInvis Menu\w", "InvisMenuHandler")
4509 new msginvis[64], msgwaterinvis[64]
4510
4511 formatex(msginvis, 63, "Players - %s", gViewInvisible[id] ? "\yOn" : "\rOff" )
4512 formatex(msgwaterinvis, 63, "Water - %s^n^n", gWaterInvisible[id] ? "\yOn" : "\rOff" )
4513
4514 menu_additem( menu, msginvis, "1" )
4515 menu_additem( menu, msgwaterinvis, "2" )
4516 menu_additem( menu, "Back", "3" )
4517
4518 menu_display(id, menu, 0)
4519 menushow[id] = true
4520 hidetime(id)
4521 return PLUGIN_HANDLED
4522}
4523
4524public InvisMenuHandler (id, menu, item)
4525{
4526 if( item == MENU_EXIT )
4527 {
4528 menu_destroy(menu)
4529 menushow[id] = false
4530 set_task(0.3, "showtimeduel", id)
4531
4532 return PLUGIN_HANDLED
4533 }
4534
4535 switch(item)
4536 {
4537 case 0:
4538 {
4539 cmdInvisible(id)
4540 InvisMenu(id)
4541 }
4542 case 1:
4543 {
4544 cmdWaterInvisible(id)
4545 InvisMenu(id)
4546 }
4547 case 2:
4548 {
4549 MoreMenu(id)
4550 }
4551 }
4552 return PLUGIN_HANDLED
4553}
4554
4555public top15menu(id)
4556{
4557 new menu = menu_create("\rProKreedz \yTop15 \w", "top15handler")
4558 menu_additem(menu, "\wPro 15", "1", 0)
4559 menu_additem(menu, "\wNoob 15^n^n", "2", 0)
4560 #if defined USE_SQL
4561 menu_additem(menu, "My Results","3")
4562 menu_additem(menu, "Players Rank^n","4")
4563 menu_additem(menu, "Last 10 Pro", "5")
4564 menu_additem(menu, "Maps","6")
4565 menu_additem(menu, "Back", "7")
4566 #else
4567 menu_additem(menu, "\wBack", "3", 0)
4568 #endif
4569
4570 menu_display(id, menu, 0);
4571 menushow[id] = true
4572 hidetime(id)
4573 return PLUGIN_HANDLED;
4574}
4575
4576public top15handler(id, menu, item)
4577{
4578 if(item == MENU_EXIT)
4579 {
4580 menu_destroy(menu)
4581 menushow[id] = false
4582 set_task(0.3, "showtimeduel", id)
4583
4584 return PLUGIN_HANDLED
4585 }
4586 #if defined USE_SQL
4587 switch(item)
4588 {
4589 case 0:
4590 {
4591 ProTop_show(id)
4592 top15menu(id)
4593 }
4594 case 1:
4595 {
4596 NoobTop_show(id)
4597 top15menu(id)
4598 }
4599 case 2:
4600 {
4601 kz_showhtml_motd(id, PRO_RECORDS, "")
4602 top15menu(id)
4603 }
4604 case 3:
4605 {
4606 kz_showhtml_motd(id, PLAYERS_RANKING, "")
4607 top15menu(id)
4608 }
4609 case 4:
4610 {
4611 kz_showhtml_motd(id, LAST_PRO10, "")
4612 top15menu(id)
4613 }
4614 case 5:
4615 {
4616 kz_showhtml_motd(id, MAPS_STATISTIC, "")
4617 top15menu(id)
4618 }
4619 case 6:
4620 {
4621 MoreMenu(id)
4622 }
4623 }
4624 #else
4625 switch(item)
4626 {
4627 case 0:
4628 {
4629 ProTop_show(id)
4630 }
4631 case 1:
4632 {
4633 NoobTop_show(id)
4634 }
4635 case 2:
4636 {
4637 kz_menu(id)
4638 }
4639 }
4640 #endif
4641
4642 return PLUGIN_HANDLED;
4643}
4644
4645// =================================================================================================
4646
4647//
4648// Timersystem
4649// =================================================================================================
4650public fwdUse(ent, id)
4651{
4652 if( is_user_bot(id) )
4653 {
4654 return HAM_IGNORED;
4655 }
4656
4657 if( !ent || id > 32 )
4658 {
4659 return HAM_IGNORED;
4660 }
4661
4662 if( !is_user_alive(id) )
4663 {
4664 return HAM_IGNORED;
4665 }
4666
4667
4668 new name[32]
4669 get_user_name(id, name, 31)
4670
4671 new szTarget[ 32 ];
4672 pev(ent, pev_target, szTarget, 31);
4673
4674 if( TrieKeyExists( g_tStarts, szTarget ) )
4675 {
4676 if((!get_user_noclip(id) && get_gametime() - antinoclipstart[id] < 3.0) || get_user_noclip(id)) {
4677 kz_hud_message( id, "Wait 3 seconds after using noclip." );
4678 return PLUGIN_HANDLED
4679 }
4680 if ( get_gametime() - antihookcheat[id] < 3.0 || ishooked[id])
4681 {
4682 kz_hud_message( id, "%L", id, "KZ_HOOK_PROTECTION" );
4683 return PLUGIN_HANDLED
4684 }
4685
4686 if ( reset_checkpoints(id) && !timer_started[id] )
4687 {
4688 start_climb(id)
4689 if( get_user_health(id) < 100 )
4690 set_user_health(id, 100)
4691
4692 pev(id, pev_origin, SavedStart[id])
4693 AutoStart[id] = true;
4694
4695 if( !DefaultStart )
4696 {
4697 kz_set_start(MapName, SavedStart[id])
4698 ColorChat(id, GREEN, "%s^x01 %L", prefix, id, "KZ_SET_START")
4699 }
4700
4701 remove_hook(id)
4702 }
4703
4704 }
4705
4706 if( TrieKeyExists( g_tStops, szTarget ) )
4707 {
4708 if (tphook_user[id])
4709 return PLUGIN_HANDLED
4710 if( timer_started[id] )
4711 {
4712 if(get_user_noclip(id))
4713 return PLUGIN_HANDLED
4714 pev(id, pev_origin, SavedStop[id])
4715 if( !DefaultStop )
4716 {
4717 kz_set_stop(MapName, SavedStop[id])
4718 }
4719 finish_climb(id)
4720 }
4721 else
4722 kz_hud_message(id, "%L", id, "KZ_TIMER_NOT_STARTED")
4723
4724 }
4725 return HAM_IGNORED
4726}
4727
4728public start_climb(id)
4729{
4730 reset_checkpoints(id)
4731 client_print(id, print_center, "Timer Started")
4732
4733 new wpn
4734 wpn = get_user_weapon(id)
4735 if (wpn != CSW_KNIFE || wpn != CSW_USP) {
4736 strip_user_weapons(id)
4737 }
4738 if( !user_has_weapon(id, CSW_USP) ){
4739 give_item(id,"weapon_usp")
4740 cs_set_user_bpammo(id, CSW_USP, 36)
4741 }
4742 if( !user_has_weapon(id, CSW_KNIFE) ){
4743 give_item(id,"weapon_knife")
4744 }
4745 if( wpn == CSW_KNIFE ){
4746 strip_user_weapons(id)
4747 cmdUsp(id)
4748 engclient_cmd(id,"weapon_knife")
4749 }
4750 if( wpn == CSW_SCOUT )
4751 {
4752 if( !user_has_weapon(id, CSW_SCOUT) ){
4753 give_item(id,"weapon_scout")
4754 cs_set_user_bpammo(id, CSW_SCOUT, 20)
4755 }
4756 user_has_scout[id]=true
4757 }
4758 set_pev(id, pev_gravity, 1.0);
4759 set_pev(id, pev_movetype, MOVETYPE_WALK)
4760 IsPaused[id] = false
4761 timer_started[id] = true
4762 timer_time[id] = get_gametime()
4763 tphook_user[id] = false
4764 WasPlayed[id] = false
4765 if(user_has_scout[id]) {
4766 client_cmd(id, "spk fvox/blip");
4767 WasPlayed[id] = true
4768 }
4769 if(!menushow[id] && !user_has_scout[id]) {
4770 showtime1(id)
4771 }
4772 else if (!menushow[id] && user_has_scout[id]) {
4773 showtime2(id)
4774 }
4775 else {
4776 kz_menu(id)
4777 }
4778 GoPosed[id] = false
4779 GoPosCp[id] = false
4780 GoPosHp[id] = false
4781 tptostart[id] = false
4782}
4783
4784
4785public finish_climb(id)
4786{
4787 if(!sqlconnected) {
4788 plugin_sql()
4789 sqlconnected = true
4790 }
4791
4792 if (!is_user_alive (id))
4793 {
4794 return;
4795 }
4796
4797 if ( (get_pcvar_num(kz_top15_authid) > 1) || (get_pcvar_num(kz_top15_authid) < 0) )
4798 {
4799 ColorChat(id, GREEN, "%s^x01 %L.", prefix, id, "KZ_TOP15_DISABLED")
4800 return;
4801 }
4802 #if defined USE_SQL
4803 FinishMsg = true
4804 MyPosUpdated[id] = true
4805 set_task(0.5, "GetTop", id + TASK_GETTOP)
4806 new Float: time, wpn
4807 time = get_gametime() - timer_time[id]
4808
4809 if (get_pcvar_num(kz_wr_diff) == 1 && gochecknumbers[id] == 0) {
4810 WrDiffShow(id)
4811 }
4812 else {
4813 show_finish_message(id, time)
4814 }
4815 new checkpoints=checknumbers[id]
4816 new gocheck=gochecknumbers[id]
4817 if(user_has_scout[id])
4818 wpn=CSW_SCOUT
4819 else
4820 wpn=get_user_weapon( id )
4821
4822 new steam[32], name[32]
4823 get_user_name(id, name, 31)
4824 get_user_authid(id, steam, 31 )
4825 new createinto[1001]
4826
4827 new cData[192]
4828 cData[0] = id
4829 formatex(cData[2], charsmax(cData)-2, "^"%f^" ^"%d^" ^"%d^" ^"%d^"", time, wpn, checkpoints ,gocheck)
4830
4831 if (gochecknumbers[id] == 0 && !user_has_scout[id] )
4832 {
4833 cData[1] = PRO_TOP
4834 formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_pro15` WHERE mapname='%s' AND authid='%s'", MapName, steam)
4835 SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
4836 }
4837 if ( gochecknumbers[id] > 0 || user_has_scout[id] )
4838 {
4839 cData[1] = NUB_TOP
4840 formatex(createinto, sizeof createinto - 1, "SELECT time FROM `kz_nub15` WHERE mapname='%s' AND authid='%s'", MapName, steam)
4841 SQL_ThreadQuery(g_SqlTuple, "Set_QueryHandler", createinto, cData, strlen(cData[2])+1)
4842 }
4843
4844 #else
4845 new Float: time, authid[32]
4846 time = get_gametime() - timer_time[id]
4847 get_user_authid(id, authid, 31)
4848 if (get_pcvar_num(kz_wr_diff) == 1 && gochecknumbers[id] == 0) {
4849 WrDiffShow(id)
4850 }
4851 else {
4852 show_finish_message(id, time)
4853 }
4854 if (gochecknumbers[id] == 0 && !user_has_scout[id] )
4855 ProTop_update(id, time)
4856 ( gochecknumbers[id] > 0 || user_has_scout[id] )
4857 NoobTop_update(id, time, checknumbers[id], gochecknumbers[id])
4858 #endif
4859 reset_checkpoints(id)
4860}
4861
4862public show_finish_message(id, Float:kreedztime)
4863{
4864 new name[32]
4865 new imin,isec,ims, wpn
4866 if(user_has_scout[id])
4867 wpn=CSW_SCOUT
4868 else
4869 wpn=get_user_weapon( id )
4870 get_user_name(id, name, 31)
4871 imin = floatround(kreedztime / 60.0, floatround_floor)
4872 isec = floatround(kreedztime - imin * 60.0,floatround_floor)
4873 ims = floatround( ( kreedztime - ( imin * 60.0 + isec ) ) * 100.0, floatround_round )
4874 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])
4875}
4876
4877
4878
4879public WrDiffShow(id) {
4880
4881 new Float:zClimbTime = get_gametime() - timer_time[id];
4882 new name[32]
4883 get_user_name(id, name, 31)
4884
4885 new imin,isec,ims
4886
4887 imin = floatround(zClimbTime / 60.0, floatround_floor)
4888 isec = floatround(zClimbTime - imin * 60.0,floatround_floor)
4889 ims = floatround( ( zClimbTime - ( imin * 60.0 + isec ) ) * 100.0, floatround_round )
4890
4891 if (g_iWorldRecordsNum > 0) {
4892 if (zClimbTime < DiffWRTime[0]) {
4893
4894 new Float:sDiffTime = DiffWRTime[0] - zClimbTime;
4895 new szDiffTime[16]
4896 WRTimer(sDiffTime, szDiffTime, sizeof(szDiffTime) - 1, true, false)
4897 ColorChat(0, RED, "%s^x04 %s^x01 finished in ^x04%02i:%02i.%02i ^x01(^x03WR -%s)", prefix, name, imin, isec, ims, szDiffTime);
4898
4899 }
4900 else {
4901 new Float:sDiffTime = zClimbTime - DiffWRTime[0];
4902 new szDiffTime[16]
4903 WRTimer(sDiffTime, szDiffTime, sizeof(szDiffTime) - 1, true, false)
4904 ColorChat(0, GREEN, "%s^x04 %s^x01 finished in ^x04%02i:%02i.%02i ^x01(^x03WR +%s)", prefix, name, imin, isec, ims, szDiffTime);
4905 }
4906 }
4907 else if (!g_iWorldRecordsNum){
4908 show_finish_message(id, zClimbTime);
4909 }
4910 return PLUGIN_CONTINUE;
4911}
4912
4913
4914
4915
4916//==========================================================
4917#if defined USE_SQL
4918public Set_QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
4919{
4920 new id = cData[0]
4921 new style = cData[1]
4922
4923 if( iFailState != TQUERY_SUCCESS )
4924 {
4925 log_amx("[KZ.M] TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
4926 ColorChat(0, GREEN, "%s^x01 %F", prefix, LANG_PLAYER, "KZ_TOP15_SQL_ERROR")
4927 }
4928 new createinto[1001]
4929 new x1[16], x2[4], x3[5], x4[5]
4930 parse(cData[2], x1, 15, x2, 3, x3, 4, x4, 4)
4931
4932 new dia[64], steam[32], name[32], ip[15], country[3], checkpoints[32], gochecks[32]
4933 new Float:newtime = str_to_float(x1)
4934 new iMin, iSec, iMs, server[64]
4935 get_pcvar_string(kz_sql_name, server, 63)
4936 get_time("%Y%m%d%H%M%S", dia, sizeof dia - 1)
4937 get_user_authid(id, steam, 31)
4938 get_user_name(id, name, sizeof name - 1)
4939 get_user_ip (id, ip, sizeof ip - 1, 1)
4940 geoip_code2_ex( ip, country)
4941 replace_all(name, 31, "\", "")
4942 replace_all(name, 31, "`", "")
4943 replace_all(name, 31, "'", "")
4944 replace_all(name, 31, ";", "")
4945 replace_all(name, 31, "#", "")
4946
4947 if( SQL_NumResults(hQuery) == 0 )
4948 {
4949 formatex(checkpoints, 31, ", '%d'", str_to_num(x3))
4950 formatex(gochecks, 31, ", '%d'", str_to_num(x4))
4951 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)
4952 SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
4953 GetNewRank(id, style)
4954 }
4955 else
4956 {
4957 new Float:oldtime, Float:thetime
4958 SQL_ReadResult(hQuery, 0, oldtime)
4959
4960 if(newtime < oldtime)
4961 {
4962 thetime = oldtime - newtime
4963 iMin = floatround(thetime / 60.0, floatround_floor)
4964 iSec = floatround(thetime - iMin * 60.0,floatround_floor)
4965 iMs = floatround( ( thetime - ( iMin * 60.0 + iSec ) ) * 100.0, floatround_round )
4966
4967 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")
4968 formatex(checkpoints, 31, ", checkpoints='%d'", str_to_num(x3))
4969 formatex(gochecks, 31, ", gocheck='%d'", str_to_num(x4))
4970 if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 19)
4971 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)
4972 else
4973 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)
4974
4975 SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto )
4976 GetNewRank(id, style)
4977 }
4978 else
4979 {
4980 thetime = newtime - oldtime
4981 iMin = floatround(thetime / 60.0, floatround_floor)
4982 iSec = floatround(thetime - iMin * 60.0,floatround_floor)
4983 iMs = floatround( ( thetime - ( iMin * 60.0 + iSec ) ) * 100.0, floatround_round )
4984 client_cmd(0, "spk fvox/bell");
4985 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")
4986 }
4987 }
4988
4989 return PLUGIN_CONTINUE
4990
4991}
4992
4993public GetNewRank_QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
4994{
4995 new id = cData[0]
4996 if( iFailState != TQUERY_SUCCESS )
4997 {
4998 return log_amx("TOP15 SQL: SQL Error #%d - %s", iErrnum, szError)
4999 }
5000
5001 new steam[32], authid[32], namez[32], name[32], i = 0
5002 get_user_authid(id, steam, 31)
5003 get_user_name(id, namez, 31)
5004
5005 while( SQL_MoreResults(hQuery) )
5006 {
5007 i++
5008
5009 SQL_ReadResult(hQuery, 0, name, 31)
5010 SQL_ReadResult(hQuery, 0, authid, 31)
5011 if( equal(name, namez) || equal(authid, steam) )
5012 {
5013
5014 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");
5015 if( (i + 1) == 2)
5016 {
5017 client_cmd(0, "spk misc/mod_unstopable");
5018 TopUpdated = true
5019 }
5020 else
5021 {
5022 client_cmd(0, "spk buttons/bell1");
5023 }
5024 break;
5025 }
5026 SQL_NextRow(hQuery)
5027 }
5028 set_task(0.1, "kz_update_plrname", id)
5029 return PLUGIN_CONTINUE
5030}
5031
5032public ProTop_show(id)
5033{
5034 kz_showhtml_motd(id, PRO_TOP, MapName)
5035
5036 return PLUGIN_HANDLED
5037}
5038
5039public NoobTop_show(id)
5040{
5041
5042 kz_showhtml_motd(id, NUB_TOP, MapName)
5043
5044 return PLUGIN_HANDLED
5045}
5046
5047public ProRecs_show(id)
5048{
5049 new authid[32]
5050 get_user_authid(id, authid, 31)
5051
5052 if(equal(authid, "VALVE_ID_LAN") || equal(authid, "STEAM_ID_LAN") || strlen(authid) > 19)
5053 {
5054 ColorChat (id, GREEN, "%s^x01 %L", prefix, id, "KZ_NO_STEAM")
5055 return PLUGIN_HANDLED
5056 }
5057
5058 kz_showhtml_motd(id, PRO_RECORDS, MapName)
5059
5060 return PLUGIN_HANDLED
5061}
5062
5063stock kz_showhtml_motd(id, type, const map[])
5064{
5065 new buffer[1001], namebuffer[64], filepath[96]
5066 get_pcvar_string(kz_sql_files, filepath, 95)
5067 new authid[32]
5068 get_user_authid(id, authid, 31)
5069 new player_namez[32]
5070 get_user_name(id, player_namez, 31)
5071
5072
5073 switch( type )
5074 {
5075 case PRO_TOP:
5076 {
5077 formatex(namebuffer, 63, "Pro 15 of %s", equal(map, "") ? "All Maps" : map)
5078 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)
5079 }
5080 case NUB_TOP:
5081 {
5082 formatex(namebuffer, 63, "Noob 15 of %s", equal(map, "") ? "All Maps" : map)
5083 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)
5084 }
5085 case PRO_RECORDS:
5086 {
5087 formatex(namebuffer, 63, "ProRecords and Rank")
5088 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)
5089 }
5090 case PLAYERS_RANKING:
5091 {
5092 formatex(namebuffer, 63, "Players Ranking")
5093 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)
5094 }
5095 case LAST_PRO10:
5096 {
5097 formatex(namebuffer, 63, "Last 10 Pro Entries")
5098 formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/lastpro.php^"></head><body><p>LOADING...</p></body></html>", filepath)
5099 }
5100 case MAPS_STATISTIC:
5101 {
5102 formatex(namebuffer, 63, "Maps Statistic")
5103 formatex(buffer, 1000, "<html><head><meta http-equiv=^"Refresh^" content=^"0;url=http://%s/map.php^"></head><body><p>LOADING...</p></body></html>", filepath)
5104 }
5105 }
5106
5107 show_motd(id, buffer, namebuffer)
5108}
5109
5110
5111
5112#else
5113
5114
5115
5116public ProTop_update(id, Float:time)
5117{
5118 new authid[32], name[32], thetime[32], Float: slower, Float: faster, Float:protiempo
5119 get_user_name(id, name, 31);
5120 get_user_authid(id, authid, 31);
5121 get_time(" %d/%m/%Y ", thetime, 31);
5122 new bool:Is_in_pro15
5123 Is_in_pro15 = false
5124
5125 for(new i = 0; i < 15; i++)
5126 {
5127 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)) )
5128 {
5129 Is_in_pro15 = true
5130 slower = time - Pro_Times[i]
5131 faster = Pro_Times[i] - time
5132 protiempo = Pro_Times[i]
5133 }
5134 }
5135
5136 for (new i = 0; i < 15; i++)
5137 {
5138 if( time < Pro_Times[i])
5139 {
5140 new pos = i
5141 if ( get_pcvar_num(kz_top15_authid) == 0 )
5142 while( !equal(Pro_Names[pos], name) && pos < 15 )
5143 {
5144 pos++;
5145 }
5146 else if ( get_pcvar_num(kz_top15_authid) == 1)
5147 while( !equal(Pro_AuthIDS[pos], authid) && pos < 15 )
5148 {
5149 pos++;
5150 }
5151
5152 for (new j = pos; j > i; j--)
5153 {
5154 formatex(Pro_AuthIDS[j], 31, Pro_AuthIDS[j-1]);
5155 formatex(Pro_Names[j], 31, Pro_Names[j-1]);
5156 formatex(Pro_Date[j], 31, Pro_Date[j-1])
5157 Pro_Times[j] = Pro_Times[j-1];
5158 }
5159
5160 formatex(Pro_AuthIDS[i], 31, authid);
5161 formatex(Pro_Names[i], 31, name);
5162 formatex(Pro_Date[i], 31, thetime)
5163 Pro_Times[i] = time
5164
5165 save_pro15()
5166
5167 if( Is_in_pro15 )
5168 {
5169
5170 if( time < protiempo )
5171 {
5172 new min, Float:sec;
5173 min = floatround(faster, floatround_floor)/60;
5174 sec = faster - (60*min);
5175 ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_IMPROVE", min, sec < 10 ? "0" : "", sec);
5176
5177 if( (i + 1) == 1)
5178 {
5179 client_cmd(0, "spk misc/mod_unstopable");
5180 ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
5181 }
5182 else
5183 {
5184 client_cmd(0, "spk buttons/bell1");
5185 ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
5186 }
5187 }
5188 }
5189 else
5190 {
5191 if( (i + 1) == 1)
5192 {
5193 client_cmd(0, "spk misc/mod_unstopable");
5194 ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
5195 }
5196 else
5197 {
5198 client_cmd(0, "spk buttons/bell1");
5199 ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Pro 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
5200 }
5201 }
5202
5203 return;
5204 }
5205
5206 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)) )
5207 {
5208 if( time > protiempo )
5209 {
5210 new min, Float:sec;
5211 min = floatround(slower, floatround_floor)/60;
5212 sec = slower - (60*min);
5213 client_cmd(0, "spk fvox/bell");
5214 ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_SLOWER", min, sec < 10 ? "0" : "", sec);
5215 return;
5216 }
5217 }
5218
5219 }
5220}
5221
5222
5223
5224
5225public save_pro15()
5226{
5227 new profile[128]
5228 formatex(profile, 127, "%s/pro_%s.cfg", Topdir, MapName)
5229
5230 if( file_exists(profile) )
5231 {
5232 delete_file(profile)
5233 }
5234
5235 new Data[256];
5236 new f = fopen(profile, "at")
5237
5238 for(new i = 0; i < 15; i++)
5239 {
5240 formatex(Data, 255, "^"%.2f^" ^"%s^" ^"%s^" ^"%s^"^n", Pro_Times[i], Pro_AuthIDS[i], Pro_Names[i], Pro_Date[i])
5241 fputs(f, Data)
5242 }
5243 fclose(f);
5244}
5245
5246public read_pro15()
5247{
5248 new profile[128], prodata[256]
5249 formatex(profile, 127, "%s/pro_%s.cfg", Topdir, MapName)
5250
5251 new f = fopen(profile, "rt" )
5252 new i = 0
5253 while( !feof(f) && i < 16)
5254 {
5255 fgets(f, prodata, 255)
5256 new totime[25]
5257 parse(prodata, totime, 24, Pro_AuthIDS[i], 31, Pro_Names[i], 31, Pro_Date[i], 31)
5258 Pro_Times[i] = str_to_float(totime)
5259 i++;
5260 }
5261 fclose(f)
5262}
5263
5264//==================================================================================================
5265
5266public NoobTop_update(id, Float:time, checkpoints, gochecks)
5267{
5268 new authid[32], name[32], thetime[32], wpn, Float: slower, Float: faster, Float:noobtiempo
5269 get_user_name(id, name, 31);
5270 get_user_authid(id, authid, 31);
5271 get_time(" %d/%m/%Y ", thetime, 31);
5272 new bool:Is_in_noob15
5273 Is_in_noob15 = false
5274 if(user_has_scout[id])
5275 wpn=CSW_SCOUT
5276 else
5277 wpn=get_user_weapon(id)
5278
5279 for(new i = 0; i < 15; i++)
5280 {
5281 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)) )
5282 {
5283 Is_in_noob15 = true
5284 slower = time - Noob_Tiempos[i];
5285 faster = Noob_Tiempos[i] - time;
5286 noobtiempo = Noob_Tiempos[i]
5287 }
5288 }
5289
5290 for (new i = 0; i < 15; i++)
5291 {
5292 if( time < Noob_Tiempos[i])
5293 {
5294 new pos = i
5295
5296 if ( get_pcvar_num(kz_top15_authid) == 0 )
5297 while( !equal(Noob_Names[pos], name) && pos < 15 )
5298 {
5299 pos++;
5300 }
5301 else if ( get_pcvar_num(kz_top15_authid) == 1)
5302 while( !equal(Noob_AuthIDS[pos], authid) && pos < 15 )
5303 {
5304 pos++;
5305 }
5306
5307 for (new j = pos; j > i; j--)
5308 {
5309 formatex(Noob_AuthIDS[j], 31, Noob_AuthIDS[j-1])
5310 formatex(Noob_Names[j], 31, Noob_Names[j-1])
5311 formatex(Noob_Date[j], 31, Noob_Date[j-1])
5312 formatex(Noob_Weapon[j], 31, Noob_Weapon[j-1])
5313 Noob_Tiempos[j] = Noob_Tiempos[j-1]
5314 Noob_CheckPoints[j] = Noob_CheckPoints[j-1]
5315 Noob_GoChecks[j] = Noob_GoChecks[j-1]
5316 }
5317
5318 formatex(Noob_AuthIDS[i], 31, authid);
5319 formatex(Noob_Names[i], 31, name);
5320 formatex(Noob_Date[i], 31, thetime)
5321 formatex(Noob_Weapon[i], 31, g_weaponsnames[wpn])
5322 Noob_Tiempos[i] = time
5323 Noob_CheckPoints[i] = checkpoints
5324 Noob_GoChecks[i] = gochecks
5325
5326 save_Noob15()
5327
5328 if( Is_in_noob15 )
5329 {
5330
5331 if( time < noobtiempo )
5332 {
5333 new min, Float:sec;
5334 min = floatround(faster, floatround_floor)/60;
5335 sec = faster - (60*min);
5336 ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_IMPROVE", min, sec < 10 ? "0" : "", sec);
5337
5338 if( (i + 1) == 1)
5339 {
5340 client_cmd(0, "spk misc/mod_unstopable");
5341 ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
5342 }
5343 else
5344 {
5345 client_cmd(0, "spk buttons/bell1");
5346 ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
5347 }
5348 }
5349 }
5350 else
5351 {
5352 if( (i + 1) == 1)
5353 {
5354 client_cmd(0, "spk misc/mod_unstopable");
5355 ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 1^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE");
5356 }
5357 else
5358 {
5359 client_cmd(0, "spk buttons/bell1");
5360 ColorChat(0, GREEN, "%s^x01^x03 %s^x01 %L^x03 %d^x01 in ^x04Noob 15^x01", prefix, name, LANG_PLAYER, "KZ_PLACE", (i+1));
5361 }
5362 }
5363 return;
5364 }
5365
5366 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)) )
5367 {
5368 if( time > noobtiempo )
5369 {
5370
5371 new min, Float:sec;
5372 min = floatround(slower, floatround_floor)/60;
5373 sec = slower - (60*min);
5374 client_cmd(0, "spk fvox/bell");
5375 ColorChat(id, GREEN, "%s^x01 %L ^x03%02d:%s%.2f^x01", prefix, id, "KZ_SLOWER", min, sec < 10 ? "0" : "", sec);
5376 return;
5377 }
5378 }
5379
5380 }
5381}
5382
5383public save_Noob15()
5384{
5385 new profile[128]
5386 formatex(profile, 127, "%s/Noob_%s.cfg", Topdir, MapName)
5387
5388 if( file_exists(profile) )
5389 {
5390 delete_file(profile)
5391 }
5392
5393 new Data[256];
5394 new f = fopen(profile, "at")
5395
5396 for(new i = 0; i < 15; i++)
5397 {
5398 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])
5399 fputs(f, Data)
5400 }
5401 fclose(f);
5402}
5403
5404public read_Noob15()
5405{
5406 new profile[128], prodata[256]
5407 formatex(profile, 127, "%s/Noob_%s.cfg", Topdir, MapName)
5408
5409 new f = fopen(profile, "rt" )
5410 new i = 0
5411 while( !feof(f) && i < 16)
5412 {
5413 fgets(f, prodata, 255)
5414 new totime[25], checks[5], gochecks[5]
5415 parse(prodata, totime, 24, Noob_AuthIDS[i], 31, Noob_Names[i], 31, checks, 4, gochecks, 4, Noob_Date[i], 31, Noob_Weapon[i], 31)
5416 Noob_Tiempos[i] = str_to_float(totime)
5417 Noob_CheckPoints[i] = str_to_num(checks)
5418 Noob_GoChecks[i] = str_to_num(gochecks)
5419 i++;
5420 }
5421 fclose(f)
5422}
5423
5424public ProTop_show(id)
5425{
5426 new buffer[2048], len, name[32]
5427
5428 len = formatex(buffer, 2047, "<meta charset=UTF-8><body bgcolor=#000000><table width=100%% cellpadding=2 cellspacing=0>")
5429 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%%> Дата")
5430
5431 for (new i = 0; i < 15; i++)
5432 {
5433 name = Pro_Names[i]
5434
5435 if( Pro_Times[i] > 9999999.0 )
5436 {
5437 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),"","","")
5438 }
5439
5440 else
5441 {
5442 new minutos, Float:segundos
5443 minutos = floatround(Pro_Times[i], floatround_floor)/60
5444 segundos = Pro_Times[i] - (60*minutos)
5445
5446 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])
5447
5448 }
5449 }
5450
5451 len += formatex(buffer[len], 2047-len, "</table></body>")
5452 len += formatex(buffer[len], 2047-len, "<tr><center><br><font color=white>Plugin created by Destroman™")
5453
5454 show_motd(id, buffer, "Pro15 Jumpers")
5455
5456 return PLUGIN_HANDLED
5457}
5458
5459
5460public NoobTop_show(id)
5461{
5462 new buffer[2048], name[32], len
5463
5464 len = formatex(buffer, 2047, "<meta charset=UTF-8><body bgcolor=#000000><table width=100%% cellpadding=2 cellspacing=0>")
5465 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%%> Дата")
5466
5467 for (new i = 0; i < 15; i++)
5468 {
5469 if( Noob_Tiempos[i] > 9999999.0 )
5470 {
5471 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),"","","")
5472 }
5473
5474 else
5475 {
5476 name = Noob_Names[i]
5477 new minutos, Float:segundos
5478 minutos = floatround(Noob_Tiempos[i], floatround_floor)/60
5479 segundos = Noob_Tiempos[i] - (60*minutos)
5480
5481 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])
5482 }
5483 }
5484
5485 len += formatex(buffer[len], 2047-len, "</table></body>")
5486 len += formatex(buffer[len], 2047-len, "<tr><center><br><font color=white>Plugin created by Destroman™")
5487
5488 show_motd(id, buffer, "Noob15 Jumpers")
5489
5490 return PLUGIN_HANDLED
5491}
5492
5493
5494
5495
5496
5497#endif
5498
5499
5500
5501public show_beacon(id){
5502 static origin[3]
5503 // emit_sound(id, CHAN_ITEM, g_snd_path, 1.0, ATTN_NORM, 0, PITCH_NORM)
5504 get_user_origin(id, origin)
5505 message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
5506 write_byte(TE_BEAMCYLINDER)
5507 write_coord(origin[0]) //position.x
5508 write_coord(origin[1]) //position.y
5509 write_coord(origin[2]-29) //position.z
5510 write_coord(origin[0]) //axis.x
5511 write_coord(origin[1]) //axis.y
5512 write_coord(origin[2]+200) //axis.z
5513 write_short(my_sprite) //sprite index
5514 write_byte(0) //starting frame
5515 write_byte(1) //frame rate in 0.1's
5516 write_byte(6) //life in 0.1's
5517 write_byte(10) //line width in 0.1's
5518 write_byte(1) //noise amplitude in 0.01's
5519 write_byte(0) //red
5520 write_byte(0) //green
5521 write_byte(255) //blue
5522 write_byte(200) //brightness
5523 write_byte(6) //scroll speed in 0.1's
5524 message_end();
5525}
5526
5527public show_beacon2(id){
5528 static origin[3]
5529 get_user_origin(id, origin)
5530 message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
5531 write_byte(TE_BEAMCYLINDER)
5532 write_coord(origin[0]) //position.x
5533 write_coord(origin[1]) //position.y
5534 write_coord(origin[2]-29) //position.z
5535 write_coord(origin[0]) //axis.x
5536 write_coord(origin[1]) //axis.y
5537 write_coord(origin[2]+200) //axis.z
5538 write_short(my_sprite) //sprite index
5539 write_byte(0) //starting frame
5540 write_byte(1) //frame rate in 0.1's
5541 write_byte(6) //life in 0.1's
5542 write_byte(10) //line width in 0.1's
5543 write_byte(1) //noise amplitude in 0.01's
5544 write_byte(0) //red
5545 write_byte(0) //green
5546 write_byte(255) //blue
5547 write_byte(200) //brightness
5548 write_byte(6) //scroll speed in 0.1's
5549 message_end();
5550}
5551
5552
5553public show_beacon3(id){
5554 id -= SHOW_BEACON
5555 static origin[3]
5556 // emit_sound(id, CHAN_ITEM, g_snd_path, 1.0, ATTN_NORM, 0, PITCH_NORM)
5557 get_user_origin(id, origin)
5558 message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
5559 write_byte(TE_BEAMCYLINDER)
5560 write_coord(origin[0]) //position.x
5561 write_coord(origin[1]) //position.y
5562 write_coord(origin[2]-29) //position.z
5563 write_coord(origin[0]) //axis.x
5564 write_coord(origin[1]) //axis.y
5565 write_coord(origin[2]+200) //axis.z
5566 write_short(my_sprite) //sprite index
5567 write_byte(0) //starting frame
5568 write_byte(1) //frame rate in 0.1's
5569 write_byte(6) //life in 0.1's
5570 write_byte(10) //line width in 0.1's
5571 write_byte(1) //noise amplitude in 0.01's
5572 write_byte(0) //red
5573 write_byte(0) //green
5574 write_byte(255) //blue
5575 write_byte(200) //brightness
5576 write_byte(6) //scroll speed in 0.1's
5577 message_end();
5578}
5579
5580public show_beacon4(id){
5581 id -= SHOW_BEACON1
5582 static origin[3]
5583 get_user_origin(id, origin)
5584 message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
5585 write_byte(TE_BEAMCYLINDER)
5586 write_coord(origin[0]) //position.x
5587 write_coord(origin[1]) //position.y
5588 write_coord(origin[2]-29) //position.z
5589 write_coord(origin[0]) //axis.x
5590 write_coord(origin[1]) //axis.y
5591 write_coord(origin[2]+200) //axis.z
5592 write_short(my_sprite) //sprite index
5593 write_byte(0) //starting frame
5594 write_byte(1) //frame rate in 0.1's
5595 write_byte(6) //life in 0.1's
5596 write_byte(10) //line width in 0.1's
5597 write_byte(1) //noise amplitude in 0.01's
5598 write_byte(0) //red
5599 write_byte(0) //green
5600 write_byte(255) //blue
5601 write_byte(200) //brightness
5602 write_byte(6) //scroll speed in 0.1's
5603 message_end();
5604}
5605
5606public plugin_end( )
5607{
5608 if(g_SqlTuple)
5609 SQL_FreeHandle(g_SqlTuple)
5610 if(SqlConnection)
5611 SQL_FreeHandle(SqlConnection)
5612 for(new i = 1; i < max_players; i++ )
5613 {
5614 if(Autosavepos[i] && !is_user_bot(i)){
5615 saveposition(i)
5616 }
5617 }
5618
5619}
5620
5621// You reached the end of file
5622// The original plugin was made by p4ddY
5623// This plugin was edited by nucLeaR
5624// Version 2.31