HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /**************************************************************************************************
  2. Forditotta: CheeseDave [www.amxmodx.extra.hu | dave@synhosting.eu]
  3.  
  4.  
  5. For use with Climbing Maps
  6. http://www.kreedz.com/
  7. And Other Climbing Maps
  8.  
  9. List Maps & Configurations in climbing.ini
  10.  
  11.  
  12. **** CVARS (FEATURES) ****
  13. kz_autoheal = AutoHeal
  14. kz_autospawn = AutoSpawn
  15. kz_bunnyjump = 1 = No slowdown after jumping | 2 = Just hold down jump to bunny hop
  16. kz_godmode = AutoGodmode
  17. kz_semiclip = AutoSemiClip
  18. kz_scout = AutoScout
  19. kz_nightvision = Free NVG
  20. kz_nightmode = Nightmode
  21. kz_checkpoints = Checkpoints
  22. kz_timer = IndividualTimer
  23. kz_top15 = Top15 (BETA)
  24.  
  25. **** CVARS (CHECKPOINT SYSTEM) ****
  26. kz_checkprice = Price of a checkpoint
  27. kz_checkpointdist = Distance from other people you can spawn
  28. kz_checkeffects = Some cool teleport effects
  29. kz_limitedcp = Limit each checkpoint to one use
  30. kz_startmoney = Instead of mp_startmoney
  31.  
  32. **** CVARS (OTHER) ****
  33. kz_grabforce = Grabforce for JediGrab
  34.  
  35. **** ADMIN COMMANDS ****
  36.  
  37. ADMIN_LEVEL_A (flag="m")
  38. Setting Noclip = amx_noclip <azonosito, nick, @csapat, @all vagy #id> <on/off>
  39. Setting Godmode = amx_godmode <azonosito, nick, @csapat, @all vagy #id> <on/off>
  40. Setting Semiclip = amx_semiclip <azonosito, nick, @csapat, @all vagy #id> <on/off>
  41. Setting Glow = amx_glow <azonosito, nick, @csapat, @all vagy #id> <red> <green> <blue> <alpha>
  42. Setting Origin = amx_teleport <azonosito, nick vagy #id> <azonosito, nick vagy #id>
  43. Setting Gravity = amx_gravity <azonosito, nick, @csapat, @all vagy #id> <Gravity>
  44. Granting Hook/Rope = amx_granthook <azonosito, nick, @csapat, @all vagy #id> <on/off>
  45.  
  46. ADMIN_LEVEL_B (flag="n")
  47. Giving Longjump = amx_longjump <azonosito, nick, @csapat, @all vagy #id>
  48. Giving Scout = amx_scout <azonosito, nick, @csapat, @all vagy #id>
  49. Giving Money = amx_money <azonosito, nick, @csapat, @all vagy #id> <Money>
  50.  
  51. ADMIN_LEVEL_C (flag="o")
  52. Set Checkpoint = amx_checkpoint <azonosito, nick vagy #id>
  53. Rem Checkpoint = amx_remcheckpoint <azonosito, nick vagy #id>
  54.  
  55. ADMIN_LEVEL_D (flag="p")
  56. Jedi Force Grab by Spacedude (slightly modified)
  57. Grabbing a person = +grab
  58. Releasing grabbed = -grab
  59. Toggle Command = grab_toggle
  60.  
  61. ADMIN_LEVEL_E (flag="q") || Granted by admin
  62. Ninja Rope by Spacedude (slightly modified) & Hook thingy
  63. Attaching Rope = +rope
  64. Deattaching Rope = -rope
  65. Attaching Hook = +hook
  66. Deattaching Hook = -hook
  67.  
  68. **** USER COMMANDS ****
  69.  
  70. checkpoint = Use Checkpoint
  71. /checkpoint
  72. gocheck = Goto Checkpoint
  73. /gocheck
  74. lastcheck = Goto Checkpoint before last (used when stuck)
  75. /stuck
  76. /unstuck
  77. /destuckme
  78.  
  79. **************************************************************************************************/
  80. #define USING_AMX 0 // 1 = Using AMX \ 0 = Useing AMXX
  81. // #define USP_SCOUT_KILL 1 //Uncomment to activate the automatic removal of usps and scouts. WARNING: MAY CAUSE CRASH
  82.  
  83. #if USING_AMX
  84. #include <amxmod>
  85. #include <amxmisc>
  86. #include <VexdUM>
  87. #include <fun>
  88. #else
  89. #include <amxmodx>
  90. #include <amxmisc>
  91. #include <cstrike>
  92. #include <fun>
  93. #include <engine>
  94. #endif
  95.  
  96. #define TE_BEAMENTPOINT 1
  97. #define TE_KILLBEAM 99
  98. #define DELTA_T 0.1 // seconds
  99. #define BEAMLIFE 100 // deciseconds
  100. #define MOVEACCELERATION 150 // units per second^2
  101. #define REELSPEED 300 // units per second
  102.  
  103. /* Stuff */
  104. new NVGrun[33]
  105. new Cvar[4] // mp_friendlyfire, mp_autoteambalance, mp_teamlimit
  106. new gMoney[33]
  107. new gJoined[33]
  108. new gStartMoney
  109. new gConfigFile[128]
  110. new gScorePath[128]
  111.  
  112. /* Checkpoint Stuff */
  113. new bool:gCheckpoint[33]
  114. new gCheckpointPos[33][3]
  115. new gLastCheckpointPos[33][3]
  116.  
  117. /* Hook Stuff */
  118. new gHookLocation[33][3]
  119. new gHookLenght[33]
  120. new bool:gIsHooked[33]
  121. new gAllowedHook[33]
  122. new Float:gBeamIsCreated[33]
  123. new global_gravity
  124. new beam
  125.  
  126. /* Timer Stuff */
  127. new bool:gHasTimer[33],bool:gHasStoppedTimer[33]
  128. new gSecs[33], gMins[33], gHuns[33], gChecks[33]
  129.  
  130. /* Top15 Stuff */
  131. new gAuthScore[15][33]
  132. new gNameScore[15][33]
  133. new gMinsScore[15]
  134. new gSecsScore[15]
  135. new gHunsScore[15]
  136. new gChecksScore[15]
  137.  
  138. /************************************************************************************************************************/
  139. public plugin_init() //Called on plugin start
  140. {
  141. // Plugin Info
  142. register_plugin("KZ Multiplugin","2.0","AssKicR")
  143. //CVARS
  144. register_cvar("kz_autoheal","0")
  145. register_cvar("kz_autospawn","0")
  146. register_cvar("kz_checkpoints","0")
  147. register_cvar("kz_checkprice","500")
  148. register_cvar("kz_checkpointdist","50")
  149. register_cvar("kz_checkeffects","0")
  150. register_cvar("kz_scout","0")
  151. register_cvar("kz_limitedcp","0")
  152. register_cvar("kz_nightvision","0")
  153. register_cvar("kz_grabforce","8")
  154. register_cvar("kz_godmode","0")
  155. register_cvar("kz_semiclip","0")
  156. register_cvar("kz_nightmode","0")
  157. register_cvar("kz_startmoney","16000")
  158. register_cvar("kz_timer","1")
  159. register_cvar("kz_bunnyjump","0")
  160. register_cvar("kz_top15", "0" )
  161. #if USING_AMX
  162. format(gConfigFile,sizeof(gConfigFile),"addons/amx/config")
  163. format(gScorePath,sizeof(gScorePath),"addons/amx/kz_top15/")
  164. #else
  165. get_configsdir(gConfigFile,sizeof(gConfigFile))
  166. format(gScorePath,sizeof(gScorePath),"addons/amxmodx/kz_top15/")
  167. #endif
  168. format (gConfigFile,sizeof(gConfigFile),"%s/climbing.ini",gConfigFile)
  169.  
  170. if(ClimbMap()) {
  171. gStartMoney=get_cvar_num("kz_startmoney")
  172. //EVENTS
  173. register_event("StatusValue","spec_event","be","1=2")
  174. register_event("DeathMsg", "DeathMsg", "a")
  175. register_event("Damage", "Damage", "b", "2!0")
  176. register_event("ResetHUD", "ResetHUD", "b")
  177. #if defined USP_SCOUT_KILL {
  178. register_clcmd("drop", "gimmetime")
  179. #endif
  180. register_event("TextMsg","RestartRound","a","2&#Game_C","2&#Game_w")
  181. //CLIENT CMDS
  182. register_clcmd("nightvision","NVGToggle")
  183.  
  184. register_clcmd("checkpoint","Checkpoint")
  185. register_clcmd("say /checkpoint","Checkpoint")
  186.  
  187. register_clcmd("gocheck","GoCheckpoint")
  188. register_clcmd("say /gocheck","GoCheckpoint")
  189.  
  190. register_clcmd("lastcheck","LastCheckpoint")
  191. register_clcmd("say /stuck","LastCheckpoint")
  192. register_clcmd("say /unstuck","LastCheckpoint")
  193. register_clcmd("say /destuckme","LastCheckpoint")
  194.  
  195. register_clcmd("say /top15", "show_top15")
  196.  
  197. register_clcmd("radio1","blocked")
  198. register_clcmd("radio2","blocked")
  199. register_clcmd("radio3","blocked")
  200. //ADMIN CMDS
  201. register_clcmd("+rope", "hook_on",ADMIN_LEVEL_E)
  202. register_clcmd("-rope", "hook_off",ADMIN_LEVEL_E)
  203. register_clcmd("+hook", "hook_on",ADMIN_LEVEL_E)
  204. register_clcmd("-hook", "hook_off",ADMIN_LEVEL_E)
  205.  
  206. register_clcmd("grab_toggle","grab_toggle",ADMIN_LEVEL_D,"nyomd meg hogy megragadj, majd ismet hogy elengedj")
  207. register_clcmd("+grab","grab",ADMIN_LEVEL_D,"bindelj egy gombot +grab-ra")
  208. register_clcmd("-grab","release",ADMIN_LEVEL_D)
  209.  
  210. register_concmd("amx_checkpoint","AdminSetCheck",ADMIN_LEVEL_C,"<azonosito, nick vagy #id>")
  211. register_concmd("amx_remcheckpoint","AdminRemCheck",ADMIN_LEVEL_C,"<azonosito, nick vagy #id>")
  212.  
  213. register_concmd("amx_longjump","AdminLongjump",ADMIN_LEVEL_B,"<azonosito, nick, @csapat, @all vagy #id>")
  214. register_concmd("amx_scout","AdminScout",ADMIN_LEVEL_B,"<azonosito, nick, @csapat, @all vagy #id>")
  215. register_concmd("amx_money","AdminSetMoney",ADMIN_LEVEL_B,"<azonosito, nick, @csapat, @all vagy #id> <Penz>")
  216. register_concmd("amx_gravity","AdminGravity",ADMIN_LEVEL_B,"<azonosito, nick, @csapat, @all vagy #id> <Gravitacio>")
  217.  
  218. register_concmd("amx_noclip","AdminNoclip",ADMIN_LEVEL_A,"<azonosito, nick, @csapat, @all vagy #id> <on/off>")
  219. register_concmd("amx_godmode","AdminGodMode",ADMIN_LEVEL_A,"<azonosito, nick, @csapat, @all vagy #id> <on/off>")
  220. register_concmd("amx_semiclip","AdminSemiClip",ADMIN_LEVEL_A,"<azonosito, nick, @csapat, @all vagy #id> <on/off>")
  221. register_concmd("amx_glow","AdminGlow",ADMIN_LEVEL_A,"<azonosito, nick, @csapat vagy #id> <piros> <zold> <kek> <alpha>")
  222. register_concmd("amx_teleport","AdminTele",ADMIN_LEVEL_A,"<azonosito, nick vagy #id> [x] [y] [z]")
  223. register_concmd("amx_granthook","AdminGrantHook",ADMIN_LEVEL_A,"<azonosito, nick, @csapat, @all vagy #id> <on/off>")
  224.  
  225. //CVAR ENFORCING
  226. Cvar[0]=get_cvar_num("mp_friendlyfire")
  227. Cvar[1]=get_cvar_num("mp_autoteambalance")
  228. Cvar[2]=get_cvar_num("mp_limitteams")
  229. Cvar[3]=get_cvar_num("mp_flashlight")
  230. set_cvar_num("mp_friendlyfire",0)
  231. set_cvar_num("mp_autoteambalance",0)
  232. set_cvar_num("mp_limitteams",99)
  233. set_cvar_num("mp_flashlight",1)
  234.  
  235. set_task(0.1,"gTimerTask",0,"",0,"b")
  236.  
  237. read_top15()
  238. }
  239. }
  240. /************************************************************************************************************************/
  241. public plugin_end() { //Called on plugin end
  242. if(ClimbMap()) {
  243. set_cvar_num("mp_friendlyfire",Cvar[0])
  244. set_cvar_num("mp_autoteambalance",Cvar[1])
  245. set_cvar_num("mp_teamlimit",Cvar[2])
  246. set_cvar_num("mp_flashlight",Cvar[3])
  247. }
  248. }
  249. /************************************************************************************************************************/
  250. public plugin_precache()
  251. {
  252. precache_model("models/w_longjump.mdl") //longjump
  253. precache_model("models/w_longjumpt.mdl") //---"---
  254. precache_sound("items/nvg_on.wav")
  255. precache_sound("items/nvg_off.wav")
  256.  
  257. beam = precache_model("sprites/zbeam4.spr")
  258. precache_sound("weapons/xbow_hit2.wav")
  259. }
  260. /*************************************************************************************************************************/
  261. /************************************************** USP/SCOUT REMOVE *****************************************************/
  262. /*************************************************************************************************************************/
  263. public gimmetime(id) {
  264. set_task(0.2, "killevilusp", id+50, "", 0)
  265. }
  266.  
  267. public killevilusp(Taskid)
  268. {
  269. new model[32]
  270. new oid, tEnt, wEnt
  271.  
  272. tEnt = find_ent_by_class(-1, "weaponbox")
  273. while (tEnt > 0) {
  274. entity_get_string(tEnt, EV_SZ_model, model, 32)
  275. if (equali(model,"models/w_usp.mdl")) {
  276. oid = entity_get_edict(tEnt, EV_ENT_owner)
  277. if (oid > 0 && oid < 33) {
  278. remove_entity(tEnt)
  279. wEnt = find_ent_by_class(-1, "weapon_usp")
  280. while (wEnt > -1) {
  281. oid = entity_get_edict(wEnt, EV_ENT_owner)
  282. if (oid == tEnt) {
  283. remove_entity(wEnt)
  284. }
  285. wEnt = find_ent_by_class(wEnt, "weapon_usp")
  286. }
  287. }
  288. }
  289. tEnt = find_ent_by_class(tEnt, "weaponbox")
  290. }
  291. set_task(0.2, "killevilscout", Taskid, "", 0)
  292. }
  293.  
  294. public killevilscout(Taskid)
  295. {
  296. new model[32]
  297. new oid, tEnt, wEnt
  298.  
  299. tEnt = find_ent_by_class(-1, "weaponbox")
  300. while (tEnt > 0) {
  301. entity_get_string(tEnt, EV_SZ_model, model, 32)
  302. if (equali(model,"models/w_scout.mdl")) {
  303. oid = entity_get_edict(tEnt, EV_ENT_owner)
  304. if (oid > 0 && oid < 33) {
  305. remove_entity(tEnt)
  306. wEnt = find_ent_by_class(-1, "weapon_scout")
  307. while (wEnt > -1) {
  308. oid = entity_get_edict(wEnt, EV_ENT_owner)
  309. if (oid == tEnt) {
  310. remove_entity(wEnt)
  311. }
  312. wEnt = find_ent_by_class(wEnt, "weapon_scout")
  313. }
  314. }
  315. }
  316. tEnt = find_ent_by_class(tEnt, "weaponbox")
  317. }
  318. }
  319. /*************************************************************************************************************************/
  320. /**************************************************** HOOKED EVENTS ******************************************************/
  321. /*************************************************************************************************************************/
  322. public DeathMsg()
  323. {
  324. new id = read_data(2)
  325. // User died, do they need to respawn???
  326. if(get_cvar_num("kz_autospawn") == 0) {
  327. // No Need, remove his timer
  328. if (gHasTimer[id]) gHasTimer[id]=false
  329. return PLUGIN_CONTINUE
  330. }
  331. // Yep, needs to respawn. Postpone with set_task for 0.5...
  332. NVGcmd(id,0)
  333. set_task(0.5,"respawn",id+123)
  334. #if defined USP_SCOUT_KILL {
  335. gimmetime(id)
  336. #endif
  337. return PLUGIN_CONTINUE
  338. }
  339. /************************************************************************************************************************/
  340. public respawn(TaskID)
  341. {
  342. //Respawn user...
  343. new id = TaskID-123
  344. if(get_user_team(id) != 2 || is_user_alive(id)) return PLUGIN_CONTINUE
  345. //Show a message to user that he is respawning
  346. client_print(id,print_chat,"[KZ] Ujraeledes!!!")
  347. #if USING_AMX
  348. user_spawn(id)
  349. #else
  350. spawn(id)
  351. #endif
  352. return PLUGIN_CONTINUE
  353. }
  354. /************************************************************************************************************************/
  355. public ResetHUD(id) {
  356. //Check if Checkpoints are on...
  357. if (get_cvar_num("kz_checkpoints") != 0) {
  358. //Check if user has a Checkpoint
  359. if (gCheckpoint[id]) {
  360. //Yep he has one... Move him to it...
  361. if (CheckCheckpoint(id)) move_to_check(id)
  362. cs_set_user_money(id,0)
  363. //Check if limited Checkpointuse is on
  364. if (get_cvar_num("kz_limitedcp") != 0) {
  365. //Yep.. It is on... Delete Checkpoint
  366. gCheckpoint[id]=false
  367. client_print(id,print_chat,"[KZ] CheckPont hasznalva...")
  368. }
  369. }else{
  370. if (gHasTimer[id]) ResetTimer(id,1)
  371. }
  372. }else{
  373. if (gHasTimer[id]) ResetTimer(id,1)
  374. }
  375. //Chech if he just joined
  376. if (gJoined[id]) {
  377. get_user_origin(id,gLastCheckpointPos[id])
  378. gJoined[id]=false
  379. if (get_cvar_num("kz_checkpoints")==1) {
  380. client_print(id,print_chat,"* ^"KZ Multiplugin^" bekapcsolva")
  381. client_print(id,print_chat,"* Hasznald a CheckPontokat ^"checkpoint^"-al a menteshez es ^"gocheck^"-al a teleportalast a konzolba")
  382. client_print(id,print_chat,"* Ha beszorulsz valahova irj ^"/stuck^"-t hogy atteleportaljanak a legutolso CheckPontba")
  383. }else{
  384. client_print(id,print_chat,"* ^"KZ Multiplugin^" letiltva")
  385. }
  386. }
  387.  
  388. //Check if he gets godmode
  389. if (get_cvar_num("kz_godmode") != 0) {
  390. //Yep, it's on... Give it too him...
  391. set_user_godmode(id,1)
  392. }
  393. //Check if auto scout give is on...
  394. if (get_cvar_num("kz_scout") != 0) {
  395. //Yep, it's on... Give it too him...
  396. GiveScout(id)
  397. }
  398. //Check if he gets semiclip...
  399. if (get_cvar_num("kz_semiclip") != 0) {
  400. //Yep, it's on... Give it too him...
  401. entity_set_int(id, EV_INT_solid, SOLID_TRIGGER)
  402. }else{
  403. //Nope, it's off... Make sure he has clip
  404. entity_set_int(id, EV_INT_solid, SOLID_BBOX)
  405. }
  406.  
  407. //Check if nightmode is on...
  408. if (get_cvar_num("kz_nightmode") != 0) {
  409. //Yep, it's on...
  410. set_lights("a")
  411. }else{
  412. //Nope, it's off...
  413. set_lights("n")
  414. }
  415. //Check if he is hooked to something
  416. if (gIsHooked[id]) RopeRelease(id)
  417.  
  418. cs_set_user_money(id,gMoney[id])
  419. }
  420. /************************************************************************************************************************/
  421. public Damage() {
  422. if(get_cvar_num("kz_autoheal") == 0) return PLUGIN_CONTINUE
  423.  
  424. new victim = read_data(0)
  425. set_user_health(victim, 100)
  426.  
  427. return PLUGIN_CONTINUE
  428. }
  429. /************************************************************************************************************************/
  430. public RestartRound() {
  431. for (new id=1; id<33; id++) {
  432. if (is_user_connected(id)) {
  433. gCheckpoint[id]=false
  434. if (gHasTimer[id]) client_print(id,print_chat,"[KZ] Ido Torlese...")
  435. ResetTimer(id,0)
  436. }
  437. }
  438. }
  439. /************************************************************************************************************************/
  440. public Checkpoint(id) {
  441. if (get_cvar_num("kz_checkpoints") != 1) {
  442. client_print(id,print_console,"[KZ] Bocs, de ez a parancs le lett tiltva")
  443. client_print(id,print_chat,"[KZ] Bocs, de ez a parancs le lett tiltva")
  444. return PLUGIN_CONTINUE
  445. }
  446. if (cs_get_user_money(id)<get_cvar_num("kz_checkprice")) {
  447. client_print(id,print_console,"[KZ] Bocs, de a CheckPont %i$-be kerul",get_cvar_num("kz_checkprice"))
  448. client_print(id,print_chat,"[KZ] Bocs, de a CheckPont %i$-be kerul",get_cvar_num("kz_checkprice"))
  449. return PLUGIN_CONTINUE
  450. }
  451. if (get_user_button(id)&IN_DUCK) {
  452. client_print(id,print_console,"[KZ] Nem helyezhetsz el CheckPontot, amig gugolsz!")
  453. client_print(id,print_chat,"[KZ] Nem helyezhetsz el CheckPontot, amig gugolsz!")
  454. return PLUGIN_CONTINUE
  455. }
  456.  
  457. client_print(id,print_console,"[KZ] Helyzet elmentve...")
  458. client_print(id,print_chat,"[KZ] Helyzet elmentve...")
  459. cs_set_user_money(id,cs_get_user_money(id)-get_cvar_num("kz_checkprice"))
  460. gMoney[id]=cs_get_user_money(id)
  461. if (gCheckpoint[id]) {
  462. gLastCheckpointPos[id][0]=gCheckpointPos[id][0]
  463. gLastCheckpointPos[id][1]=gCheckpointPos[id][1]
  464. gLastCheckpointPos[id][2]=gCheckpointPos[id][2]
  465. }
  466. get_user_origin(id,gCheckpointPos[id])
  467. gCheckpointPos[id][2] += 5
  468. gCheckpoint[id]=true
  469. gChecks[id] += 1
  470. return PLUGIN_HANDLED
  471. }
  472.  
  473. public LastCheckpoint(id) {
  474. if (get_cvar_num("kz_checkpoints") != 1) {
  475. client_print(id,print_console,"[KZ] Bocs, de ez a parancs le lett tiltva")
  476. client_print(id,print_chat,"[KZ] Bocs, de ez a parancs le lett tiltva")
  477. return PLUGIN_CONTINUE
  478. }
  479. if (!gCheckpoint[id]) {
  480. client_print(id,print_console,"[KZ] Nem helyeztel el CheckPontot, hogy vissza tudj ra menni.")
  481. client_print(id,print_chat,"[KZ] Nem helyeztel el CheckPontot, hogy vissza tudj ra menni.")
  482. return PLUGIN_CONTINUE
  483. }
  484. client_print(id,print_console,"[KZ] Teleportalas a legutobbi CheckPontba")
  485. client_print(id,print_chat,"[KZ] Teleportalas a legutobbi CheckPontba")
  486.  
  487. gCheckpointPos[id][0]=gLastCheckpointPos[id][0]
  488. gCheckpointPos[id][1]=gLastCheckpointPos[id][1]
  489. gCheckpointPos[id][2]=gLastCheckpointPos[id][2]
  490. gCheckpoint[id]=true
  491.  
  492. if (CheckCheckpoint(id)) move_to_check(id)
  493.  
  494. return PLUGIN_HANDLED
  495. }
  496.  
  497. public GoCheckpoint(id) {
  498. if (get_cvar_num("kz_checkpoints") != 1) {
  499. client_print(id,print_console,"[KZ] Bocs, de ez a parancs le lett tiltva")
  500. client_print(id,print_chat,"[KZ] Bocs, de ez a parancs le lett tiltva")
  501. return PLUGIN_CONTINUE
  502. }
  503. if (!gCheckpoint[id]) {
  504. client_print(id,print_console,"[KZ] Meg nincs CheckPontod")
  505. client_print(id,print_chat,"[KZ] Meg nincs CheckPontod")
  506. return PLUGIN_CONTINUE
  507. }
  508. if (CheckCheckpoint(id)) move_to_check(id)
  509. return PLUGIN_HANDLED
  510. }
  511.  
  512. public CheckCheckpoint(id) {
  513. // Check if they can respawn
  514. new origin[33][3]
  515. new dist = 9999
  516. for(new a = 0; a < 33; a++) {
  517. if (is_user_connected(a)) {
  518. get_user_origin(a,origin[a])
  519. dist = get_distance(origin[a],gCheckpointPos[id])
  520. if (dist<=get_cvar_num("kz_checkpointdist")) {
  521. client_print(id,print_console,"[KZ] Tul kozel van egy jatekos a CheckPontodhoz.. vard meg mig elmegy...")
  522. client_print(id,print_chat,"[KZ] Tul kozel van egy jatekos a CheckPontodhoz.. vard meg mig elmegy...")
  523. return false
  524. }
  525. }
  526. }
  527. return true
  528. }
  529.  
  530. public blocked(id) {
  531. return PLUGIN_HANDLED
  532. }
  533. /*************************************************************************************************************************/
  534. /**************************************************** STOCK COMMANDS *****************************************************/
  535. /*************************************************************************************************************************/
  536. stock ClimbMap()
  537. {
  538. if(file_exists(gConfigFile) == 1) {
  539. new line, stxtsize
  540. new data[192]
  541. new cMap[32]
  542. get_mapname(cMap, 31)
  543. new MapName[32],aHeal[6]=0,aSpawn[6]=0,aBunny[6]=0,aGodmode[6]=0,aScout[6]=0,aSemiClip[6]=0,aNVG[6]=0,nMode[6]=0,cTimer[6]=0,cTopS[6]=0,cPoints[6]=0,cPrice[6]=0,cDist[6]=0,cEffects[6]=0,cLimited[6]=0
  544. while((line=read_file(gConfigFile,line,data,191,stxtsize))!=0)
  545. {
  546. if ( data[0] == ';' ) continue
  547. parse(data,MapName,31,aHeal,5,aSpawn,5,aBunny,5,aGodmode,5,aScout,5,aSemiClip,5,aNVG,5,nMode,5,cTimer,5,cTopS,5,cPoints,5,cPrice,5,cDist,5,cEffects,5,cLimited,5)
  548. if (equal(MapName,cMap)) {
  549. set_cvar_num("kz_autoheal",str_to_num(aHeal))
  550. set_cvar_num("kz_autospawn",str_to_num(aSpawn))
  551. set_cvar_num("kz_bunnyjump",str_to_num(aBunny))
  552. set_cvar_num("kz_godmode",str_to_num(aGodmode))
  553. set_cvar_num("kz_scout",str_to_num(aScout))
  554. set_cvar_num("kz_semiclip",str_to_num(aSemiClip))
  555. set_cvar_num("kz_nightvision",str_to_num(aNVG))
  556. set_cvar_num("kz_nightmode",str_to_num(nMode))
  557. set_cvar_num("kz_timer",str_to_num(cTimer))
  558. set_cvar_num("kz_top15",str_to_num(cTopS))
  559. set_cvar_num("kz_checkpoints",str_to_num(cPoints))
  560. set_cvar_num("kz_checkprice",str_to_num(cPrice))
  561. set_cvar_num("kz_checkpointdist",str_to_num(cDist))
  562. set_cvar_num("kz_checkeffects",str_to_num(cEffects))
  563. set_cvar_num("kz_limitedcp",str_to_num(cLimited))
  564. return true
  565. }
  566. }
  567. return false
  568. }else{
  569. server_cmd("echo [KZ] Hiba!!! Failed To Load climbing.ini!!!")
  570. log_message("[KZ] Hiba!!! Failed To Load climbing.ini!!!")
  571. return false
  572. }
  573. return false
  574. }
  575.  
  576. stock kz_velocity_set(id,vel[3]) {
  577. //Set Their Velocity to 0 so that they they fall straight down from
  578. new Float:Ivel[3]
  579. Ivel[0]=float(vel[0])
  580. Ivel[1]=float(vel[1])
  581. Ivel[2]=float(vel[2])
  582. entity_set_vector(id, EV_VEC_velocity, Ivel)
  583. }
  584.  
  585. stock FormatTime(iMins,iSecs,iHuns,sMins[],sSecs[],sHuns[]) {
  586. if (iHuns==0) {
  587. format(sHuns,2,"00",iHuns)
  588. } else {
  589. format(sHuns,2,"%d",iHuns)
  590. }
  591. if (iSecs<10) {
  592. format(sSecs,2,"0%d",iSecs)
  593. } else {
  594. format(sSecs,2,"%d",iSecs)
  595. }
  596. if (iMins<10) {
  597. format(sMins,2,"0%d",iMins)
  598. } else {
  599. format(sMins,2,"%d",iMins)
  600. }
  601. return 1
  602. }
  603.  
  604. stock kz_velocity_get(id,vel[3]) {
  605. //Set Their Velocity to 0 so that they they fall straight down from
  606. new Float:Ivel[3]
  607.  
  608. entity_get_vector(id, EV_VEC_velocity, Ivel)
  609. vel[0]=floatround(Ivel[0])
  610. vel[1]=floatround(Ivel[1])
  611. vel[2]=floatround(Ivel[2])
  612. }
  613.  
  614. stock move_to_check(id) {
  615. new vel[3]={0,0,0}
  616. kz_velocity_set(id,vel)
  617. //Check if Effects are enabled
  618. if (get_cvar_num("kz_checkeffects")==1) {
  619. //Yep They Are
  620. new CurOrig[3]
  621. get_user_origin(id,CurOrig)
  622. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  623. write_byte(11)
  624. write_coord(CurOrig[0])
  625. write_coord(CurOrig[1])
  626. write_coord(CurOrig[2])
  627. message_end()
  628. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  629. write_byte(11)
  630. write_coord(gCheckpointPos[id][0])
  631. write_coord(gCheckpointPos[id][1])
  632. write_coord(gCheckpointPos[id][2])
  633. message_end()
  634. }
  635. //Move To Checkpoint
  636. set_user_origin(id,gCheckpointPos[id])
  637. }
  638.  
  639. stock GiveScout(id)
  640. {
  641. // Check If They Already Have Scout
  642. new iwpn, iwpns[32]
  643. new ownWeapon[32]
  644. new bool:HasScout
  645. get_user_weapons(id, iwpns,iwpn)
  646. for(new a = 0; a < iwpn; a++)
  647. {
  648. get_weaponname(iwpns[a],ownWeapon,31)
  649. if ( equali(ownWeapon, "weapon_scout") ) HasScout=true
  650. }
  651. // They Don't Got It
  652. if (!HasScout) give_item(id,"weapon_scout")
  653. }
  654.  
  655. stock CheatDetect(id,cheat[]) {
  656. if (gHasTimer[id]) {
  657. client_print(id,print_chat,"[KZ] %s Eszlelve.. Idozites Torolve",cheat)
  658. ResetTimer(id,0)
  659. }
  660. }
  661. /************************************************************************************************************************/
  662. /**************************************************** ADMIN COMMANDS ****************************************************/
  663. /************************************************************************************************************************/
  664. public AdminLongjump(id,level,cid)
  665. {
  666. if ( !cmd_access(id,level,cid,1) )
  667. return PLUGIN_HANDLED
  668.  
  669. new arg1[32]
  670. read_argv(1,arg1,31)
  671.  
  672. if ( equali(arg1,"@all") )
  673. {
  674. new plist[32],pnum
  675. get_players(plist,pnum,"a")
  676. if (pnum==0)
  677. {
  678. console_print(id,"[KZ] Nincsenek jatekosok")
  679. return PLUGIN_HANDLED
  680. }
  681. for (new i=0; i<pnum; i++)
  682. {
  683. give_item(plist[i],"item_longjump")
  684. CheatDetect(plist[i],"Longjump")
  685. }
  686.  
  687. console_print(id,"[KZ] Minden jateksonak longjump adva")
  688. }
  689. else if ( arg1[0]=='@' )
  690. {
  691. new plist[32],pnum
  692. get_players(plist,pnum,"ae",arg1[1])
  693. if ( pnum==0 )
  694. {
  695. console_print(id,"[KZ] Ebben a csapatban nincsen jatekos")
  696. return PLUGIN_HANDLED
  697. }
  698. for (new i=0; i<pnum; i++)
  699. {
  700. give_item(plist[i],"item_longjump")
  701. CheatDetect(plist[i],"Longjump")
  702.  
  703. }
  704. console_print(id,"[KZ] Minden %s-nek adva lett longjump",arg1[1])
  705. }
  706. else
  707. {
  708. new pName[32]
  709. new player = cmd_target(id,arg1,6)
  710. if (!player) return PLUGIN_HANDLED
  711. give_item(player,"item_longjump")
  712. CheatDetect(player,"Longjump")
  713.  
  714. get_user_name(player,pName,31)
  715. console_print(id,"[KZ] Adva lett longjump ^"%s^"-nek",pName)
  716. }
  717.  
  718. return PLUGIN_HANDLED
  719. }
  720.  
  721. public AdminGrantHook(id,level,cid)
  722. {
  723. if ( !cmd_access(id,level,cid,1) )
  724. return PLUGIN_HANDLED
  725.  
  726. new arg1[32],arg2[32]
  727. read_argv(1,arg1,31)
  728. read_argv(2,arg2,31)
  729. new onoff = str_to_num(arg2)
  730.  
  731. if ( equali(arg1,"@all") )
  732. {
  733. new plist[32],pnum
  734. get_players(plist,pnum,"a")
  735. if (pnum==0)
  736. {
  737. console_print(id,"[KZ] Nincsenek jatekosok")
  738. return PLUGIN_HANDLED
  739. }
  740. for (new i=0; i<pnum; i++) {
  741. gAllowedHook[plist[i]]=onoff
  742. if (gIsHooked[plist[i]]==true && onoff==0)
  743. {
  744. RopeRelease(plist[i])
  745. }
  746. }
  747.  
  748. console_print(id,"[KZ] %s hozzaferhet hook/rope-hoz",onoff ? "Mindenki":"Admin")
  749. }
  750. else if ( arg1[0]=='@' )
  751. {
  752. new plist[32],pnum
  753. get_players(plist,pnum,"ae",arg1[1])
  754. if ( pnum==0 )
  755. {
  756. console_print(id,"[KZ] Nincsenek jatekosok ebben a csapatban")
  757. return PLUGIN_HANDLED
  758. }
  759. for (new i=0; i<pnum; i++) {
  760. gAllowedHook[plist[i]]=onoff
  761. if (gIsHooked[plist[i]]==true && onoff==0)
  762. {
  763. RopeRelease(plist[i])
  764. }
  765. }
  766. console_print(id,"[KZ] %s all %ss access to hook/rope",onoff ? "Gave":"Removed",arg1[1])
  767. }
  768. else
  769. {
  770. new pName[32]
  771. new player = cmd_target(id,arg1,6)
  772. if (!player) return PLUGIN_HANDLED
  773.  
  774. gAllowedHook[player]=onoff
  775. if (gAllowedHook[player]==0 && onoff==0)
  776. {
  777. RopeRelease(player)
  778. }
  779.  
  780.  
  781. get_user_name(player,pName,31)
  782. console_print(id,"[KZ] %s ^"%s^" access to hook/rope",onoff ? "Gave":"Removed",pName)
  783. }
  784.  
  785. return PLUGIN_HANDLED
  786. }
  787.  
  788. public AdminScout(id,level,cid)
  789. {
  790. if ( !cmd_access(id,level,cid,1) )
  791. return PLUGIN_HANDLED
  792.  
  793. new arg1[32]
  794. read_argv(1,arg1,31)
  795.  
  796. if ( equali(arg1,"@all") )
  797. {
  798. new plist[32],pnum
  799. get_players(plist,pnum,"a")
  800. if (pnum==0)
  801. {
  802. console_print(id,"[KZ] Nincsenek jatekosok")
  803. return PLUGIN_HANDLED
  804. }
  805. for (new i=0; i<pnum; i++)
  806. GiveScout(plist[i])
  807.  
  808. console_print(id,"[KZ] Minden jatekosnak adva lett Scout")
  809. }
  810. else if ( arg1[0]=='@' )
  811. {
  812. new plist[32],pnum
  813. get_players(plist,pnum,"ae",arg1[1])
  814. if ( pnum==0 )
  815. {
  816. console_print(id,"[KZ] Nincsen jatekos ebben a csapatban")
  817. return PLUGIN_HANDLED
  818. }
  819. for (new i=0; i<pnum; i++)
  820. GiveScout(plist[i])
  821. console_print(id,"[KZ] Minden %s-nek adva lett scout",arg1[1])
  822. }
  823. else
  824. {
  825. new pName[32]
  826. new player = cmd_target(id,arg1,6)
  827. if (!player) return PLUGIN_HANDLED
  828. GiveScout(player)
  829. get_user_name(player,pName,31)
  830. console_print(id,"[KZ] ^"%s^"-nek adva lett egy scout",pName)
  831. }
  832.  
  833. return PLUGIN_HANDLED
  834. }
  835.  
  836. public AdminGravity(id,level,cid)
  837. {
  838. if ( !cmd_access(id,level,cid,3) )
  839. return PLUGIN_HANDLED
  840.  
  841. new arg1[32],arg2[32]
  842. read_argv(1,arg1,31)
  843. read_argv(2,arg2,31)
  844. new Float:gravalue = floatstr(arg2) / 100.0
  845.  
  846. if ( equali(arg1,"@all") )
  847. {
  848. new plist[32],pnum
  849. get_players(plist,pnum,"a")
  850. if (pnum==0)
  851. {
  852. console_print(id,"[KZ] Nincsenek jatekosok")
  853. return PLUGIN_HANDLED
  854. }
  855. for (new i=0; i<pnum; i++)
  856. {
  857. set_user_gravity(plist[i],gravalue)
  858. CheatDetect(plist[i],"GravityChange")
  859. }
  860.  
  861. console_print(id,"[KZ] Mindenki gravitacioja atalitva %f-re",gravalue)
  862. }
  863. else if ( arg1[0]=='@' )
  864. {
  865. new plist[32],pnum
  866. get_players(plist,pnum,"ae",arg1[1])
  867. if ( pnum==0 )
  868. {
  869. console_print(id,"[KZ] Nincsen jatekos ebben a csapatban")
  870. return PLUGIN_HANDLED
  871. }
  872. for (new i=0; i<pnum; i++)
  873. {
  874. set_user_gravity(plist[i],gravalue)
  875. CheatDetect(plist[i],"GravityChange")
  876. }
  877. console_print(id,"[KZ] Minden %s-nek at lett allitva a gravitacio %f-re ",arg1[1],gravalue)
  878. }
  879. else
  880. {
  881. new pName[32]
  882. new player = cmd_target(id,arg1,6)
  883. if (!player) return PLUGIN_HANDLED
  884. set_user_gravity(player,gravalue)
  885. CheatDetect(player,"GravityChange")
  886. get_user_name(player,pName,31)
  887. console_print(id,"[KZ] Atalitva ^"%s^"-nek a gravitacio %f-re",pName,gravalue)
  888. }
  889.  
  890. return PLUGIN_HANDLED
  891. }
  892.  
  893. public AdminSetCheck(id,level,cid)
  894. {
  895. if ( !cmd_access(id,level,cid,1) )
  896. return PLUGIN_HANDLED
  897.  
  898. new arg1[32]
  899. read_argv(1,arg1,31)
  900.  
  901. new pName[32]
  902. new player = cmd_target(id,arg1,6)
  903. if (!player) return PLUGIN_HANDLED
  904. get_user_origin(id,gCheckpointPos[player])
  905. gCheckpointPos[player][2] += 20
  906. gCheckpoint[player]=true
  907. gChecks[player]+=1
  908. CheatDetect(id,"Admin Checkpoint Change")
  909. get_user_name(player,pName,31)
  910. console_print(id,"[KZ] ^"%s^"-nek letrehozva egy CheckPont",pName)
  911. return PLUGIN_HANDLED
  912. }
  913.  
  914. public AdminRemCheck(id,level,cid)
  915. {
  916. if ( !cmd_access(id,level,cid,1) )
  917. return PLUGIN_HANDLED
  918.  
  919. new arg1[32]
  920. read_argv(1,arg1,31)
  921.  
  922. new pName[32]
  923. new player = cmd_target(id,arg1,6)
  924. if (!player) return PLUGIN_HANDLED
  925. gCheckpoint[player]=false
  926. gChecks[player]=0
  927. // CheatDetect(id,"Admin Checkpoint Removal")
  928. get_user_name(player,pName,31)
  929. console_print(id,"[KZ] Torolve lett ^"%s^" Checkpontja",pName)
  930. return PLUGIN_HANDLED
  931. }
  932.  
  933. public AdminSetMoney(id,level,cid)
  934. {
  935. if ( !cmd_access(id,level,cid,3) )
  936. return PLUGIN_HANDLED
  937.  
  938. new arg1[32],arg2[32]
  939. read_argv(1,arg1,31)
  940. read_argv(2,arg2,31)
  941. new money = str_to_num(arg2)
  942.  
  943. if ( equali(arg1,"@all") )
  944. {
  945. new plist[32],pnum
  946. get_players(plist,pnum,"a")
  947. if (pnum==0)
  948. {
  949. console_print(id,"[KZ] Nincsenek jatekosok")
  950. return PLUGIN_HANDLED
  951. }
  952. for (new i=0; i<pnum; i++)
  953. cs_set_user_money(plist[i],money)
  954.  
  955. console_print(id,"[KZ] Mindenki penze at lett allitva %d-re",money)
  956. }
  957. else if ( arg1[0]=='@' )
  958. {
  959. new plist[32],pnum
  960. get_players(plist,pnum,"ae",arg1[1])
  961. if ( pnum==0 )
  962. {
  963. console_print(id,"[KZ] Nincsen jatekos ebben a csapatban")
  964. return PLUGIN_HANDLED
  965. }
  966. for (new i=0; i<pnum; i++)
  967. cs_set_user_money(plist[i],money)
  968. console_print(id,"[KZ] Minden %s penze at lett allitva %d-re ",arg1[1],money)
  969. }
  970. else
  971. {
  972. new pName[32]
  973. new player = cmd_target(id,arg1,6)
  974. if (!player) return PLUGIN_HANDLED
  975. cs_set_user_money(player,money)
  976. get_user_name(player,pName,31)
  977. console_print(id,"[KZ] Atalitva ^"%s^" penze %d-re",pName,money)
  978. gMoney[player]=money
  979. }
  980.  
  981. return PLUGIN_HANDLED
  982. }
  983.  
  984. public AdminNoclip(id,level,cid)
  985. {
  986. if ( !cmd_access(id,level,cid,3) )
  987. return PLUGIN_HANDLED
  988.  
  989. new arg1[32],arg2[32]
  990. read_argv(1,arg1,31)
  991. read_argv(2,arg2,31)
  992. new onoff = str_to_num(arg2)
  993.  
  994. if ( equali(arg1,"@all") )
  995. {
  996. new plist[32],pnum
  997. get_players(plist,pnum,"a")
  998. if (pnum==0)
  999. {
  1000. console_print(id,"[KZ] Nincsenek jatekosok")
  1001. return PLUGIN_HANDLED
  1002. }
  1003. for (new i=0; i<pnum; i++)
  1004. {
  1005. set_user_noclip(plist[i],onoff)
  1006. CheatDetect(plist[i],"NoClip")
  1007. }
  1008.  
  1009. console_print(id,"[KZ] Falonatjaras mindenkinek bekapcsolva")
  1010. }
  1011. else if ( arg1[0]=='@' )
  1012. {
  1013. new plist[32],pnum
  1014. get_players(plist,pnum,"ae",arg1[1])
  1015. if ( pnum==0 )
  1016. {
  1017. console_print(id,"[KZ] Nincsen jatekos ebben a csapatban")
  1018. return PLUGIN_HANDLED
  1019. }
  1020. for (new i=0; i<pnum; i++)
  1021. {
  1022. set_user_noclip(plist[i],onoff)
  1023. CheatDetect(plist[i],"NoClip")
  1024. }
  1025. console_print(id,"[KZ] Falonatjaras bekapcsolva minden %s-nek",arg1[1])
  1026. }
  1027. else
  1028. {
  1029. new pName[32]
  1030. new player = cmd_target(id,arg1,6)
  1031. if (!player) return PLUGIN_HANDLED
  1032. set_user_noclip(player,onoff)
  1033. CheatDetect(player,"NoClip")
  1034. get_user_name(player,pName,31)
  1035. console_print(id,"[KZ] Falonatjaras bekapcsolva ^"%s^"-nek",pName)
  1036. }
  1037.  
  1038. return PLUGIN_HANDLED
  1039. }
  1040.  
  1041. public AdminSemiClip(id,level,cid)
  1042. {
  1043. if ( !cmd_access(id,level,cid,3) )
  1044. return PLUGIN_HANDLED
  1045.  
  1046. new arg1[32],arg2[32]
  1047. read_argv(1,arg1,31)
  1048. read_argv(2,arg2,31)
  1049. new onoff = str_to_num(arg2)
  1050.  
  1051. if ( equali(arg1,"@all") )
  1052. {
  1053. new plist[32],pnum
  1054. get_players(plist,pnum,"a")
  1055. if (pnum==0)
  1056. {
  1057. console_print(id,"[KZ] Nincsenek jatekosok")
  1058. return PLUGIN_HANDLED
  1059. }
  1060. for (new i=0; i<pnum; i++) {
  1061. if (is_user_alive(i)){
  1062. entity_set_int(plist[i], EV_INT_solid, onoff ? 1:2)
  1063. }
  1064. }
  1065.  
  1066. console_print(id,"[KZ] Jatekos-Atjaras bekapcsolva mindenkinek")
  1067. }
  1068. else if ( arg1[0]=='@' )
  1069. {
  1070. new plist[32],pnum
  1071. get_players(plist,pnum,"ae",arg1[1])
  1072. if ( pnum==0 )
  1073. {
  1074. console_print(id,"[KZ] Nincsen jatekos ebben a csapatban")
  1075. return PLUGIN_HANDLED
  1076. }
  1077. for (new i=0; i<pnum; i++)
  1078. entity_set_int(plist[i], EV_INT_solid, onoff ? 1:2)
  1079. console_print(id,"[KZ] Jatekos-Atjaras bekapcsolva minden %s-nek",arg1[1])
  1080. }
  1081. else
  1082. {
  1083. new pName[32]
  1084. new player = cmd_target(id,arg1,6)
  1085. if (!player) return PLUGIN_HANDLED
  1086. entity_set_int(player, EV_INT_solid, onoff ? 1:2)
  1087. get_user_name(player,pName,31)
  1088. console_print(id,"[KZ] Jatekos-Atjaras bekapcsolva ^"%s^"-nek",pName)
  1089. }
  1090.  
  1091. return PLUGIN_HANDLED
  1092. }
  1093.  
  1094. public AdminGodMode(id,level,cid)
  1095. {
  1096. if ( !cmd_access(id,level,cid,3) )
  1097. return PLUGIN_HANDLED
  1098.  
  1099. new arg1[32],arg2[32]
  1100. read_argv(1,arg1,31)
  1101. read_argv(2,arg2,31)
  1102. new onoff = str_to_num(arg2)
  1103.  
  1104. if ( equali(arg1,"@all") )
  1105. {
  1106. new plist[32],pnum
  1107. get_players(plist,pnum,"a")
  1108. if (pnum==0)
  1109. {
  1110. console_print(id,"[KZ] Nincsenek jatekosok")
  1111. return PLUGIN_HANDLED
  1112. }
  1113. for (new i=0; i<pnum; i++)
  1114. set_user_godmode(plist[i],onoff)
  1115.  
  1116. console_print(id,"[KZ] Istenmod bekapcsolva mindenkinek")
  1117. }
  1118. else if ( arg1[0]=='@' )
  1119. {
  1120. new plist[32],pnum
  1121. get_players(plist,pnum,"ae",arg1[1])
  1122. if ( pnum==0 )
  1123. {
  1124. console_print(id,"[KZ] Nincsen jatekos ebben a csapatban")
  1125. return PLUGIN_HANDLED
  1126. }
  1127. for (new i=0; i<pnum; i++)
  1128. set_user_godmode(plist[i],onoff)
  1129. console_print(id,"[KZ] Istenmod bekapcsolva minden %s-nek",arg1[1])
  1130. }
  1131. else
  1132. {
  1133. new pName[32]
  1134. new player = cmd_target(id,arg1,6)
  1135. if (!player) return PLUGIN_HANDLED
  1136. set_user_godmode(player,onoff)
  1137. get_user_name(player,pName,31)
  1138. console_print(id,"[KZ] Istenmod bekapcsolva ^"%s^"-nek",pName)
  1139. }
  1140.  
  1141. return PLUGIN_HANDLED
  1142. }
  1143.  
  1144. public AdminGlow(id,level,cid)
  1145. {
  1146. if ( !cmd_access(id,level,cid,5) )
  1147. return PLUGIN_HANDLED
  1148.  
  1149. new arg1[32], sred[8], sgreen[8], sblue[8], salpha[8], name2[32]
  1150. get_user_name(id,name2,31)
  1151. read_argv(1,arg1,31)
  1152. read_argv(2,sred,7)
  1153. read_argv(3,sgreen,7)
  1154. read_argv(4,sblue,7)
  1155. read_argv(5,salpha,7)
  1156. new ired = str_to_num(sred)
  1157. new igreen = str_to_num(sgreen)
  1158. new iblue = str_to_num(sblue)
  1159. new ialpha = str_to_num(salpha)
  1160. if ( equali(arg1,"@all") )
  1161. {
  1162. new plist[32],pnum
  1163. get_players(plist,pnum,"a")
  1164. if (pnum==0)
  1165. {
  1166. console_print(id,"[KZ] Nincsenek jatekosok")
  1167. return PLUGIN_HANDLED
  1168. }
  1169. for (new i=0; i<pnum; i++)
  1170. set_user_rendering(plist[i],kRenderFxGlowShell,ired,igreen,iblue,kRenderTransAlpha,ialpha)
  1171.  
  1172. console_print(id,"[KZ] Mindenki ki lett vilagitva")
  1173. }
  1174. else if ( arg1[0]=='@' )
  1175. {
  1176. new plist[32],pnum
  1177. get_players(plist,pnum,"ae",arg1[1])
  1178. if ( pnum==0 )
  1179. {
  1180. console_print(id,"[KZ] Nincsen jatekos ebben a csapatban")
  1181. return PLUGIN_HANDLED
  1182. }
  1183. for (new i=0; i<pnum; i++)
  1184. set_user_rendering(plist[i],kRenderFxGlowShell,ired,igreen,iblue,kRenderTransAlpha,ialpha)
  1185. console_print(id,"[KZ] Minden %s ki lett vilagitva",arg1[1])
  1186. }
  1187. else
  1188. {
  1189. new pName[32]
  1190. new player = cmd_target(id,arg1,6)
  1191. if (!player) return PLUGIN_HANDLED
  1192. set_user_rendering(player,kRenderFxGlowShell,ired,igreen,iblue,kRenderTransAlpha,ialpha)
  1193. get_user_name(player,pName,31)
  1194. console_print(id,"[KZ] ^"%s^" ki lett vilagitva",pName)
  1195. }
  1196.  
  1197. return PLUGIN_HANDLED
  1198. }
  1199.  
  1200. public AdminTele(id,level,cid) {
  1201.  
  1202. if ( !cmd_access(id,level,cid,2) )
  1203. return PLUGIN_HANDLED
  1204.  
  1205. new arg[32],TeleOrigin[3]
  1206.  
  1207. read_argv(1,arg,31)
  1208. new TelePlayer = cmd_target(id,arg,6)
  1209. if (!TelePlayer) return PLUGIN_HANDLED
  1210.  
  1211. new argc = read_argc()
  1212. if (argc == 3) {
  1213. new arg2[32]
  1214. read_argv(2,arg2,31)
  1215. new OrigPlayer = cmd_target(id,arg2,6)
  1216. if (!OrigPlayer) return PLUGIN_HANDLED
  1217. get_user_origin(OrigPlayer,TeleOrigin)
  1218. TeleOrigin[2]+=60
  1219. }else{
  1220. new sx[8], sy[8], sz[8]
  1221. read_argv(2,sx,7)
  1222. read_argv(3,sy,7)
  1223. read_argv(4,sz,7)
  1224. TeleOrigin[0] = str_to_num(sx)
  1225. TeleOrigin[1] = str_to_num(sy)
  1226. TeleOrigin[2] = str_to_num(sz)
  1227. }
  1228. set_user_origin(TelePlayer, TeleOrigin)
  1229.  
  1230. new pName[32]
  1231. get_user_name(TelePlayer,pName,31)
  1232. CheatDetect(TelePlayer,"Teleport")
  1233. console_print(id,"[KZ] ^"%s^" at lett teleportalva ide: x:%i y:%i z%i",pName,TeleOrigin[0],TeleOrigin[1],TeleOrigin[2])
  1234. return PLUGIN_HANDLED
  1235. }
  1236.  
  1237. /************************************************************************************************************************/
  1238. /***************************************************** NVG CONTROL ******************************************************/
  1239. /************************************************************************************************************************/
  1240.  
  1241. public NVGToggle(id) {
  1242. if (get_cvar_num("kz_nightvision")==0) return PLUGIN_CONTINUE
  1243.  
  1244. if (NVGrun[id]==1) NVGcmd(id,0)
  1245. else NVGcmd(id,1)
  1246. return PLUGIN_HANDLED
  1247. }
  1248. /************************************************************************************************************************/
  1249. public NVGcmd(id,nvgstate) {
  1250. message_begin(MSG_ONE, get_user_msgid("NVGToggle"), {0,0,0}, id)
  1251. write_byte( nvgstate )
  1252. message_end()
  1253. NVGrun[id]=nvgstate
  1254. emit_sound(id,CHAN_ITEM, NVGrun[id]?"items/nvg_on.wav":"items/nvg_off.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  1255. }
  1256. /************************************************************************************************************************/
  1257. /******************************************************* JEDIGRAB *******************************************************/
  1258. /************************************************************************************************************************/
  1259. new grabbed[33]
  1260. new grablength[33]
  1261. new bool:grabmodeon[33]
  1262. new velocity_multiplier
  1263.  
  1264. public grabtask(parm[])
  1265. {
  1266. new id = parm[0]
  1267. new targetid, body
  1268. if (!grabbed[id])
  1269. {
  1270. get_user_aiming(id, targetid, body)
  1271. if (targetid)
  1272. {
  1273. set_grabbed(id, targetid)
  1274. }
  1275. }
  1276. if (grabbed[id])
  1277. {
  1278. new origin[3], look[3], direction[3], moveto[3], grabbedorigin[3], velocity[3], length
  1279.  
  1280. if (!is_user_alive(grabbed[id]))
  1281. {
  1282. release(id)
  1283. return
  1284. }
  1285.  
  1286. get_user_origin(id, origin, 1)
  1287. get_user_origin(id, look, 3)
  1288. get_user_origin(grabbed[id], grabbedorigin)
  1289.  
  1290. direction[0]=look[0]-origin[0]
  1291. direction[1]=look[1]-origin[1]
  1292. direction[2]=look[2]-origin[2]
  1293. length = get_distance(look,origin)
  1294. if (!length) length=1 // avoid division by 0
  1295.  
  1296. moveto[0]=origin[0]+direction[0]*grablength[id]/length
  1297. moveto[1]=origin[1]+direction[1]*grablength[id]/length
  1298. moveto[2]=origin[2]+direction[2]*grablength[id]/length
  1299.  
  1300. velocity[0]=(moveto[0]-grabbedorigin[0])*velocity_multiplier
  1301. velocity[1]=(moveto[1]-grabbedorigin[1])*velocity_multiplier
  1302. velocity[2]=(moveto[2]-grabbedorigin[2])*velocity_multiplier
  1303.  
  1304. kz_velocity_set(grabbed[id], velocity)
  1305. }
  1306. }
  1307.  
  1308. public grab_toggle(id)
  1309. {
  1310. if (grabmodeon[id])
  1311. release(id)
  1312. else
  1313. grab(id)
  1314. return PLUGIN_HANDLED
  1315. }
  1316.  
  1317. public grab(id)
  1318. {
  1319. if (!(get_user_flags(id)&ADMIN_LEVEL_D))
  1320. {
  1321. client_print(id,print_chat,"[KZ] Nincs hozzaferesed ehhez a parancshoz")
  1322. return PLUGIN_HANDLED
  1323. }
  1324. if (!grabmodeon[id])
  1325. {
  1326. new targetid, body
  1327. new parm[1]
  1328. parm[0] = id
  1329. velocity_multiplier = get_cvar_num("kz_grabforce")
  1330. grabmodeon[id]=true
  1331. set_task(0.1, "grabtask", 100+id, parm, 1, "b")
  1332. get_user_aiming(id, targetid, body)
  1333. if (targetid)
  1334. {
  1335. set_grabbed(id, targetid)
  1336. }
  1337. else
  1338. {
  1339. client_print(id,print_chat,"[KZ] Celpont keresese")
  1340. }
  1341. }
  1342. return PLUGIN_HANDLED
  1343. }
  1344.  
  1345. public release(id)
  1346. {
  1347. if (!(get_user_flags(id)&ADMIN_LEVEL_D))
  1348. {
  1349. client_print(id,print_chat,"[KZ] Nincs hozzaferesed ehhez a parancshoz")
  1350. return PLUGIN_HANDLED
  1351. }
  1352. if (grabmodeon[id])
  1353. {
  1354. grabmodeon[id]=false
  1355. if (grabbed[id])
  1356. {
  1357. new targname[32]
  1358. set_user_gravity(grabbed[id])
  1359. set_user_rendering(grabbed[id])
  1360. get_user_name(grabbed[id],targname,31)
  1361. client_print(id,print_chat,"[KZ] Elengedted %s-t", targname)
  1362. }
  1363. else
  1364. {
  1365. client_print(id,print_chat,"[KZ] Nincs Celpont")
  1366. }
  1367. grabbed[id]=0
  1368. remove_task(100+id)
  1369. }
  1370. return PLUGIN_HANDLED
  1371. }
  1372.  
  1373. public spec_event(id)
  1374. {
  1375. new targetid = read_data(2)
  1376.  
  1377. if (targetid < 1 || targetid > 32)
  1378. return PLUGIN_CONTINUE
  1379.  
  1380. if (grabmodeon[id] && !grabbed[id])
  1381. {
  1382. set_grabbed(id, targetid)
  1383. }
  1384. return PLUGIN_CONTINUE
  1385. }
  1386.  
  1387. public set_grabbed(id, targetid)
  1388. {
  1389. new origin1[3], origin2[3], targname[32]
  1390. get_user_origin(id, origin1)
  1391. get_user_origin(targetid, origin2)
  1392. grabbed[id]=targetid
  1393. grablength[id]=get_distance(origin1,origin2)
  1394. set_user_gravity(targetid,0.001)
  1395. set_user_rendering(targetid,kRenderFxGlowShell,50,0,0, kRenderNormal, 16)
  1396. get_user_name(targetid,targname,31)
  1397. client_print(id,print_chat,"[KZ] Megragadtad %s-t", targname)
  1398. }
  1399.  
  1400. /************************************************************************************************************************/
  1401. /****************************************************** NINJAROPE *******************************************************/
  1402. /************************************************************************************************************************/
  1403.  
  1404. public ropetask(parm[])
  1405. {
  1406. new id = parm[0]
  1407. new user_origin[3], user_look[3], user_direction[3], move_direction[3]
  1408. new A[3], D[3], buttonadjust[3]
  1409. new acceleration, velocity_towards_A, desired_velocity_towards_A
  1410. new velocity[3], null[3]
  1411.  
  1412. if (!is_user_alive(id))
  1413. {
  1414. RopeRelease(id)
  1415. return
  1416. }
  1417.  
  1418. if (gBeamIsCreated[id] + BEAMLIFE/10 <= get_gametime())
  1419. {
  1420. beamentpoint(id)
  1421. }
  1422.  
  1423. null[0] = 0
  1424. null[1] = 0
  1425. null[2] = 0
  1426.  
  1427. get_user_origin(id, user_origin)
  1428. get_user_origin(id, user_look,2)
  1429. kz_velocity_get(id, velocity)
  1430.  
  1431. buttonadjust[0]=0
  1432. buttonadjust[1]=0
  1433.  
  1434. if (get_user_button(id)&IN_FORWARD) buttonadjust[0]+=1
  1435. if (get_user_button(id)&IN_BACK) buttonadjust[0]-=1
  1436. if (get_user_button(id)&IN_MOVERIGHT) buttonadjust[1]+=1
  1437. if (get_user_button(id)&IN_MOVELEFT) buttonadjust[1]-=1
  1438. if (get_user_button(id)&IN_JUMP) buttonadjust[2]+=1
  1439. if (get_user_button(id)&IN_DUCK) buttonadjust[2]-=1
  1440.  
  1441. if (buttonadjust[0] || buttonadjust[1])
  1442. {
  1443. user_direction[0] = user_look[0] - user_origin[0]
  1444. user_direction[1] = user_look[1] - user_origin[1]
  1445.  
  1446. move_direction[0] = buttonadjust[0]*user_direction[0] + user_direction[1]*buttonadjust[1]
  1447. move_direction[1] = buttonadjust[0]*user_direction[1] - user_direction[0]*buttonadjust[1]
  1448. move_direction[2] = 0
  1449.  
  1450. velocity[0] += floatround(move_direction[0] * MOVEACCELERATION * DELTA_T / get_distance(null,move_direction))
  1451. velocity[1] += floatround(move_direction[1] * MOVEACCELERATION * DELTA_T / get_distance(null,move_direction))
  1452. }
  1453.  
  1454. if (buttonadjust[2]) gHookLenght[id] -= floatround(buttonadjust[2] * REELSPEED * DELTA_T)
  1455. if (gHookLenght[id] < 100) gHookLenght[id] = 100
  1456.  
  1457. A[0] = gHookLocation[id][0] - user_origin[0]
  1458. A[1] = gHookLocation[id][1] - user_origin[1]
  1459. A[2] = gHookLocation[id][2] - user_origin[2]
  1460.  
  1461. D[0] = A[0]*A[2] / get_distance(null,A)
  1462. D[1] = A[1]*A[2] / get_distance(null,A)
  1463. D[2] = -(A[1]*A[1] + A[0]*A[0]) / get_distance(null,A)
  1464.  
  1465. acceleration = - global_gravity * D[2] / get_distance(null,D)
  1466.  
  1467. velocity_towards_A = (velocity[0] * A[0] + velocity[1] * A[1] + velocity[2] * A[2]) / get_distance(null,A)
  1468. desired_velocity_towards_A = (get_distance(user_origin,gHookLocation[id]) - gHookLenght[id] /*- 10*/) * 4
  1469.  
  1470. if (get_distance(null,D)>10)
  1471. {
  1472. velocity[0] += floatround((acceleration * DELTA_T * D[0]) / get_distance(null,D))
  1473. velocity[1] += floatround((acceleration * DELTA_T * D[1]) / get_distance(null,D))
  1474. velocity[2] += floatround((acceleration * DELTA_T * D[2]) / get_distance(null,D))
  1475. }
  1476.  
  1477. velocity[0] += ((desired_velocity_towards_A - velocity_towards_A) * A[0]) / get_distance(null,A)
  1478. velocity[1] += ((desired_velocity_towards_A - velocity_towards_A) * A[1]) / get_distance(null,A)
  1479. velocity[2] += ((desired_velocity_towards_A - velocity_towards_A) * A[2]) / get_distance(null,A)
  1480.  
  1481. kz_velocity_set(id, velocity)
  1482. }
  1483.  
  1484. public hooktask(parm[])
  1485. {
  1486. new id = parm[0]
  1487. new velocity[3]
  1488.  
  1489. if ( !gIsHooked[id] ) return
  1490.  
  1491. new user_origin[3],oldvelocity[3]
  1492. parm[0] = id
  1493.  
  1494. if (!is_user_alive(id))
  1495. {
  1496. RopeRelease(id)
  1497. return
  1498. }
  1499.  
  1500. if (gBeamIsCreated[id] + BEAMLIFE/10 <= get_gametime())
  1501. {
  1502. beamentpoint(id)
  1503. }
  1504.  
  1505. get_user_origin(id, user_origin)
  1506. kz_velocity_get(id, oldvelocity)
  1507. new distance=get_distance( gHookLocation[id], user_origin )
  1508. if ( distance > 10 )
  1509. {
  1510. velocity[0] = floatround( (gHookLocation[id][0] - user_origin[0]) * ( 2.0 * REELSPEED / distance ) )
  1511. velocity[1] = floatround( (gHookLocation[id][1] - user_origin[1]) * ( 2.0 * REELSPEED / distance ) )
  1512. velocity[2] = floatround( (gHookLocation[id][2] - user_origin[2]) * ( 2.0 * REELSPEED / distance ) )
  1513. }
  1514. else
  1515. {
  1516. velocity[0]=0
  1517. velocity[1]=0
  1518. velocity[2]=0
  1519. }
  1520.  
  1521. kz_velocity_set(id, velocity)
  1522.  
  1523. }
  1524.  
  1525. public hook_on(id)
  1526. {
  1527. if (gAllowedHook[id] || (get_user_flags(id)&ADMIN_LEVEL_E)) {
  1528. if (!gIsHooked[id] && is_user_alive(id))
  1529. {
  1530. new cmd[32]
  1531. read_argv(0,cmd,31)
  1532. if(equal(cmd,"+rope")) RopeAttach(id,0)
  1533. if(equal(cmd,"+hook")) RopeAttach(id,1)
  1534. }
  1535. }else{
  1536. client_print(id,print_chat,"[KZ] Nincs hozzaferesed ehhez a parancshoz")
  1537. return PLUGIN_HANDLED
  1538. }
  1539. return PLUGIN_HANDLED
  1540. }
  1541.  
  1542. public hook_off(id)
  1543. {
  1544. if (gAllowedHook[id] || (get_user_flags(id)&ADMIN_LEVEL_E)) {
  1545. if (gIsHooked[id])
  1546. {
  1547. RopeRelease(id)
  1548. }
  1549. }else{
  1550. client_print(id,print_chat,"[KZ] Nincs hozzaferesed ehhez a parancshoz")
  1551. return PLUGIN_HANDLED
  1552. }
  1553. return PLUGIN_HANDLED
  1554. }
  1555.  
  1556. public RopeAttach(id,hook)
  1557. {
  1558. CheatDetect(id,"Hook/Rope")
  1559. new parm[1], user_origin[3]
  1560. parm[0] = id
  1561. gIsHooked[id] = true
  1562. get_user_origin(id,user_origin)
  1563. get_user_origin(id,gHookLocation[id], 3)
  1564. gHookLenght[id] = get_distance(gHookLocation[id],user_origin)
  1565. global_gravity = get_cvar_num("sv_gravity")
  1566. set_user_gravity(id,0.001)
  1567. beamentpoint(id)
  1568. emit_sound(id, CHAN_STATIC, "weapons/xbow_hit2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  1569. if (hook) set_task(DELTA_T, "hooktask", 200+id, parm, 1, "b")
  1570. else set_task(DELTA_T, "ropetask", 200+id, parm, 1, "b")
  1571. }
  1572.  
  1573. public RopeRelease(id)
  1574. {
  1575. gIsHooked[id] = false
  1576. killbeam(id)
  1577. set_user_gravity(id)
  1578. remove_task(200+id)
  1579. }
  1580.  
  1581. public beamentpoint(id)
  1582. {
  1583. message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
  1584. write_byte( TE_BEAMENTPOINT )
  1585. write_short( id )
  1586. write_coord( gHookLocation[id][0] )
  1587. write_coord( gHookLocation[id][1] )
  1588. write_coord( gHookLocation[id][2] )
  1589. write_short( beam ) // sprite index
  1590. write_byte( 0 ) // start frame
  1591. write_byte( 0 ) // framerate
  1592. write_byte( BEAMLIFE ) // life
  1593. write_byte( 10 ) // width
  1594. write_byte( 0 ) // noise
  1595. if (get_user_team(id)==1) // Terrorist
  1596. {
  1597. write_byte( 255 ) // r, g, b
  1598. write_byte( 0 ) // r, g, b
  1599. write_byte( 0 ) // r, g, b
  1600. }
  1601. else // Counter-Terrorist
  1602. {
  1603. write_byte( 0 ) // r, g, b
  1604. write_byte( 0 ) // r, g, b
  1605. write_byte( 255 ) // r, g, b
  1606. }
  1607. write_byte( 150 ) // brightness
  1608. write_byte( 0 ) // speed
  1609. message_end( )
  1610. gBeamIsCreated[id] = get_gametime()
  1611. }
  1612.  
  1613. public killbeam(id)
  1614. {
  1615. message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
  1616. write_byte( TE_KILLBEAM )
  1617. write_short( id )
  1618. message_end()
  1619. }
  1620.  
  1621. /************************************************************************************************************************/
  1622. /******************************************************* FORWARDS *******************************************************/
  1623. /************************************************************************************************************************/
  1624.  
  1625. public client_disconnect(id) {
  1626. gCheckpoint[id]=false
  1627. gJoined[id]=false
  1628. gAllowedHook[id]=0
  1629. ResetTimer(id,0)
  1630. }
  1631.  
  1632. /*#if defined NO_STEAM() {*/
  1633. public client_putinserver(id) {
  1634. /*#else
  1635. public client_authorized(id) {
  1636. #endif*/
  1637. gJoined[id]=true
  1638. gCheckpoint[id]=false
  1639. gMoney[id]=gStartMoney
  1640. ResetTimer(id,0)
  1641. }
  1642.  
  1643. #if USING_AMX
  1644. public client_prethink(id) {
  1645. if (get_cvar_num("kz_bunnyjump")==0)
  1646. return PLUGIN_CONTINUE
  1647.  
  1648. if(!is_user_alive(id)) return PLUGIN_CONTINUE
  1649.  
  1650. entity_set_float(id, EV_FL_fuser2, 0.0) // Disable slow down after jumping
  1651.  
  1652. if (get_cvar_num("kz_bunnyjump")>=2)
  1653. return PLUGIN_CONTINUE
  1654.  
  1655. // Code from CBasePlayer::Jump (player.cpp) Make a player jump automatically
  1656. if (entity_get_int(id, EV_INT_button) & 2) { // If holding jump
  1657. new flags = entity_get_int(id, EV_INT_flags)
  1658.  
  1659. if (flags & FL_WATERJUMP)
  1660. return PLUGIN_CONTINUE
  1661. if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )
  1662. return PLUGIN_CONTINUE
  1663. if ( !(flags & FL_ONGROUND) )
  1664. return PLUGIN_CONTINUE
  1665.  
  1666. new Float:velocity[3]
  1667. entity_get_vector(id, EV_VEC_velocity, velocity)
  1668. velocity[2] += 250.0
  1669. entity_set_vector(id, EV_VEC_velocity, velocity)
  1670.  
  1671. entity_set_int(id, EV_INT_gaitsequence, 6) // Play the Jump Animation
  1672. }
  1673. return PLUGIN_CONTINUE
  1674. }
  1675. #else
  1676. public client_PreThink(id) {
  1677. if (get_cvar_num("kz_bunnyjump")==0)
  1678. return PLUGIN_CONTINUE
  1679.  
  1680. if(!is_user_alive(id)) return PLUGIN_CONTINUE
  1681.  
  1682. entity_set_float(id, EV_FL_fuser2, 0.0) // Disable slow down after jumping
  1683.  
  1684. if (get_cvar_num("kz_bunnyjump")>1)
  1685. return PLUGIN_CONTINUE
  1686.  
  1687. // Code from CBasePlayer::Jump (player.cpp) Make a player jump automatically
  1688. if (entity_get_int(id, EV_INT_button) & 2) { // If holding jump
  1689. new flags = entity_get_int(id, EV_INT_flags)
  1690.  
  1691. if (flags & FL_WATERJUMP)
  1692. return PLUGIN_CONTINUE
  1693. if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )
  1694. return PLUGIN_CONTINUE
  1695. if ( !(flags & FL_ONGROUND) )
  1696. return PLUGIN_CONTINUE
  1697.  
  1698. new Float:velocity[3]
  1699. entity_get_vector(id, EV_VEC_velocity, velocity)
  1700. velocity[2] += 250.0
  1701. entity_set_vector(id, EV_VEC_velocity, velocity)
  1702.  
  1703. entity_set_int(id, EV_INT_gaitsequence, 6) // Play the Jump Animation
  1704. }
  1705. return PLUGIN_CONTINUE
  1706. }
  1707. #endif
  1708.  
  1709. public entity_touch(entity1, entity2) {
  1710. DoTouch(entity1,entity2)
  1711. }
  1712.  
  1713. public pfn_touch(ptr, ptd) {
  1714. DoTouch(ptr,ptd)
  1715. }
  1716.  
  1717. public DoTouch(pToucher,pTouched) {
  1718. if (pToucher == 0 || pTouched == 0) return PLUGIN_CONTINUE
  1719.  
  1720. new pTouchername[32], pTouchedname[32],pToucherTarget[32],pToucherTargetname[32]
  1721. entity_get_string(pToucher, EV_SZ_classname, pTouchername, 31)
  1722. entity_get_string(pTouched, EV_SZ_classname, pTouchedname, 31)
  1723. entity_get_string(pToucher, EV_SZ_targetname, pToucherTargetname, 31)
  1724. entity_get_string(pToucher, EV_SZ_target, pToucherTarget, 31)
  1725.  
  1726. if(equal(pTouchername, "func_button") && equal(pTouchedname, "player"))
  1727. {
  1728. if (get_cvar_num("kz_timer")==1) {
  1729. if (equal(pToucherTarget, "counter_start") && !gHasTimer[pTouched] || equal(pToucherTargetname, "clockstartbutton") && !gHasTimer[pTouched]) {
  1730. gHasTimer[pTouched]=true
  1731. client_print(pTouched,print_chat,"[KZ] Idozito Elinditva")
  1732. gCheckpoint[pTouched]=false
  1733. }
  1734. if (equal(pToucherTarget, "counter_off") && gHasTimer[pTouched] && !gHasStoppedTimer[pTouched] || equal(pToucherTargetname, "clockstopbutton") && gHasTimer[pTouched] && !gHasStoppedTimer[pTouched] ) {
  1735. new gName[33]
  1736. gHasStoppedTimer[pTouched]=true
  1737. gHasTimer[pTouched]=false
  1738. get_user_name(pTouched,gName,32)
  1739. client_print(pTouched,print_chat,"[KZ] Idozito Megallitva")
  1740. if (get_cvar_num("kz_checkpoints") == 1) client_print(0,print_chat,"[KZ] %s vegigvitte a palyat %d:%d:%d (Osszesen %d CheckPontal)",gName,gMins[pTouched],gSecs[pTouched],gHuns[pTouched],gChecks[pTouched])
  1741. else client_print(0,print_chat,"[KZ] %s vegigvitte a palyat %d:%d:%d",gName,gMins[pTouched],gSecs[pTouched],gHuns[pTouched])
  1742. check_top15(pTouched)
  1743. }
  1744. }
  1745. }
  1746. return PLUGIN_CONTINUE
  1747. }
  1748.  
  1749. /************************************************************************************************************************/
  1750. /********************************************************* TIMER ********************************************************/
  1751. /************************************************************************************************************************/
  1752.  
  1753. public gTimerTask() {
  1754. for (new id=1;id<33;id++) {
  1755. if(gHasTimer[id]) {
  1756. gHuns[id]+=10
  1757. if (gHuns[id] == 100) {
  1758. gHuns[id] = 00
  1759. gSecs[id] += 1
  1760. }
  1761. if (gSecs[id] == 60) {
  1762. gSecs[id] = 00
  1763. gMins[id] += 1
  1764. }
  1765. if (gMins[id] == 120) {
  1766. gMins[id] = 00
  1767. ResetTimer(id,1)
  1768. if (is_user_connected(id)) client_print(id,print_center,"Bocs de tul sok idot hasznaltal el")
  1769. }
  1770. new sMins[33],sSecs[33],sHuns[33]
  1771. FormatTime(gMins[id],gSecs[id],gHuns[id],sMins,sSecs,sHuns)
  1772. if (is_user_connected(id)) client_print(id,print_center,"%s:%s:%s",sMins,sSecs,sHuns)
  1773. }
  1774. }
  1775. }
  1776.  
  1777. public ResetTimer(id,msg)
  1778. {
  1779. if (msg==1) client_print(id,print_chat,"[KZ] Ido Torlese...")
  1780. gHasTimer[id]=false
  1781. gHasStoppedTimer[id]=false
  1782. gSecs[id]=0
  1783. gMins[id]=0
  1784. gHuns[id]=0
  1785. gChecks[id]=0
  1786. }
  1787.  
  1788. /************************************************************************************************************************/
  1789. /************************************************** AMXX -> AMX funcs ***************************************************/
  1790. /************************************************************************************************************************/
  1791. #if USING_AMX
  1792. stock get_user_button(id) return entity_get_int(id, EV_INT_button)
  1793. stock find_ent_by_class(iIndex, szValue[]) return find_entity(iIndex, szValue)
  1794. stock cs_get_user_money(index) return get_user_money(index)
  1795. stock cs_set_user_money(index, money, flash = 1) set_user_money(index, money, flash)
  1796. #endif
  1797.  
  1798. /************************************************************************************************************************/
  1799. /******************************************************* Top 15 *********************************************************/
  1800. /************************************************************************************************************************/
  1801.  
  1802. public check_top15(id) {
  1803. if (get_cvar_num("kz_top15")!=1)
  1804. return
  1805. new name[32],authid[32]
  1806. get_user_name( id, name, 31 )
  1807. get_user_authid( id, authid ,31 )
  1808.  
  1809. new sPlayerScore[10], sHighScore[10], iPlayerScore, iHighScore
  1810. new sMins[33],sSecs[33],sHuns[33]
  1811. new sMinsScore[33],sSecsScore[33],sHunsScore[33]
  1812. FormatTime(gMins[id],gSecs[id],gHuns[id],sMins,sSecs,sHuns)
  1813. format(sPlayerScore,9,"%s%s%s",sMins,sSecs,sHuns)
  1814. FormatTime(gMinsScore[14],gSecsScore[14],gHunsScore[14],sMinsScore,sSecsScore,sHunsScore)
  1815. format(sHighScore,9,"%s%s%s",sMinsScore,sSecsScore,sHunsScore)
  1816. iPlayerScore = str_to_num(sPlayerScore)
  1817. iHighScore = str_to_num(sHighScore)
  1818.  
  1819. if( iPlayerScore < iHighScore) {
  1820. for( new i = 0; i < 15; i++ ) {
  1821. FormatTime(gMinsScore[i],gSecsScore[i],gHunsScore[i],sMinsScore,sSecsScore,sHunsScore)
  1822. format(sHighScore,9,"%s%s%s",sMinsScore,sSecsScore,sHunsScore)
  1823. iHighScore = str_to_num(sHighScore)
  1824. if( iPlayerScore < iHighScore) {
  1825. new pos = i
  1826. while( !equal( gAuthScore[pos], authid ) && pos < 14 )
  1827. pos++
  1828. for( new j = pos; j > i; j-- ) {
  1829. format( gAuthScore[j], 32, gAuthScore[j-1] )
  1830. format( gNameScore[j], 32, gNameScore[j-1] )
  1831. gMinsScore[j] = gMinsScore[j-1]
  1832. gSecsScore[j] = gSecsScore[j-1]
  1833. gHunsScore[j] = gHunsScore[j-1]
  1834. gChecksScore[j] = gChecksScore[j-1]
  1835. }
  1836.  
  1837. format( gAuthScore[i], 32, authid )
  1838. format( gNameScore[i], 32, name )
  1839. gMinsScore[i] = gMins[id]
  1840. gSecsScore[i] = gSecs[id]
  1841. gHunsScore[i] = gHuns[id]
  1842. gChecksScore[i] = gChecks[id]
  1843.  
  1844. save_top15()
  1845. return
  1846. }
  1847. if( equal( gAuthScore[i], authid ) )
  1848. return
  1849. }
  1850. }
  1851. return
  1852. }
  1853.  
  1854. public save_top15() {
  1855. if (get_cvar_num("kz_top15")!=1)
  1856. return PLUGIN_HANDLED
  1857.  
  1858. new cMap[32]
  1859. get_mapname(cMap, 31)
  1860.  
  1861. new cScoreFile[128]
  1862. format(cScoreFile, 127, "%s/%s.txt", gScorePath, cMap)
  1863.  
  1864. if( file_exists(cScoreFile) )
  1865. delete_file(cScoreFile)
  1866.  
  1867. for( new i = 0; i < 15; i++ ) {
  1868. if( gMinsScore[i] == 0 && gSecsScore[i] == 0 && gHunsScore[i] == 0)
  1869. return PLUGIN_HANDLED
  1870.  
  1871. new TextToSave[1024],sNameScore[33]
  1872. format(sNameScore, 127, "^"%s^"", gNameScore[i])
  1873. format(TextToSave,sizeof(TextToSave),"%s %s %d %d %d %d",gAuthScore[i],sNameScore,gMinsScore[i],gSecsScore[i],gHunsScore[i],gChecksScore[i])
  1874. write_file(cScoreFile, TextToSave)
  1875. }
  1876. return PLUGIN_HANDLED
  1877. }
  1878.  
  1879. public read_top15() {
  1880. if (get_cvar_num("kz_top15")!=1)
  1881. return PLUGIN_HANDLED
  1882.  
  1883. for( new i = 0 ; i < 15; ++i) {
  1884. gAuthScore[i] = "X"
  1885. gNameScore[i] = "X"
  1886. gMinsScore[i] = 9999999
  1887. gSecsScore[i] = 0
  1888. gHunsScore[i] = 0
  1889. gChecksScore[i] = 9999999
  1890. }
  1891. new cMap[32]
  1892. get_mapname(cMap, 31)
  1893.  
  1894. new cScoreFile[128]
  1895. format(cScoreFile, 127, "%s/%s.txt", gScorePath, cMap)
  1896.  
  1897. if(file_exists(cScoreFile) == 1) {
  1898. new line, stxtsize
  1899. new data[192]
  1900. new tAuth[32],tName[32],tMins[10],tSecs[10],tHuns[10],tChecks[10]
  1901. for(line = 0; line < 15; ++line) {
  1902. read_file(cScoreFile,line,data,191,stxtsize)
  1903. parse(data,tAuth,31,tName,31,tMins,9,tSecs,9,tHuns,9,tChecks,9)
  1904. format(gAuthScore[line],sizeof(gAuthScore),tAuth)
  1905. format(gNameScore[line],sizeof(gNameScore),tName)
  1906. gMinsScore[line] = str_to_num(tMins)
  1907. gSecsScore[line] = str_to_num(tSecs)
  1908. gHunsScore[line] = str_to_num(tHuns)
  1909. gChecksScore[line] = str_to_num(tChecks)
  1910. }
  1911. }else{
  1912. server_cmd("echo [KZ] Error!!! Failed To Load ^"%s^"!!!",cScoreFile)
  1913. log_message("[KZ] Error!!! Failed To Load ^"%s^"!!!",cScoreFile)
  1914. }
  1915.  
  1916. return PLUGIN_HANDLED
  1917. }
  1918.  
  1919. public show_top15( id ) {
  1920. if (get_cvar_num("kz_top15")!=1) {
  1921. client_print(id,print_chat,"[KZ] Top15 le van tiltva")
  1922. return PLUGIN_HANDLED
  1923. }
  1924.  
  1925. new buffer[2048]
  1926. new line[256]
  1927.  
  1928. new len = format( buffer, 2047, "<table cellspacing=0 rules=all border=2 frame=border>" )
  1929. if (get_cvar_num("kz_checkpoints")==1) {
  1930. len += format( buffer[len], 2047-len, "<tr><th> # <th> Nev <th> Maszasi Ido <th> CheckPontok" )
  1931. }else{
  1932. len += format( buffer[len], 2047-len, "<tr><th> # <th> Nev <th> Maszasi Ido" )
  1933. }
  1934. for(new i = 0; i < 15; ++i) {
  1935. if( gMinsScore[i] == 9999999 && gSecsScore[i] == 0 && gHunsScore[i] == 0 && gChecksScore[i] == 9999999)
  1936. if (get_cvar_num("kz_checkpoints")==1) {
  1937. format(line, 255, "<tr><td> %d. <td> %s <td> %s <td> %s", (i+1), "&lt;----------&gt;", "&lt;not set&gt;", "&lt;not set&gt;" )
  1938. }else{
  1939. format(line, 255, "<tr><td> %d. <td> %s <td> %s", (i+1), "&lt;----------&gt;", "&lt;not set&gt;" )
  1940. }
  1941. else
  1942. if (get_cvar_num("kz_checkpoints")==1) {
  1943. format(line, 255, "<tr><td> %d. <td> %s <td> (%d:%d:%d) <td> (%d)", (i+1), gNameScore[i], gMinsScore[i] , gSecsScore[i], gHunsScore[i], gChecksScore[i] )
  1944. }else{
  1945. format(line, 255, "<tr><td> %d. <td> %s <td> (%d:%d:%d)", (i+1), gNameScore[i], gMinsScore[i] , gSecsScore[i], gHunsScore[i] )
  1946. }
  1947. len += format( buffer[len], 2047-len, line )
  1948. }
  1949.  
  1950. format(line, 255, "</table>" )
  1951. len += format( buffer[len], 2047-len, line )
  1952.  
  1953. show_motd( id, buffer, "Top 15 Maszo")
  1954. return PLUGIN_HANDLED
  1955. }