MegastoRM

UJBM_main.sma

Mar 17th, 2013
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 94.68 KB | None | 0 0
  1.  
  2. #include <amxmodx>
  3. #include <amxmisc>
  4. #include <engine>
  5. #include <fakemeta>
  6. #include <hamsandwich>
  7. #include <fun>
  8. #include <cstrike>
  9.  
  10. #define PLUGIN_NAME "[UJBM] Main"
  11. #define PLUGIN_AUTHOR "R_O_O_T"
  12. #define PLUGIN_VERSION "1.0"
  13. #define PLUGIN_CVAR "Ultimate JailBreak Manager"
  14.  
  15. #define TASK_STATUS 2487000
  16. #define TASK_FREEDAY 2487100
  17. #define TASK_ROUND 2487200
  18. #define TASK_HELP 2487300
  19. #define TASK_SAFETIME 2487400
  20. #define TASK_FREEEND 2487500
  21. #define TASK_GIVEITEMS 2487600
  22. #define TEAM_MENU "#Team_Select_Spect"
  23. #define TEAM_MENU2 "#Team_Select"
  24. #define HUD_DELAY Float:4.0
  25. #define CELL_RADIUS Float:200.0
  26.  
  27. #define get_bit(%1,%2) ( %1 & 1 << ( %2 & 31 ) )
  28. #define set_bit(%1,%2) %1 |= ( 1 << ( %2 & 31 ) )
  29. #define clear_bit(%1,%2) %1 &= ~( 1 << ( %2 & 31 ) )
  30.  
  31. #define vec_len(%1) floatsqroot(%1[0] * %1[0] + %1[1] * %1[1] + %1[2] * %1[2])
  32. #define vec_mul(%1,%2) ( %1[0] *= %2, %1[1] *= %2, %1[2] *= %2)
  33. #define vec_copy(%1,%2) ( %2[0] = %1[0], %2[1] = %1[1],%2[2] = %1[2])
  34.  
  35. // Offsets
  36. #define m_iPrimaryWeapon 116
  37. #define m_iVGUI 510
  38. #define m_fGameHUDInitialized 349
  39. #define m_fNextHudTextArgsGameTime 198
  40.  
  41. #define FLASHCOST 12000
  42. #define HECOST 12000
  43. #define SMOKECOST 10000
  44. #define SHIELDCOST 16000
  45. #define FDCOST 12000
  46. #define CROWBARCOST 16000
  47. #define CTDEAGLECOST 1000
  48. #define CTFLASHCOST 3000
  49. #define HPCOST 4000
  50. #define NVGCOST 1500
  51. #define CTSMOKECOST 3000
  52. #define FLASHLIGHTCOST 2000
  53.  
  54. #define ALIEN_RED 180
  55. #define ALIEN_GREEN 240
  56. #define ALIEN_BLUE 140
  57.  
  58.  
  59. #define OFFSET_TEAM 114
  60. #define OFFSET_PAINSHOCK 108
  61. #define OFFSET_LINUX 5
  62. #define Keyscl_min (1<<0)|(1<<1) // Keys: 12
  63.  
  64.  
  65.  
  66.  
  67.  
  68. enum _hud { _hudsync, Float:_x, Float:_y, Float:_time }
  69. enum _lastrequest { _knife, _deagle, _freeday, _weapon }
  70. enum _duel { _name[16], _csw, _entname[32], _opt[32], _sel[32] }
  71.  
  72. new gp_PrecacheSpawn
  73. new gp_PrecacheKeyValue
  74. new gp_CrowbarMul
  75. new gp_BoxMax
  76. new gp_TalkMode
  77. new gp_VoiceBlock
  78. new gp_RetryTime
  79. new gp_FDLength
  80. new gp_ButtonShoot
  81. new gp_SimonSteps
  82. new gp_GlowModels
  83. new gp_AutoLastresquest
  84. new gp_LastRequest
  85. new gp_NoGame
  86. new gp_Motd
  87. new gp_TShop
  88. new gp_CTShop
  89. new gp_GameHP
  90. new gp_Games
  91. new gp_ShowColor
  92. new gp_Effects
  93. new gp_ShowFD
  94. new gp_ShowWanted
  95. new g_MaxClients
  96. new g_MsgStatusText
  97. new g_MsgStatusIcon
  98. new g_MsgClCorpse
  99. new g_MsgMOTD
  100. new gc_TalkMode
  101. new gc_VoiceBlock
  102. new gc_SimonSteps
  103. new gc_ButtonShoot
  104. new gp_Help
  105. new Float:gc_CrowbarMul
  106.  
  107. // Precache
  108.  
  109. new const _FistModels[][] = { "models/p_bknuckles.mdl", "models/v_bknuckles.mdl" }
  110. new const _CrowbarModels[][] = { "models/p_crowbar.mdl", "models/v_crowbar.mdl" , "models/w_crowbar.mdl" }
  111. new const _RpgModels[][] = { "models/p_rpg.mdl", "models/v_rpg.mdl" , "models/w_rpg.mdl", "models/rpgrocket.mdl" }
  112. new const _RpgSounds[][] = { "weapons/rocketfire1.wav", "weapons/explode3.wav", "weapons/rocket1.wav" }
  113.  
  114. new SpriteExplosion
  115. new const _FistSounds[][] = { "weapons/cbar_hitbod2.wav", "weapons/cbar_hitbod1.wav", "weapons/bullet_hit1.wav", "weapons/bullet_hit2.wav" }
  116. new const _RemoveEntities[][] = {
  117. "func_hostage_rescue", "info_hostage_rescue", "func_bomb_target", "info_bomb_target",
  118. "hostage_entity", "info_vip_start", "func_vip_safetyzone", "func_escapezone"
  119. }
  120.  
  121. new const _WeaponsFree[][] = { "weapon_m4a1", "weapon_deagle", "weapon_g3sg1", "weapon_elite", "weapon_ak47", "weapon_mp5navy", "weapon_m3" }
  122. new const _WeaponsFreeCSW[] = { CSW_M4A1, CSW_DEAGLE, CSW_G3SG1, CSW_ELITE, CSW_AK47, CSW_MP5NAVY, CSW_M3 }
  123. new const _WeaponsFreeAmmo[] = { 999, 999, 999, 999, 999, 999, 999, 999 }
  124.  
  125. new const _Duel[][_duel] =
  126. {
  127. { "Deagle", CSW_DEAGLE, "weapon_deagle", "UJBM_MENU_LASTREQ_OPT4", "UJBM_MENU_LASTREQ_SEL4" },
  128. { "Grenades", CSW_FLASHBANG, "weapon_flashbang", "UJBM_MENU_LASTREQ_OPT5", "UJBM_MENU_LASTREQ_SEL5" }, //rpg!!!
  129. ///rpg
  130. { "Grenades", CSW_HEGRENADE, "weapon_hegrenade", "UJBM_MENU_LASTREQ_OPT6", "UJBM_MENU_LASTREQ_SEL6" },
  131. { "m249", CSW_M249, "weapon_m249", "UJBM_MENU_LASTREQ_OPT8", "UJBM_MENU_LASTREQ_SEL8" },
  132. { "Awp", CSW_AWP, "weapon_awp", "UJBM_MENU_LASTREQ_OPT7", "UJBM_MENU_LASTREQ_SEL7" }
  133. }
  134.  
  135.  
  136. // Reasons
  137. new const g_Reasons[][] = {
  138. "",
  139. "UJBM_PRISONER_REASON_1",
  140. "UJBM_PRISONER_REASON_2",
  141. "UJBM_PRISONER_REASON_3",
  142. "UJBM_PRISONER_REASON_4",
  143. "UJBM_PRISONER_REASON_5",
  144. "UJBM_PRISONER_REASON_6"
  145. }
  146.  
  147. // HudSync: 0=ttinfo / 1=info / 2=simon / 3=ctinfo / 4=player / 5=day / 6=center / 7=help / 8=timer
  148. new const g_HudSync[][_hud] =
  149. {
  150. {0, 0.6, 0.2, 2.0},
  151. {0, -1.0, 0.7, 5.0},
  152. {0, 0.1, 0.2, 2.0},
  153. {0, 0.1, 0.3, 2.0},
  154. {0, -1.0, 0.9, 3.0},
  155. {0, 0.6, 0.1, 3.0},
  156. {0, -1.0, 0.6, 3.0},
  157. {0, 0.8, 0.3, 20.0},
  158. {0, -1.0, 0.4, 3.0},
  159. {0, 0.1, 0.5, 2.0},
  160. {0, -1.0, 0.55, 2.0}
  161.  
  162.  
  163. }
  164.  
  165. // Colors: 0:Simon / 1:Freeday / 2:CT Duel / 3:TT Duel
  166. new const g_Colors[][3] = { {0, 255, 0}, {255, 140, 0}, {0, 0, 255}, {255, 0, 0} }
  167.  
  168.  
  169. //new CsTeams:g_PlayerTeam[33]
  170. new Trie:g_CellManagers
  171. new g_JailDay
  172. new g_PlayerJoin
  173. new g_PlayerReason[33]
  174. new g_PlayerSpect[33]
  175. new g_PlayerSimon[33]
  176.  
  177. new g_PlayerWanted
  178. new g_PlayerCrowbar
  179. new g_PlayerVoice
  180. new g_PlayerRevolt
  181. new g_PlayerHelp
  182. new g_PlayerFreeday
  183. new g_PlayerLast
  184.  
  185. new g_NoShowShop = 0
  186. /*new g_FreedayNext*/
  187. //new g_TeamCount[CsTeams]
  188. //new g_TeamAlive[CsTeams]
  189. new g_BoxStarted
  190. /*new g_CrowbarCount*/
  191. new g_Simon
  192. new g_SimonAllowed
  193. new g_SimonTalking
  194. new g_SimonVoice
  195. new g_RoundStarted
  196. new g_LastDenied
  197. new g_Freeday
  198. new g_RoundEnd
  199. new m_iTrail
  200. new g_Duel
  201. new g_DuelA
  202. new g_DuelB
  203. new g_Buttons[10]
  204. new g_GameMode = 1
  205. new g_nogamerounds
  206. new gmsgSetFOV
  207. new gp_Bind
  208. new g_BackToCT = 0
  209. new g_Fonarik = 0
  210. new CTallowed[31]
  211. new Tallowed[31]
  212. new bindstr[33]
  213. new g_iMsgSayText
  214.  
  215. new gmsgBombDrop
  216.  
  217.  
  218.  
  219. public plugin_init()
  220. {
  221.  
  222. unregister_forward(FM_Spawn, gp_PrecacheSpawn)
  223. unregister_forward(FM_KeyValue, gp_PrecacheKeyValue)
  224.  
  225.  
  226. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
  227. register_cvar(PLUGIN_CVAR, PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY)
  228.  
  229. register_dictionary("ujbm.txt")
  230.  
  231. g_MsgStatusText = get_user_msgid("StatusText")
  232. g_MsgStatusIcon = get_user_msgid("StatusIcon")
  233. g_MsgMOTD = get_user_msgid("MOTD")
  234. g_MsgClCorpse = get_user_msgid("ClCorpse")
  235. gmsgBombDrop = get_user_msgid("BombDrop")
  236. new Copyright[10] = PLUGIN_AUTHOR;
  237.  
  238. register_touch("crowbar", "worldspawn", "cr_bar_snd")
  239.  
  240.  
  241. register_message(g_MsgStatusText, "msg_statustext")
  242. register_message(g_MsgStatusIcon, "msg_statusicon")
  243. register_message(g_MsgMOTD, "msg_motd")
  244. register_message(g_MsgClCorpse, "msg_clcorpse")
  245.  
  246.  
  247. register_event("CurWeapon", "current_weapon", "be", "1=1", "2=29")
  248. register_event("CurWeapon", "current_weapon_fl", "be", "1=1", "2=25")
  249. register_event("StatusValue", "player_status", "be", "1=2", "2!0")
  250. register_event("StatusValue", "player_status", "be", "1=1", "2=0")
  251.  
  252. register_impulse(100, "impulse_100")
  253.  
  254.  
  255. register_forward(FM_Touch, "crowbar_touch")
  256.  
  257. RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_flashbang", "rpg_pre")
  258. //RegisterHam(Ham_Weapon_WeaponIdle, "weapon_flashbang", "rpg_idle")
  259. RegisterHam(Ham_Weapon_Reload, "weapon_flashbang", "rpg_reload")
  260.  
  261. register_touch("rpg_missile", "worldspawn", "rocket_touch")
  262. register_touch("rpg_missile", "player", "rocket_touch")
  263.  
  264.  
  265. RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
  266. RegisterHam(Ham_TakeDamage, "player", "player_damage")
  267.  
  268. RegisterHam(Ham_TraceAttack, "player", "player_attack")
  269.  
  270.  
  271. RegisterHam(Ham_TraceAttack, "func_button", "button_attack")
  272. RegisterHam(Ham_Killed, "player", "player_killed", 1)
  273. RegisterHam(Ham_Item_PreFrame, "player", "player_maxspeed", 1 );
  274.  
  275. register_forward(FM_SetClientKeyValue, "set_client_kv")
  276. register_forward(FM_EmitSound, "sound_emit")
  277. register_forward(FM_Voice_SetClientListening, "voice_listening")
  278. register_forward(FM_CmdStart, "player_cmdstart", 1)
  279.  
  280.  
  281. register_logevent("round_end", 2, "1=Round_End")
  282. register_logevent("round_first", 2, "0=World triggered", "1&Restart_Round_")
  283. register_logevent("round_first", 2, "0=World triggered", "1=Game_Commencing")
  284. register_logevent("round_start", 2, "0=World triggered", "1=Round_Start")
  285.  
  286.  
  287. register_clcmd("drop","drop",0,"")
  288. register_clcmd("+simonvoice", "cmd_voiceon")
  289. register_clcmd("-simonvoice", "cmd_voiceoff")
  290.  
  291. register_clcmd("say /voice", "cmd_simon_micr")
  292. register_clcmd("say /micr", "cmd_simon_micr")
  293. register_clcmd("say /shop", "cmd_shop")
  294. register_clcmd("say /fd", "cmd_freeday")
  295. register_clcmd("say /menu", "cmd_simonmenu")
  296.  
  297.  
  298.  
  299. register_clcmd("say /freeday", "cmd_freeday")
  300. register_clcmd("say /day", "cmd_freeday")
  301. register_clcmd("say /lr", "cmd_lastrequest")
  302. register_clcmd("say /lastrequest", "cmd_lastrequest")
  303. register_clcmd("say /duel", "cmd_lastrequest")
  304. register_clcmd("say /simon", "cmd_simon")
  305. register_clcmd("say /open", "cmd_open")
  306.  
  307. register_clcmd("say /help", "cmd_help")
  308.  
  309. //register_clcmd("say /lr1", "cmd_lastrequest1")
  310. ///kids protection
  311.  
  312. if (Copyright[6] != 'T' || Copyright[2] != 'O' || Copyright[0] != 'R' || Copyright[4] != 'O' ) return PLUGIN_HANDLED
  313. ///kids protection
  314. gp_GlowModels = register_cvar("jb_glowmodels", "0")
  315. gp_SimonSteps = register_cvar("jb_simonsteps", "1")
  316. gp_CrowbarMul = register_cvar("jb_crowbarmultiplier", "25.0")
  317.  
  318. gp_BoxMax = register_cvar("jb_boxmax", "6")
  319. gp_RetryTime = register_cvar("jb_retrytime", "10.0")
  320.  
  321. gp_AutoLastresquest = register_cvar("jb_autolastrequest", "1")
  322. gp_LastRequest = register_cvar("jb_lastrequest", "1")
  323. gp_Motd = register_cvar("jb_motd", "1")
  324. gp_TalkMode = register_cvar("jb_talkmode", "2") // 0-alltak / 1-tt talk / 2-tt no talk
  325. gp_VoiceBlock = register_cvar("jb_blockvoice", "0") // 0-dont block / 1-block voicerecord / 2-block voicerecord except simon
  326. gp_ButtonShoot = register_cvar("jb_buttonshoot", "1") // 0-standard / 1-func_button shoots!
  327. gp_NoGame = register_cvar("jb_nogamerounds", "10")
  328. gp_TShop = register_cvar("jb_tshop", "abcdefg")
  329. gp_CTShop = register_cvar("jb_ctshop", "abcdef")
  330. gp_Games = register_cvar("jb_games", "abcdef")
  331. gp_Bind = register_cvar("jb_bindkey","v")
  332. gp_Help = register_cvar("jb_autohelp","2")
  333. gp_FDLength = register_cvar("jb_fdlen","120.0")
  334. gp_GameHP = register_cvar("jb_hpmultiplier","200")
  335. gp_ShowColor = register_cvar("jb_hud_showcolor","1")
  336. gp_ShowFD = register_cvar("jb_hud_showfd","1")
  337. gp_ShowWanted = register_cvar("jb_hud_show_wanted","1")
  338. gp_Effects= register_cvar("jb_game_effects","2")
  339.  
  340.  
  341. g_MaxClients = get_global_int(GL_maxClients)
  342.  
  343. for(new i = 0; i < sizeof(g_HudSync); i++)
  344. g_HudSync[i][_hudsync] = CreateHudSyncObj()
  345.  
  346.  
  347. gmsgSetFOV = get_user_msgid( "SetFOV" )
  348. g_iMsgSayText = get_user_msgid("SayText");
  349.  
  350.  
  351. set_task(320.0, "help_trollface", _, _, _, "b")
  352.  
  353.  
  354. setup_buttons()
  355. return PLUGIN_CONTINUE
  356. }
  357.  
  358.  
  359. public plugin_precache()
  360. {
  361. static i
  362. precache_model("models/player/ujbm_v1/ujbm_v1.mdl")
  363.  
  364.  
  365.  
  366.  
  367. for(i = 0; i < sizeof(_FistModels); i++)
  368. precache_model(_FistModels[i])
  369.  
  370. for(i = 0; i < sizeof(_CrowbarModels); i++)
  371. precache_model(_CrowbarModels[i])
  372.  
  373. for(i = 0; i < sizeof(_RpgModels); i++)
  374. precache_model(_RpgModels[i])
  375.  
  376.  
  377. for(i = 0; i < sizeof(_FistSounds); i++)
  378. precache_sound(_FistSounds[i])
  379.  
  380. for(i = 0; i < sizeof(_RpgSounds); i++)
  381. precache_sound(_RpgSounds[i])
  382.  
  383. SpriteExplosion = precache_model("sprites/fexplo1.spr")
  384. m_iTrail = precache_model("sprites/smoke.spr")
  385.  
  386. precache_sound("alien_alarm.wav")
  387. precache_sound("jbextreme/nm_goodbadugly.wav")
  388. precache_sound("jbextreme/brass_bell_C.wav")
  389. precache_sound("ambience/the_horror2.wav")
  390. precache_sound("debris/metal2.wav")
  391. precache_sound("items/gunpickup2.wav")
  392. precache_sound("weapons/cbar_hit1.wav")
  393. precache_sound("weapons/cbar_miss1.wav")
  394.  
  395.  
  396.  
  397. g_CellManagers = TrieCreate()
  398. gp_PrecacheSpawn = register_forward(FM_Spawn, "precache_spawn", 1)
  399. gp_PrecacheKeyValue = register_forward(FM_KeyValue, "precache_keyvalue", 1)
  400. }
  401.  
  402. public plugin_natives()
  403. {
  404. register_library("ujbm");
  405. register_native ("get_simon", "_get_simon",0)
  406. register_native ("get_gamemode", "_get_gamemode",0)
  407. register_native ("get_fd", "_get_fd",0)
  408. register_native ("get_wanted", "_get_wanted",0)
  409. register_native ("get_last", "_get_last",0)
  410. }
  411.  
  412. public _get_simon(iPlugin, iParams)
  413. {
  414. return g_Simon;
  415. }
  416.  
  417. public _get_last(iPlugin, iParams)
  418. {
  419. return g_PlayerLast;
  420. }
  421.  
  422. public _get_gamemode(iPlugin, iParams)
  423. {
  424. return g_GameMode;
  425. }
  426.  
  427. public bool:_get_fd(iPlugin, iParams)
  428. {
  429. new id = get_param(1);
  430. if (get_bit(g_PlayerFreeday, id))return true;
  431. return false;
  432. }
  433.  
  434.  
  435. public bool:_get_wanted(iPlugin, iParams)
  436. {
  437. new id = get_param(1);
  438. if (get_bit(g_PlayerWanted, id))return true;
  439. return false;
  440. }
  441.  
  442.  
  443.  
  444. public precache_spawn(ent)
  445. {
  446. if(is_valid_ent(ent))
  447. {
  448. static szClass[33]
  449. entity_get_string(ent, EV_SZ_classname, szClass, sizeof(szClass))
  450. for(new i = 0; i < sizeof(_RemoveEntities); i++)
  451. if(equal(szClass, _RemoveEntities[i]))
  452. remove_entity(ent)
  453. }
  454. }
  455.  
  456.  
  457. public precache_keyvalue(ent, kvd_handle)
  458. {
  459. static info[32]
  460. if(!is_valid_ent(ent))
  461. return FMRES_IGNORED
  462.  
  463. get_kvd(kvd_handle, KV_ClassName, info, charsmax(info))
  464. if(!equal(info, "multi_manager"))
  465. return FMRES_IGNORED
  466.  
  467. get_kvd(kvd_handle, KV_KeyName, info, charsmax(info))
  468. TrieSetCell(g_CellManagers, info, ent)
  469. return FMRES_IGNORED
  470. }
  471.  
  472. public client_putinserver(id)
  473. {
  474. clear_bit(g_PlayerJoin, id)
  475. clear_bit(g_PlayerHelp, id)
  476. clear_bit(g_PlayerCrowbar, id)
  477. clear_bit(g_PlayerWanted, id)
  478. clear_bit(g_SimonTalking, id)
  479. clear_bit(g_SimonVoice, id)
  480. g_PlayerSpect[id] = 0
  481. g_PlayerSimon[id] = 0
  482.  
  483. first_join(id)
  484.  
  485. }
  486.  
  487.  
  488. public client_disconnect(id)
  489. {
  490. if(g_Simon == id)
  491. {
  492. g_Simon = 0
  493. ClearSyncHud(0, g_HudSync[2][_hudsync])
  494. player_hudmessage(0, 2, 5.0, _, "%L", LANG_SERVER, "UJBM_SIMON_HASGONE")
  495. }
  496. else if(g_PlayerLast == id || (g_Duel && (id == g_DuelA || id == g_DuelB)))
  497. {
  498. g_Duel = 0
  499. g_DuelA = 0
  500. g_DuelB = 0
  501. g_LastDenied = 0
  502. //g_BlockWeapons = 0
  503. g_PlayerLast = 0
  504. }
  505.  
  506. }
  507.  
  508. public client_PostThink(id)
  509. {
  510. if(id != g_Simon || !gc_SimonSteps || !is_user_alive(id) ||
  511. !(entity_get_int(id, EV_INT_flags) & FL_ONGROUND) || entity_get_int(id, EV_ENT_groundentity))
  512. return PLUGIN_CONTINUE
  513.  
  514. static Float:origin[3]
  515. static Float:last[3]
  516.  
  517. entity_get_vector(id, EV_VEC_origin, origin)
  518. if(get_distance_f(origin, last) < 32.0)
  519. {
  520. return PLUGIN_CONTINUE
  521. }
  522.  
  523. vec_copy(origin, last)
  524. if(entity_get_int(id, EV_INT_bInDuck))
  525. origin[2] -= 18.0
  526. else
  527. origin[2] -= 36.0
  528.  
  529.  
  530. message_begin(MSG_BROADCAST, SVC_TEMPENTITY, {0,0,0}, 0)
  531. write_byte(TE_WORLDDECAL)
  532. write_coord(floatround(origin[0]))
  533. write_coord(floatround(origin[1]))
  534. write_coord(floatround(origin[2]))
  535. write_byte(105)
  536. message_end()
  537.  
  538. return PLUGIN_CONTINUE
  539. }
  540.  
  541.  
  542. public msg_statustext(msgid, dest, id)
  543. {
  544. return PLUGIN_HANDLED
  545. }
  546.  
  547. public msg_statusicon(msgid, dest, id)
  548. {
  549. static icon[5]
  550. get_msg_arg_string(2, icon, charsmax(icon))
  551. if(icon[0] == 'b' && icon[2] == 'y' && icon[3] == 'z')
  552. {
  553. set_pdata_int(id, 235, get_pdata_int(id, 235) & ~(1<<0))
  554. return PLUGIN_HANDLED
  555. }
  556.  
  557. return PLUGIN_CONTINUE
  558. }
  559. \
  560. public msg_motd(msgid, dest, id)
  561. {
  562. if(get_pcvar_num(gp_Motd))
  563. return PLUGIN_HANDLED
  564.  
  565. return PLUGIN_CONTINUE
  566. }
  567.  
  568. public msg_clcorpse(msgid, dest, id)
  569. {
  570. return PLUGIN_HANDLED
  571. }
  572.  
  573. public current_weapon(id)
  574. {
  575. if(!is_user_alive(id))
  576. return PLUGIN_CONTINUE
  577.  
  578. if(get_bit(g_PlayerCrowbar, id))
  579. {
  580. set_pev(id, pev_viewmodel2, _CrowbarModels[1])
  581. set_pev(id, pev_weaponmodel2, _CrowbarModels[0])
  582. }
  583. else
  584. {
  585. set_pev(id, pev_viewmodel2, _FistModels[1])
  586. set_pev(id, pev_weaponmodel2, _FistModels[0])
  587. }
  588. return PLUGIN_CONTINUE
  589. }
  590.  
  591. public player_status(id)
  592. {
  593.  
  594. static type, player, CsTeams:team, name[32], health
  595. type = read_data(1)
  596. player = read_data(2)
  597. switch(type)
  598. {
  599. case(1):
  600. {
  601. ClearSyncHud(id, g_HudSync[1][_hudsync])
  602. }
  603. case(2):
  604. {
  605. if (player == g_Simon) return PLUGIN_HANDLED
  606. team = cs_get_user_team(player)
  607. if((team != CS_TEAM_T) && (team != CS_TEAM_CT))
  608. return PLUGIN_HANDLED
  609.  
  610. health = get_user_health(player)
  611. get_user_name(player, name, charsmax(name))
  612. player_hudmessage(id, 4, 2.0, {0, 255, 0}, "%L", LANG_SERVER,
  613. (team == CS_TEAM_T) ? "UJBM_PRISONER_STATUS" : "UJBM_GUARD_STATUS", name, health)
  614. }
  615. }
  616.  
  617. return PLUGIN_HANDLED
  618. }
  619.  
  620. public impulse_100(id)
  621. {
  622. if(!get_bit(g_Fonarik,id))
  623. return PLUGIN_HANDLED
  624.  
  625. return PLUGIN_CONTINUE
  626. }
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633. public player_maxspeed(id)
  634. {
  635.  
  636. if(!is_user_connected(id))
  637. return HAM_IGNORED
  638.  
  639. switch (g_GameMode)
  640. {
  641. case 3:
  642. {
  643. if (cs_get_user_team(id) == CS_TEAM_T) set_user_maxspeed(id ,310.0)
  644. }
  645. case 4:
  646. {
  647.  
  648. if (g_Simon == id) set_user_maxspeed(id ,450.0)
  649.  
  650. }
  651. case 5:
  652. {
  653.  
  654. if (g_Simon == id) set_user_maxspeed(id ,320.0)
  655.  
  656. }
  657.  
  658. default:
  659. {
  660. set_user_maxspeed(id ,250.0)
  661.  
  662. }
  663. }
  664. return PLUGIN_HANDLED
  665.  
  666. }
  667.  
  668.  
  669.  
  670.  
  671.  
  672. public player_spawn(id)
  673. {
  674. static CsTeams:team
  675.  
  676. if(!is_user_connected(id))
  677. return HAM_IGNORED
  678.  
  679. set_pdata_float(id, m_fNextHudTextArgsGameTime, get_gametime() + 999999.0)
  680. player_strip_weapons(id)
  681. if(g_RoundEnd)
  682. {
  683. g_RoundEnd = 0
  684. g_JailDay++
  685. }
  686.  
  687. set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
  688.  
  689.  
  690. clear_bit(g_PlayerWanted, id)
  691. team = cs_get_user_team(id)
  692.  
  693. if (!get_bit(g_NoShowShop,id)) cmd_shop(id)
  694.  
  695.  
  696.  
  697.  
  698. switch(team)
  699. {
  700. case(CS_TEAM_T):
  701. {
  702. g_PlayerLast = 0
  703. if(!g_PlayerReason[id])
  704. g_PlayerReason[id] = random_num(1, 6)
  705.  
  706. player_hudmessage(id, 0, 5.0, {255, 0, 255}, "%L %L", LANG_SERVER, "UJBM_PRISONER_REASON",
  707. LANG_SERVER, g_Reasons[g_PlayerReason[id]])
  708.  
  709.  
  710. client_infochanged(id)
  711. entity_set_int(id, EV_INT_body, 2)
  712. if (g_GameMode == 0)
  713. {
  714. entity_set_int(id, EV_INT_skin, 3)
  715. } else
  716. /*if(get_bit(g_FreedayAuto, id))
  717. {
  718. freeday_set(0, id)
  719. clear_bit(g_FreedayAuto, id)
  720. }
  721. else*/
  722. {
  723. entity_set_int(id, EV_INT_skin, random_num(0, 2))
  724. }
  725.  
  726.  
  727. cs_set_user_armor(id, 0, CS_ARMOR_NONE)
  728.  
  729. }
  730. case(CS_TEAM_CT):
  731. {
  732.  
  733.  
  734. g_PlayerSimon[id]++
  735.  
  736. set_user_info(id, "model", "ujbm_v1")
  737. entity_set_int(id, EV_INT_body, 3)
  738. cs_set_user_armor(id, 100, CS_ARMOR_VESTHELM)
  739.  
  740. new r = random_num(1,3)
  741. switch (r)
  742. {
  743. case 1:
  744. {
  745. set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 6.0)
  746. show_hudmessage(id, "%L", LANG_SERVER, "UJBM_WARN_FK")
  747. }
  748. case 2:
  749. {
  750. set_hudmessage(0, 255, 0, -1.0, 0.60, 0, 6.0, 6.0)
  751. show_hudmessage(id, "%L", LANG_SERVER, "UJBM_WARN_RULES")
  752. }
  753. default:
  754. {
  755. set_hudmessage(0, 212, 255, -1.0, 0.80, 0, 6.0, 6.0)
  756. show_hudmessage(id, "%L", LANG_SERVER, "UJBM_WARN_MICR")
  757. }
  758. }
  759.  
  760. }
  761. }
  762.  
  763.  
  764.  
  765.  
  766. if (g_GameMode == 4 || g_GameMode == 5)
  767. {
  768.  
  769. if (cs_get_user_team(id) == CS_TEAM_CT)
  770. {
  771.  
  772. set_bit(g_BackToCT, id)
  773. cs_set_user_team2(id, CS_TEAM_T)
  774. }
  775.  
  776. new j = 0;
  777. strip_user_weapons(id)
  778. j = random_num(0, sizeof(_WeaponsFree) - 1)
  779. give_item(id, "weapon_knife")
  780. give_item(id, _WeaponsFree[j])
  781. cs_set_user_bpammo(id, _WeaponsFreeCSW[j], _WeaponsFreeAmmo[j])
  782.  
  783. }
  784.  
  785.  
  786. return HAM_IGNORED
  787. }
  788.  
  789. public task_inviz()
  790. {
  791. /*
  792. message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, g_Simon)
  793. write_short(~0)
  794. write_short(~0)
  795. write_short(0x0004) // stay faded
  796. write_byte(ALIEN_RED)
  797. write_byte(ALIEN_GREEN)
  798. write_byte(ALIEN_BLUE)
  799. write_byte(100)
  800. message_end()
  801. g_Faded = 1*/
  802. set_user_rendering(g_Simon, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0 )
  803. }
  804.  
  805. public player_damage(victim, ent, attacker, Float:damage, bits)
  806. {
  807. if (victim == attacker || !is_user_connected(attacker))
  808. return HAM_IGNORED;
  809.  
  810. if ((g_GameMode == 5 )&& (g_Simon == attacker) )
  811. {
  812. set_user_rendering(attacker, kRenderFxNone, 0, 0, 0, kRenderNormal, 0 )
  813. /*
  814. if (g_Faded)
  815. {
  816. message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, g_Simon)
  817. write_short(1<<10)
  818. write_short(1<<10)
  819. write_short(0x0000) // fade out
  820. write_byte(ALIEN_RED)
  821. write_byte(ALIEN_GREEN)
  822. write_byte(ALIEN_BLUE)
  823. write_byte(100)
  824. message_end()
  825. }
  826. g_Faded = 0*/
  827. remove_task(7447)
  828. set_task(3.1, "task_inviz",7447);
  829. }
  830. /*
  831. if(!is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker)
  832. return HAM_IGNORED
  833. */
  834.  
  835. switch(g_Duel)
  836. {
  837. case(0):
  838. {
  839. if(attacker == ent && get_user_weapon(attacker) == CSW_KNIFE && get_bit(g_PlayerCrowbar, attacker) )
  840. {
  841. SetHamParamFloat(4, damage * gc_CrowbarMul)
  842. return HAM_OVERRIDE
  843. }
  844. }
  845. case(2):
  846. {
  847. if(attacker != g_PlayerLast)
  848. return HAM_SUPERCEDE
  849. }
  850. default:
  851. {
  852. if((victim == g_DuelA && attacker == g_DuelB) || (victim == g_DuelB && attacker == g_DuelA))
  853. return HAM_IGNORED
  854.  
  855. return HAM_SUPERCEDE
  856. }
  857. }
  858.  
  859. return HAM_IGNORED
  860. }
  861.  
  862.  
  863.  
  864. public player_damage2(victim, ent, attacker, Float:damage, bits)
  865. {
  866. if (victim == attacker || !is_user_connected(attacker))
  867. return HAM_IGNORED;
  868.  
  869. //if ((g_GameMode == 4 )&& (g_Simon == victim) ) set_pdata_float(victim, OFFSET_PAINSHOCK, 1.0, OFFSET_LINUX)
  870. /*
  871. if(!is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker)
  872. return HAM_IGNORED
  873. */
  874.  
  875. switch(g_Duel)
  876. {
  877. case(0):
  878. {
  879. if(attacker == ent && get_user_weapon(attacker) == CSW_KNIFE && get_bit(g_PlayerCrowbar, attacker) )
  880. {
  881. SetHamParamFloat(4, damage * gc_CrowbarMul)
  882. return HAM_OVERRIDE
  883. }
  884. }
  885. case(2):
  886. {
  887. if(attacker != g_PlayerLast)
  888. return HAM_SUPERCEDE
  889. }
  890. default:
  891. {
  892. if((victim == g_DuelA && attacker == g_DuelB) || (victim == g_DuelB && attacker == g_DuelA))
  893. return HAM_IGNORED
  894.  
  895. return HAM_SUPERCEDE
  896. }
  897. }
  898.  
  899. return HAM_IGNORED
  900. }
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907. public player_attack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damagebits)
  908. {
  909. static CsTeams:vteam, CsTeams:ateam
  910. if(!is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker)
  911. return HAM_IGNORED
  912.  
  913. vteam = cs_get_user_team(victim)
  914. ateam = cs_get_user_team(attacker)
  915.  
  916. if(ateam == CS_TEAM_CT && vteam == CS_TEAM_CT)
  917. return HAM_SUPERCEDE
  918.  
  919. switch(g_Duel)
  920. {
  921. case(0):
  922. {
  923. if(ateam == CS_TEAM_CT && vteam == CS_TEAM_T)
  924. {
  925. if(get_bit(g_PlayerRevolt, victim))
  926. {
  927. clear_bit(g_PlayerRevolt, victim)
  928. hud_status(0)
  929. }
  930. return HAM_IGNORED
  931. }
  932. }
  933. case(2):
  934. {
  935. if(attacker != g_PlayerLast)
  936. return HAM_SUPERCEDE
  937. }
  938. case(5):
  939. {
  940.  
  941. }
  942. default:
  943. {
  944. if((victim == g_DuelA && attacker == g_DuelB) || (victim == g_DuelB && attacker == g_DuelA))
  945. return HAM_IGNORED
  946.  
  947. return HAM_SUPERCEDE
  948. }
  949. }
  950.  
  951. if(ateam == CS_TEAM_T && vteam == CS_TEAM_T && !g_BoxStarted)
  952. return HAM_SUPERCEDE
  953.  
  954. if(ateam == CS_TEAM_T && vteam == CS_TEAM_CT &&g_GameMode <=1)
  955. {
  956. if(!g_PlayerRevolt)
  957. revolt_start()
  958.  
  959. set_bit(g_PlayerRevolt, attacker)
  960. clear_bit(g_PlayerFreeday, attacker)
  961. }
  962.  
  963. return HAM_IGNORED
  964. }
  965.  
  966. public button_attack(button, id, Float:damage, Float:direction[3], tracehandle, damagebits)
  967. {
  968. if(is_valid_ent(button) && gc_ButtonShoot)
  969. {
  970. ExecuteHamB(Ham_Use, button, id, 0, 2, 1.0)
  971. entity_set_float(button, EV_FL_frame, 0.0)
  972. }
  973.  
  974. return HAM_IGNORED
  975. }
  976.  
  977. public task_last()
  978. {
  979. new Players[32]
  980. new playerCount, i, TAlive
  981.  
  982. get_players(Players, playerCount, "ac")
  983. for (i=0; i<playerCount; i++)
  984. {
  985. if (is_user_connected(Players[i]))
  986.  
  987. if ( cs_get_user_team(Players[i]) == CS_TEAM_T )
  988. {
  989. TAlive++;
  990. }
  991. }
  992. if (TAlive == 1)
  993. {
  994.  
  995. for (i=0; i<playerCount; i++)
  996. {
  997. if ( cs_get_user_team(Players[i]) == CS_TEAM_T )
  998. {
  999. g_PlayerLast = Players[i];
  1000. if (get_pcvar_num(gp_AutoLastresquest)) cmd_lastrequest(Players[i])
  1001. break;
  1002. }
  1003. }
  1004.  
  1005. }
  1006. return PLUGIN_CONTINUE
  1007. }
  1008.  
  1009. public player_killed(victim, attacker, shouldgib)
  1010. {
  1011. static CsTeams:vteam, CsTeams:kteam
  1012.  
  1013.  
  1014.  
  1015.  
  1016. if(!(0 < attacker <= g_MaxClients) || !is_user_connected(attacker))
  1017. kteam = CS_TEAM_UNASSIGNED
  1018. else
  1019. kteam = cs_get_user_team(attacker)
  1020.  
  1021. vteam = cs_get_user_team(victim)
  1022.  
  1023.  
  1024.  
  1025. switch (g_GameMode)
  1026. {
  1027. case 2:
  1028.  
  1029.  
  1030. {
  1031.  
  1032.  
  1033. if (vteam == CS_TEAM_T && kteam == CS_TEAM_CT && is_user_connected(attacker))
  1034. give_item(attacker, "ammo_buckshot")
  1035. }
  1036.  
  1037. case 4:
  1038. {
  1039.  
  1040. if (victim == g_Simon) cs_set_user_money(attacker, 16000)
  1041. else if (attacker == g_Simon) set_user_health(g_Simon, get_user_health(g_Simon) + 100)
  1042. }
  1043. case 5:
  1044. {
  1045.  
  1046. if (victim == g_Simon) cs_set_user_money(attacker, 16000)
  1047. else if (attacker == g_Simon) set_user_health(g_Simon, get_user_health(g_Simon) + 100)
  1048. }
  1049. default:
  1050. {
  1051.  
  1052. if (vteam == CS_TEAM_T)
  1053. {
  1054. remove_task(677365)
  1055. set_task(2.1, "task_last", 677365)
  1056. }
  1057.  
  1058.  
  1059.  
  1060. if(g_Simon == victim)
  1061. {
  1062. g_Simon = 0
  1063. ClearSyncHud(0, g_HudSync[2][_hudsync])
  1064. player_hudmessage(0, 2, 5.0, _, "%L", LANG_SERVER, "UJBM_SIMON_KILLED")
  1065.  
  1066.  
  1067. if (vteam == CS_TEAM_CT && kteam == CS_TEAM_T && is_user_connected(attacker))
  1068. if (victim == g_Simon)
  1069. cs_set_user_money(attacker, cs_get_user_money(attacker) + 3500)
  1070. else cs_set_user_money(attacker, cs_get_user_money(attacker) + 500)
  1071. else if (vteam == CS_TEAM_T && kteam == CS_TEAM_T && is_user_connected(attacker)) cs_set_user_money(attacker, cs_get_user_money(attacker) + 200)
  1072. }
  1073.  
  1074. if (get_bit(g_PlayerCrowbar,victim))
  1075. {
  1076. spawn_crowbar(victim)
  1077. clear_bit(g_PlayerCrowbar, victim)
  1078. }
  1079.  
  1080.  
  1081. switch(g_Duel)
  1082. {
  1083. case(0):
  1084. {
  1085. switch(vteam)
  1086. {
  1087. case(CS_TEAM_CT):
  1088. {
  1089. if(kteam == CS_TEAM_T && !get_bit(g_PlayerWanted, attacker))
  1090. {
  1091. set_bit(g_PlayerWanted, attacker)
  1092. entity_set_int(attacker, EV_INT_skin, 4)
  1093. }
  1094. }
  1095. case(CS_TEAM_T):
  1096. {
  1097. clear_bit(g_PlayerRevolt, victim)
  1098. clear_bit(g_PlayerWanted, victim)
  1099. }
  1100. }
  1101. }
  1102. default:
  1103. {
  1104. if(g_Duel != 2 && (attacker == g_DuelA || attacker == g_DuelB))
  1105. {
  1106. set_user_rendering(victim, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
  1107. set_user_rendering(attacker, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
  1108. g_Duel = 0
  1109. g_LastDenied = 0
  1110. //g_BlockWeapons = 0
  1111. g_PlayerLast = 0
  1112. if (g_Duel == 5)
  1113. {
  1114. player_strip_weapons(attacker)
  1115. give_item(attacker,"weapon_knife")
  1116. }
  1117.  
  1118.  
  1119. }
  1120. }
  1121. }
  1122.  
  1123.  
  1124. hud_status(0)
  1125. }
  1126. }
  1127. return HAM_IGNORED
  1128. }
  1129.  
  1130.  
  1131.  
  1132. public set_client_kv(id, const info[], const key[])
  1133. {
  1134. if(equal(key, "model"))
  1135. return FMRES_SUPERCEDE
  1136.  
  1137. return FMRES_IGNORED
  1138. }
  1139.  
  1140. public sound_emit(id, channel, sample[])
  1141. {
  1142. if(is_user_alive(id) )
  1143. {
  1144.  
  1145. if (equal(sample, "weapons/knife_", 14))
  1146.  
  1147.  
  1148. switch(sample[17])
  1149. {
  1150. case('b'):
  1151. {
  1152. emit_sound(id, CHAN_WEAPON, "weapons/cbar_hitbod2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  1153. }
  1154. case('w'):
  1155. {
  1156. if (get_bit(g_PlayerCrowbar,id))
  1157. emit_sound(id, CHAN_WEAPON, "weapons/cbar_hit1.wav", 1.0, ATTN_NORM, 0, PITCH_LOW)
  1158. else
  1159. emit_sound(id, CHAN_WEAPON, "weapons/cbar_hitbod1.wav", 1.0, ATTN_NORM, 0, PITCH_LOW)
  1160. }
  1161. case('1', '2'):
  1162. {
  1163. emit_sound(id, CHAN_WEAPON, "weapons/bullet_hit2.wav", random_float(0.5, 1.0), ATTN_NORM, 0, PITCH_NORM)
  1164. }
  1165.  
  1166. case('s'):
  1167. {
  1168. if (get_bit(g_PlayerCrowbar,id))
  1169. emit_sound(id, CHAN_WEAPON, "weapons/cbar_miss1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  1170. }
  1171. }
  1172.  
  1173.  
  1174.  
  1175.  
  1176. return FMRES_SUPERCEDE
  1177.  
  1178.  
  1179.  
  1180. }
  1181. return FMRES_IGNORED
  1182. }
  1183.  
  1184. public voice_listening(receiver, sender, bool:listen)
  1185. {
  1186. if((receiver == sender))
  1187. return FMRES_IGNORED
  1188.  
  1189. if(is_user_admin(sender))
  1190. {
  1191. engfunc(EngFunc_SetClientListening, receiver, sender, true)
  1192. return FMRES_SUPERCEDE
  1193. }
  1194.  
  1195. switch(gc_VoiceBlock)
  1196. {
  1197. case(2):
  1198. {
  1199. if((sender != g_Simon) && (!get_bit(g_SimonVoice, sender) && gc_VoiceBlock))
  1200. {
  1201. engfunc(EngFunc_SetClientListening, receiver, sender, false)
  1202. return FMRES_SUPERCEDE
  1203. }
  1204. }
  1205. case(1):
  1206. {
  1207. if(!get_bit(g_SimonVoice, sender) && gc_VoiceBlock)
  1208. {
  1209. engfunc(EngFunc_SetClientListening, receiver, sender, false)
  1210. return FMRES_SUPERCEDE
  1211. }
  1212. }
  1213. }
  1214. if(!is_user_alive(sender))
  1215. {
  1216. engfunc(EngFunc_SetClientListening, receiver, sender, false)
  1217. return FMRES_SUPERCEDE
  1218. }
  1219.  
  1220. if(sender == g_Simon)
  1221. {
  1222. engfunc(EngFunc_SetClientListening, receiver, sender, true)
  1223. return FMRES_SUPERCEDE
  1224. }
  1225.  
  1226. if(get_bit(g_PlayerVoice, sender))
  1227. {
  1228. engfunc(EngFunc_SetClientListening, receiver, sender, true)
  1229. return FMRES_SUPERCEDE
  1230. }
  1231.  
  1232. listen = true
  1233.  
  1234. if(g_SimonTalking && (sender != g_Simon))
  1235. {
  1236. listen = false
  1237. }
  1238. else
  1239. {
  1240. static CsTeams:steam
  1241. steam = cs_get_user_team(sender)
  1242. switch(gc_TalkMode)
  1243. {
  1244. case(2):
  1245. {
  1246. listen = (steam == CS_TEAM_CT)
  1247. }
  1248. case(1):
  1249. {
  1250. listen = (steam == CS_TEAM_CT || steam == CS_TEAM_T)
  1251. }
  1252. }
  1253. }
  1254.  
  1255. engfunc(EngFunc_SetClientListening, receiver, sender, listen)
  1256. return FMRES_SUPERCEDE
  1257. }
  1258.  
  1259. public player_cmdstart(id, uc, random)
  1260. {
  1261. if(g_Duel > 3)
  1262. {
  1263. if (_Duel[g_Duel - 4][_csw] != CSW_M249) cs_set_user_bpammo(id, _Duel[g_Duel - 4][_csw], 1)
  1264. }
  1265. }
  1266.  
  1267. public round_first()
  1268. {
  1269.  
  1270. g_JailDay = 0
  1271. for(new i = 1; i <= g_MaxClients; i++)
  1272. {
  1273. g_PlayerSimon[i] = 0
  1274.  
  1275. }
  1276.  
  1277. set_cvar_num("sv_alltalk", 1)
  1278. set_cvar_num("mp_roundtime", 2)
  1279. set_cvar_num("mp_limitteams", 0)
  1280. set_cvar_num("mp_autoteambalance", 0)
  1281. set_cvar_num("mp_tkpunish", 0)
  1282. set_cvar_num("mp_friendlyfire", 1)
  1283. round_end()
  1284. g_GameMode = 1
  1285. }
  1286.  
  1287. public round_end()
  1288. {
  1289. server_cmd("jb_unblock_weapons")
  1290. g_PlayerRevolt = 0
  1291. g_PlayerFreeday = 0
  1292. /* g_PlayerVoice = 0*/
  1293. g_PlayerLast = 0
  1294. g_BoxStarted = 0
  1295. /*g_CrowbarCount = 0*/
  1296. g_Simon = 0
  1297. g_SimonAllowed = 0
  1298. g_RoundStarted = 0
  1299. g_LastDenied = 0
  1300.  
  1301.  
  1302. new Ent = -1
  1303. while((Ent = find_ent_by_class(Ent, "rpg_off")))
  1304. {
  1305. remove_entity(Ent)
  1306. }
  1307. g_Freeday = 0
  1308. /*g_FreedayNext = (random_num(0,99) >= 95)*/
  1309. g_RoundEnd = 1
  1310. g_Duel = 0
  1311. g_Fonarik = 0
  1312.  
  1313.  
  1314.  
  1315. remove_task(TASK_STATUS)
  1316. remove_task(TASK_FREEDAY)
  1317. remove_task(TASK_FREEEND)
  1318. remove_task(TASK_ROUND)
  1319. remove_task(TASK_GIVEITEMS)
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325. for(new i = 0; i < sizeof(g_HudSync); i++)
  1326. ClearSyncHud(0, g_HudSync[i][_hudsync])
  1327.  
  1328. if (g_GameMode > 1)
  1329. {
  1330.  
  1331. set_lights("#OFF");
  1332. fog(false)
  1333.  
  1334. new Players[32]
  1335.  
  1336. new playerCount, i
  1337. get_players(Players, playerCount, "c")
  1338. for (i=0; i<playerCount; i++)
  1339. {
  1340. if (is_user_connected(Players[i]))
  1341. {
  1342. if (get_bit(g_BackToCT, Players[i])) cs_set_user_team2(Players[i], CS_TEAM_CT)
  1343. client_infochanged(Players[i])
  1344. set_user_maxspeed(Players[i], 250.0)
  1345. menu_cancel(Players[i])
  1346. player_strip_weapons(Players[i])
  1347. }
  1348.  
  1349. }
  1350. /*if (g_Faded)
  1351. {
  1352. message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, g_Simon)
  1353. write_short(1<<10)
  1354. write_short(1<<10)
  1355. write_short(0x0000) // fade out
  1356. write_byte(ALIEN_RED)
  1357. write_byte(ALIEN_GREEN)
  1358. write_byte(ALIEN_BLUE)
  1359. write_byte(100)
  1360. message_end()
  1361. }*/
  1362. remove_task(7447)
  1363. remove_task(666)
  1364. g_BackToCT = 0
  1365. }
  1366. g_GameMode = 1
  1367.  
  1368.  
  1369. }
  1370.  
  1371. public SimonAllowed()
  1372. {
  1373. g_SimonAllowed = 1
  1374. }
  1375. public round_start()
  1376. {
  1377. gc_TalkMode = get_pcvar_num(gp_TalkMode)
  1378. gc_VoiceBlock = get_pcvar_num(gp_VoiceBlock)
  1379. gc_SimonSteps = get_pcvar_num(gp_SimonSteps)
  1380. gc_ButtonShoot = get_pcvar_num(gp_ButtonShoot)
  1381. gc_CrowbarMul = get_pcvar_float(gp_CrowbarMul)
  1382. get_pcvar_string(gp_TShop, Tallowed,31)
  1383. get_pcvar_string(gp_CTShop, CTallowed,31)
  1384. get_pcvar_string(gp_Bind, bindstr,32)
  1385. g_GameMode = 1
  1386. g_SimonAllowed = 0
  1387. /*g_FreedayNext = 0*/
  1388.  
  1389. g_nogamerounds++
  1390.  
  1391. new ent = -1
  1392. while((ent = find_ent_by_class(ent, "crowbar")))
  1393. {
  1394. if (is_valid_ent(ent)) remove_entity(ent)
  1395. }
  1396.  
  1397.  
  1398.  
  1399. if(g_RoundEnd)
  1400. return
  1401.  
  1402. set_task(HUD_DELAY, "hud_status", TASK_STATUS, _, _, "b")
  1403. set_task(random_float(2.0,5.0), "SimonAllowed")
  1404. player_hudmessage(0, 5, 5.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_STATUS_DAY", g_JailDay)
  1405.  
  1406. }
  1407.  
  1408.  
  1409.  
  1410. public cmd_voiceon(id)
  1411. {
  1412. client_cmd(id, "+voicerecord")
  1413. set_bit(g_SimonVoice, id)
  1414. if(g_Simon == id || is_user_admin(id))
  1415. set_bit(g_SimonTalking, id)
  1416.  
  1417. return PLUGIN_HANDLED
  1418. }
  1419.  
  1420. public cmd_voiceoff(id)
  1421. {
  1422. client_cmd(id, "-voicerecord")
  1423. clear_bit(g_SimonVoice, id)
  1424. if(g_Simon == id || is_user_admin(id))
  1425. clear_bit(g_SimonTalking, id)
  1426.  
  1427. return PLUGIN_HANDLED
  1428. }
  1429.  
  1430. public cmd_simon(id)
  1431. {
  1432. static CsTeams:team, name[32]
  1433. if(!is_user_connected(id))
  1434. return PLUGIN_HANDLED
  1435.  
  1436. team = cs_get_user_team(id)
  1437. if(g_SimonAllowed != 0 && !g_Freeday && is_user_alive(id) && team == CS_TEAM_CT && !g_Simon)
  1438. {
  1439. g_Simon = id
  1440. get_user_name(id, name, charsmax(name))
  1441. entity_set_int(id, EV_INT_body, 1)
  1442. g_PlayerSimon[id]--
  1443. if(get_pcvar_num(gp_GlowModels))
  1444. player_glow(id, g_Colors[0])
  1445. give_item(id, "weapon_p228")
  1446. give_item(id, "ammo_357sig")
  1447. give_item(id, "ammo_357sig")
  1448. give_item(id, "ammo_357sig")
  1449. give_item(id, "ammo_357sig")
  1450. cmd_simonmenu(id)
  1451. hud_status(0)
  1452. }
  1453. return PLUGIN_HANDLED
  1454. }
  1455.  
  1456. public cmd_open(id)
  1457. {
  1458. if(id == g_Simon || id == is_user_admin(id))
  1459. jail_open()
  1460.  
  1461. return PLUGIN_HANDLED
  1462. }
  1463.  
  1464.  
  1465.  
  1466. public cmd_box(id)
  1467. {
  1468.  
  1469. if((id == g_Simon || is_user_admin(id)) && g_GameMode == 1)
  1470. {
  1471. new Players[32]
  1472. new playerCount, i, TAlive
  1473.  
  1474. get_players(Players, playerCount, "ac")
  1475. for (i=0; i<playerCount; i++)
  1476. {
  1477. if (is_user_connected(Players[i]))
  1478.  
  1479. if ( cs_get_user_team(Players[i]) == CS_TEAM_T )
  1480. {
  1481. TAlive++;
  1482. }
  1483. }
  1484.  
  1485. if(TAlive<= get_pcvar_num(gp_BoxMax) && TAlive > 1)
  1486. {
  1487. for(i = 1; i <= g_MaxClients; i++)
  1488. if(is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_T)
  1489. set_user_health(i, 100)
  1490.  
  1491. set_cvar_num("mp_tkpunish", 0)
  1492. set_cvar_num("mp_friendlyfire", 1)
  1493. g_BoxStarted = 1
  1494. player_hudmessage(0, 1, 3.0, _, "%L", LANG_SERVER, "UJBM_GUARD_BOX")
  1495. }
  1496. else
  1497. {
  1498. player_hudmessage(id, 1, 3.0, _, "%L", LANG_SERVER, "UJBM_GUARD_CANTBOX")
  1499. }
  1500. }
  1501. return PLUGIN_HANDLED
  1502. }
  1503.  
  1504.  
  1505. public cmd_help(id)
  1506. {
  1507. if(id > g_MaxClients)
  1508. id -= TASK_HELP
  1509.  
  1510. remove_task(TASK_HELP + id)
  1511.  
  1512.  
  1513.  
  1514. show_motd(id,"jb_help.txt","Ultimate Jail Break Manager");
  1515.  
  1516.  
  1517.  
  1518. }
  1519.  
  1520. public cmd_minmodels(id)
  1521. {
  1522. if(id > g_MaxClients)
  1523. id -= TASK_HELP
  1524.  
  1525. remove_task(TASK_HELP + id)
  1526.  
  1527.  
  1528.  
  1529. query_client_cvar(id, "cl_minmodels", "cvar_result_func");
  1530.  
  1531.  
  1532.  
  1533. }
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542. public cmd_freeday(id)
  1543. {
  1544.  
  1545. if (g_GameMode == 1)
  1546. {
  1547. static menu, menuname[32], option[64]
  1548. if((is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT) || is_user_admin(id))
  1549. {
  1550. formatex(menuname, charsmax(menuname), "%L", LANG_SERVER, "UJBM_MENU_FREEDAY")
  1551. menu = menu_create(menuname, "freeday_choice")
  1552.  
  1553. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_FREEDAY_PLAYER")
  1554. menu_additem(menu, option, "1", 0)
  1555.  
  1556. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_FREEDAY_ALL")
  1557. menu_additem(menu, option, "2", 0)
  1558.  
  1559. menu_display(id, menu)
  1560. }
  1561.  
  1562. }
  1563. return PLUGIN_HANDLED
  1564. }
  1565.  
  1566. public cmd_freeday_player(id)
  1567. {
  1568. if((is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT) || is_user_admin(id))
  1569. menu_players(id, CS_TEAM_T, id, 1, "freeday_select", "%L", LANG_SERVER, "UJBM_MENU_FREEDAY")
  1570.  
  1571. return PLUGIN_CONTINUE
  1572. }
  1573.  
  1574.  
  1575. public cmd_punish(id)
  1576. {
  1577. if((id == g_Simon) || is_user_admin(id) )
  1578. menu_players(id, CS_TEAM_CT, id, 1, "cmd_punish_ct", "%L", LANG_SERVER, "UJBM_MENU_PUNISH")
  1579.  
  1580. return PLUGIN_CONTINUE
  1581. }
  1582.  
  1583.  
  1584.  
  1585. public cmd_lastrequest(id)
  1586. {
  1587.  
  1588. static i, num[5], menu, menuname[32], option[64]
  1589. if (!is_user_alive(g_PlayerLast)) task_last();
  1590. if(!get_pcvar_num(gp_LastRequest) || g_Freeday || g_LastDenied || g_PlayerLast !=id || !is_user_alive(id) || g_GameMode >= 2)
  1591. return PLUGIN_CONTINUE
  1592.  
  1593.  
  1594. formatex(menuname, charsmax(menuname), "%L", LANG_SERVER, "UJBM_MENU_LASTREQ")
  1595. menu = menu_create(menuname, "lastrequest_select")
  1596.  
  1597. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_LASTREQ_OPT1")
  1598. menu_additem(menu, option, "1", 0)
  1599.  
  1600. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_LASTREQ_OPT2")
  1601. menu_additem(menu, option, "2", 0)
  1602.  
  1603. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_LASTREQ_OPT3")
  1604. menu_additem(menu, option, "3", 0)
  1605.  
  1606. for(i = 0; i < sizeof(_Duel); i++)
  1607. {
  1608. num_to_str(i + 4, num, charsmax(num))
  1609. formatex(option, charsmax(option), "%L", LANG_SERVER, _Duel[i][_opt])
  1610. menu_additem(menu, option, num, 0)
  1611. }
  1612.  
  1613.  
  1614. menu_display(id, menu)
  1615. return PLUGIN_CONTINUE
  1616. }
  1617.  
  1618. public adm_freeday(id)
  1619. {
  1620. static player, user[32]
  1621. if(!is_user_admin(id))
  1622. return PLUGIN_CONTINUE
  1623.  
  1624. read_argv(1, user, charsmax(user))
  1625. player = cmd_target(id, user, 2)
  1626. if(is_user_connected(player) && cs_get_user_team(player) == CS_TEAM_T)
  1627. {
  1628. freeday_set(id, player)
  1629. }
  1630. return PLUGIN_HANDLED
  1631. }
  1632.  
  1633.  
  1634. public adm_open(id)
  1635. {
  1636. if(!is_user_admin(id))
  1637. return PLUGIN_CONTINUE
  1638.  
  1639. jail_open()
  1640. return PLUGIN_HANDLED
  1641. }
  1642.  
  1643. public adm_box(id)
  1644. {
  1645. if(!is_user_admin(id))
  1646. return PLUGIN_CONTINUE
  1647.  
  1648. cmd_box(-1)
  1649. return PLUGIN_HANDLED
  1650. }
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657. public revolt_start()
  1658. {
  1659. client_cmd(0,"speak ambience/siren")
  1660. set_task(8.0, "stop_sound")
  1661. hud_status(0)
  1662. }
  1663.  
  1664. public stop_sound(task)
  1665. {
  1666. client_cmd(0, "stopsound")
  1667. }
  1668.  
  1669.  
  1670. public show_color(id)
  1671. {
  1672. new n = 0;
  1673. if (id == 0)
  1674. {
  1675.  
  1676. /*new name[32], szStatus[64]*/
  1677.  
  1678. new Players[32]
  1679. new playerCount, i
  1680. get_players(Players, playerCount, "ac")
  1681. for (i=0; i<playerCount; i++)
  1682. {
  1683. if (is_user_connected(Players[i]))
  1684. if ( cs_get_user_team(Players[i]) == CS_TEAM_T && is_user_alive(Players[i]))
  1685. {
  1686. n=entity_get_int(Players[i], EV_INT_skin);
  1687. switch (n)
  1688. {
  1689. case 0:
  1690. {
  1691.  
  1692. player_hudmessage(Players[i], 10, HUD_DELAY + 1.0, {200, 100, 0}, "%L", LANG_SERVER, "UJBM__COLOR_ORANGE")
  1693. }
  1694.  
  1695. case 1:
  1696. {
  1697.  
  1698. player_hudmessage(Players[i], 10, HUD_DELAY + 1.0, {255, 255, 255}, "%L", LANG_SERVER, "UJBM__COLOR_WHITE")
  1699. }
  1700.  
  1701. case 2:
  1702. {
  1703. player_hudmessage(Players[i], 10, HUD_DELAY + 1.0, {150, 200, 0}, "%L", LANG_SERVER, "UJBM__COLOR_YELLOW")
  1704. }
  1705.  
  1706. case 3:
  1707. {
  1708. player_hudmessage(Players[i], 10, HUD_DELAY + 1.0, {0, 200, 0}, "%L", LANG_SERVER, "UJBM__COLOR_GREEN")
  1709. }
  1710.  
  1711. case 4:
  1712. {
  1713.  
  1714. player_hudmessage(Players[i], 10, HUD_DELAY + 1.0, {200, 0, 0}, "%L", LANG_SERVER, "UJBM__COLOR_RED")
  1715. }
  1716. }
  1717.  
  1718. }
  1719. }
  1720. }
  1721. else
  1722.  
  1723. {
  1724. n=entity_get_int(id, EV_INT_skin);
  1725. switch (n)
  1726. {
  1727. case 0:
  1728. {
  1729.  
  1730. player_hudmessage(id, 10, HUD_DELAY + 1.0, {200, 100, 0}, "%L", LANG_SERVER, "UJBM__COLOR_ORANGE")
  1731. }
  1732.  
  1733. case 1:
  1734. {
  1735.  
  1736. player_hudmessage(id, 10, HUD_DELAY + 1.0, {255, 255, 255}, "%L", LANG_SERVER, "UJBM__COLOR_WHITE")
  1737. }
  1738.  
  1739. case 2:
  1740. {
  1741. player_hudmessage(id, 10, HUD_DELAY + 1.0, {150, 200, 0}, "%L", LANG_SERVER, "UJBM__COLOR_YELLOW")
  1742. }
  1743.  
  1744. case 3:
  1745. {
  1746. player_hudmessage(id, 10, HUD_DELAY + 1.0, {0, 200, 0}, "%L", LANG_SERVER, "UJBM__COLOR_GREEN")
  1747. }
  1748.  
  1749. case 4:
  1750. {
  1751.  
  1752. player_hudmessage(id, 10, HUD_DELAY + 1.0, {200, 0, 0}, "%L", LANG_SERVER, "UJBM__COLOR_RED")
  1753. }
  1754. }
  1755.  
  1756. }
  1757. }
  1758.  
  1759.  
  1760. stock show_count()
  1761. {
  1762. new Players[32]
  1763. new playerCount, i,TAlive,TAll
  1764. new szStatus[64]
  1765. get_players(Players, playerCount, "c")
  1766. for (i=0; i<playerCount; i++)
  1767. {
  1768. if (is_user_connected(Players[i]))
  1769.  
  1770. if ( cs_get_user_team(Players[i]) == CS_TEAM_T)
  1771. {
  1772. TAll++;
  1773. if (is_user_alive(Players[i])) TAlive++;
  1774. }
  1775. }
  1776.  
  1777.  
  1778.  
  1779. formatex(szStatus, charsmax(szStatus), "%L", LANG_SERVER, "UJBM_STATUS", TAlive,TAll)
  1780. message_begin(MSG_BROADCAST, get_user_msgid("StatusText"), {0,0,0}, 0)
  1781. write_byte(0)
  1782. write_string(szStatus)
  1783. message_end()
  1784. }
  1785.  
  1786.  
  1787.  
  1788. public hud_status(task)
  1789. {
  1790. static i, n
  1791. new name[32], szStatus[64], wanted[512], fdlist[512]
  1792.  
  1793.  
  1794.  
  1795.  
  1796. if(g_RoundStarted < (get_pcvar_num(gp_RetryTime) / 2))
  1797. g_RoundStarted++
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805. switch (g_GameMode)
  1806.  
  1807. {
  1808.  
  1809.  
  1810. case 0:
  1811. {
  1812. show_count()
  1813.  
  1814. n = 0
  1815. formatex(wanted, charsmax(wanted), "%L", LANG_SERVER, "UJBM_PRISONER_WANTED")
  1816. n = strlen(wanted)
  1817. for(i = 0; i < g_MaxClients; i++)
  1818. {
  1819.  
  1820. if(get_bit(g_PlayerWanted, i) && is_user_alive(i) && n < charsmax(wanted))
  1821. {
  1822. get_user_name(i, name, charsmax(name))
  1823. n += copy(wanted[n], charsmax(wanted) - n, "^n^t")
  1824. n += copy(wanted[n], charsmax(wanted) - n, name)
  1825. }
  1826. }
  1827.  
  1828.  
  1829. player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_STATUS_FREEDAY")
  1830. if(g_PlayerWanted)
  1831. player_hudmessage(0, 3, HUD_DELAY + 1.0, {255, 25, 50}, "%s", wanted)
  1832. else if(g_PlayerRevolt)
  1833. player_hudmessage(0, 3, HUD_DELAY + 1.0, {255, 25, 50}, "%L", LANG_SERVER, "UJBM_PRISONER_REVOLT")
  1834.  
  1835. }
  1836.  
  1837.  
  1838. case 1:
  1839.  
  1840. {
  1841. show_count()
  1842. if (get_pcvar_num (gp_ShowColor) == 1) show_color(0)
  1843.  
  1844. if (get_pcvar_num (gp_ShowFD) == 1)
  1845. {
  1846. n = 0
  1847. formatex(fdlist, charsmax(fdlist), "%L", LANG_SERVER, "UJBM_FREEDAY_SINGLE")
  1848. n = strlen(fdlist)
  1849. for(i = 0; i < g_MaxClients; i++)
  1850. {
  1851. if(get_bit(g_PlayerFreeday, i) && is_user_alive(i) && n < charsmax(fdlist))
  1852. {
  1853. get_user_name(i, name, charsmax(name))
  1854. n += copy(fdlist[n], charsmax(fdlist) - n, "^n^t")
  1855. n += copy(fdlist[n], charsmax(fdlist) - n, name)
  1856. }
  1857.  
  1858. }
  1859. if(g_PlayerFreeday)
  1860. player_hudmessage(0, 9, HUD_DELAY + 1.0, {0, 255, 0}, "%s", fdlist)
  1861.  
  1862. }
  1863.  
  1864.  
  1865.  
  1866. if (get_pcvar_num (gp_ShowWanted) == 1)
  1867. {
  1868. n = 0
  1869. formatex(wanted, charsmax(wanted), "%L", LANG_SERVER, "UJBM_PRISONER_WANTED")
  1870. n = strlen(wanted)
  1871. for(i = 0; i < g_MaxClients; i++)
  1872. {
  1873. if(get_bit(g_PlayerWanted, i) && is_user_alive(i) && n < charsmax(wanted))
  1874. {
  1875. get_user_name(i, name, charsmax(name))
  1876. n += copy(wanted[n], charsmax(wanted) - n, "^n^t")
  1877. n += copy(wanted[n], charsmax(wanted) - n, name)
  1878. }
  1879. }
  1880. if(g_PlayerWanted)
  1881. player_hudmessage(0, 3, HUD_DELAY + 1.0, {255, 25, 50}, "%s", wanted)
  1882.  
  1883. }
  1884. if(!g_Simon && g_SimonAllowed )
  1885. {
  1886. cmd_simon(random_num(1, g_MaxClients))
  1887. }
  1888. else if (g_Simon != 0)
  1889. {
  1890.  
  1891. get_user_name(g_Simon, name, charsmax(name))
  1892. player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_SIMON_FOLLOW", name)
  1893. }
  1894.  
  1895. if(g_PlayerRevolt)
  1896. player_hudmessage(0, 3, HUD_DELAY + 1.0, {255, 25, 50}, "%L", LANG_SERVER, "UJBM_PRISONER_REVOLT")
  1897.  
  1898.  
  1899.  
  1900. }
  1901.  
  1902. case 2:
  1903.  
  1904. {
  1905. player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_STATUS_ZOMBIEDAY")
  1906. }
  1907.  
  1908. case 3:
  1909.  
  1910. {
  1911. player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_STATUS_HNS")
  1912. }
  1913.  
  1914. case 4:
  1915. {
  1916. get_user_name(g_Simon, name, charsmax(name))
  1917. player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_STATUS_ALIENDAY", name)
  1918. formatex(szStatus, charsmax(szStatus), "%L", LANG_SERVER, "UJBM_STATUS_ALIENHP", get_user_health(g_Simon))
  1919. message_begin(MSG_BROADCAST, get_user_msgid("StatusText"), {0,0,0}, 0)
  1920. write_byte(0)
  1921. write_string(szStatus)
  1922. message_end()
  1923. }
  1924.  
  1925. case 5:
  1926. {
  1927. get_user_name(g_Simon, name, charsmax(name))
  1928. player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_STATUS_ALIENDAY", name)
  1929. formatex(szStatus, charsmax(szStatus), "%L", LANG_SERVER, "UJBM_STATUS_ALIENHP", get_user_health(g_Simon))
  1930. message_begin(MSG_BROADCAST, get_user_msgid("StatusText"), {0,0,0}, 0)
  1931. write_byte(0)
  1932. write_string(szStatus)
  1933. message_end()
  1934. }
  1935.  
  1936. case 6:
  1937. {
  1938. get_user_name(g_Simon, name, charsmax(name))
  1939. player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_STATUS_GORDONDAY")
  1940. formatex(szStatus, charsmax(szStatus), "%L", LANG_SERVER, "UJBM_STATUS_GORDONHP", get_user_health(g_Simon))
  1941. message_begin(MSG_BROADCAST, get_user_msgid("StatusText"), {0,0,0}, 0)
  1942. write_byte(0)
  1943. write_string(szStatus)
  1944. message_end()
  1945. }
  1946.  
  1947.  
  1948. }
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957. }
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963. public prisoner_last(id)
  1964. {
  1965. static name[32], Float:roundmax
  1966.  
  1967.  
  1968. if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T && g_GameMode <= 1)
  1969. {
  1970.  
  1971. get_user_name(id, name, charsmax(name))
  1972. g_PlayerLast = id
  1973. player_hudmessage(0, 6, 5.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_PRISONER_LAST", name)
  1974. remove_task(TASK_ROUND)
  1975. if(roundmax > 0.0)
  1976. {
  1977. player_hudmessage(0, 8, 3.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_STATUS_ENDTIMER", floatround(roundmax - 60.0))
  1978. set_task(roundmax - 60.0, "check_end", TASK_ROUND)
  1979. }
  1980.  
  1981. static i
  1982. new Players[32]
  1983. new playerCount, CTAlive
  1984.  
  1985.  
  1986. get_players(Players, playerCount, "ac")
  1987. for (i=0; i<playerCount; i++)
  1988. {
  1989. if (is_user_connected(Players[i]))
  1990.  
  1991. if ( cs_get_user_team(Players[i]) == CS_TEAM_CT )
  1992. {
  1993. CTAlive++;
  1994. }
  1995. }
  1996.  
  1997.  
  1998. if((CTAlive> 0) && get_pcvar_num(gp_AutoLastresquest) && (g_GameMode == 1))
  1999. cmd_lastrequest(id)
  2000. }
  2001. else if (g_GameMode == 2)
  2002. {
  2003. set_user_health(id, 1000)
  2004. player_glow(id, g_Colors[3])
  2005. set_user_maxspeed(id, 275.0)
  2006. }
  2007. }
  2008.  
  2009. public freeday_select(id, menu, item)
  2010. {
  2011. if(item == MENU_EXIT)
  2012. {
  2013. menu_destroy(menu)
  2014. return PLUGIN_HANDLED
  2015. }
  2016.  
  2017. static dst[32], data[5], player, access, callback
  2018.  
  2019. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  2020. player = str_to_num(data)
  2021. freeday_set(id, player)
  2022. return PLUGIN_HANDLED
  2023. }
  2024.  
  2025. public duel_knives(id, menu, item)
  2026. {
  2027. if(item == MENU_EXIT)
  2028. {
  2029. menu_destroy(menu)
  2030. g_LastDenied = 0
  2031. return PLUGIN_HANDLED
  2032. }
  2033.  
  2034. static dst[32], data[5], access, callback, option[128], player, src[32]
  2035.  
  2036. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  2037. get_user_name(id, src, charsmax(src))
  2038. player = str_to_num(data)
  2039. formatex(option, charsmax(option), "%L^n%L", LANG_SERVER, "UJBM_MENU_LASTREQ_SEL3", src, LANG_SERVER, "UJBM_MENU_DUEL_SEL", src, dst)
  2040. player_hudmessage(0, 6, 3.0, {0, 255, 0}, option)
  2041.  
  2042. g_DuelA = id
  2043. clear_bit(g_PlayerCrowbar, id)
  2044. player_strip_weapons(id)
  2045. player_glow(id, g_Colors[3])
  2046. set_user_health(id, 100)
  2047.  
  2048. g_DuelB = player
  2049. player_strip_weapons(player)
  2050. player_glow(player, g_Colors[2])
  2051. set_user_health(player, 100)
  2052. server_cmd("jb_unblock_teams")
  2053. return PLUGIN_HANDLED
  2054. }
  2055.  
  2056. public duel_guns(id, menu, item)
  2057. {
  2058. if(item == MENU_EXIT || g_PlayerLast != id)
  2059. {
  2060. menu_destroy(menu)
  2061. g_LastDenied = 0
  2062. g_Duel = 0
  2063. return PLUGIN_HANDLED
  2064. }
  2065.  
  2066.  
  2067. static gun, dst[32], data[5], access, callback, option[128], player, src[32]
  2068.  
  2069. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  2070. get_user_name(id, src, charsmax(src))
  2071. player = str_to_num(data)
  2072. formatex(option, charsmax(option), "%L^n%L", LANG_SERVER, _Duel[g_Duel - 4][_sel], src, LANG_SERVER, "UJBM_MENU_DUEL_SEL", src, dst)
  2073. emit_sound(0, CHAN_AUTO, "jbextreme/nm_goodbadugly.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  2074. player_hudmessage(0, 6, 3.0, {0, 255, 0}, option)
  2075.  
  2076.  
  2077.  
  2078.  
  2079. switch (_Duel[g_Duel - 4][_csw])
  2080. {
  2081. case CSW_M249:
  2082. {
  2083. g_DuelA = id
  2084. if(is_user_alive(id))
  2085. {
  2086. player_strip_weapons(id)
  2087. gun = give_item(id, _Duel[g_Duel - 4][_entname])
  2088. cs_set_weapon_ammo(gun, 2000)
  2089. cs_set_user_bpammo(id,CSW_M249,0)
  2090. set_user_health(id, 2000)
  2091. entity_set_int(id, EV_INT_body, 4)
  2092. player_glow(id, g_Colors[3])
  2093. }
  2094. else
  2095. return PLUGIN_HANDLED
  2096.  
  2097. g_DuelB = player
  2098. if(is_user_alive(id))
  2099. {
  2100. player_strip_weapons(player)
  2101. gun = give_item(player, _Duel[g_Duel - 4][_entname])
  2102. cs_set_weapon_ammo(gun, 2000)
  2103. set_user_health(player, 2000)
  2104. cs_set_user_bpammo(player,CSW_M249,0)
  2105. entity_set_int(player, EV_INT_body, 4)
  2106. player_glow(player, g_Colors[2])
  2107. }
  2108. else
  2109. return PLUGIN_HANDLED
  2110. }
  2111.  
  2112. case CSW_FLASHBANG:
  2113. {
  2114. g_DuelA = id
  2115. if(is_user_alive(id))
  2116. {
  2117. player_strip_weapons(id)
  2118. gun = give_item(id, _Duel[g_Duel - 4][_entname])
  2119. cs_set_weapon_ammo(gun, 1)
  2120. set_user_health(id, 2000)
  2121. entity_set_int(id, EV_INT_body, 4)
  2122. player_glow(id, g_Colors[3])
  2123. }
  2124. else
  2125. return PLUGIN_HANDLED
  2126.  
  2127. current_weapon_fl(id)
  2128.  
  2129. g_DuelB = player
  2130. if(is_user_alive(id))
  2131. {
  2132. player_strip_weapons(player)
  2133. gun = give_item(player, _Duel[g_Duel - 4][_entname])
  2134. cs_set_weapon_ammo(gun, 1)
  2135. set_user_health(player, 2000)
  2136. entity_set_int(player, EV_INT_body, 4)
  2137. player_glow(player, g_Colors[2])
  2138. current_weapon_fl(player)
  2139. }
  2140. else
  2141. return PLUGIN_HANDLED
  2142. }
  2143.  
  2144.  
  2145.  
  2146. default:
  2147. {
  2148. player_strip_weapons(id)
  2149. g_DuelA = id
  2150. if(is_user_alive(id))
  2151. {
  2152. gun = give_item(id, _Duel[g_Duel - 4][_entname])
  2153. cs_set_weapon_ammo(gun, 1)
  2154. set_user_health(id, 100)
  2155. player_glow(id, g_Colors[3])
  2156. }
  2157. else
  2158. return PLUGIN_HANDLED
  2159.  
  2160. g_DuelB = player
  2161. if(is_user_alive(id))
  2162. {
  2163. player_strip_weapons(player)
  2164. gun = give_item(player, _Duel[g_Duel - 4][_entname])
  2165. cs_set_weapon_ammo(gun, 1)
  2166. set_user_health(player, 100)
  2167. player_glow(player, g_Colors[2])
  2168. }
  2169. else
  2170. return PLUGIN_HANDLED
  2171. }
  2172. }
  2173. server_cmd("jb_block_weapons")
  2174. return PLUGIN_HANDLED
  2175. }
  2176.  
  2177. public freeday_choice(id, menu, item)
  2178. {
  2179. if(item == MENU_EXIT)
  2180. {
  2181. menu_destroy(menu)
  2182. return PLUGIN_HANDLED
  2183. }
  2184.  
  2185. static dst[32], data[5], access, callback
  2186.  
  2187. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  2188. menu_destroy(menu)
  2189. get_user_name(id, dst, charsmax(dst))
  2190. switch(data[0])
  2191. {
  2192. case('1'):
  2193. {
  2194. cmd_freeday_player(id)
  2195. }
  2196. case('2'):
  2197. {
  2198. if((id == g_Simon) || is_user_admin(id))
  2199. {
  2200. g_Simon = 0
  2201.  
  2202. get_user_name(id, dst, charsmax(dst))
  2203. client_print(0, print_console, "%s gives freeday for everyone", dst)
  2204. server_print("JBE Client %i gives freeday for everyone", id)
  2205.  
  2206. g_GameMode = 0
  2207.  
  2208. g_Simon = 0
  2209. emit_sound(0, CHAN_AUTO, "jbextreme/brass_bell_C.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  2210. hud_status(0)
  2211. g_PlayerFreeday = 0
  2212.  
  2213. jail_open()
  2214.  
  2215.  
  2216. new Players[32]
  2217. new playerCount, i
  2218. get_players(Players, playerCount, "ac")
  2219. for (i=0; i<playerCount; i++)
  2220. {
  2221. entity_set_int(Players[i], EV_INT_skin, 3)
  2222. }
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228. new Float:FDLEN = get_pcvar_float(gp_FDLength)
  2229. if (FDLEN < 20.0) FDLEN = 99999.0
  2230. set_task(FDLEN, "task_freeday_end",TASK_FREEEND)
  2231. }
  2232. }
  2233. }
  2234. return PLUGIN_HANDLED
  2235. }
  2236.  
  2237. public lastrequest_select(id, menu, item)
  2238. {
  2239. if(item == MENU_EXIT || g_PlayerLast != id)
  2240. {
  2241. menu_destroy(menu)
  2242. return PLUGIN_HANDLED
  2243. }
  2244.  
  2245. static i, dst[32], data[5], access, callback, option[64]
  2246.  
  2247. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  2248. get_user_name(id, dst, charsmax(dst))
  2249. switch(data[0])
  2250. {
  2251. case('1'):
  2252. {
  2253. cs_set_user_money(id,16000,1)
  2254. user_silentkill(id)
  2255. }
  2256. case('2'):
  2257. {
  2258. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_LASTREQ_SEL2", dst)
  2259. player_hudmessage(0, 6, 3.0, {0, 255, 0}, option)
  2260. g_Duel = 2
  2261. player_strip_weapons_all()
  2262. i = random_num(0, sizeof(_WeaponsFree) - 1)
  2263. give_item(id, _WeaponsFree[i])
  2264. server_cmd("jb_block_weapons")
  2265. cs_set_user_bpammo(id, _WeaponsFreeCSW[i], _WeaponsFreeAmmo[i])
  2266. }
  2267. case('3'):
  2268. {
  2269. g_Duel = 3
  2270. menu_players(id, CS_TEAM_CT, 0, 1, "duel_knives", "%L", LANG_SERVER, "UJBM_MENU_DUEL")
  2271. }
  2272. default:
  2273. {
  2274. g_Duel = str_to_num(data)
  2275. menu_players(id, CS_TEAM_CT, 0, 1, "duel_guns", "%L", LANG_SERVER, "UJBM_MENU_DUEL")
  2276. }
  2277. }
  2278. g_LastDenied = 1
  2279. menu_destroy(menu)
  2280. return PLUGIN_HANDLED
  2281. }
  2282.  
  2283. public setup_buttons()
  2284. {
  2285. new ent[3]
  2286. new Float:origin[3]
  2287. new info[32]
  2288. new pos
  2289.  
  2290. while((pos <= sizeof(g_Buttons)) && (ent[0] = engfunc(EngFunc_FindEntityByString, ent[0], "classname", "info_player_deathmatch")))
  2291. {
  2292. pev(ent[0], pev_origin, origin)
  2293. while((ent[1] = engfunc(EngFunc_FindEntityInSphere, ent[1], origin, CELL_RADIUS)))
  2294. {
  2295. if(!is_valid_ent(ent[1]))
  2296. continue
  2297.  
  2298. entity_get_string(ent[1], EV_SZ_classname, info, charsmax(info))
  2299. if(!equal(info, "func_door"))
  2300. continue
  2301.  
  2302. entity_get_string(ent[1], EV_SZ_targetname, info, charsmax(info))
  2303. if(!info[0])
  2304. continue
  2305.  
  2306. if(TrieKeyExists(g_CellManagers, info))
  2307. {
  2308. TrieGetCell(g_CellManagers, info, ent[2])
  2309. }
  2310. else
  2311. {
  2312. ent[2] = engfunc(EngFunc_FindEntityByString, 0, "target", info)
  2313. }
  2314.  
  2315. if(is_valid_ent(ent[2]) && (in_array(ent[2], g_Buttons, sizeof(g_Buttons)) < 0))
  2316. {
  2317. g_Buttons[pos] = ent[2]
  2318. pos++
  2319. break
  2320. }
  2321. }
  2322. }
  2323. TrieDestroy(g_CellManagers)
  2324. }
  2325.  
  2326. stock in_array(needle, data[], size)
  2327. {
  2328. for(new i = 0; i < size; i++)
  2329. {
  2330. if(data[i] == needle)
  2331. return i
  2332. }
  2333. return -1
  2334. }
  2335.  
  2336. stock freeday_set(id, player)
  2337. {
  2338. static src[32], dst[32]
  2339. get_user_name(player, dst, charsmax(dst))
  2340.  
  2341. if(is_user_alive(player) && !get_bit(g_PlayerWanted, player))
  2342. {
  2343. set_bit(g_PlayerFreeday, player)
  2344. entity_set_int(player, EV_INT_skin, 3)
  2345. if(get_pcvar_num(gp_GlowModels))
  2346. player_glow(player, g_Colors[1])
  2347.  
  2348. if(0 < id <= g_MaxClients)
  2349. {
  2350. get_user_name(id, src, charsmax(src))
  2351. player_hudmessage(0, 6, 3.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_GUARD_FREEDAYGIVE", src, dst)
  2352. }
  2353. else if(g_GameMode == 1)
  2354. {
  2355. player_hudmessage(0, 6, 3.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_PRISONER_HASFREEDAY", dst)
  2356. }
  2357. }
  2358. }
  2359.  
  2360. stock first_join(id)
  2361. {
  2362. if (get_bit(g_PlayerJoin, id)) return PLUGIN_CONTINUE
  2363.  
  2364. switch (get_pcvar_num(gp_Help))
  2365. {
  2366. case 1:{
  2367. set_task(5.0, "cmd_help", TASK_HELP + id)
  2368. }
  2369. case 2:{
  2370. if (!is_user_admin(id))
  2371. set_task(5.0, "cmd_help", TASK_HELP + id)
  2372. }
  2373. }
  2374.  
  2375.  
  2376. set_task(20.0, "cmd_minmodels", TASK_HELP + id)
  2377. set_bit(g_PlayerJoin, id)
  2378. clear_bit(g_PlayerHelp, id)
  2379.  
  2380. return PLUGIN_CONTINUE
  2381. }
  2382.  
  2383.  
  2384. stock player_hudmessage(id, hudid, Float:time = 0.0, color[3] = {0, 255, 0}, msg[], any:...)
  2385. {
  2386. static text[512], Float:x, Float:y
  2387. x = g_HudSync[hudid][_x]
  2388. y = g_HudSync[hudid][_y]
  2389.  
  2390. if(time > 0)
  2391. set_hudmessage(color[0], color[1], color[2], x, y, 0, 0.00, time, 0.00, 0.00)
  2392. else
  2393. set_hudmessage(color[0], color[1], color[2], x, y, 0, 0.00, g_HudSync[hudid][_time], 0.00, 0.00)
  2394.  
  2395. vformat(text, charsmax(text), msg, 6)
  2396. ShowSyncHudMsg(id, g_HudSync[hudid][_hudsync], text)
  2397. }
  2398.  
  2399. stock menu_players(id, CsTeams:team, skip, alive, callback[], title[], any:...)
  2400. {
  2401. static i, name[32], num[5], menu, menuname[32]
  2402. vformat(menuname, charsmax(menuname), title, 7)
  2403. menu = menu_create(menuname, callback)
  2404. for(i = 1; i <= g_MaxClients; i++)
  2405. {
  2406. if(!is_user_connected(i) || (alive && !is_user_alive(i)) || (skip == i))
  2407. continue
  2408.  
  2409. if(!(team == CS_TEAM_T || team == CS_TEAM_CT) || ((team == CS_TEAM_T || team == CS_TEAM_CT) && (cs_get_user_team(i) == team)))
  2410. {
  2411. get_user_name(i, name, charsmax(name))
  2412. num_to_str(i, num, charsmax(num))
  2413. menu_additem(menu, name, num, 0)
  2414. }
  2415. }
  2416. menu_display(id, menu)
  2417. }
  2418.  
  2419. stock player_glow(id, color[3], amount=40)
  2420. {
  2421. set_user_rendering(id, kRenderFxGlowShell, color[0], color[1], color[2], kRenderNormal, amount)
  2422. }
  2423.  
  2424. stock player_strip_weapons(id)
  2425. {
  2426. strip_user_weapons(id)
  2427. give_item(id, "weapon_knife")
  2428. set_pdata_int(id, m_iPrimaryWeapon, 0)
  2429. }
  2430.  
  2431. stock player_strip_weapons_all()
  2432. {
  2433. for(new i = 1; i <= g_MaxClients; i++)
  2434. {
  2435. if(is_user_alive(i))
  2436. {
  2437. player_strip_weapons(i)
  2438. }
  2439. }
  2440. }
  2441.  
  2442.  
  2443.  
  2444. public jail_open()
  2445. {
  2446. static i
  2447. for(i = 0; i < sizeof(g_Buttons); i++)
  2448. {
  2449. if(g_Buttons[i])
  2450. {
  2451. ExecuteHamB(Ham_Use, g_Buttons[i], 0, 0, 1, 1.0)
  2452. entity_set_float(g_Buttons[i], EV_FL_frame, 0.0)
  2453. }
  2454. }
  2455. }
  2456.  
  2457.  
  2458.  
  2459. public fog(bool:on)
  2460.  
  2461. {
  2462. if (on)
  2463. {
  2464. message_begin(MSG_ALL,get_user_msgid("Fog"),{0,0,0},0)
  2465. write_byte(random_num(180,244)) // R
  2466. write_byte(1) // G
  2467. write_byte(1) // B
  2468. write_byte(10) // SD
  2469. write_byte(41) // ED
  2470. write_byte(95) // D1
  2471. write_byte(59) // D2
  2472. message_end()
  2473.  
  2474. }
  2475. else
  2476. {
  2477. message_begin(MSG_ALL,get_user_msgid("Fog"),{0,0,0},0)
  2478. write_byte(0) // R
  2479. write_byte(0) // G
  2480. write_byte(0) // B
  2481. write_byte(0) // SD
  2482. write_byte(0) // ED
  2483. write_byte(0) // D1
  2484. write_byte(0) // D2
  2485. message_end()
  2486. }
  2487.  
  2488.  
  2489. }
  2490.  
  2491.  
  2492. public client_infochanged(id)
  2493. {
  2494. if (is_user_connected(id))
  2495. {
  2496. if (g_GameMode != 6 && id != g_Simon) set_user_info(id, "model", "ujbm_v1")
  2497. }
  2498.  
  2499.  
  2500. }
  2501.  
  2502. public cvar_result_func(id, const cvar[], const value[])
  2503. {
  2504.  
  2505. if (value[0] != '0') Showcl_min(id)
  2506.  
  2507. }
  2508.  
  2509.  
  2510.  
  2511. public cmd_zmday(id)
  2512. {
  2513. if (is_user_admin(id)) cmd_game_zombie()
  2514. }
  2515.  
  2516.  
  2517. public cmd_game_zombie()
  2518. {
  2519. jail_open()
  2520. g_GameMode = 2
  2521. g_BoxStarted = 0
  2522. server_cmd("jb_block_weapons")
  2523. g_Simon = 0
  2524. g_nogamerounds = 0
  2525.  
  2526. new Players[32]
  2527. new playerCount, i
  2528. get_players(Players, playerCount, "ac")
  2529. for (i=0; i<playerCount; i++)
  2530. {
  2531. if (is_user_connected(Players[i]))
  2532. if ( cs_get_user_team(Players[i]) == CS_TEAM_T)
  2533. {
  2534. player_strip_weapons(Players[i])
  2535. set_user_maxspeed(Players[i], 200.0)
  2536. set_user_health(Players[i], 800)
  2537. give_item(Players[i], "item_assaultsuit")
  2538.  
  2539. cs_set_user_nvg (Players[i],true);
  2540. //engclient_cmd(Players[i], "nightvision")
  2541.  
  2542. entity_set_int(Players[i], EV_INT_body, 4)
  2543.  
  2544. clear_bit(g_PlayerCrowbar, Players[i])
  2545. message_begin( MSG_ONE, gmsgSetFOV, _, Players[i] )
  2546. write_byte( 170 )
  2547. message_end()
  2548. } else
  2549. if (cs_get_user_team(Players[i]) == CS_TEAM_CT)
  2550. {
  2551. strip_user_weapons(Players[i])
  2552. give_item(Players[i], "weapon_m3")
  2553. give_item(Players[i], "weapon_hegrenade")
  2554. give_item(Players[i], "weapon_flashbang")
  2555. give_item(Players[i], "ammo_buckshot")
  2556. give_item(Players[i], "ammo_buckshot")
  2557. give_item(Players[i], "ammo_buckshot")
  2558. give_item(Players[i], "ammo_buckshot")
  2559. give_item(Players[i], "ammo_buckshot")
  2560. give_item(Players[i], "ammo_buckshot")
  2561. give_item(Players[i], "ammo_buckshot")
  2562. give_item(Players[i], "ammo_buckshot")
  2563. set_user_health(Players[i], 100)
  2564. set_user_maxspeed(Players[i], 250.0)
  2565. set_bit(g_Fonarik, Players[i])
  2566. client_cmd(Players[i], "impulse 100")
  2567. player_glow(Players[i], g_Colors[2])
  2568. }
  2569. }
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577. emit_sound(0, CHAN_AUTO, "ambience/the_horror2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  2578. new effect = get_pcvar_num (gp_Effects)
  2579. if (effect > 0)
  2580. {
  2581. set_lights("b")
  2582. if (effect > 1) fog(true)
  2583. }
  2584.  
  2585. player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_MENU_GAME_TEXT_ZM")
  2586.  
  2587.  
  2588.  
  2589. return PLUGIN_CONTINUE
  2590. }
  2591.  
  2592. public cmd_hns_start()
  2593. {
  2594. server_cmd("jb_unblock_weapons")
  2595. new Players[32]
  2596. new playerCount, i
  2597. get_players(Players, playerCount, "ac")
  2598. for (i=0; i<playerCount; i++)
  2599. {
  2600. if (cs_get_user_team(Players[i]) == CS_TEAM_T)
  2601. {
  2602. give_item(Players[i], "weapon_knife")
  2603. current_weapon(Players[i])
  2604. give_item(Players[i], "weapon_flashbang")
  2605. give_item(Players[i], "weapon_smokegrenade")
  2606. set_user_maxspeed(Players[i], 300.0)
  2607. set_user_health(Players[i], 100)
  2608. }
  2609. else
  2610. {
  2611. give_item(Players[i], "weapon_knife")
  2612. current_weapon(Players[i])
  2613. give_item(Players[i], "weapon_smokegrenade")
  2614. set_bit(g_Fonarik, Players[i])
  2615. client_cmd(Players[i], "impulse 100")
  2616.  
  2617.  
  2618. new j = random_num(0, sizeof(_WeaponsFree) - 1)
  2619.  
  2620. give_item(Players[i], _WeaponsFree[j])
  2621. cs_set_user_bpammo(Players[i], _WeaponsFreeCSW[j], _WeaponsFreeAmmo[j])
  2622. /// give two random guns
  2623.  
  2624. new n = random_num(0, sizeof(_WeaponsFree) - 1)
  2625. while (n == j) {
  2626. n = random_num(0, sizeof(_WeaponsFree) - 1)
  2627. }
  2628.  
  2629. give_item(Players[i], _WeaponsFree[n])
  2630. cs_set_user_bpammo(Players[i], _WeaponsFreeCSW[n], _WeaponsFreeAmmo[n])
  2631. }
  2632. }
  2633. emit_sound(0, CHAN_AUTO, "jbextreme/brass_bell_C.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  2634.  
  2635. new sz_msg[256];
  2636. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_GAME_TEXT_HNS_START")
  2637. client_print(0, print_center , sz_msg)
  2638.  
  2639. return PLUGIN_CONTINUE
  2640. }
  2641.  
  2642.  
  2643.  
  2644. public cmd_game_hns()
  2645. {
  2646.  
  2647. g_nogamerounds = 0
  2648. g_BoxStarted = 0
  2649. jail_open()
  2650. g_GameMode = 3
  2651. g_SimonAllowed = 0
  2652. g_Simon = 0
  2653.  
  2654.  
  2655. emit_sound(0, CHAN_AUTO, "jbextreme/brass_bell_C.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  2656. player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_MENU_GAME_TEXT_HNS")
  2657.  
  2658.  
  2659. set_lights("b");
  2660. server_cmd("jb_block_weapons")
  2661.  
  2662.  
  2663. new Players[32]
  2664. new playerCount, i
  2665. get_players(Players, playerCount, "ac")
  2666. for (i=0; i<playerCount; i++)
  2667. {
  2668. strip_user_weapons(Players[i])
  2669. }
  2670. set_task(30.0,"cmd_hns_start",TASK_GIVEITEMS)
  2671.  
  2672. return PLUGIN_CONTINUE
  2673. }
  2674.  
  2675.  
  2676. public cmd_shop(id)
  2677.  
  2678. {
  2679.  
  2680.  
  2681. static roundloop
  2682. roundloop = floatround(get_pcvar_float(gp_RetryTime) / 2)
  2683.  
  2684. if(!is_user_alive(id) || g_GameMode >= 2 || (g_RoundStarted >= roundloop)) return PLUGIN_CONTINUE
  2685.  
  2686.  
  2687. static menu, menuname[32], option[64]
  2688. if(cs_get_user_team(id) == CS_TEAM_T)
  2689. {
  2690.  
  2691. if (strlen(Tallowed) <= 0 ) return PLUGIN_CONTINUE
  2692.  
  2693. formatex(menuname, charsmax(menuname), "%L", LANG_SERVER, "UJBM_MENU_SHOP")
  2694. menu = menu_create(menuname, "shop_choice_T")
  2695.  
  2696. if (containi(Tallowed,"a") >= 0)
  2697. {
  2698. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_CROWBAR",CROWBARCOST)
  2699. menu_additem(menu, option, "1", 0)
  2700. }
  2701.  
  2702. if (containi(Tallowed,"b") >= 0)
  2703. {
  2704. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_FLASHBANG", FLASHCOST)
  2705. menu_additem(menu, option, "2", 0)
  2706. }
  2707.  
  2708. if (containi(Tallowed,"c") >= 0)
  2709. {
  2710. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_SMOKE", SMOKECOST)
  2711. menu_additem(menu, option, "3", 0)
  2712. }
  2713.  
  2714. if (containi(Tallowed,"d") >= 0)
  2715. {
  2716. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_HE", HECOST)
  2717. menu_additem(menu, option, "4", 0)
  2718. }
  2719.  
  2720. if (containi(Tallowed,"e") >= 0)
  2721. {
  2722. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_SHIELD",SHIELDCOST)
  2723. menu_additem(menu, option, "5", 0)
  2724. }
  2725.  
  2726. if (containi(Tallowed,"f") >= 0)
  2727. {
  2728. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_FD", FDCOST)
  2729. menu_additem(menu, option, "6", 0)
  2730. }
  2731.  
  2732. if (containi(Tallowed,"g") >= 0)
  2733. {
  2734. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_FLASHLIGHT", FLASHLIGHTCOST)
  2735. menu_additem(menu, option, "7", 0)
  2736. }
  2737.  
  2738. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_NOSHOW")
  2739. menu_additem(menu, option, "8", 0)
  2740.  
  2741.  
  2742. menu_display(id, menu)
  2743. }
  2744. else
  2745. if(cs_get_user_team(id) == CS_TEAM_CT)
  2746. {
  2747.  
  2748. if (strlen(CTallowed) <= 0 ) return PLUGIN_CONTINUE
  2749.  
  2750. formatex(menuname, charsmax(menuname), "%L", LANG_SERVER, "UJBM_MENU_SHOP")
  2751. menu = menu_create(menuname, "shop_choice_CT")
  2752.  
  2753. if (containi(CTallowed,"a") >= 0)
  2754. {
  2755. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_DEAGLE", CTDEAGLECOST)
  2756. menu_additem(menu, option, "1", 0)
  2757. }
  2758.  
  2759. if (containi(CTallowed,"b") >= 0)
  2760. {
  2761. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_FLASHBANG_CT", CTFLASHCOST)
  2762. menu_additem(menu, option, "2", 0)
  2763. }
  2764.  
  2765. if (containi(CTallowed,"c") >= 0)
  2766. {
  2767. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_SMOKE_CT",CTSMOKECOST)
  2768. menu_additem(menu, option, "3", 0)
  2769. }
  2770.  
  2771. if (containi(CTallowed,"d") >= 0)
  2772. {
  2773. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_HP",HPCOST)
  2774. menu_additem(menu, option, "4", 0)
  2775. }
  2776.  
  2777. if (containi(CTallowed,"e") >= 0)
  2778. {
  2779. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_NVG",NVGCOST)
  2780. menu_additem(menu, option, "5", 0)
  2781. }
  2782.  
  2783. if (containi(CTallowed,"f") >= 0)
  2784. {
  2785. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_FLASHLIGHT",FLASHLIGHTCOST)
  2786. menu_additem(menu, option, "6", 0)
  2787. }
  2788.  
  2789. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SHOP_NOSHOW")
  2790. menu_additem(menu, option, "7", 0)
  2791.  
  2792.  
  2793. menu_display(id, menu)
  2794.  
  2795. }
  2796. return PLUGIN_HANDLED
  2797. }
  2798.  
  2799.  
  2800. public shop_choice_T(id, menu, item)
  2801. {
  2802. if(item == MENU_EXIT || !is_user_alive(id) || g_GameMode >= 2 )
  2803. {
  2804. menu_destroy(menu)
  2805. return PLUGIN_HANDLED
  2806. }
  2807.  
  2808. static dst[32], data[5], access, callback
  2809. new money = cs_get_user_money (id);
  2810. new sz_msg[256];
  2811. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  2812. menu_destroy(menu)
  2813. get_user_name(id, dst, charsmax(dst))
  2814.  
  2815. switch(data[0])
  2816. {
  2817. case('2'):
  2818. {
  2819. if (money >= FLASHCOST)
  2820. {
  2821. cs_set_user_money (id, money - FLASHCOST, 0)
  2822. give_item(id, "weapon_flashbang")
  2823. }
  2824.  
  2825. else
  2826.  
  2827. {
  2828. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  2829. client_print(id, print_center , sz_msg)
  2830. }
  2831.  
  2832. }
  2833.  
  2834.  
  2835. case('4'):
  2836. {
  2837. if (money >= HECOST)
  2838. {
  2839. cs_set_user_money (id, money - HECOST, 0)
  2840. give_item(id, "weapon_hegrenade")
  2841. }
  2842.  
  2843. else
  2844.  
  2845. {
  2846. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  2847. client_print(id, print_center , sz_msg)
  2848. }
  2849.  
  2850. }
  2851.  
  2852. case('3'):
  2853. {
  2854. if (money >= SMOKECOST)
  2855. {
  2856. cs_set_user_money (id, money - SMOKECOST, 0)
  2857. give_item(id, "weapon_smokegrenade")
  2858. }
  2859.  
  2860. else
  2861.  
  2862. {
  2863. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  2864. client_print(id, print_center , sz_msg)
  2865. }
  2866.  
  2867. }
  2868.  
  2869. case('5'):
  2870. {
  2871. if (money >= SHIELDCOST)
  2872. {
  2873. cs_set_user_money (id, money - SHIELDCOST, 0)
  2874. give_item(id, "weapon_shield")
  2875. }
  2876.  
  2877. else
  2878.  
  2879. {
  2880. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  2881. client_print(id, print_center , sz_msg)
  2882. }
  2883.  
  2884. }
  2885.  
  2886.  
  2887. case('1'):
  2888. {
  2889. if (money >= CROWBARCOST)
  2890. {
  2891. cs_set_user_money (id, money - CROWBARCOST, 0)
  2892. set_bit(g_PlayerCrowbar, id)
  2893. current_weapon(id)
  2894. }
  2895.  
  2896. else
  2897.  
  2898. {
  2899. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  2900. client_print(id, print_center , sz_msg)
  2901. }
  2902.  
  2903. }
  2904.  
  2905. case('6'):
  2906. {
  2907. if (money >= FDCOST)
  2908. {
  2909. cs_set_user_money (id, money - FDCOST, 0)
  2910. freeday_set(0, id)
  2911. }
  2912.  
  2913. else
  2914.  
  2915. {
  2916. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  2917. client_print(id, print_center , sz_msg)
  2918. }
  2919.  
  2920. }
  2921.  
  2922. case('7'):
  2923. {
  2924.  
  2925. if (money >= FLASHLIGHTCOST)
  2926. {
  2927. cs_set_user_money (id, money - FLASHLIGHTCOST, 0)
  2928. set_bit(g_Fonarik, id)
  2929. client_cmd(id, "impulse 100")
  2930. }
  2931.  
  2932. else
  2933.  
  2934. {
  2935. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  2936. client_print(id, print_center , sz_msg)
  2937. }
  2938.  
  2939.  
  2940.  
  2941.  
  2942. }
  2943.  
  2944. case('8'):
  2945. {
  2946. set_bit(g_NoShowShop, id)
  2947. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_SHOWHOW")
  2948. client_print(id, print_center , sz_msg)
  2949.  
  2950. }
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958. }
  2959. return PLUGIN_HANDLED
  2960. }
  2961.  
  2962.  
  2963. public shop_choice_CT(id, menu, item)
  2964. {
  2965. if(item == MENU_EXIT)
  2966. {
  2967. menu_destroy(menu)
  2968. return PLUGIN_HANDLED
  2969. }
  2970.  
  2971. static dst[32], data[5], access, callback
  2972. new money = cs_get_user_money (id);
  2973. new sz_msg[256];
  2974.  
  2975. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  2976. menu_destroy(menu)
  2977. get_user_name(id, dst, charsmax(dst))
  2978.  
  2979. switch(data[0])
  2980. {
  2981. case('1'):
  2982. {
  2983. if (money >= CTDEAGLECOST)
  2984. {
  2985. cs_set_user_money (id, money - CTDEAGLECOST, 0)
  2986. give_item(id, "weapon_deagle")
  2987. give_item(id, "ammo_50ae")
  2988. give_item(id, "ammo_50ae")
  2989. give_item(id, "ammo_50ae")
  2990. give_item(id, "ammo_50ae")
  2991. give_item(id, "ammo_50ae")
  2992. }
  2993.  
  2994. else
  2995.  
  2996. {
  2997. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  2998. client_print(id, print_center , sz_msg)
  2999. }
  3000.  
  3001. }
  3002.  
  3003. case('2'):
  3004. {
  3005. if (money >= CTFLASHCOST)
  3006. {
  3007. cs_set_user_money (id, money - CTFLASHCOST, 0)
  3008. give_item(id, "weapon_flashbang")
  3009. }
  3010.  
  3011. else
  3012.  
  3013. {
  3014. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  3015. client_print(id, print_center , sz_msg)
  3016. }
  3017.  
  3018. }
  3019.  
  3020. case('3'):
  3021. {
  3022. if (money >= CTSMOKECOST)
  3023. {
  3024. cs_set_user_money (id, money - CTSMOKECOST, 0)
  3025. give_item(id, "weapon_smokegrenade")
  3026. }
  3027.  
  3028. else
  3029.  
  3030. {
  3031. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  3032. client_print(id, print_center , sz_msg)
  3033. }
  3034.  
  3035. }
  3036.  
  3037. case('4'):
  3038. {
  3039. if (money >= HPCOST)
  3040. {
  3041. cs_set_user_money (id, money - HPCOST, 0)
  3042. set_user_health(id, 150)
  3043. }
  3044.  
  3045. else
  3046.  
  3047. {
  3048. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  3049. client_print(id, print_center , sz_msg)
  3050. }
  3051.  
  3052. }
  3053.  
  3054. case('5'):
  3055. {
  3056. if (money >= NVGCOST)
  3057. {
  3058. cs_set_user_money (id, money - NVGCOST, 0)
  3059. cs_set_user_nvg (id,true);
  3060. engclient_cmd(id, "nightvision")
  3061. }
  3062.  
  3063. else
  3064.  
  3065. {
  3066. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  3067. client_print(id, print_center , sz_msg)
  3068. }
  3069.  
  3070. }
  3071.  
  3072. case('6'):
  3073. {
  3074. if (money >= FLASHLIGHTCOST)
  3075. {
  3076. cs_set_user_money (id, money - FLASHLIGHTCOST, 0)
  3077. set_bit(g_Fonarik, id)
  3078. client_cmd(id, "impulse 100")
  3079. }
  3080.  
  3081. else
  3082.  
  3083. {
  3084. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_NOT_ENOUGH")
  3085. client_print(id, print_center , sz_msg)
  3086. }
  3087.  
  3088.  
  3089. }
  3090.  
  3091. case('7'):
  3092. {
  3093. set_bit(g_NoShowShop, id)
  3094. formatex(sz_msg, charsmax(sz_msg), "^x03%L", LANG_SERVER, "UJBM_MENU_SHOP_SHOWHOW")
  3095. client_print(id, print_center , sz_msg)
  3096.  
  3097. }
  3098.  
  3099.  
  3100. }
  3101. if (!get_bit(g_NoShowShop, id)) cmd_shop(id)
  3102. return PLUGIN_HANDLED
  3103. }
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111. /*
  3112. public cmd_football(id)
  3113. {
  3114. if (g_Simon == id || is_user_admin(id))
  3115. {
  3116. player_hudmessage(0, 1, 8.0, _, "%L", LANG_SERVER, "UJBM_FOOTBALL")
  3117. new n = 0;
  3118. new name[32], szStatus[64]
  3119.  
  3120. new bool:orange = true
  3121. new Players[32]
  3122.  
  3123. new playerCount, i
  3124. get_players(Players, playerCount, "ac")
  3125. for (i=0; i<playerCount; i++)
  3126. {
  3127.  
  3128. if ( cs_get_user_team(Players[i]) == CS_TEAM_T && is_user_alive(Players[i]) && !get_bit(g_PlayerFreeday, id))
  3129. {
  3130. if (orange)
  3131. {
  3132. entity_set_int(Players[i], EV_INT_skin, 0)
  3133. orange=false;
  3134. }
  3135. else
  3136. {
  3137. entity_set_int(Players[i], EV_INT_skin, 1)
  3138. orange=true;
  3139. }
  3140.  
  3141. }
  3142. }
  3143. new origin[3]
  3144. get_user_origin(id,origin) // Gets the current location the player is at
  3145.  
  3146.  
  3147. set_task( 5.0 , "teleport" , 0 , origin , 4 );
  3148.  
  3149.  
  3150. return PLUGIN_HANDLED
  3151. }
  3152. }
  3153.  
  3154. */
  3155.  
  3156.  
  3157.  
  3158. public enable_player_voice(id, player)
  3159. {
  3160. static src[32], dst[32]
  3161. get_user_name(player, dst, charsmax(dst))
  3162.  
  3163.  
  3164. if (!get_bit(g_PlayerVoice, player))
  3165.  
  3166. {
  3167. set_bit(g_PlayerVoice, player)
  3168. if(0 < id <= g_MaxClients)
  3169. {
  3170. get_user_name(id, src, charsmax(src))
  3171. player_hudmessage(0, 6, 3.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_GUARD_VOICEENABLED", src, dst)
  3172. }
  3173. }
  3174.  
  3175. else
  3176.  
  3177. {
  3178. clear_bit(g_PlayerVoice, player)
  3179. if(0 < id <= g_MaxClients)
  3180. {
  3181. get_user_name(id, src, charsmax(src))
  3182. player_hudmessage(0, 6, 3.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_GUARD_VOICEDISABLED", src, dst)
  3183. }
  3184.  
  3185. }
  3186.  
  3187.  
  3188.  
  3189. }
  3190.  
  3191.  
  3192.  
  3193. public voice_enable_select(id, menu, item)
  3194. {
  3195.  
  3196. if(item == MENU_EXIT)
  3197. {
  3198. menu_destroy(menu)
  3199. return PLUGIN_HANDLED
  3200. }
  3201.  
  3202. static dst[32], data[5], player, access, callback
  3203.  
  3204. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  3205. player = str_to_num(data)
  3206. enable_player_voice(id, player)
  3207. cmd_simonmenu(id)
  3208. return PLUGIN_HANDLED
  3209. }
  3210. public cmd_simon_micr(id)
  3211. {
  3212. if (g_Simon == id || is_user_admin(id))
  3213. {
  3214. menu_players(id, CS_TEAM_T, 0, 1, "voice_enable_select", "%L", LANG_SERVER, "UJBM_MENU_VOICE")
  3215.  
  3216. }
  3217. }
  3218.  
  3219.  
  3220. public na2team(id) {
  3221.  
  3222. if (g_Simon == id || is_user_admin(id))
  3223. {
  3224.  
  3225. new s = get_pcvar_num (gp_ShowColor)
  3226. new playerCount, i
  3227. new Players[32]
  3228. new bool:orange = true
  3229. get_players(Players, playerCount, "ac")
  3230. for (i=0; i<playerCount; i++)
  3231. {
  3232.  
  3233. if ( cs_get_user_team(Players[i]) == CS_TEAM_T && is_user_alive(Players[i]) && !get_bit(g_PlayerFreeday, Players[i]) && !get_bit(g_PlayerWanted, Players[i]))
  3234. {
  3235. if (orange)
  3236. {
  3237. entity_set_int(Players[i], EV_INT_skin, 0)
  3238. orange=false;
  3239. if (s == 1) show_color(Players[i])
  3240. }
  3241. else
  3242. {
  3243. entity_set_int(Players[i], EV_INT_skin, 1)
  3244. orange=true;
  3245. if (s == 1) show_color(Players[i])
  3246. }
  3247.  
  3248. }
  3249. }
  3250.  
  3251.  
  3252. }
  3253. return PLUGIN_HANDLED
  3254. }
  3255.  
  3256.  
  3257. bool:GameAllowed()
  3258.  
  3259. {
  3260. if (g_GameMode > 1 || g_nogamerounds < get_pcvar_num(gp_NoGame))
  3261. return false
  3262.  
  3263. return true;
  3264.  
  3265. }
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272. public cmd_simonmenu(id)
  3273.  
  3274. {
  3275.  
  3276.  
  3277. if (g_Simon == id || is_user_admin(id))
  3278. {
  3279. static menu, menuname[32], option[64]
  3280.  
  3281. formatex(menuname, charsmax(menuname), "%L", LANG_SERVER, "UJBM_MENU_SIMONMENU")
  3282. menu = menu_create(menuname, "simon_choice")
  3283.  
  3284.  
  3285. formatex(option, charsmax(option), "\r%L\w", LANG_SERVER, "UJBM_MENU_SIMONMENU_OPEN")
  3286. menu_additem(menu, option, "1", 0)
  3287.  
  3288.  
  3289. formatex(option, charsmax(option), "\g%L\w", LANG_SERVER, "UJBM_MENU_SIMONMENU_FD")
  3290. menu_additem(menu, option, "2", 0)
  3291.  
  3292. if (g_GameMode == 1)
  3293. {
  3294. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SIMONMENU_CLR")
  3295. menu_additem(menu, option, "3", 0)
  3296. }
  3297.  
  3298. else
  3299. {
  3300. formatex(option, charsmax(option), "%L\w", LANG_SERVER, "UJBM_MENU_SIMONMENU_CLR")
  3301. menu_additem(menu, option, "3", 0)
  3302. }
  3303.  
  3304. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SIMONMENU_VOICE")
  3305. menu_additem(menu, option, "4", 0)
  3306.  
  3307. formatex(option, charsmax(option), "\y%L\w", LANG_SERVER, "UJBM_MENU_SIMONMENU_GONG")
  3308. menu_additem(menu, option, "5", 0)
  3309.  
  3310. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_PUNISH")
  3311. menu_additem(menu, option, "6", 0)
  3312.  
  3313. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_SIMON_GAMES")
  3314. menu_additem(menu, option, "7", 0)
  3315.  
  3316. formatex(option, charsmax(option), "%L",LANG_SERVER, "UJBM_MENU_BIND",bindstr)
  3317. menu_additem(menu, option, "8", 0)
  3318.  
  3319. menu_display(id, menu)
  3320.  
  3321.  
  3322. }
  3323. return PLUGIN_HANDLED
  3324. }
  3325.  
  3326.  
  3327. public simon_gameschoice(id, menu, item)
  3328. {
  3329. if(item == MENU_EXIT || g_GameMode > 1)
  3330. {
  3331. menu_destroy(menu)
  3332. cmd_simonmenu(id)
  3333. return PLUGIN_HANDLED
  3334. }
  3335.  
  3336. static dst[32], data[5], access, callback
  3337.  
  3338.  
  3339. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  3340. menu_destroy(menu)
  3341. get_user_name(id, dst, charsmax(dst))
  3342.  
  3343. switch(data[0])
  3344. {
  3345.  
  3346. case('1'):
  3347. {
  3348.  
  3349. if (GameAllowed() || is_user_admin(id)) cmd_game_alien2()
  3350. }
  3351.  
  3352. case'2':
  3353. {
  3354. if (GameAllowed() || is_user_admin(id))cmd_game_zombie()
  3355. }
  3356.  
  3357. case('3'):
  3358. {
  3359. if (GameAllowed() || is_user_admin(id)) cmd_game_hns()
  3360. }
  3361.  
  3362. case('4'):
  3363. {
  3364. if (GameAllowed() || is_user_admin(id)) cmd_game_alien()
  3365. }
  3366.  
  3367. case('7'):
  3368. {
  3369. if (GameAllowed() || is_user_admin(id)) cmd_game_gordon()
  3370. }
  3371.  
  3372. case('5'):
  3373. {
  3374. if (id == g_Simon || is_user_admin(id)) cmd_box(id)
  3375. }
  3376.  
  3377. case('6'):
  3378. {
  3379. if (id == g_Simon || is_user_admin(id)) cmd_footballmenu(id)
  3380. }
  3381.  
  3382.  
  3383. }
  3384. return PLUGIN_HANDLED
  3385. }
  3386.  
  3387.  
  3388.  
  3389.  
  3390. public football_choice(id, menu, item)
  3391. {
  3392. if(item == MENU_EXIT || (g_Simon != id && !is_user_admin(id)))
  3393. {
  3394. menu_destroy(menu)
  3395. cmd_simonmenu(id)
  3396. return PLUGIN_HANDLED
  3397. }
  3398.  
  3399. static dst[32], data[5], access, callback
  3400. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  3401. menu_destroy(menu)
  3402.  
  3403. switch(data[0])
  3404. {
  3405.  
  3406. case('1'):
  3407. {
  3408.  
  3409. if (g_Simon == id || is_user_admin(id)) server_cmd("jb_football")
  3410. }
  3411. case('2'):
  3412. {
  3413.  
  3414. if (g_Simon == id || is_user_admin(id)) server_cmd("jb_spawnball")
  3415. }
  3416.  
  3417. }
  3418. cmd_footballmenu(id)
  3419. return PLUGIN_HANDLED;
  3420. }
  3421.  
  3422.  
  3423.  
  3424. public cmd_footballmenu(id)
  3425.  
  3426. {
  3427. if ((g_Simon == id || is_user_admin(id)) && g_GameMode <= 1)
  3428. {
  3429. static menu, menuname[32], option[64]
  3430. formatex(menuname, charsmax(menuname), "%L", LANG_SERVER, "UJBM_FOOTBALL")
  3431. menu = menu_create(menuname, "football_choice")
  3432.  
  3433. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_FOOTBALL_START")
  3434. menu_additem(menu, option, "1", 0)
  3435.  
  3436. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_FOOTBALL_BALLSPAWN")
  3437. menu_additem(menu, option, "2", 0)
  3438.  
  3439. menu_display(id, menu)
  3440. }
  3441.  
  3442.  
  3443.  
  3444. return PLUGIN_HANDLED
  3445.  
  3446. }
  3447.  
  3448. public cmd_simongamesmenu(id)
  3449.  
  3450. {
  3451. if ((g_Simon == id || is_user_admin(id)) && g_GameMode <= 1)
  3452. {
  3453. static menu, menuname[32], option[64]
  3454.  
  3455. formatex(menuname, charsmax(menuname), "%L", LANG_SERVER, "UJBM_MENU_SIMONMENU")
  3456. menu = menu_create(menuname, "simon_gameschoice")
  3457.  
  3458.  
  3459. new allowed[31];
  3460. get_pcvar_string(gp_Games, allowed,31)
  3461. if (strlen(allowed) <= 0 ) return PLUGIN_CONTINUE
  3462.  
  3463. //gp_Games
  3464.  
  3465.  
  3466. if (GameAllowed() || is_user_admin(id))
  3467. {
  3468. if (containi(allowed,"a") >= 0)
  3469. {
  3470. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SIMONMENU_ALIEN2")
  3471. menu_additem(menu, option, "1", 0)
  3472. }
  3473.  
  3474. if (containi(allowed,"b") >= 0)
  3475. {
  3476. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SIMONMENU_ZM")
  3477. menu_additem(menu, option, "2", 0)
  3478. }
  3479. if (containi(allowed,"c") >= 0)
  3480. {
  3481. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SIMONMENU_HNS")
  3482. menu_additem(menu, option, "3", 0)
  3483. }
  3484. if (containi(allowed,"d") >= 0)
  3485. {
  3486. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SIMONMENU_SIMON_ALIEN")
  3487. menu_additem(menu, option, "4", 0)
  3488. }
  3489. }
  3490. else
  3491. {
  3492. if (containi(allowed,"a") >= 0)
  3493. {
  3494. formatex(option, charsmax(option), "\d%L\w", LANG_SERVER, "UJBM_MENU_SIMONMENU_ALIEN2")
  3495. menu_additem(menu, option, "1", 0)
  3496. }
  3497. if (containi(allowed,"b") >= 0)
  3498. {
  3499. formatex(option, charsmax(option), "\d%L\w", LANG_SERVER, "UJBM_MENU_SIMONMENU_ZM")
  3500. menu_additem(menu, option, "2", 0)
  3501. }
  3502. if (containi(allowed,"c") >= 0)
  3503. {
  3504. formatex(option, charsmax(option), "\d%L\w", LANG_SERVER, "UJBM_MENU_SIMONMENU_HNS")
  3505. menu_additem(menu, option, "3", 0)
  3506. }
  3507. if (containi(allowed,"d") >= 0)
  3508. {
  3509. formatex(option, charsmax(option), "\d%L\w", LANG_SERVER, "UJBM_MENU_SIMONMENU_SIMON_ALIEN")
  3510. menu_additem(menu, option, "4", 0)
  3511. }
  3512.  
  3513.  
  3514. }
  3515.  
  3516. if (containi(allowed,"e") >= 0)
  3517. {
  3518. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_GUARD_BOX")
  3519. menu_additem(menu, option, "5", 0)
  3520. }
  3521. if (containi(allowed,"f") >= 0 && is_plugin_loaded("[UJBM] Football"))
  3522. {
  3523. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_FOOTBALL")
  3524. menu_additem(menu, option, "6", 0)
  3525. }
  3526.  
  3527. if (containi(allowed,"g") >= 0)
  3528. {
  3529. formatex(option, charsmax(option), "%L", LANG_SERVER, "UJBM_MENU_SIMONMENU_SIMON_GORDON")
  3530. menu_additem(menu, option, "7", 0)
  3531. }
  3532.  
  3533.  
  3534. menu_display(id, menu)
  3535.  
  3536.  
  3537. }
  3538. return PLUGIN_HANDLED
  3539. }
  3540.  
  3541.  
  3542. stock cs_set_user_team2(index, {CsTeams,_}:team, update = 1)
  3543. {
  3544. if (index == g_Simon)
  3545. {
  3546. g_Simon = 0
  3547. hud_status(0)
  3548. }
  3549. set_pdata_int(index, OFFSET_TEAM, _:team)
  3550. set_pev(index, pev_team, _:team)
  3551.  
  3552. if(update)
  3553. {
  3554. static _msg_teaminfo; if(!_msg_teaminfo) _msg_teaminfo = get_user_msgid("TeamInfo")
  3555. static teaminfo[][] = { "UNASSIGNED", "TERRORIST", "CT", "SPECTATOR" }
  3556.  
  3557. message_begin(MSG_ALL, _msg_teaminfo)
  3558. write_byte(index)
  3559. write_string(teaminfo[_:team])
  3560. message_end()
  3561. }
  3562. return 1
  3563. }
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572.  
  3573. public simon_choice(id, menu, item)
  3574. {
  3575. if(item == MENU_EXIT || !(id == g_Simon || is_user_admin(id)) )
  3576. {
  3577. menu_destroy(menu)
  3578. return PLUGIN_HANDLED
  3579. }
  3580.  
  3581. static dst[32], data[5], access, callback
  3582.  
  3583. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  3584. menu_destroy(menu)
  3585. get_user_name(id, dst, charsmax(dst))
  3586.  
  3587. switch(data[0])
  3588. {
  3589. case('1'):
  3590. {
  3591. jail_open()
  3592. cmd_simonmenu(id)
  3593. }
  3594. case('2'): cmd_freeday(id)
  3595. case('3'): na2team(id)
  3596. case('4'): cmd_simon_micr(id)
  3597. case('5'):
  3598. {
  3599. emit_sound(0, CHAN_AUTO, "jbextreme/brass_bell_C.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  3600. cmd_simonmenu(id)
  3601. }
  3602. //case('5'):
  3603.  
  3604. case('6'): cmd_punish(id)
  3605. case('7'): cmd_simongamesmenu(id)
  3606. case('8'): {
  3607. client_cmd(id,"bind ^"%s^" ^"say /menu^"", bindstr)
  3608. }
  3609.  
  3610. }
  3611. return PLUGIN_HANDLED
  3612. }
  3613.  
  3614.  
  3615.  
  3616. public cmd_game_alien()
  3617. {
  3618. if (g_Simon == 0) return PLUGIN_HANDLED
  3619.  
  3620. g_BoxStarted = 0
  3621. g_nogamerounds = 0
  3622. jail_open()
  3623. g_GameMode = 4
  3624. server_cmd("jb_block_weapons")
  3625. hud_status(0)
  3626. new j = 0
  3627. new Players[32]
  3628. new playerCount, i
  3629. get_players(Players, playerCount, "ac")
  3630. for (i=0; i<playerCount; i++)
  3631. {
  3632. if ( g_Simon != Players[i])
  3633. {
  3634. if (cs_get_user_team(Players[i]) == CS_TEAM_CT)
  3635. {
  3636. set_bit(g_BackToCT, Players[i])
  3637. cs_set_user_team2(Players[i], CS_TEAM_T)
  3638. }
  3639. strip_user_weapons(Players[i])
  3640.  
  3641. j = random_num(0, sizeof(_WeaponsFree) - 1)
  3642.  
  3643. give_item(Players[i], "weapon_knife")
  3644. give_item(Players[i], _WeaponsFree[j])
  3645. cs_set_user_bpammo(Players[i], _WeaponsFreeCSW[j], _WeaponsFreeAmmo[j])
  3646. }
  3647. else
  3648. {
  3649. set_user_maxspeed(Players[i], 400.0)
  3650. strip_user_weapons(Players[i])
  3651. entity_set_int(Players[i], EV_INT_body, 5)
  3652. set_user_health(Players[i], 130*playerCount)
  3653. give_item(Players[i], "item_assaultsuit")
  3654. give_item(Players[i], "item_longjump")
  3655. give_item(Players[i], "weapon_knife")
  3656. set_bit(g_PlayerCrowbar, Players[i])
  3657. current_weapon(Players[i])
  3658.  
  3659. }
  3660.  
  3661.  
  3662. }
  3663.  
  3664. new effect = get_pcvar_num (gp_Effects)
  3665. if (effect > 0)
  3666. {
  3667. set_lights("b")
  3668. if (effect > 1) fog(true)
  3669. }
  3670. emit_sound(0, CHAN_AUTO, "jbextreme/brass_bell_C.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  3671. return PLUGIN_HANDLED
  3672. }
  3673.  
  3674.  
  3675.  
  3676.  
  3677. public radar_alien()
  3678. {
  3679. new origin[3]
  3680. get_user_origin(g_Simon,origin)
  3681.  
  3682. message_begin(MSG_ALL, gmsgBombDrop, {0,0,0}, 0)
  3683. write_coord(origin[0]) //X Coordinate
  3684. write_coord(origin[1]) //Y Coordinate
  3685. write_coord(origin[2]) //Z Coordinate
  3686. write_byte(0) //?? This byte seems to always be 0...so, w/e
  3687. message_end()
  3688. }
  3689.  
  3690.  
  3691. public give_items_alien()
  3692. {
  3693.  
  3694. give_item(g_Simon, "item_assaultsuit")
  3695. give_item(g_Simon, "item_longjump")
  3696. give_item(g_Simon, "weapon_knife")
  3697. set_bit(g_PlayerCrowbar, g_Simon)
  3698. current_weapon(g_Simon)
  3699.  
  3700. }
  3701.  
  3702.  
  3703.  
  3704.  
  3705.  
  3706. public cmd_game_alien2()
  3707. {
  3708. if (g_Simon == 0) return PLUGIN_HANDLED
  3709. g_nogamerounds = 0
  3710. g_BoxStarted = 0
  3711. jail_open()
  3712. g_GameMode = 5
  3713. server_cmd("jb_block_weapons")
  3714. server_cmd("jb_block_teams")
  3715. hud_status(0)
  3716.  
  3717. new Players[32]
  3718. new playerCount, i
  3719. get_players(Players, playerCount, "ac")
  3720. for (i=0; i<playerCount; i++)
  3721. {
  3722.  
  3723. strip_user_weapons(Players[i])
  3724. if ( g_Simon != Players[i])
  3725. {
  3726. if (cs_get_user_team(Players[i]) == CS_TEAM_CT)
  3727. {
  3728. set_bit(g_BackToCT, Players[i])
  3729. cs_set_user_team2(Players[i], CS_TEAM_T)
  3730. }
  3731. give_item(Players[i], "weapon_knife")
  3732. new j = random_num(0, sizeof(_WeaponsFree) - 1)
  3733.  
  3734. give_item(Players[i], _WeaponsFree[j])
  3735. cs_set_user_bpammo(Players[i], _WeaponsFreeCSW[j], _WeaponsFreeAmmo[j])
  3736. /// give two random guns
  3737.  
  3738. new n = random_num(0, sizeof(_WeaponsFree) - 1)
  3739. while (n == j) {
  3740. n = random_num(0, sizeof(_WeaponsFree) - 1)
  3741. }
  3742.  
  3743. give_item(Players[i], _WeaponsFree[n])
  3744. cs_set_user_bpammo(Players[i], _WeaponsFreeCSW[n], _WeaponsFreeAmmo[n])
  3745. }
  3746.  
  3747. }
  3748. set_user_rendering(g_Simon, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0 )
  3749. message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, g_Simon)
  3750. write_short(~0)
  3751. write_short(~0)
  3752. write_short(0x0004) // stay faded
  3753. write_byte(ALIEN_RED)
  3754. write_byte(ALIEN_GREEN)
  3755. write_byte(ALIEN_BLUE)
  3756. write_byte(100)
  3757. message_end()
  3758. set_user_maxspeed(g_Simon, 320.0)
  3759. entity_set_int(g_Simon, EV_INT_body, 5)
  3760. new hp = get_pcvar_num(gp_GameHP)
  3761. if (hp < 20) hp = 200
  3762.  
  3763. set_user_health(g_Simon, hp*playerCount)
  3764. set_task(20.0, "give_items_alien", TASK_GIVEITEMS)
  3765.  
  3766. set_lights("z")
  3767. emit_sound(0, CHAN_VOICE, "alien_alarm.wav", 1.0, ATTN_NORM, 0, PITCH_LOW)
  3768. set_task(2.5, "radar_alien", 666, _, _, "b")
  3769. set_task(5.0, "stop_sound")
  3770.  
  3771. return PLUGIN_HANDLED
  3772. }
  3773.  
  3774.  
  3775.  
  3776. public cmd_game_gordon()
  3777. {
  3778. if (g_Simon == 0) return PLUGIN_HANDLED
  3779. g_nogamerounds = 0
  3780. g_BoxStarted = 0
  3781. jail_open()
  3782. g_GameMode = 6
  3783. server_cmd("jb_block_weapons")
  3784. server_cmd("jb_block_teams")
  3785. hud_status(0)
  3786.  
  3787. new Players[32]
  3788. new playerCount, i
  3789. get_players(Players, playerCount, "ac")
  3790. for (i=0; i<playerCount; i++)
  3791. {
  3792. strip_user_weapons(Players[i])
  3793. if ( g_Simon != Players[i])
  3794. {
  3795. if (cs_get_user_team(Players[i]) == CS_TEAM_CT)
  3796. {
  3797. set_bit(g_BackToCT, Players[i])
  3798. cs_set_user_team2(Players[i], CS_TEAM_T)
  3799. }
  3800. give_item(Players[i], "weapon_knife")
  3801. new j = random_num(0, sizeof(_WeaponsFree) - 1)
  3802.  
  3803. give_item(Players[i], _WeaponsFree[j])
  3804. cs_set_user_bpammo(Players[i], _WeaponsFreeCSW[j], _WeaponsFreeAmmo[j])
  3805. /// give two random guns
  3806.  
  3807. new n = random_num(0, sizeof(_WeaponsFree) - 1)
  3808. while (n == j) {
  3809. n = random_num(0, sizeof(_WeaponsFree) - 1)
  3810. }
  3811.  
  3812. give_item(Players[i], _WeaponsFree[n])
  3813. cs_set_user_bpammo(Players[i], _WeaponsFreeCSW[n], _WeaponsFreeAmmo[n])
  3814. }
  3815.  
  3816. }
  3817.  
  3818. //entity_set_int(g_Simon, EV_INT_body, 1)
  3819. //entity_set_int(g_Simon, EV_INT_skin, 0)
  3820. //client_cmd(g_Simon,"model gordon");
  3821. set_user_info(g_Simon, "model", "gordon")
  3822. /* entity_set_int(g_Simon, EV_INT_skin, 0)
  3823. entity_set_int(g_Simon, EV_INT_body, 1)
  3824. entity_set_int(g_Simon, EV_INT_fixangle, 1);
  3825. entity_set_int(g_Simon, EV_INT_playerclass, 1);
  3826. */
  3827.  
  3828.  
  3829.  
  3830. new hp = get_pcvar_num(gp_GameHP)
  3831. if (hp < 20) hp = 200
  3832.  
  3833. set_user_maxspeed(g_Simon, 320.0)
  3834. set_user_health(g_Simon, hp*playerCount)
  3835. set_task(5.0, "give_items_gordon", TASK_GIVEITEMS)
  3836.  
  3837. set_lights("z")
  3838. emit_sound(0, CHAN_VOICE, "alien_alarm.wav", 1.0, ATTN_NORM, 0, PITCH_LOW)
  3839. set_task(5.0, "stop_sound")
  3840.  
  3841. return PLUGIN_HANDLED
  3842. }
  3843.  
  3844. public give_items_gordon()
  3845. {
  3846. //give_item(g_Simon, "weapon_knife")
  3847. give_item(g_Simon, "weapon_flashbang")
  3848. current_weapon_fl(g_Simon)
  3849. }
  3850.  
  3851.  
  3852.  
  3853. public cmd_punish_ct(id, menu, item)
  3854. {
  3855.  
  3856. if(item == MENU_EXIT ||( g_Simon != id &&!is_user_admin(id)))
  3857. {
  3858. menu_destroy(menu)
  3859. return PLUGIN_HANDLED
  3860. }
  3861.  
  3862. static dst[32],src[32], data[5], player, access, callback
  3863. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  3864. player = str_to_num(data)
  3865. if (g_Simon == player) return PLUGIN_CONTINUE
  3866. set_bit(g_BackToCT,player)
  3867. cs_set_user_team2(player, CS_TEAM_T)
  3868.  
  3869. strip_user_weapons(player)
  3870. give_item(player, "weapon_knife")
  3871. current_weapon(player)
  3872. get_user_name(player, dst, charsmax(dst))
  3873. get_user_name(id, src, charsmax(src))
  3874. player_hudmessage(0, 6, 3.0, {0, 255, 0}, "%L", LANG_SERVER, "UJBM_SIMON_PUNISH", src, dst,dst)
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882. return PLUGIN_HANDLED
  3883. }
  3884.  
  3885.  
  3886.  
  3887. public chooseteamfunc(id)
  3888. {
  3889. if (g_GameMode == 4 || g_GameMode == 5) return PLUGIN_HANDLED;
  3890. return PLUGIN_CONTINUE
  3891. }
  3892.  
  3893.  
  3894. public drop(id)
  3895. {
  3896. if (get_bit(g_PlayerCrowbar,id) && (get_user_weapon(id) == CSW_KNIFE))
  3897. {
  3898. clear_bit(g_PlayerCrowbar, id)
  3899. current_weapon(id)
  3900. spawn_crowbar(id)
  3901. return PLUGIN_HANDLED
  3902. }
  3903.  
  3904. return PLUGIN_CONTINUE
  3905. }
  3906.  
  3907.  
  3908. public spawn_crowbar(id)
  3909. {
  3910. new ent
  3911. new Float:where[3]
  3912.  
  3913. ent = create_entity("info_target")
  3914. set_pev(ent, pev_classname, "crowbar")
  3915. set_pev(ent, pev_solid, SOLID_TRIGGER)
  3916. set_pev(ent, pev_movetype, MOVETYPE_BOUNCE)
  3917. entity_set_model(ent, "models/w_crowbar.mdl")
  3918. pev(id, pev_origin, where)
  3919. where[2] += 50.0;
  3920. where[0] += random_float(-20.0, 20.0)
  3921. where[1] += random_float(-20.0, 20.0)
  3922. entity_set_origin(ent, where)
  3923. where[0] = 0.0
  3924. where[2] = 0.0
  3925. where[1] = random_float(0.0, 180.0)
  3926. entity_set_vector(ent, EV_VEC_angles, where)
  3927. velocity_by_aim(id, 200, where)
  3928. entity_set_vector(ent,EV_VEC_velocity,where)
  3929.  
  3930.  
  3931. return PLUGIN_HANDLED
  3932. }
  3933.  
  3934.  
  3935. public cr_bar_snd(id, world)
  3936.  
  3937. {
  3938. new Float:v[3]
  3939. new Float:volume
  3940. entity_get_vector(id, EV_VEC_velocity, v)
  3941.  
  3942. v[0] = (v[0] * 0.45)
  3943. v[1] = (v[1] * 0.45)
  3944. v[2] = (v[2] * 0.45)
  3945. entity_set_vector(id, EV_VEC_velocity, v)
  3946. volume = get_speed(id) * 0.005;
  3947. if (volume > 1.0) volume = 1.0
  3948. if (volume > 0.1) emit_sound(id, CHAN_AUTO, "debris/metal2.wav", volume, ATTN_NORM, 0, PITCH_NORM)
  3949. return PLUGIN_CONTINUE
  3950. }
  3951.  
  3952.  
  3953. public crowbar_touch(ent, player)
  3954. {
  3955. static touch_class[32]
  3956.  
  3957. if (!pev_valid(ent))
  3958. return FMRES_IGNORED
  3959. pev(ent, pev_classname, touch_class, 31)
  3960.  
  3961. if (!is_user_alive(player) || is_user_bot(player) || cs_get_user_team(player) == CS_TEAM_CT)
  3962. return FMRES_IGNORED
  3963.  
  3964. if (equal(touch_class, "crowbar") && g_GameMode <= 3 && !get_bit(g_PlayerCrowbar, player))
  3965. {
  3966. set_bit(g_PlayerCrowbar, player)
  3967. remove_entity(ent)
  3968. if (get_user_weapon(player) == CSW_KNIFE) current_weapon(player)
  3969. emit_sound(player, CHAN_AUTO, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  3970. return FMRES_SUPERCEDE
  3971. }
  3972. return FMRES_IGNORED
  3973. }
  3974.  
  3975.  
  3976. public task_freeday_end()
  3977. {
  3978. emit_sound(0, CHAN_AUTO, "jbextreme/brass_bell_C.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  3979. g_GameMode = 1
  3980. set_hudmessage(0, 255, 0, -1.0, 0.35, 0, 6.0, 15.0)
  3981. show_hudmessage(0, "%L", LANG_SERVER, "UJBM_STATUS_ENDFREEDAY")
  3982. new playerCount, i
  3983. new Players[32]
  3984. get_players(Players, playerCount, "ac")
  3985. for (i=0; i<playerCount; i++)
  3986. {
  3987.  
  3988. if ( cs_get_user_team(Players[i]) == CS_TEAM_T && is_user_alive(Players[i]) && !get_bit(g_PlayerFreeday, Players[i]) && !get_bit(g_PlayerWanted, Players[i]))
  3989. {
  3990.  
  3991. entity_set_int(Players[i], EV_INT_skin, random_num(0,2))
  3992. if (get_pcvar_num (gp_ShowColor) == 1 ) show_color(Players[i])
  3993. }
  3994. }
  3995.  
  3996.  
  3997.  
  3998. return PLUGIN_CONTINUE
  3999. }
  4000.  
  4001.  
  4002. /*
  4003.  
  4004. public death_event()
  4005. {
  4006.  
  4007. new id = read_data(2)
  4008. if (g_Simon == id && g_GameMode == 5)
  4009. {
  4010. message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
  4011. write_short(1<<10)
  4012. write_short(1<<10)
  4013. write_short(0x0000) // fade out
  4014. write_byte(ALIEN_RED)
  4015. write_byte(ALIEN_GREEN)
  4016. write_byte(ALIEN_BLUE)
  4017. write_byte(100)
  4018. message_end()
  4019. }
  4020. return PLUGIN_CONTINUE
  4021. }
  4022. */
  4023.  
  4024.  
  4025.  
  4026. public rocket_touch(id, world)
  4027. {
  4028.  
  4029.  
  4030.  
  4031. new Float:location[3]
  4032. new players[32]
  4033. new playercount
  4034. //stop_sound(0)
  4035. entity_get_vector(id,EV_VEC_origin,location)
  4036. emit_sound(id, CHAN_WEAPON, _RpgSounds[2], 0.0, 0.0, SND_STOP, PITCH_NORM)
  4037. explode(location, SpriteExplosion, 30, 10, 0)
  4038.  
  4039. get_players(players,playercount,"a")
  4040.  
  4041. for (new i=0; i<playercount; i++)
  4042. {
  4043. new Float:playerlocation[3]
  4044. new Float:resultdistance
  4045.  
  4046. pev(players[i], pev_origin, playerlocation)
  4047.  
  4048. resultdistance = get_distance_f(playerlocation,location)
  4049.  
  4050. if(resultdistance < 450.0)
  4051. {
  4052. fakedamage(players[i],"RPG",(1000.0 - (2.0*resultdistance)),DMG_BLAST)
  4053.  
  4054. }
  4055. }
  4056.  
  4057. emit_sound(id, CHAN_AUTO, _RpgSounds[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
  4058. remove_entity(id)
  4059.  
  4060. return PLUGIN_CONTINUE
  4061. }
  4062.  
  4063. public current_weapon_fl(id)
  4064. {
  4065. if(!is_user_alive(id))
  4066. return PLUGIN_CONTINUE
  4067.  
  4068.  
  4069. if (g_Duel == 5 || (g_GameMode == 6 && id == g_Simon))
  4070. {
  4071. set_pev(id, pev_viewmodel2, _RpgModels[1])
  4072. set_pev(id, pev_weaponmodel2, _RpgModels[0])
  4073. }
  4074.  
  4075.  
  4076. return PLUGIN_CONTINUE
  4077. }
  4078.  
  4079. public rpg_touch(id, world)
  4080.  
  4081. {
  4082. new Float:v[3]
  4083. new Float:volume
  4084. entity_get_vector(id, EV_VEC_velocity, v)
  4085.  
  4086. v[0] = (v[0] * 0.45)
  4087. v[1] = (v[1] * 0.45)
  4088. v[2] = (v[2] * 0.45)
  4089. entity_set_vector(id, EV_VEC_velocity, v)
  4090. volume = get_speed(id) * 0.005;
  4091. if (volume > 1.0) volume = 1.0
  4092. if (volume > 0.1) emit_sound(id, CHAN_AUTO, "debris/metal2.wav", volume, ATTN_NORM, 0, PITCH_NORM)
  4093. return PLUGIN_CONTINUE
  4094. }
  4095.  
  4096.  
  4097.  
  4098.  
  4099.  
  4100.  
  4101. public explode(Float:startloc[3], spritename, scale, framerate, flags)
  4102. {
  4103. message_begin( MSG_BROADCAST, SVC_TEMPENTITY)
  4104. write_byte(3) // TE_EXPLOSION
  4105. write_coord(floatround(startloc[0]))
  4106. write_coord(floatround(startloc[1]))
  4107. write_coord(floatround(startloc[2])) // start location
  4108. write_short(spritename) // spritename
  4109. write_byte(scale) // scale of sprite
  4110. write_byte(framerate) // framerate of sprite
  4111. write_byte(flags) // flags
  4112. message_end()
  4113. }
  4114.  
  4115.  
  4116.  
  4117.  
  4118. public rpg_pre(weapon)
  4119. {
  4120. if (!is_valid_ent(weapon)) return PLUGIN_CONTINUE
  4121. new id = entity_get_edict( weapon, EV_ENT_owner )
  4122. if (g_Duel == 5 || (g_GameMode == 6 && id == g_Simon))
  4123. {
  4124. new ent
  4125. new Float:where[3]
  4126. new gmsgShake = get_user_msgid("ScreenShake")
  4127. message_begin(MSG_ONE, gmsgShake, {0,0,0}, id)
  4128. write_short(255<< 14 ) //ammount
  4129. write_short(1 << 14) //lasts this long
  4130. write_short(255<< 14) //frequency
  4131. message_end()
  4132.  
  4133. ent = create_entity("info_target")
  4134. set_pev(ent, pev_classname, "rpg_missile")
  4135. set_pev(ent, pev_solid, SOLID_TRIGGER)
  4136. set_pev(ent, pev_movetype, MOVETYPE_BOUNCE)
  4137. entity_set_model(ent, "models/rpgrocket.mdl")
  4138. pev(id, pev_origin, where)
  4139. where[2] += 50.0;
  4140. where[0] += random_float(-20.0, 20.0)
  4141. where[1] += random_float(-20.0, 20.0)
  4142. entity_set_origin(ent, where)
  4143. entity_get_vector(id,EV_VEC_angles,where)
  4144. //where[1] = random_float(0.0, 180.0)
  4145. entity_set_vector(ent, EV_VEC_angles, where)
  4146. velocity_by_aim(id, 700, where)
  4147. //entity_set_edict(ent, EV_ENT_aiment, id );
  4148. //where[2] += 200.0;
  4149. entity_set_edict(ent,EV_ENT_owner,id)
  4150. entity_set_vector(ent,EV_VEC_velocity,where)
  4151. message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
  4152. write_byte( TE_BEAMFOLLOW )
  4153. write_short(ent) // entity
  4154. write_short(m_iTrail) // model
  4155. write_byte( 10 ) // lifeffffff
  4156. write_byte( 8 ) // width
  4157.  
  4158. write_byte( 130) // r, g, b
  4159. write_byte( 130 ) // r, g, b
  4160. write_byte( 130 ) // r, g, b
  4161. write_byte( 196 ) // brightness
  4162. message_end()
  4163. emit_sound(id, CHAN_WEAPON, _RpgSounds[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
  4164. emit_sound(ent, CHAN_WEAPON, _RpgSounds[2], 1.0, ATTN_NORM, 0, PITCH_NORM)
  4165.  
  4166. RegisterHamFromEntity(Ham_Think,ent,"fw_rocket_think")
  4167. set_pev(ent, pev_nextthink, get_gametime()+0.25);
  4168.  
  4169.  
  4170. set_pdata_float( weapon , 46 , 2.5, 4 );
  4171. set_user_weaponanim(id, 2)
  4172.  
  4173. //cs_set_weapon_ammo(gun, 2000)
  4174. return HAM_SUPERCEDE
  4175. }
  4176.  
  4177.  
  4178. return HAM_IGNORED
  4179. }
  4180.  
  4181. stock set_user_weaponanim(id, anim)
  4182. {
  4183. entity_set_int(id, EV_INT_weaponanim, anim)
  4184. message_begin(MSG_ONE, SVC_WEAPONANIM, {0, 0, 0}, id)
  4185. write_byte(anim)
  4186. write_byte(entity_get_int(id, EV_INT_body))
  4187. message_end()
  4188. }
  4189. /*
  4190. public rpg_idle(weapon)
  4191. {
  4192. if (g_Duel == 5)
  4193. {
  4194. new id = entity_get_edict( weapon, EV_ENT_owner )
  4195. //set_user_weaponanim(id, 0)
  4196. }
  4197. return HAM_IGNORED
  4198. }
  4199. */
  4200. public rpg_reload(weapon)
  4201. {
  4202. if (g_Duel == 5)
  4203. {
  4204. new id = entity_get_edict( weapon, EV_ENT_owner )
  4205. set_user_weaponanim(id, 2)
  4206. }
  4207. return HAM_IGNORED
  4208. }
  4209.  
  4210.  
  4211. public cmd_lastrequest1(id)
  4212. {
  4213. g_Duel = 5
  4214. g_DuelA = id
  4215. player_strip_weapons(id)
  4216. new gun = give_item(id, _Duel[g_Duel - 4][_entname])
  4217. cs_set_weapon_ammo(gun, 1)
  4218. set_user_health(id, 2000)
  4219. entity_set_int(id, EV_INT_body, 4)
  4220. player_glow(id, g_Colors[3])
  4221.  
  4222. current_weapon_fl(id)
  4223.  
  4224. }
  4225.  
  4226. public fw_rocket_think(ent)
  4227. {
  4228.  
  4229. entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.25)
  4230. new id = entity_get_edict( ent, EV_ENT_owner )
  4231. new Float:where[3]
  4232. entity_get_vector(id,EV_VEC_angles,where)
  4233. entity_set_vector(ent, EV_VEC_angles, where)
  4234. velocity_by_aim(id, 700, where)
  4235.  
  4236. entity_set_vector(ent,EV_VEC_velocity,where)
  4237.  
  4238. return PLUGIN_CONTINUE
  4239. }
  4240.  
  4241.  
  4242. public help_trollface()
  4243. {
  4244. new Msg[512];
  4245. format(Msg, 511, "%L",LANG_SERVER,"UJBM_HELP_CHAT");
  4246. client_print(0,print_chat,Msg)
  4247.  
  4248. format(Msg, 511, "^x01Powered by ^x03%s ^x01%s by ^x03%s",PLUGIN_CVAR,PLUGIN_VERSION,PLUGIN_AUTHOR);
  4249.  
  4250.  
  4251. new iPlayers[32], iNum, i;
  4252. get_players(iPlayers, iNum);
  4253.  
  4254. for(i = 0; i <= iNum; i++)
  4255. {
  4256. new x = iPlayers[i];
  4257.  
  4258. if(!is_user_connected(x) || is_user_bot(x)) continue;
  4259. message_begin( MSG_ONE, g_iMsgSayText, {0,0,0}, x );
  4260. write_byte ( x );
  4261. write_string( Msg );
  4262. message_end ();
  4263. }
  4264.  
  4265.  
  4266. //client_print(0,print_chat,Msg)
  4267.  
  4268. return PLUGIN_CONTINUE
  4269. }
  4270.  
  4271.  
  4272.  
  4273.  
  4274. public Showcl_min(id) {
  4275.  
  4276. new menu = menu_create("\yset cl_minmodels to 0? You will be able to see high quality models\w^n", "cl_choice")
  4277.  
  4278. //formatex(option, charsmax(option), )
  4279. menu_additem(menu, "Yes", "1", 0)
  4280.  
  4281. //formatex(option, charsmax(option), "\rNo^n")
  4282. menu_additem(menu, "No, thanks", "2", 0)
  4283.  
  4284. menu_display(id, menu)
  4285.  
  4286. }
  4287.  
  4288. public cl_choice(id, menu, item) {
  4289. {
  4290. if(item == MENU_EXIT)
  4291. {
  4292. menu_destroy(menu)
  4293. return PLUGIN_HANDLED
  4294. }
  4295.  
  4296. static dst[32], data[5], access, callback
  4297.  
  4298. menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
  4299. menu_destroy(menu)
  4300.  
  4301. if (data[0])
  4302. {
  4303. client_cmd(id,"cl_minmodels 0")
  4304. client_print(id,print_console, "cl_minmodels is now 0, enjoy normal models :)")
  4305. }
  4306.  
  4307. }
  4308. return PLUGIN_CONTINUE
  4309. }
Advertisement
Add Comment
Please, Sign In to add comment