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