hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.04.27. 11:11



Jelenlévő felhasználók

Jelenleg 562 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 561 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: Majestic-12 [Bot] az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 3 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Gránátcsík
HozzászólásElküldve: 2015.01.28. 12:42 
Offline
Senior Tag
Avatar

Csatlakozott: 2014.02.02. 10:59
Hozzászólások: 238
Megköszönt másnak: 63 alkalommal
Megköszönték neki: 12 alkalommal
Sziasztok:) valaki nekem megtudná ezt csinálni (Ha meglehet) hogy minden eldobáskor más szinü legyen a gránát?
SMA Forráskód: [ Mindet kijelol ]
  1. /**
  2.  *
  3.  * Team Grenade Trail
  4.  * by Numb
  5.  *
  6.  *
  7.  * Description
  8.  * This plugin adds a trail after the grenade. Each type of grenade has an unique
  9.  * color what can be changed by cvar. Unlike other grenade trail plugins, this one
  10.  * has two major differences. First is that trails are actually made out of arrows
  11.  * what show direction in what grenade is moving (so now if you came out of corner
  12.  * and see a trail - you can instantly tell where to expect grenade to be). Second
  13.  * and most important one is that by default only team mates can see trails of your
  14.  * thrown grenades (this gives you and your team mates advantage from misunderstandings
  15.  * - no more guessing did any of those 10 noobs behind you thrown flashes or what;
  16.  * but when it comes to enemy grenades - you still must spot the model of the grenade
  17.  * to see and identify grenade type).
  18.  *
  19.  *
  20.  * Requires:
  21.  * CStrike
  22.  * CSX
  23.  *
  24.  *
  25.  * Cvars:
  26.  *
  27.  * + "amx_grentrail_status" - who can see the trail.
  28.  * - "3" - everyone.
  29.  * - "2" - team and everyone who's dead.
  30.  * - "1" - only team. [default]
  31.  * - "0" - plugin disabled.
  32.  *
  33.  * + "amx_grentrail_color_fb" - flashbang trail color [rrrgggbbb].
  34.  * - "000255255" - red 0; 255 green; 255 blue [default].
  35.  *
  36.  * + "amx_grentrail_color_he" - explosive trail color [rrrgggbbb].
  37.  * - "255063000" - red 255; 63 green; 0 blue [default].
  38.  *
  39.  * + "amx_grentrail_color_sg" - smokegren trail color [rrrgggbbb].
  40.  * - "031255127" - red 31; 255 green; 127 blue [default].
  41.  *
  42.  * + "amx_grentrail_team_color" - extra trail line with owners team color.
  43.  * - "1" - enabled.
  44.  * - "0" - disabled. [default]
  45.  *
  46.  *
  47.  * Additional info:
  48.  * Tested in Counter-Strike 1.6 with amxmodx 1.8.2 (dev build hg21).
  49.  *
  50.  *
  51.  * Credits:
  52.  * Original idea came from AssKicR's ( http://forums.alliedmods.net/member.php?u=261 )
  53.  * plugin ( http://forums.alliedmods.net/showthread.php?p=19096 ) what was published in
  54.  * 2004/May/05. Method of showing trails taken from jim_yang's
  55.  * ( http://forums.alliedmods.net/showthread.php?t=50171 ) what was published in 2007/Jan/21.
  56.  *
  57.  *
  58.  * Change-Log:
  59.  *
  60.  * + 1.2
  61.  * - Added: Support for team color trail (this is another smaller trail what has no effect on the main one).
  62.  * - Changed: Improved plugin performance.
  63.  * - Changed: Renamed "amx_grentrail_team" cvar to "amx_grentrail_status".
  64.  * - Changed: Renamed "amx_grentrail_color_sm" cvar to "amx_grentrail_color_sg".
  65.  *
  66.  * + 1.1
  67.  * - Fixed: An issue with team detection once player team was changed by some custom plugin.
  68.  *
  69.  * + 1.0
  70.  * - First release.
  71.  *
  72.  *
  73.  * Downloads:
  74.  *
  75. **/
  76.  
  77. // ----------------------------------------- CONFIG START -----------------------------------------
  78.  
  79. // If you are having problems, that not everyone who should see the trail is seeing them, that can
  80. // be due to message type and ping. Using "MSG_ONE_UNRELIABLE" and "MSG_BROADCAST" is better for server
  81. // stability, however using "MSG_ONE" and "MSG_ALL" garanties that client will recieve the update.
  82. #define MSG_TYPE_ALONE MSG_ONE // default: (uncommented)
  83. //#define MSG_TYPE_ALONE MSG_ONE_UNRELIABLE // default: (commented)
  84. #define MSG_TYPE_ALL MSG_ALL // default: (uncommented)
  85. //#define MSG_TYPE_ALL MSG_BROADCAST // default: (commented)
  86.  
  87. // ------------------------------------------ CONFIG END ------------------------------------------
  88.  
  89.  
  90. #include <amxmodx>
  91. #include <cstrike>
  92. #include <csx>
  93.  
  94. #define PLUGIN_NAME "Team Grenade Trail"
  95. #define PLUGIN_VERSION "1.2"
  96. #define PLUGIN_AUTHOR "Numb"
  97.  
  98. #define SetPlayerBit(%1,%2) ( %1 |= ( 1 << ( %2 & 31 ) ) )
  99. #define ClearPlayerBit(%1,%2) ( %1 &= ~( 1 << ( %2 & 31 ) ) )
  100. #define CheckPlayerBit(%1,%2) ( %1 & ( 1 << ( %2 & 31 ) ) )
  101.  
  102. new g_iCvar_ColorFlash;
  103. new g_iCvar_ColorHe;
  104. new g_iCvar_ColorSmoke;
  105. new g_iCvar_TrailStatus;
  106. new g_iCvar_TeamColor;
  107.  
  108. new g_iSpriteLine;
  109. new g_iSpriteArrow;
  110.  
  111. new g_iConnectedUsers;
  112. new g_iDeadUsers;
  113. new g_iMaxPlayers;
  114.  
  115. public plugin_precache()
  116. {
  117. g_iSpriteArrow = precache_model("sprites/arrow1.spr");
  118. g_iSpriteLine = precache_model("sprites/smoke.spr");
  119. }
  120.  
  121. public plugin_init()
  122. {
  123. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
  124.  
  125. g_iCvar_TrailStatus = register_cvar("amx_grentrail_status", "1");
  126.  
  127. g_iCvar_ColorFlash = register_cvar("amx_grentrail_color_fb", "000255255");
  128. g_iCvar_ColorHe = register_cvar("amx_grentrail_color_he", "255063000");
  129. g_iCvar_ColorSmoke = register_cvar("amx_grentrail_color_sg", "031255127");
  130.  
  131. g_iCvar_TeamColor = register_cvar("amx_grentrail_team_color", "0");
  132.  
  133. register_event("ResetHUD", "Event_ResetHUD", "be");
  134. register_event("Health", "Event_Health", "bd");
  135.  
  136. g_iMaxPlayers = clamp(get_maxplayers(), 1, 32);
  137. }
  138.  
  139. public client_connect(iPlrId)
  140. {
  141. ClearPlayerBit(g_iConnectedUsers, iPlrId);
  142. ClearPlayerBit(g_iDeadUsers, iPlrId);
  143. }
  144.  
  145. public client_putinserver(iPlrId)
  146. {
  147. if( !is_user_bot(iPlrId) )
  148. {
  149. SetPlayerBit(g_iConnectedUsers, iPlrId);
  150. if( is_user_alive(iPlrId) )
  151. ClearPlayerBit(g_iDeadUsers, iPlrId);
  152. else
  153. SetPlayerBit(g_iDeadUsers, iPlrId);
  154. }
  155. }
  156.  
  157. public client_disconnect(iPlrId)
  158. {
  159. ClearPlayerBit(g_iConnectedUsers, iPlrId);
  160. ClearPlayerBit(g_iDeadUsers, iPlrId);
  161. }
  162.  
  163. public Event_ResetHUD(iPlrId)
  164. {
  165. if( CheckPlayerBit(g_iConnectedUsers, iPlrId) )
  166. {
  167. if( is_user_alive(iPlrId) )
  168. ClearPlayerBit(g_iDeadUsers, iPlrId);
  169. else
  170. SetPlayerBit(g_iDeadUsers, iPlrId);
  171. }
  172. }
  173.  
  174. public Event_Health(iPlrId)
  175. {
  176. if( CheckPlayerBit(g_iConnectedUsers, iPlrId) )
  177. {
  178. if( is_user_alive(iPlrId) )
  179. ClearPlayerBit(g_iDeadUsers, iPlrId);
  180. else
  181. SetPlayerBit(g_iDeadUsers, iPlrId);
  182. }
  183. }
  184.  
  185. public plugin_unpause()
  186. {
  187. g_iConnectedUsers = 0;
  188. g_iDeadUsers = 0;
  189.  
  190. for( new iPlrId=1; iPlrId<=g_iMaxPlayers; iPlrId++ )
  191. {
  192. if( is_user_connected(iPlrId) )
  193. {
  194. if( !is_user_bot(iPlrId) )
  195. {
  196. SetPlayerBit(g_iConnectedUsers, iPlrId);
  197. if( !is_user_alive(iPlrId) )
  198. SetPlayerBit(g_iDeadUsers, iPlrId);
  199. }
  200. }
  201. }
  202. }
  203.  
  204. public grenade_throw(iPlrId, iGrenId, iWeaponType)
  205. {
  206. new iTemp;
  207. switch( iWeaponType )
  208. {
  209. case CSW_FLASHBANG: iTemp = get_pcvar_num(g_iCvar_ColorFlash);
  210. case CSW_HEGRENADE: iTemp = get_pcvar_num(g_iCvar_ColorHe);
  211. case CSW_SMOKEGRENADE: iTemp = get_pcvar_num(g_iCvar_ColorSmoke);
  212. default: return;
  213. }
  214.  
  215. new iRed = iTemp/1000000;
  216. iTemp %= 1000000;
  217. new iGreen = iTemp/1000;
  218. new iBlue = iTemp%1000;
  219.  
  220. iTemp = clamp(get_pcvar_num(g_iCvar_TeamColor), 0, 1);
  221.  
  222. switch( clamp(get_pcvar_num(g_iCvar_TrailStatus), 0, 3) )
  223. {
  224. case 1:
  225. {
  226. new CsTeams:iOwnerTeam = cs_get_user_team(iPlrId);
  227.  
  228. for( new iPlayer=1; iPlayer<=g_iMaxPlayers; iPlayer++ )
  229. {
  230. if( CheckPlayerBit(g_iConnectedUsers, iPlayer) )
  231. {
  232. if( cs_get_user_team(iPlayer)==iOwnerTeam )
  233. {
  234. message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
  235. write_byte(TE_BEAMFOLLOW);
  236. write_short(iGrenId);
  237. write_short(g_iSpriteArrow);
  238. write_byte(15);
  239. write_byte(7);
  240. write_byte(iRed);
  241. write_byte(iGreen);
  242. write_byte(iBlue);
  243. write_byte(191);
  244. message_end();
  245.  
  246. if( iTemp )
  247. {
  248. message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
  249. write_byte(TE_BEAMFOLLOW);
  250. write_short(iGrenId);
  251. write_short(g_iSpriteLine);
  252. write_byte(15);
  253. write_byte(1);
  254. switch( iOwnerTeam )
  255. {
  256. case CS_TEAM_T:
  257. {
  258. write_byte(255);
  259. write_byte(0);
  260. write_byte(0);
  261. }
  262. case CS_TEAM_CT:
  263. {
  264. write_byte(0);
  265. write_byte(0);
  266. write_byte(255);
  267. }
  268. default:
  269. {
  270. write_byte(127);
  271. write_byte(127);
  272. write_byte(127);
  273. }
  274. }
  275. write_byte(191);
  276. message_end();
  277. }
  278. }
  279. }
  280. }
  281. }
  282. case 2:
  283. {
  284. new CsTeams:iOwnerTeam = cs_get_user_team(iPlrId);
  285.  
  286. for( new iPlayer=1; iPlayer<=g_iMaxPlayers; iPlayer++ )
  287. {
  288. if( CheckPlayerBit(g_iConnectedUsers, iPlayer) )
  289. {
  290. if( CheckPlayerBit(g_iDeadUsers, iPlayer) || cs_get_user_team(iPlayer)==iOwnerTeam )
  291. {
  292. message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
  293. write_byte(TE_BEAMFOLLOW);
  294. write_short(iGrenId);
  295. write_short(g_iSpriteArrow);
  296. write_byte(15);
  297. write_byte(7);
  298. write_byte(iRed);
  299. write_byte(iGreen);
  300. write_byte(iBlue);
  301. write_byte(191);
  302. message_end();
  303.  
  304. if( iTemp )
  305. {
  306. message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
  307. write_byte(TE_BEAMFOLLOW);
  308. write_short(iGrenId);
  309. write_short(g_iSpriteLine);
  310. write_byte(15);
  311. write_byte(1);
  312. switch( iOwnerTeam )
  313. {
  314. case CS_TEAM_T:
  315. {
  316. write_byte(255);
  317. write_byte(0);
  318. write_byte(0);
  319. }
  320. case CS_TEAM_CT:
  321. {
  322. write_byte(0);
  323. write_byte(0);
  324. write_byte(255);
  325. }
  326. default:
  327. {
  328. write_byte(127);
  329. write_byte(127);
  330. write_byte(127);
  331. }
  332. }
  333. write_byte(191);
  334. message_end();
  335. }
  336. }
  337. }
  338. }
  339. }
  340. case 3:
  341. {
  342. message_begin(MSG_TYPE_ALL, SVC_TEMPENTITY);
  343. write_byte(TE_BEAMFOLLOW);
  344. write_short(iGrenId);
  345. write_short(g_iSpriteArrow);
  346. write_byte(15);
  347. write_byte(7);
  348. write_byte(iRed);
  349. write_byte(iGreen);
  350. write_byte(iBlue);
  351. write_byte(191);
  352. message_end();
  353.  
  354. if( iTemp )
  355. {
  356. message_begin(MSG_TYPE_ALL, SVC_TEMPENTITY);
  357. write_byte(TE_BEAMFOLLOW);
  358. write_short(iGrenId);
  359. write_short(g_iSpriteLine);
  360. write_byte(15);
  361. write_byte(1);
  362. switch( cs_get_user_team(iPlrId) )
  363. {
  364. case CS_TEAM_T:
  365. {
  366. write_byte(255);
  367. write_byte(0);
  368. write_byte(0);
  369. }
  370. case CS_TEAM_CT:
  371. {
  372. write_byte(0);
  373. write_byte(0);
  374. write_byte(255);
  375. }
  376. default:
  377. {
  378. write_byte(127);
  379. write_byte(127);
  380. write_byte(127);
  381. }
  382. }
  383. write_byte(191);
  384. message_end();
  385. }
  386. }
  387. }
  388. }
  389.  
  390.  

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Gránátcsík
HozzászólásElküldve: 2015.01.28. 13:24 
Offline
Fanatikus

Csatlakozott: 2015.01.28. 02:18
Hozzászólások: 160
Megköszönték neki: 31 alkalommal
Szia.

Picit spóroltam a sorokkal, most már random színek lesznek, ha eldobsz egy gránátot.

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <csx>
  3.  
  4. #define PLUGIN "Grenade Trail"
  5. #define VERSION "1.0"
  6. #define AUTHOR "Jim"
  7.  
  8. new g_cvar_tr
  9. new g_cvar_he
  10. new g_cvar_fb
  11. new g_cvar_sg
  12. new g_trail
  13.  
  14. public plugin_init()
  15. {
  16. register_plugin(PLUGIN, VERSION, AUTHOR)
  17. g_cvar_tr = register_cvar("grenade_tr", "1")
  18. g_cvar_he = register_cvar("grenade_he", "255000000")
  19. g_cvar_fb = register_cvar("grenade_fb", "000000255")
  20. g_cvar_sg = register_cvar("grenade_sg", "000255000")
  21. }
  22.  
  23. public plugin_precache()
  24. {
  25. g_trail = precache_model("sprites/smoke.spr")
  26. g_trail = precache_model("sprites/arrow1.spr")
  27. }
  28.  
  29. public grenade_throw(id, gid, wid)
  30. {
  31. new gtm = get_pcvar_num(g_cvar_tr)
  32. if(!gtm) return
  33. new r, g, b
  34. switch(gtm)
  35. {
  36. case 1:
  37. {
  38. r = random(256)
  39. g = random(256)
  40. b = random(256)
  41. }
  42. case 2:
  43. {
  44. new nade, color[10]
  45. switch(wid)
  46. {
  47. case CSW_HEGRENADE: nade = g_cvar_he
  48. case CSW_FLASHBANG: nade = g_cvar_fb
  49. case CSW_SMOKEGRENADE: nade = g_cvar_sg
  50. }
  51. get_pcvar_string(nade, color, 9)
  52. new c = str_to_num(color)
  53. r = c / 1000000
  54. c %= 1000000
  55. g = c / 1000
  56. b = c % 1000
  57. }
  58. case 3:
  59. {
  60. switch(get_user_team(id))
  61. {
  62. case 1: r = 255
  63. case 2: b = 255
  64. }
  65. }
  66. }
  67. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  68. write_byte(TE_BEAMFOLLOW)
  69. write_short(gid)
  70. write_short(g_trail)
  71. write_byte(10)
  72. write_byte(5)
  73. write_byte(r)
  74. write_byte(g)
  75. write_byte(b)
  76. write_byte(192)
  77. message_end()
  78. }

_________________
Általam magyarított modok:
[API] Fegyver csata v6.2 | Diablo II Mod : Lord of Destruction | DeathRun XP & Szint Mód
Kép

Ők köszönték meg excitedboy nek ezt a hozzászólást: bbshop (2015.01.28. 14:04)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Gránátcsík
HozzászólásElküldve: 2015.01.28. 14:05 
Offline
Senior Tag
Avatar

Csatlakozott: 2014.02.02. 10:59
Hozzászólások: 238
Megköszönt másnak: 63 alkalommal
Megköszönték neki: 12 alkalommal
Köszi, ment a gomb

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 3 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 31 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole