hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.06.16. 19:35



Jelenlévő felhasználók

Jelenleg 359 felhasználó van jelen :: 2 regisztrált, 0 rejtett és 357 vendég

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot], Google [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  [4 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: sniper control 1.2 plugin
HozzászólásElküldve:2014.04.15. 19:44 
Offline
Jómunkásember
Avatar

Csatlakozott:2014.04.14. 16:23
Hozzászólások:475
Megköszönt másnak: 97 alkalommal
Megköszönték neki: 4 alkalommal
Sziasztok!Azt szeretnem kerdezni,hogy a aniper controll 1.2 pluginba be lehet e allitani azt hogy csak a wpt es a magozot tiltsa es pl a scoutot ne?
A plugin:http://www.hlmod.hu/viewtopic.php?f=101&t=13609


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: sniper control 1.2 plugin
HozzászólásElküldve:2014.04.15. 19:49 
Offline
Jómunkásember
Avatar

Csatlakozott:2013.09.21. 12:03
Hozzászólások:318
Megköszönt másnak: 31 alkalommal
Megköszönték neki: 30 alkalommal
Ha jól néztem nem lehet...


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: sniper control 1.2 plugin
HozzászólásElküldve:2014.04.15. 20:10 
Offline
Őskövület
Avatar

Csatlakozott:2012.03.22. 18:22
Hozzászólások:2978
Megköszönt másnak: 117 alkalommal
Megköszönték neki: 368 alkalommal
elvileg csak ki kellett volna törölni a #define-t.

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4.  
  5. #pragma semicolon 1 // force ; usage, just 'cause
  6.  
  7. #define INCLUDE_SCOUT 1 // Include scouts in sniper rifle
  8.  
  9. new g_szTitle[] = "Sniper Rifle Control";
  10. new g_szVersion[] = "1.2";
  11. new g_szAuthor[] = "WillyumYum";
  12.  
  13. new g_iSniperNum[3]; // number of sniper rifles per team
  14.  
  15. new bool:g_bHasSniper[33]; // bool - true if player has a sniper rifle
  16.  
  17. new g_szWarn[] = "A csapatod elerte a sniper-korlat hatarat!";
  18.  
  19. new const SNIPERMODELS[3][] =
  20. {
  21. "models/w_sg550.mdl", // CSW_SG550
  22. "models/w_awp.mdl", // CSW_AWP
  23. "models/w_g3sg1.mdl" // CSW_G3SG1
  24. };
  25.  
  26. // Map disabled - original code by Ryan
  27.  
  28. public bool:Map_Disabled() {
  29.  
  30. new szDisabledFile[64];
  31. get_configsdir( szDisabledFile, 63 );
  32. format( szDisabledFile, 63, "%s/sc_disabled_maps.cfg", szDisabledFile );
  33.  
  34. if ( file_exists( szDisabledFile ) )
  35. {
  36. new iLineNum, szData[64], iTextLen;
  37.  
  38. while ( read_file( szDisabledFile, iLineNum, szData, 63, iTextLen ) )
  39. {
  40. new szMapName[64], szDisabledName[64];
  41.  
  42. get_mapname( szMapName, 63 );
  43. new iLen = copyc( szDisabledName, 63, szData, '*' );
  44.  
  45. if ( equali( szMapName, szDisabledName, iLen ) )
  46. return true;
  47.  
  48. iLineNum++;
  49. }
  50. }
  51.  
  52. return false;
  53. }
  54.  
  55. public menuSniper( id, key ) {
  56.  
  57. if ( !get_cvar_num( "mp_sniper_control" ) )
  58. return PLUGIN_CONTINUE;
  59.  
  60. new iTeam = get_user_team( id );
  61.  
  62. if ( iTeam == 1 && ( g_iSniperNum[iTeam] < get_cvar_num( "sc_max_snipers_t" ) || g_bHasSniper[id] ) ) // TERRORIST
  63. return PLUGIN_CONTINUE;
  64. else
  65. if ( iTeam == 2 && ( g_iSniperNum[iTeam] < get_cvar_num( "sc_max_snipers_ct" ) || g_bHasSniper[id] ) ) // COUNTER-TERRORIST
  66. return PLUGIN_CONTINUE;
  67.  
  68. if( iTeam == 1 && key == 1 ) // Allows T's tp buy ak-47, but blocks CT's from buying scout
  69. return PLUGIN_CONTINUE;
  70. else
  71. if( iTeam == 2 && key == 2 ) // Allows CT's to buy m4, but blocks T's from buying scout
  72. return PLUGIN_CONTINUE;
  73.  
  74. engclient_cmd( id, "menuselect" ,"10");
  75. client_print( id, print_center , g_szWarn );
  76.  
  77. return PLUGIN_HANDLED;
  78. }
  79.  
  80. public bool:check_primary( id ) {
  81.  
  82. new iWeapons[32];
  83. new iTotalWeapons = 0;
  84. get_user_weapons( id, iWeapons, iTotalWeapons );
  85.  
  86. for ( new i = 0; i < iTotalWeapons; i++ )
  87. {
  88. switch ( iWeapons[i] )
  89. {
  90. case CSW_M3: return true;
  91. case CSW_XM1014: return true;
  92. case CSW_MP5NAVY: return true;
  93. case CSW_TMP: return true;
  94. case CSW_P90: return true;
  95. case CSW_MAC10: return true;
  96. case CSW_UMP45: return true;
  97. case CSW_AK47: return true;
  98. case CSW_SG552: return true;
  99. case CSW_GALI: return true;
  100. case CSW_FAMAS: return true;
  101. case CSW_M4A1: return true;
  102. case CSW_AUG: return true;
  103. case CSW_SCOUT: return true;
  104. case CSW_AWP: return true;
  105. case CSW_G3SG1: return true;
  106. case CSW_SG550: return true;
  107. case CSW_M249: return true;
  108. }
  109. }
  110. return false;
  111. }
  112.  
  113. public bool:check_sniper( id ) {
  114.  
  115. new iWeapons[32];
  116. new iTotalWeapons = 0;
  117. get_user_weapons( id, iWeapons, iTotalWeapons );
  118.  
  119. for ( new i = 0; i < iTotalWeapons; i++ )
  120. {
  121. switch ( iWeapons[i] )
  122. {
  123. case CSW_AWP: return true;
  124. case CSW_G3SG1: return true;
  125. case CSW_SG550: return true;
  126. }
  127. }
  128. return false;
  129. }
  130.  
  131. public vexd_pfntouch(pToucher, pTouched) {
  132.  
  133. if ( !get_cvar_num( "mp_sniper_control" ) )
  134. return PLUGIN_CONTINUE;
  135.  
  136. new iTouchId = pToucher;
  137. new iPlayerId = pTouched;
  138.  
  139. if ( iPlayerId < 0 || iPlayerId > 32 || !is_user_alive( iPlayerId ) )
  140. return PLUGIN_CONTINUE;
  141.  
  142. new szClassName[32];
  143. entity_get_string( iTouchId, EV_SZ_classname, szClassName, 31 );
  144.  
  145. if ( equal( szClassName, "weaponbox" ) ) // a dropped or already 'fired' weapon
  146. {
  147. new szGunModel[32];
  148. entity_get_string( iTouchId, EV_SZ_model, szGunModel, 31 );
  149.  
  150. new bool:bHasPrimaryWeapon = check_primary( iPlayerId );
  151.  
  152. for ( new i = 0; i < 4; i++ )
  153. {
  154. if ( get_entity_flags( iTouchId ) & FL_ONGROUND && !bHasPrimaryWeapon && equal( szGunModel, SNIPERMODELS[i] ) )
  155. {
  156. set_entity_flags( iTouchId, FL_ONGROUND, 0 );
  157.  
  158. new iTeam = get_user_team( iPlayerId );
  159.  
  160. if ( iTeam == 1 ) // TERRORIST
  161. {
  162. if ( g_iSniperNum[iTeam] < get_cvar_num( "sc_max_snipers_t" ) )
  163. {
  164. set_entity_flags( iTouchId, FL_ONGROUND, 1 );
  165. }
  166. else
  167. {
  168. client_print( iPlayerId, print_center , g_szWarn );
  169. }
  170. }
  171. else
  172. if ( iTeam == 2 ) // COUNTER-TERRORIST
  173. {
  174. if ( g_iSniperNum[iTeam] < get_cvar_num( "sc_max_snipers_ct" ) )
  175. {
  176. set_entity_flags( iTouchId, FL_ONGROUND, 1 );
  177. }
  178. else
  179. {
  180. client_print( iPlayerId, print_center , g_szWarn );
  181. }
  182. }
  183. break;
  184. }
  185. }
  186. }
  187. return PLUGIN_CONTINUE;
  188. }
  189.  
  190. public cmdDrop( id ) {
  191.  
  192. if ( !get_cvar_num( "mp_sniper_control" ) )
  193. return PLUGIN_CONTINUE;
  194.  
  195. new iTeam = get_user_team( id );
  196.  
  197. new iAmmo, iClip;
  198. new iWeap = get_user_weapon( id, iAmmo, iClip );
  199.  
  200. if ( check_sniper( id ) && ( iWeap == CSW_AWP || iWeap == CSW_G3SG1 || iWeap == CSW_SG550 ) )
  201. {
  202. g_bHasSniper[id] = false;
  203. --g_iSniperNum[iTeam];
  204.  
  205. }
  206. #if ( INCLUDE_SCOUT )
  207.  
  208. else
  209. if( check_sniper( id ) && iWeap == CSW_SCOUT )
  210. {
  211. g_bHasSniper[id] = false;
  212. --g_iSniperNum[iTeam];
  213. }
  214.  
  215. #endif
  216.  
  217. return PLUGIN_CONTINUE;
  218. }
  219.  
  220. public evPickUp( id ) {
  221.  
  222. if ( !get_cvar_num( "mp_sniper_control" ) )
  223. return PLUGIN_CONTINUE;
  224.  
  225. new iTeam = get_user_team( id );
  226.  
  227. if( check_sniper( id ) && !g_bHasSniper[id] )
  228. {
  229. g_bHasSniper[id] = true;
  230. ++g_iSniperNum[iTeam];
  231. }
  232.  
  233. if ( g_bHasSniper[id] && !check_sniper( id ) )
  234. {
  235. // Has a primary weapon and HAD sniper, but bought new non-sniper rifle weapon ( no drop event )
  236.  
  237. g_bHasSniper[id] = false;
  238. --g_iSniperNum[iTeam];
  239. }
  240.  
  241. return PLUGIN_CONTINUE;
  242. }
  243.  
  244. public evRestartRound() {
  245.  
  246. if ( !get_cvar_num( "mp_sniper_control" ) )
  247. return PLUGIN_CONTINUE;
  248.  
  249. g_iSniperNum[0] = g_iSniperNum[1] = g_iSniperNum[2] = 0;
  250.  
  251. for(new a = 1; a < 33; ++a)
  252. g_bHasSniper[a] = false;
  253.  
  254. return PLUGIN_CONTINUE;
  255. }
  256.  
  257. public sc_remove_data( id ) {
  258.  
  259. new iTeam = get_user_team( id );
  260.  
  261. if ( g_bHasSniper[id] )
  262. {
  263. g_bHasSniper[id] = false;
  264. --g_iSniperNum[iTeam];
  265. }
  266.  
  267. return PLUGIN_CONTINUE;
  268. }
  269.  
  270. public client_disconnect( id ) {
  271.  
  272. if ( !get_cvar_num( "mp_sniper_control" ) )
  273. return PLUGIN_CONTINUE;
  274.  
  275. sc_remove_data( id );
  276.  
  277. return PLUGIN_CONTINUE;
  278. }
  279.  
  280. public evDeath() {
  281.  
  282. new id = read_data(2);
  283. sc_remove_data( id );
  284.  
  285. return PLUGIN_CONTINUE;
  286. }
  287.  
  288. public plugin_init() {
  289.  
  290. register_plugin( g_szTitle, g_szVersion, g_szAuthor );
  291.  
  292. // set defaults ( for non 'sniper_control.cfg' users )
  293.  
  294. register_cvar( "mp_sniper_control", "1" );
  295. register_cvar( "sc_max_snipers_t", "2" );
  296. register_cvar( "sc_max_snipers_ct", "2" );
  297.  
  298. // Standard Menus
  299.  
  300. register_menucmd( register_menuid("BuyRifle" , 1 ), (1<<4), "menuSniper" ); // T: AWP, CT: Sig SG-550 Sniper
  301. register_menucmd( register_menuid("BuyRifle" , 1 ), (1<<5), "menuSniper" ); // CT: AWP, T: H&K G3/SG-1 Sniper Rifle
  302.  
  303.  
  304. // Block Aliases and Vgui menus - because steam sucks and uses aliases to buy rifles ?!?!?
  305.  
  306. register_clcmd("awp", "menuSniper");
  307. register_clcmd("magnum", "menuSniper");
  308. register_clcmd("g3sg1", "menuSniper");
  309. register_clcmd("d3au1", "menuSniper");
  310. register_clcmd("sg550", "menuSniper");
  311. register_clcmd("krieg550", "menuSniper");
  312.  
  313. register_menucmd( -31 ,(1<<4), "menuSniper" ); // T: AWP, CT: Sig SG-550 Sniper - VGUI
  314. register_menucmd( -31 ,(1<<5), "menuSniper" ); // CT: AWP, T: H&K G3/SG-1 Sniper Rifle - VGUI
  315.  
  316. #if ( INCLUDE_SCOUT )
  317.  
  318. register_menucmd( register_menuid("BuyRifle" , 1 ), (1<<1), "menuSniper" ); // CT: Scout - Standard
  319. register_menucmd( register_menuid("BuyRifle" , 1 ), (1<<2), "menuSniper" ); // T: Scout - Standard
  320.  
  321. register_clcmd("scout", "menuSniper");
  322.  
  323. register_menucmd( -31 ,(1<<1), "menuSniper" ); // CT: Scout - VGUI
  324. register_menucmd( -31 ,(1<<2), "menuSniper" ); // T: Scout - VGUI
  325.  
  326. #endif
  327.  
  328. register_event( "WeapPickup", "evPickUp", "b" ); // 3 = Scout, 13 = SG-550, 18 = AWP, G3/SG-1
  329. register_clcmd( "drop", "cmdDrop" );
  330. register_event( "DeathMsg", "evDeath", "a" );
  331. register_event( "TextMsg", "evRestartRound", "a", "2&Game_C", "2&Game_w" );
  332.  
  333. if ( !Map_Disabled() )
  334. {
  335. new szConfigFile[64];
  336. get_configsdir( szConfigFile, 63 );
  337. format( szConfigFile, 63, "%s/sniper_control.cfg", szConfigFile );
  338. server_cmd( "exec %s", szConfigFile ); // load configuration settings
  339. }
  340. else
  341. {
  342. set_cvar_num( "mp_sniper_control", 0 );
  343. }
  344.  
  345. return PLUGIN_CONTINUE;
  346. }
  347.  
  348.  

_________________
Blasenkampfwagen

https://discord.gg/uBYnNnZP
GTA:PURSUIT MTA


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: sniper control 1.2 plugin
HozzászólásElküldve:2014.04.15. 23:21 
Offline
Jómunkásember
Avatar

Csatlakozott:2014.04.14. 16:23
Hozzászólások:475
Megköszönt másnak: 97 alkalommal
Megköszönték neki: 4 alkalommal
Najo haggyuk ink ezzel allitom be:http://www.hlmod.hu/viewtopic.php?f=101&t=13787 mert ezt ertem is :D

_________________
Kép
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  [4 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 26 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