HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. // // PLUGIN KESZITO: ANDREI || Magyarositotta es editelte Nanosuit
  2. // client_cmd(pPlayer, "spk cso_mod/select") Ezt nyugodtan kitorolheted/vagy atirhatod. Annyit tesz hogy mikor megnyitod a menut hangot ad ki.
  3.  
  4. #include < amxmodx >
  5. #include < cstrike >
  6. #include < amxmisc >
  7. #include < fun >
  8. #include < zombieplague >
  9. #include < hamsandwich >
  10. #include < engine >
  11. #include < sqlx >
  12. #include < fakemeta >
  13. #include <xs>
  14.  
  15. #define PLUGIN_NAME "ZP - Buy System"
  16. #define PLUGIN_VERSION "0.0.0.1"
  17. #define PLUGIN_AUTHOR "Andrei" // Magyarositotta & Editelte Nanosuit
  18.  
  19. #define SQL_HOST "HOST"
  20. #define SQL_USER "USER/FELHASZNALO"
  21. #define SQL_PASSWORD "PASSWORD/JELSZO"
  22. #define SQL_DBNAME "DATABASE NAME/ADATBAZIS NEVE"
  23.  
  24. #define MAX_CLIENTS 32
  25. #define MAX_ITEMS_DATA 512
  26.  
  27. #define MAX_MONEY_ADMIN 500000 // Adminak a maximalis ossze gyujtheto penz limit
  28. #define MAX_MONEY 100000 // Sima jatekosoknak a penz limitje
  29. #define MAX_MONEY_HUMANS_KILL 300 // Ha megfertozol egy embert penz jutalma
  30. #define MAX_MONEY_ZOMBIES_KILL 500 // Ha megolsz egy zombit penz jutalma
  31. #define MAX_MONEY_NEMESIS_KILL 5000 // Ha megolsz egy Nemesist penz jutalma
  32. #define MAX_MONEY_SURVIVAl_KILL 6000 // Ha megolsz egy tulelot penz jutalma
  33. #define MAX_MONEY_WIN_HUMANS 2500 // Zombik nyertek jutalma
  34. #define MAX_MONEY_WIN_ZOMBIES 1500 // Emberek nyertek jutalma
  35. #define MAX_MONEY_FAIL_HUMANS 2000 // Emberek vesztettek jutalma
  36. #define MAX_MONEY_FAIL_ZOMBIES 2500 // Zombik vesztettek jutalma
  37. #define MAX_MONEY_NO_ONE 1000 // Nem nyert senki jutalma
  38.  
  39. #define MAX_EXP_INFECTION_KILL 5 // Fertozesi xp
  40. #define MAX_EXP_ZOMBIES_KILL 8 // Zombi olesert jaro xp
  41. #define MAX_EXP_NEMESIS_KILL 20 // Nemesis olesert jaro xp
  42. #define MAX_EXP_SURVIVOR_KILL 15 // Tulelo olesert jaro xp
  43. #define MAX_EXP_WIN_HUMANS 3 // Emberek nyertek jaro jutalom (xp)
  44. #define MAX_EXP_WIN_ZOMBIES 3 // Zombik nyertek jaro jutalom (xp)
  45. #define MAX_EXP_FAIL_ZOMBIES 0 // Sikertelen Zombi jaro xp jutalom
  46. #define MAX_EXP_FAIL_HUMANS 0 // Sikertelen Ember jaro xp jutalom
  47. #define MAX_EXP_NO_ONE 2 // Nem nyert senki xp jutalom
  48.  
  49. #define WIN_HUMAN 0, 255, 0 // Emberek Nyertek Hud beallitasa "rgb" pl "100,255,0"
  50. #define FAIL_HUMAN 255, 0, 0 // Sikertelen Hud beallitasa "rgb" pl "100,255,0"
  51. #define DRAW_HUMAN 255, 255, 255 // Dontetlen Hud beallitasa "rgb" pl "100,255,0"
  52.  
  53. #define WIN_ZOMBIE 0, 255, 0 // Zombik Nyertek Hud beallitasa "rgb" pl "100,255,0"
  54. #define FAIL_ZOMBIE 255, 0, 0 // Sikertelen (Zombik) Hud beallitasa "rgb" pl "100,255,0"
  55. #define DRAW_ZOMBIE 255, 255, 255 // Dontetlen Hud beallitasa "rgb" pl "100,255,0"
  56. #define ADMIN_LISTEN ADMIN_BAN // Ezt a reszt nyugodtan at irhatod !
  57.  
  58. //PREFIX
  59. new message[192]
  60. new strName[191]
  61. new strText[191]
  62. new sayText
  63. new teamInfo
  64. new maxPlayers
  65. new static color[10]
  66.  
  67.  
  68. //Ability // Kepesseg
  69. new Float:g_lastLeaptime[33]
  70. new bool:g_norecoil[33]
  71. new bool:g_leap[33]
  72. new bool:g_speed[33]
  73.  
  74. native ZBS_GetUserLevel(id)
  75. native ZBS_SetUserMoney(id, value)
  76. native ZBS_GetUserMoney(id)
  77. new Float: cl_pushangle[33][3]
  78.  
  79. new g_szBuyCommands[ ][ ] =
  80. {
  81. "usp", "glock", "deagle", "p228", "elites",
  82. "fn57", "m3", "xm1014", "mp5", "tmp", "p90",
  83. "mac10", "ump45", "ak47", "galil", "famas",
  84. "sg552", "m4a1", "aug", "scout", "awp", "g3sg1",
  85. "sg550", "m249", "vest", "vesthelm", "flash",
  86. "hegren", "sgren", "defuser", "nvgs", "shield",
  87. "primammo", "secammo", "km45", "9x19mm", "nighthawk",
  88. "228compact", "fiveseven", "12gauge", "autoshotgun",
  89. "mp", "c90", "cv47", "defender", "clarion", "krieg552",
  90. "bullpup", "magnum", "d3au1", "krieg550",
  91. "buy", "buyequip", "cl_autobuy",
  92. "cl_rebuy", "cl_setautobuy", "cl_setrebuy", "client_buy_open"
  93. };
  94.  
  95. new const g_szStatsLevel[ ] =
  96. {
  97. 0, // 0
  98. 50, // 1
  99. 100, // 3
  100. 200, // 4
  101. 400, // 5
  102. 800, // 6
  103. 1600, // 7
  104. 3200, // 8
  105. 6400, // 9
  106. 12800, // 10
  107. 25600, // 11
  108. 51200, // 12
  109. 102400, // 13
  110. 204800, // 14
  111. 409600, // 15
  112. 819200, // 16
  113. 1638400, // 17
  114. 3276800, // 18
  115. 5974915, // 19
  116. 7899700, // 20
  117. 99999999, // 21 //Tovabb is irhatod ha kell neked tobb szint
  118. };
  119.  
  120. enum _:EBuySystemData
  121. {
  122. g_iMoneyNum = 1,
  123. g_iLevelNum,
  124. g_iExpNum,
  125. g_iBonusNum,
  126. g_iLastBought,
  127.  
  128. Float:g_flBuyTime,
  129. Float:g_flBlockMoney,
  130.  
  131. bool:g_bIsItemBought[ 3 ]
  132.  
  133. }; new g_pDataBuySystem[ MAX_CLIENTS +1 ][ EBuySystemData ];
  134.  
  135. enum _:EItemsData
  136. {
  137. g_szExtraItemKeyName[ 32 ] = 1,
  138. g_szExtraItemName[ 32 ],
  139. g_szExtraItemFlags[ 32 ],
  140. g_szExtraItemMode[ 32 ],
  141. g_szExtraItemLevelAcces[ 32 ],
  142.  
  143. g_iExtraItemCost,
  144. g_iExtraItemLevel,
  145. g_iExtraItemOnline,
  146. g_iExtraItemCtype,
  147. g_iExtraItemIndex,
  148. g_iExtraItemTeam,
  149. g_iExtraItemLimit
  150.  
  151. }; new g_pItemsData[ MAX_ITEMS_DATA ][ EItemsData ];
  152.  
  153. const WEAPONS_PRIMARY_BITSUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90);
  154. const WEAPONS_SECONDARY_BITSUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE);
  155. const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
  156. const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
  157.  
  158. new const BITSUM_SECTION_DROP = ((1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5));
  159.  
  160. new bool:g_bIsBoss;
  161. new bool:g_bIsAdmin[ MAX_CLIENTS +1 ];
  162.  
  163. new g_iMessagesMoney;
  164. new g_iMessagesBuyClose;
  165. new g_iMessagesBlinkAcct;
  166. new g_iMessagesStatusIcon;
  167. new g_iMaxClients;
  168. new g_iExtraItemsNum;
  169. new g_iRoundNum = 2;
  170.  
  171. new Handle:g_hDBTuple;
  172.  
  173. const WEAPONS_BITSUM = (1<<CSW_KNIFE|1<<CSW_HEGRENADE|1<<CSW_FLASHBANG|1<<CSW_SMOKEGRENADE|1<<CSW_C4)
  174. public plugin_init( )
  175. {
  176. register_plugin
  177. (
  178. PLUGIN_NAME,
  179. PLUGIN_VERSION,
  180. PLUGIN_AUTHOR
  181. );
  182.  
  183. register_dictionary( "BuySystem.txt" ); // LANG FAJL
  184.  
  185. static iCommands;
  186. for( iCommands = 0; iCommands < sizeof g_szBuyCommands; iCommands++ )
  187. register_clcmd( g_szBuyCommands[ iCommands ], "ClientCommannd__BuyCommands" );
  188.  
  189. static szMapName[ 64 ]; get_mapname( szMapName, charsmax( szMapName ) ); g_bIsBoss = !!equal( szMapName, "zs_decoy_boss" );
  190.  
  191. register_event( "HLTV", "CEvent__Round_Start", "a", "1=0", "2=0" );
  192.  
  193. RegisterHam( Ham_Spawn, "player", "CBasePlayer__Spawn_Post", .Post = true );
  194. RegisterHam( Ham_TakeDamage, "player", "CBasePlayer__TakeDamage_Pre", .Post = false );
  195. RegisterHam( Ham_Killed, "player", "CBasePlayer__Killed_Pre", .Post = false );
  196. RegisterHam( Ham_Player_PreThink, "player", "CBasePlayer__PreThink_Post", .Post = true );
  197.  
  198. g_iMessagesMoney = get_user_msgid( "Money" );
  199. g_iMessagesBuyClose = get_user_msgid( "BuyClose" );
  200. g_iMessagesBlinkAcct = get_user_msgid("BlinkAcct");
  201. g_iMessagesStatusIcon = get_user_msgid( "StatusIcon" );
  202. g_iMaxClients = get_maxplayers( );
  203.  
  204.  
  205. //RegisterHam(Ham_Spawn, "player", "OnCBasePlayer_Spawn_P", true);
  206. register_event("HLTV", "rewardlevel", "a", "1=0", "2=0")
  207. register_forward(FM_PlayerPreThink, "FW_playerprethink")
  208. register_clcmd ("say", "hook_say") //PREFIX miatt
  209. register_clcmd ("say_team", "hook_teamsay") //PREFIX miatt
  210. sayText = get_user_msgid ("SayText") //PREFIX miatt
  211. teamInfo = get_user_msgid ("TeamInfo") //PREFIX miatt
  212. maxPlayers = get_maxplayers() //PREFIX miatt
  213. register_message (sayText, "avoid_duplicated") // Chat beszed duplikalas ellen
  214. register_message( g_iMessagesMoney, "CMessages__Money" );
  215.  
  216. register_clcmd("cso_setlvl", "clcmd_set_lvl", ADMIN_IMMUNITY, "Használata: cso_setlvl <Név> <Szint>"); // Szint adas max 21 szintig vagy bovitheted ameddig akarod
  217. register_clcmd("cso_setmoney", "clcmd_set_money", ADMIN_IMMUNITY, "Használata: cso_setmoney <Név> <Mennyiség>"); // Penz addolas
  218. new weapon_name[24]
  219. for (new i = 1; i <= 30; i++)
  220. {
  221. if (!(WEAPONS_BITSUM & 1 << i) && get_weaponname(i, weapon_name, 23))
  222. {
  223. RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Pre")
  224. RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Post", 1)
  225. }
  226. }
  227. }
  228.  
  229. public plugin_natives( )
  230. {
  231. register_native("zbm_set_user_money", "_ZBS_SetUserMoney_", 1)
  232. register_native("zbm_get_user_money", "_ZBS_GetUserMoney_", 1)
  233.  
  234. register_native("zp_cs_get_user_money", "_ZBS_GetUserMoney_", 1);
  235. register_native("zp_cs_set_user_money", "_ZBS_SetUserMoney_", 1);
  236. register_native("zp_get_user_exp", "_ZBS_GetUserExp_", 1);
  237. register_native("zp_get_user_level", "_ZBS_GetUserLevel_", 1);
  238. register_native("zp_get_exp_current", "_ZBS_GetUserNextExp_", 1);
  239.  
  240. register_native("ZBS_GetUserMoney", "_ZBS_GetUserMoney_", 1);
  241. register_native("ZBS_GetUserExp", "_ZBS_GetUserExp_", 1);
  242. register_native("ZBS_GetUserLevel", "_ZBS_GetUserLevel_", 1);
  243. register_native("ZBS_GetUserNextExp", "_ZBS_GetUserNextExp_", 1);
  244. register_native("ZBS_GetUserMaxLevel", "_ZBS_GetUserMaxLevel_", 1);
  245.  
  246. register_native("ZBS_SetUserMoney", "_ZBS_SetUserMoney_", 1);
  247. register_native("ZBS_SetUserLevel", "_ZBS_SetUserLevel_", 1);
  248. register_native("ZBS_SetUserExp", "_ZBS_SetUserExp_", 1);
  249. }
  250.  
  251. public plugin_cfg( )
  252. {
  253. new szText[ 64 ];
  254. new szError[ 64 ];
  255.  
  256. new iFile;
  257. new iCtype;
  258. new iTeam;
  259. new iErrorCode;
  260.  
  261. iFile = fopen( "addons/amxmodx/configs/ZpBuySystem.ini", "rt" ); // LANG FAJL HELYE
  262.  
  263. if( !iFile )
  264. set_fail_state(".INI Fájl nem található!");
  265.  
  266. while( !feof( iFile ) )
  267. {
  268. fgets( iFile, szText, charsmax( szText ) );
  269.  
  270. if( !strlen( szText ) || szText[ 0 ] == ';' || ( szText[ 0 ] == '/' && szText[ 1 ] == '/' ) )
  271. continue;
  272.  
  273. if( szText[ 0 ] == '[' )
  274. {
  275. switch( szText[ 1 ] )
  276. {
  277. case 'P': iCtype = 1;
  278. case 'S': iCtype = 2;
  279. case 'A': iCtype = 3;
  280. case 'R': iCtype = 4;
  281. case 'M': iCtype = 5;
  282. case 'Z':
  283. {
  284. iCtype = 6;
  285. iTeam = 1;
  286. }
  287. case 'H':
  288. {
  289. iCtype = 6;
  290. iTeam = 2;
  291. }
  292. case 'K':
  293. {
  294. iCtype = 7;
  295. }
  296. }
  297. }
  298.  
  299. new szCost[ 32 ];
  300. new szLevel[ 32 ];
  301. new szOnline[ 32 ];
  302. new szLimit[ 32 ];
  303.  
  304. parse( szText, g_pItemsData[ g_iExtraItemsNum ][ g_szExtraItemKeyName ], 31, g_pItemsData[ g_iExtraItemsNum ][ g_szExtraItemName ], 31, szCost, 31, szLevel, 31, szOnline, 31, g_pItemsData[ g_iExtraItemsNum ][ g_szExtraItemMode ], 31 );
  305.  
  306. g_pItemsData[ g_iExtraItemsNum ][ g_iExtraItemCtype ] = iCtype;
  307. g_pItemsData[ g_iExtraItemsNum ][ g_iExtraItemTeam ] = iTeam;
  308. g_pItemsData[ g_iExtraItemsNum ][ g_iExtraItemCost ] = str_to_num( szCost );
  309. g_pItemsData[ g_iExtraItemsNum ][ g_iExtraItemLevel ] = str_to_num( szLevel );
  310. g_pItemsData[ g_iExtraItemsNum ][ g_iExtraItemOnline ] = str_to_num( szOnline );
  311. g_pItemsData[ g_iExtraItemsNum ][ g_iExtraItemLimit ] = str_to_num( szLimit );
  312. g_pItemsData[ g_iExtraItemsNum ][ g_iExtraItemIndex ] = g_pItemsData[ g_iExtraItemsNum ][ g_szExtraItemMode ] == 'Z' ? zp_get_extra_item_id( g_pItemsData[ g_iExtraItemsNum ][ g_szExtraItemName ] ) : get_weaponid( g_pItemsData[ g_iExtraItemsNum ][ g_szExtraItemName ] );
  313.  
  314. g_iExtraItemsNum++;
  315. }
  316.  
  317. fclose( iFile );
  318.  
  319. g_hDBTuple = SQL_MakeDbTuple( SQL_HOST,SQL_USER,SQL_PASSWORD,SQL_DBNAME );
  320.  
  321. new Handle:hConnection = SQL_Connect( g_hDBTuple, iErrorCode, szError, charsmax( szError ) );
  322.  
  323. if( hConnection == Empty_Handle )
  324. set_fail_state( szError );
  325.  
  326. new Handle:hQuery = SQL_PrepareQuery( hConnection,"CREATE TABLE IF NOT EXISTS BuySystemData(steamid varchar( 32 ),BuySystemDataMoney INT( 11 ),BuySystemDataLEVEL INT( 11 ), BuySystemDataEXP INT( 11 ) )");
  327.  
  328. if( !SQL_Execute( hQuery ) )
  329. {
  330. SQL_QueryError( hQuery, szError, charsmax( szError ) );
  331. set_fail_state( szError );
  332. }
  333.  
  334. SQL_FreeHandle( hQuery );
  335. SQL_FreeHandle( hConnection );
  336.  
  337. }
  338.  
  339. public plugin_end( )
  340. {
  341. SQL_FreeHandle( g_hDBTuple );
  342. }
  343. public rewardlevel() // Plusz hozza adva , ha nem kell neked torold .
  344. {
  345. new players[32],inum,id
  346. get_players(players,inum)
  347. for(new i;i<inum;i++)
  348. {
  349. id = players[i]
  350.  
  351. new current_ammopacks = zp_get_user_ammo_packs(id) // REWARD LEVEL ez kulon lett hozzairva. Ha akarod hogy irja minden kor kezdes elott akkor vedd ki belole "//"
  352. new current_money = ZBS_GetUserMoney(id)
  353. if(ZBS_GetUserLevel(id) >= 0 && ZBS_GetUserLevel(id) <= 1)
  354. {
  355. zp_set_user_ammo_packs(id, current_ammopacks + 2)
  356. ZBS_SetUserMoney(id, current_money + 1000)
  357. //zp_colored_print(id,"!n[!gLEVEL SYSTEM!n] !t• !nYour Level: !g%i !n| !gREWARD: !t2AP !n& !t1000$ !n& !t5 Armor", ZBS_GetUserLevel(id)) // Magyarul: "!n[!gLEVEL SYSTEM!n] !t• !nSzinted: !g%i !n| !gKör Jutalom: !t2C !n& !t1000$"
  358. }
  359. else if(ZBS_GetUserLevel(id) >= 2 && ZBS_GetUserLevel(id) <= 3)
  360. {
  361. zp_set_user_ammo_packs(id, current_ammopacks + 4)
  362. ZBS_SetUserMoney(id, current_money + 1500)
  363. //zp_colored_print(id,"!n[!gLEVEL SYSTEM!n] !t• !nYour Level: !g%i !n| !gREWARD: !t4AP !n& !t1500$", ZBS_GetUserLevel(id))
  364. }
  365. else if(ZBS_GetUserLevel(id) >= 4 && ZBS_GetUserLevel(id) <= 5)
  366. {
  367. zp_set_user_ammo_packs(id, current_ammopacks + 6)
  368. ZBS_SetUserMoney(id, current_money + 2000)
  369. //zp_colored_print(id,"!n[!gLEVEL SYSTEM!n] !t• !nYour Level: !g%i !n| !gREWARD: !t6AP !n& !t2000$", ZBS_GetUserLevel(id))
  370. }
  371. if(ZBS_GetUserLevel(id) >= 6 && ZBS_GetUserLevel(id) <= 7)
  372. {
  373. zp_set_user_ammo_packs(id, current_ammopacks + 8)
  374. ZBS_SetUserMoney(id, current_money + 2500)
  375. //zp_colored_print(id,"!n[!gLEVEL SYSTEM!n] !t• !nYour Level: !g%i !n| !gREWARD: !t8AP !n& !t2500$", ZBS_GetUserLevel(id))
  376. }
  377. else if(ZBS_GetUserLevel(id) >= 8 && ZBS_GetUserLevel(id) <= 9)
  378. {
  379. zp_set_user_ammo_packs(id, current_ammopacks + 10)
  380. ZBS_SetUserMoney(id, current_money + 3000)
  381. //zp_colored_print(id,"!n[!gLEVEL SYSTEM!n] !t• !nYour Level: !g%i !n| !gREWARD: !t10AP !n& !t3000$", ZBS_GetUserLevel(id))
  382. }
  383. else if(ZBS_GetUserLevel(id) >= 10 && ZBS_GetUserLevel(id) <= 11)
  384. {
  385. zp_set_user_ammo_packs(id, current_ammopacks + 12)
  386. ZBS_SetUserMoney(id, current_money + 3500)
  387. //zp_colored_print(id,"!n[!gLEVEL SYSTEM!n] !t• !nYour Level: !g%i !n| !gREWARD: !t12AP !n& !t3500$", ZBS_GetUserLevel(id))
  388. }
  389. if(ZBS_GetUserLevel(id) >= 12 && ZBS_GetUserLevel(id) <= 13)
  390. {
  391. zp_set_user_ammo_packs(id, current_ammopacks + 14)
  392. ZBS_SetUserMoney(id, current_money + 4000)
  393. //zp_colored_print(id,"!n[!gLEVEL SYSTEM!n] !t• !nYour Level: !g%i !n| !gREWARD: !t14AP !n& !t4000$", ZBS_GetUserLevel(id))
  394. }
  395. else if(ZBS_GetUserLevel(id) >= 14 && ZBS_GetUserLevel(id) <= 15)
  396. {
  397. zp_set_user_ammo_packs(id, current_ammopacks + 16)
  398. ZBS_SetUserMoney(id, current_money + 4500)
  399. g_norecoil[id] = true
  400. //zp_colored_print(id,"!n[!gLEVEL SYSTEM!n] !t• !nYour Level: !g%i !n| !gREWARD: !t16AP !n& !t4500$ !n& !tNo Recoil", ZBS_GetUserLevel(id))
  401. }
  402. else if(ZBS_GetUserLevel(id) >= 16 && ZBS_GetUserLevel(id) <= 17)
  403. {
  404. zp_set_user_ammo_packs(id, current_ammopacks + 18)
  405. ZBS_SetUserMoney(id, current_money + 5000)
  406. g_norecoil[id] = true
  407. //zp_colored_print(id,"!n[!gLEVEL SYSTEM!n] !t• !nYour Level: !g%i !n| !gREWARD: !t18AP !n& !t5000$ !n& !tNo Recoil", ZBS_GetUserLevel(id))
  408. }
  409. else if(ZBS_GetUserLevel(id) >= 18 && ZBS_GetUserLevel(id) <= 19)
  410. {
  411. zp_set_user_ammo_packs(id, current_ammopacks + 20)
  412. ZBS_SetUserMoney(id, current_money + 5500)
  413. g_norecoil[id] = true
  414. g_speed[id] = true // Gyorsasag
  415. g_leap[id] = true // Codokban ismert JetPack ugras
  416. //zp_colored_print(id,"!n[!gLEVEL SYSTEM!n] !t• !nYour Level: !g%i !n| !gREWARD: !t20AP !n& !t5500$ !n& !tNo Recoil & Leap & Speed", ZBS_GetUserLevel(id))
  417. }
  418. else if(ZBS_GetUserLevel(id) >= 20 && ZBS_GetUserLevel(id) <= 21)
  419. {
  420. zp_set_user_ammo_packs(id, current_ammopacks + 22)
  421. ZBS_SetUserMoney(id, current_money + 6000)
  422. g_norecoil[id] = true
  423. g_speed[id] = true // Gyorsasag
  424. g_leap[id] = true // Hosszu ugras
  425. //zp_colored_print(id,"!n[!gLEVEL SYSTEM!n] !t• !nYour Level: !g%i !n| !gREWARD: !t22C !n& !t6000$ !n& !tNo Recoil & Leap & Speed", ZBS_GetUserLevel(id))
  426. }
  427. }
  428. }
  429. public give_no_recoil(id) // Kepesseg
  430. {
  431. g_norecoil[id] = true
  432. }
  433. public give_speed(id) // Kepesseg
  434. {
  435. g_speed[id] = true
  436. }
  437. public give_leap(id) // Kepesseg
  438. {
  439. g_leap[id] = true
  440. }
  441. public fw_Weapon_PrimaryAttack_Post(entity) // NO RECOIL
  442. {
  443. new id = pev(entity, pev_owner)
  444. if (g_norecoil[id] == true)
  445. {
  446. new Float: push[3]
  447. pev(id, pev_punchangle, push)
  448. xs_vec_sub(push, cl_pushangle[id], push)
  449. xs_vec_mul_scalar(push, 0.0, push)
  450. xs_vec_add(push, cl_pushangle[id], push)
  451. set_pev(id, pev_punchangle, push)
  452. return HAM_IGNORED;
  453. }
  454. return HAM_IGNORED;
  455. }
  456. public fw_Weapon_PrimaryAttack_Pre(entity) // NO RECOIL
  457. {
  458. new id = pev(entity, pev_owner)
  459. if (g_norecoil[id] == true)
  460. {
  461. pev(id, pev_punchangle, cl_pushangle[id])
  462. return HAM_IGNORED;
  463. }
  464. return HAM_IGNORED;
  465. }
  466. public clcmd_set_lvl(id, level, cid)
  467. {
  468. if (!(get_user_flags(id) & ADMIN_IMMUNITY))
  469. return PLUGIN_HANDLED;
  470.  
  471. static szArg1[40], szArg2[10], iTarget, iCount;
  472.  
  473. iTarget = 0;
  474.  
  475. read_argv(1, szArg1, charsmax(szArg1));
  476.  
  477. iTarget = find_player("bl", szArg1);
  478.  
  479. if(iTarget <= 0)
  480. {
  481. client_print(id, print_console, "A játékos nem található");
  482. return PLUGIN_HANDLED;
  483. }
  484.  
  485. read_argv(2, szArg2, charsmax(szArg2));
  486. iCount = str_to_num(szArg2);
  487.  
  488. _ZBS_SetUserLevel_( iTarget, iCount );
  489.  
  490. return PLUGIN_HANDLED;
  491. }
  492.  
  493. public clcmd_set_money(id, level, cid)
  494. {
  495. if (!(get_user_flags(id) & ADMIN_IMMUNITY))
  496. return PLUGIN_HANDLED;
  497.  
  498. static szArg1[40], szArg2[10], iTarget, iCount;
  499.  
  500. iTarget = 0;
  501.  
  502. read_argv(1, szArg1, charsmax(szArg1));
  503.  
  504. iTarget = find_player("bl", szArg1);
  505.  
  506. if(iTarget <= 0)
  507. {
  508. client_print(id, print_console, "A játékos nem található");
  509. return PLUGIN_HANDLED;
  510. }
  511.  
  512. read_argv(2, szArg2, charsmax(szArg2));
  513. iCount = str_to_num(szArg2);
  514.  
  515. _ZBS_SetUserMoney_( iTarget, iCount );
  516.  
  517. if( !task_exists( iTarget ) )
  518. set_task( 0.1, "CTask__CalculateMoney", iTarget );
  519.  
  520. return PLUGIN_HANDLED;
  521. }
  522.  
  523. public client_connect( pPlayer )
  524. {
  525. if( is_user_bot( pPlayer ) || is_user_hltv( pPlayer ) )
  526. return;
  527.  
  528. g_bIsAdmin[ pPlayer ] = !!is_user_admin( pPlayer );
  529.  
  530. new szSteamId[ 32 ];
  531. new szTemp[ 512 ];
  532. new pParameters[ 1 ]; pParameters[ 0 ] = pPlayer;
  533.  
  534. get_user_authid( pPlayer, szSteamId, charsmax( szSteamId ) );
  535.  
  536. format( szTemp, charsmax( szTemp ), "SELECT * FROM `BuySystemData` WHERE (`BuySystemData`.`steamid` = '%s')", szSteamId );
  537. SQL_ThreadQuery( g_hDBTuple,"SQL_QueryConnection", szTemp, pParameters, sizeof pParameters );
  538. }
  539.  
  540. public client_disconnect( pPlayer )
  541. {
  542. new szSteamId[ 32 ];
  543. new szTemp[ 512 ];
  544.  
  545. get_user_authid( pPlayer, szSteamId, charsmax( szSteamId ) );
  546.  
  547. format(szTemp,charsmax(szTemp),"UPDATE `BuySystemData` SET `BuySystemDataMoney` = '%i', `BuySystemDataLEVEL` = '%i',`BuySystemDataEXP` = '%i' WHERE `BuySystemData`.`steamid` = '%s';",g_pDataBuySystem[ pPlayer ][ g_iMoneyNum ],g_pDataBuySystem[ pPlayer ][ g_iLevelNum ],g_pDataBuySystem[ pPlayer ][ g_iExpNum ], szSteamId);
  548.  
  549. SQL_ThreadQuery( g_hDBTuple,"SQL_QueryCloseConnection",szTemp );
  550. }
  551.  
  552. public SQL_QueryConnection( iState, Handle:hQuery, szError[ ], iErrcode, pParameters[], pParametersSize )
  553. {
  554. switch( iState )
  555. {
  556. case TQUERY_CONNECT_FAILED: log_amx( "Load - Could not connect to SQL database. [ %d ] %s", iErrcode, szError );
  557. case TQUERY_QUERY_FAILED: log_amx( "Load Query failed. [ %d ] %s", iErrcode, szError );
  558. }
  559.  
  560. new pPlayer; pPlayer = pParameters[ 0 ];
  561.  
  562. if( SQL_NumResults( hQuery ) < 1 )
  563. {
  564.  
  565. new szSteamId[ 32 ];
  566. get_user_authid( pPlayer, szSteamId, charsmax( szSteamId ) ) ;
  567.  
  568. if (equal( szSteamId,"ID_PENDING" ) )
  569. return PLUGIN_HANDLED;
  570.  
  571. new szTemp[ 512 ];
  572. format( szTemp,charsmax( szTemp ),"INSERT INTO `BuySystemData`( `steamid`, `BuySystemDataMoney`,`BuySystemDataLEVEL`,`BuySystemDataEXP`) VALUES ('%s','%i', '1', '0' );", szSteamId, get_pcvar_num( get_cvar_pointer( "mp_startmoney" ) ) );
  573.  
  574. SQL_ThreadQuery( g_hDBTuple,"SQL_QueryCloseConnection", szTemp );
  575.  
  576. g_pDataBuySystem[ pPlayer ][ g_iMoneyNum ] = get_pcvar_num( get_cvar_pointer( "mp_startmoney" ) );
  577. g_pDataBuySystem[ pPlayer ][ g_iLevelNum ] = 1;
  578.  
  579. return PLUGIN_HANDLED;
  580. }
  581.  
  582. for( new i = g_iMoneyNum; i <= g_iExpNum; i++ )
  583. {
  584. g_pDataBuySystem[ pPlayer ][ i ] = SQL_ReadResult( hQuery, i );
  585. }
  586.  
  587. return PLUGIN_HANDLED;
  588. }
  589.  
  590. public SQL_QueryCloseConnection( iState, Handle:hQuery, szError[ ], iErrcode, pParameters[], pParametersSize )
  591. {
  592. SQL_FreeHandle( hQuery );
  593.  
  594. return PLUGIN_HANDLED;
  595. }
  596.  
  597. public CEvent__Round_Start( )
  598. {
  599. static iCell;
  600.  
  601. for( iCell = 1; iCell <= g_iMaxClients; iCell++ )
  602. {
  603. if( !is_user_connected( iCell ) )
  604. continue;
  605.  
  606. g_pDataBuySystem[ iCell ][ g_flBuyTime ] = _:( g_bIsBoss ? get_gametime( ) + get_pcvar_float( get_cvar_pointer( "mp_buytime_boss" ) ) : get_gametime( ) + get_pcvar_float( get_cvar_pointer( "mp_buytime" ) ) );
  607. }
  608. }
  609.  
  610. public zp_round_started( iGameMode, pPlayer )
  611. {
  612. static iCell;
  613.  
  614. for( iCell = 1; iCell <= g_iMaxClients; iCell++ )
  615. {
  616. if( !is_user_alive( iCell ) )
  617. continue;
  618.  
  619. g_pDataBuySystem[ iCell ][ g_flBuyTime ] = _:0.0;
  620.  
  621. if( IsHuman( iCell ) )
  622. continue;
  623.  
  624. g_pDataBuySystem[ iCell ][ g_iBonusNum ] += g_pDataBuySystem[ iCell ][ g_iLastBought ];
  625.  
  626. if( !task_exists( iCell ) )
  627. set_task( 0.1, "CTask__CalculateMoney", iCell );
  628. }
  629. }
  630. public hook_say(id) // ++ Chat/Chatprefix hozzaadva , ha ez sem kell nyugodtan torold!
  631. {
  632. read_args (message, 191)
  633. remove_quotes (message)
  634.  
  635. if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, ""))
  636. return PLUGIN_CONTINUE
  637.  
  638. new name[32]
  639. get_user_name (id, name, 31)
  640.  
  641. new isAlive, alive[32]
  642.  
  643. if (is_user_alive (id))
  644. {
  645. isAlive = 1
  646. alive = "^1*ELO*"
  647. }
  648. else
  649. {
  650. isAlive = 0
  651. alive = "^1*HALOTT* "
  652. }
  653.  
  654. //static color[10]
  655.  
  656. if(get_user_flags(id)&ADMIN_IMMUNITY)
  657. {
  658. //get_user_team (id, color, 9)
  659. getTeam(id)
  660. format (strName, 191, "%s ^1[^4Level: %i^1] ^1[^4OWNER^1] ^3%s:", alive, ZBS_GetUserLevel(id) , name) // Tulajdonos
  661. format (strText, 191, "^4%s", message)
  662. }
  663.  
  664. else if(get_user_flags(id)&ADMIN_BAN)
  665. {
  666. getTeam(id)
  667. format (strName, 191, "%s ^1[^4Level: %i^1] ^1[^4ADMIN^1] ^3%s:", alive, ZBS_GetUserLevel(id), name) // ADMIN
  668. format (strText, 191, "^4%s", message)
  669. }
  670.  
  671. else if(get_user_flags(id)&ADMIN_LEVEL_H)
  672. {
  673. getTeam(id)
  674. format (strName, 191, "%s ^1[^4Level: %i^1] ^1[^4VIP^1] ^3%s:", alive, ZBS_GetUserLevel(id), name) // VIP
  675. format (strText, 191, "^1%s", message)
  676. }
  677.  
  678. else if(get_user_flags(id)&ADMIN_USER)
  679. {
  680. getTeam(id)
  681. format (strName, 191, "%s ^1[^4Level: %i^1] ^1[^4PLAYER^1] ^3%i:",alive, ZBS_GetUserLevel(id), name) // SIMA JATEKOS
  682. format (strText, 191, "^1%s", message)
  683. }
  684.  
  685. format (message, 191, "%s ^1%s", strName, strText)
  686. sendMessage (color, isAlive)
  687.  
  688. return PLUGIN_CONTINUE
  689. }
  690.  
  691. public hook_teamsay(id)
  692. {
  693. new playerTeam = get_user_team(id)
  694. new playerTeamName[19]
  695.  
  696. switch (playerTeam)
  697. {
  698. case 1:
  699. copy (playerTeamName, 11, "ZOMBIE")
  700.  
  701. case 2:
  702. copy (playerTeamName, 18, "HUMAN")
  703.  
  704. default:
  705. copy (playerTeamName, 9, "SPECTATOR")
  706. }
  707.  
  708. read_args (message, 191)
  709. remove_quotes (message)
  710.  
  711. if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, ""))
  712. return PLUGIN_CONTINUE
  713.  
  714. new isAlive, alive[32]
  715.  
  716. if (is_user_alive (id))
  717. {
  718. isAlive = 1
  719. alive = "^1*ELO*"
  720. }
  721. else
  722. {
  723. isAlive = 0
  724. alive = "^1*HALOTT*"
  725. }
  726.  
  727. new name[32]
  728. get_user_name (id, name, 31)
  729.  
  730. //static color[10]
  731.  
  732. if(get_user_flags(id)&ADMIN_IMMUNITY)
  733. {
  734. //get_user_team (id, color, 9)
  735. getTeam(id)
  736. format (strName, 191, "%s(%s) ^1[^4Level: %i^1] ^1[^4OWNER^1] ^3%s:",alive , playerTeamName, ZBS_GetUserLevel(id), name) // TULAJDONOS
  737. format (strText, 191, "^4%s", message)
  738. }
  739.  
  740. else if(get_user_flags(id)&ADMIN_BAN)
  741. {
  742. getTeam(id)
  743. format (strName, 191, "%s(%s) ^1[^4Level: %i^1] ^1[^4ADMIN^1] ^3%s:",alive , playerTeamName, ZBS_GetUserLevel(id), name) // ADMIN
  744. format (strText, 191, "^4%s", message)
  745. }
  746.  
  747. else if(get_user_flags(id)&ADMIN_LEVEL_H)
  748. {
  749. getTeam(id)
  750. format (strName, 191, "%s(%s) ^1[^4Level: %i^1] ^1[^4VIP^1] ^3%s:",alive , playerTeamName, ZBS_GetUserLevel(id), name) // VIP
  751. format (strText, 191, "^1%s", message)
  752. }
  753.  
  754. else if(get_user_flags(id)&ADMIN_USER)
  755. {
  756. getTeam(id)
  757. format (strName, 191, "%s(%s) ^1[^4Level: %i^1] ^1[^4USER^1] ^3%s:",alive ,playerTeamName, ZBS_GetUserLevel(id), name) // SIMA JATEKOS
  758. format (strText, 191, "^1%s", message)
  759. }
  760.  
  761. format (message, 191, "%s ^1%s", strName, strText)
  762. sendTeamMessage (color,isAlive, playerTeam)
  763.  
  764. return PLUGIN_CONTINUE
  765. }
  766.  
  767. public sendMessage (color[], alive)
  768. {
  769. new teamName[10]
  770.  
  771. for (new player = 1; player < maxPlayers; player++)
  772. {
  773. if (!is_user_connected(player))
  774. continue
  775. if((alive && is_user_alive(player)) || (!alive && !is_user_alive(player)) || (get_user_flags(player) && ADMIN_LISTEN))
  776. {
  777. get_user_team (player, teamName, 9)
  778. changeTeamInfo (player, color)
  779. writeMessage (player, message)
  780. changeTeamInfo (player, teamName)
  781. }
  782. }
  783. }
  784.  
  785. public sendTeamMessage (color[], alive, playerTeam)
  786. {
  787. new teamName[10]
  788.  
  789. for (new player = 1; player < maxPlayers; player++)
  790. {
  791. if (!is_user_connected(player))
  792. continue
  793.  
  794. if (get_user_team(player) == playerTeam || get_user_flags(player) & ADMIN_LISTEN)
  795. {
  796. if (alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_user_flags(player) & ADMIN_LISTEN)
  797. {
  798. get_user_team (player, teamName, 9)
  799. changeTeamInfo (player, color)
  800. writeMessage (player, message)
  801. changeTeamInfo (player, teamName)
  802. }
  803. }
  804. }
  805. }
  806.  
  807. public changeTeamInfo (player, team[])
  808. {
  809. message_begin (MSG_ONE, teamInfo, _, player)
  810. write_byte (player)
  811. write_string (team)
  812. message_end()
  813. }
  814.  
  815. public writeMessage (player, message[])
  816. {
  817. message_begin (MSG_ONE, sayText, {0, 0, 0}, player)
  818. write_byte (player)
  819. write_string (message)
  820. message_end ()
  821. }
  822. public getTeam(id)
  823. {
  824. get_user_team (id, color, 9)
  825. }
  826. public zp_round_ended( iTeam )
  827. {
  828. if( g_iRoundNum-- > 1 )
  829. return;
  830.  
  831. static iCell;
  832.  
  833. for( iCell = 1; iCell <= g_iMaxClients; iCell++ )
  834. {
  835. if( !is_user_connected( iCell ) )
  836. continue;
  837.  
  838. switch( iTeam )
  839. {
  840. case WIN_HUMANS:
  841. {
  842. if (IsHuman( iCell ))
  843. {
  844. set_dhudmessage( WIN_HUMAN, 0.05, 0.63, 2, 1.0, 3.5, 0.05, 0.05 );
  845. show_dhudmessage( iCell, "%L", iCell, "ZBS_WIN", MAX_MONEY_WIN_HUMANS );
  846. }
  847. else
  848. {
  849. set_dhudmessage( FAIL_ZOMBIE, 0.05, 0.63, 2, 1.0, 3.5, 0.05, 0.05 );
  850. show_dhudmessage( iCell, "%L", iCell, "ZBS_FAIL", MAX_MONEY_FAIL_ZOMBIES );
  851. }
  852.  
  853. g_pDataBuySystem[ iCell ][ g_iBonusNum ] += IsHuman( iCell ) ? MAX_MONEY_WIN_HUMANS : MAX_MONEY_FAIL_ZOMBIES;
  854. g_pDataBuySystem[ iCell ][ g_iExpNum ] += IsHuman( iCell ) ? MAX_EXP_WIN_HUMANS : MAX_EXP_FAIL_ZOMBIES;
  855. }
  856. case WIN_ZOMBIES:
  857. {
  858. if (IsHuman( iCell ))
  859. {
  860. set_dhudmessage( FAIL_HUMAN, 0.05, 0.63, 2, 1.0, 3.5, 0.05, 0.05 );
  861. show_dhudmessage( iCell, "%L", iCell, "ZBS_FAIL", MAX_MONEY_FAIL_HUMANS )
  862. }
  863. else
  864. {
  865. set_dhudmessage( WIN_ZOMBIE, 0.05, 0.63, 2, 1.0, 3.5, 0.05, 0.05 );
  866. show_dhudmessage( iCell, "%L", iCell, "ZBS_WIN", MAX_MONEY_WIN_ZOMBIES );
  867. }
  868.  
  869. g_pDataBuySystem[ iCell ][ g_iBonusNum ] += IsHuman( iCell ) ? MAX_MONEY_FAIL_HUMANS : MAX_MONEY_WIN_ZOMBIES;
  870. g_pDataBuySystem[ iCell ][ g_iExpNum ] += IsHuman( iCell ) ? MAX_EXP_FAIL_HUMANS : MAX_EXP_WIN_ZOMBIES;
  871. }
  872. default:
  873. {
  874. if (IsHuman( iCell ))
  875. {
  876. set_dhudmessage( DRAW_HUMAN, 0.05, 0.63, 2, 1.0, 3.5, 0.05, 0.05 )
  877. show_dhudmessage( iCell, "%L", iCell, "ZBS_NO_ONE", MAX_MONEY_NO_ONE );
  878. }
  879. else
  880. {
  881. set_dhudmessage( DRAW_ZOMBIE, 0.05, 0.63, 2, 1.0, 3.5, 0.05, 0.05 )
  882. show_dhudmessage( iCell, "%L", iCell, "ZBS_NO_ONE", MAX_MONEY_NO_ONE );
  883. }
  884.  
  885. g_pDataBuySystem[ iCell ][ g_iBonusNum ] += MAX_MONEY_NO_ONE;
  886. g_pDataBuySystem[ iCell ][ g_iExpNum ] += MAX_EXP_NO_ONE;
  887. }
  888. }
  889.  
  890. if( !task_exists( iCell ) )
  891. set_task( 0.1, "CTask__CalculateMoney", iCell );
  892.  
  893. if( g_pDataBuySystem[ iCell ][ g_iLevelNum ] >= sizeof( g_szStatsLevel ) )
  894. return;
  895.  
  896. while( g_pDataBuySystem[ iCell ][ g_iExpNum ] >= g_szStatsLevel[ g_pDataBuySystem[ iCell ][ g_iLevelNum ] ] )
  897. {
  898. g_pDataBuySystem[ iCell ][ g_iLevelNum ]++;
  899. }
  900. }
  901. }
  902.  
  903. public zp_user_infected_post( pPlayer, pInfector, pNemesis )
  904. {
  905. if( is_user_alive( pInfector ) )
  906. {
  907. g_pDataBuySystem[ pInfector ][ g_iBonusNum ] += MAX_MONEY_ZOMBIES_KILL;
  908. g_pDataBuySystem[ pInfector ][ g_iExpNum ] += MAX_EXP_INFECTION_KILL;
  909.  
  910. if( !task_exists( pInfector ) )
  911. set_task( 0.1, "CTask__CalculateMoney", pInfector );
  912. }
  913. }
  914.  
  915. public CBasePlayer__Spawn_Post( pPlayer )
  916. {
  917. if( !is_user_alive( pPlayer ) )
  918. return HAM_IGNORED;
  919.  
  920. g_pDataBuySystem[ pPlayer ][ g_iLastBought ] = 0;
  921. g_pDataBuySystem[ pPlayer ][ g_bIsItemBought ][ 0 ] = false;
  922. g_pDataBuySystem[ pPlayer ][ g_bIsItemBought ][ 1 ] = false;
  923. g_pDataBuySystem[ pPlayer ][ g_bIsItemBought ][ 2 ] = false;
  924.  
  925. return HAM_IGNORED;
  926. }
  927.  
  928. public CBasePlayer__TakeDamage_Pre( pevVictim, pevInflictor, pevAttacker, Float:flDamage, BitDamageType )
  929. {
  930. if( !is_user_alive( pevAttacker ) || !IsHuman( pevAttacker ) )
  931. return HAM_IGNORED;
  932.  
  933. g_pDataBuySystem[ pevAttacker ][ g_iBonusNum ] += floatround( flDamage );
  934.  
  935. if( !task_exists( pevAttacker ) )
  936. set_task( 0.1, "CTask__CalculateMoney", pevAttacker );
  937.  
  938. return HAM_IGNORED;
  939. }
  940.  
  941. public CBasePlayer__Killed_Pre( pevVictim, pevKiller )
  942. {
  943. if( !is_user_alive( pevKiller) )
  944. return HAM_IGNORED;
  945.  
  946. if( g_pDataBuySystem[ pevKiller ][ g_iLevelNum ] >= sizeof( g_szStatsLevel ) )
  947. return HAM_IGNORED;
  948.  
  949. if( zp_get_user_zombie( pevVictim ) )
  950. {
  951. g_pDataBuySystem[ pevKiller ][ g_iExpNum ] += MAX_EXP_ZOMBIES_KILL;
  952. }
  953. else if( zp_get_user_nemesis( pevVictim ) )
  954. {
  955. g_pDataBuySystem[ pevKiller ][ g_iExpNum ] += MAX_EXP_NEMESIS_KILL;
  956.  
  957. g_pDataBuySystem[ pevKiller ][ g_iBonusNum ] += MAX_MONEY_NEMESIS_KILL;
  958.  
  959. set_dhudmessage( 50, 50, 255, -1.0, 0.63, 2, 1.0, 3.5, 0.05, 0.05 );
  960. show_dhudmessage( pevKiller, "You killed the boss^nBonus: %d$", MAX_MONEY_NEMESIS_KILL ) // Magyarul: "Megölted a Nemesist^nBónusz Pénz: %d$"
  961. }
  962. else if( zp_get_user_survivor( pevVictim ) )
  963. {
  964. g_pDataBuySystem[ pevKiller ][ g_iExpNum ] += MAX_EXP_SURVIVOR_KILL;
  965.  
  966. g_pDataBuySystem[ pevKiller ][ g_iBonusNum ] += MAX_MONEY_SURVIVAl_KILL;
  967.  
  968. set_dhudmessage( 50, 50, 255, -1.0, 0.63, 2, 1.0, 3.5, 0.05, 0.05 );
  969. show_dhudmessage( pevKiller, "You killed the survivor^nBonus: %d$", MAX_MONEY_SURVIVAl_KILL ) // Magyarul: "Megölted a Túlélőt^nBónusz Pénz: %d$"
  970. }
  971. else
  972. {
  973. g_pDataBuySystem[ pevKiller ][ g_iBonusNum ] += MAX_MONEY_HUMANS_KILL;
  974. }
  975.  
  976. while( g_pDataBuySystem[ pevKiller ][ g_iExpNum ] >= g_szStatsLevel[ g_pDataBuySystem[ pevKiller ][ g_iLevelNum ] ] )
  977. {
  978. g_pDataBuySystem[ pevKiller ][ g_iLevelNum ]++;
  979. }
  980.  
  981. if( !task_exists( pevKiller ) )
  982. set_task( 0.1, "CTask__CalculateMoney", pevKiller );
  983.  
  984. return HAM_IGNORED;
  985. }
  986.  
  987. public CBasePlayer__PreThink_Post( pPlayer )
  988. {
  989. if( !is_user_alive( pPlayer ) )
  990. return HAM_IGNORED;
  991.  
  992. message_begin( MSG_ONE, g_iMessagesStatusIcon, _, pPlayer );
  993. write_byte( 1 );
  994. write_string( "buyzone" );
  995. write_byte( 0 );
  996. write_byte( 160 );
  997. write_byte( 0 );
  998. message_end( );
  999.  
  1000. return HAM_IGNORED;
  1001. }
  1002.  
  1003. public ClientCommannd__BuyCommands( pPlayer ) // Vasarlo Menu resz
  1004. {
  1005. client_cmd(pPlayer, "spk cso_mod/select")
  1006. message_begin( MSG_ONE, g_iMessagesBuyClose, _, pPlayer );
  1007. message_end( );
  1008.  
  1009. new szBuffer[ 1024 ];
  1010.  
  1011. new iCallBackPistols = menu_makecallback( "CallBackPistols" );
  1012. new iCallBackRifles = menu_makecallback( "CallBackRifles" );
  1013. new iCallBackItems = menu_makecallback( "CallBackItems" );
  1014. new iCallBackKnifes = menu_makecallback( "CallBackKnifes" );
  1015.  
  1016. formatex( szBuffer, charsmax( szBuffer ), "%L", pPlayer, "ZBS_MAIN_TITLE" );
  1017. new iBuySystemMenu = menu_create( szBuffer, "BuySystemMenuHandler" )
  1018.  
  1019. formatex( szBuffer, charsmax( szBuffer ), "%L", pPlayer, "ZBS_MAIN_PISTOLS" );
  1020. menu_additem( iBuySystemMenu, szBuffer, "1", _, iCallBackPistols );
  1021. formatex( szBuffer, charsmax( szBuffer ), "%L", pPlayer, "ZBS_MAIN_SHOTGUNS" );
  1022. menu_additem( iBuySystemMenu, szBuffer, "2", _, iCallBackRifles );
  1023. formatex( szBuffer, charsmax( szBuffer ), "%L", pPlayer, "ZBS_MAIN_AUTO" );
  1024. menu_additem( iBuySystemMenu, szBuffer, "3", _, iCallBackRifles );
  1025. formatex( szBuffer, charsmax( szBuffer ), "%L", pPlayer, "ZBS_MAIN_RIFLE" );
  1026. menu_additem( iBuySystemMenu, szBuffer, "4", _, iCallBackRifles );
  1027. formatex( szBuffer, charsmax( szBuffer ), "%L^n", pPlayer, "ZBS_MAIN_MACHINE" );
  1028. menu_additem( iBuySystemMenu, szBuffer, "5", _, iCallBackRifles );
  1029.  
  1030. formatex( szBuffer, charsmax( szBuffer ), "%L^n", pPlayer, "ZBS_MAIN_EXTRA");
  1031. menu_additem( iBuySystemMenu, szBuffer, "6", _, iCallBackItems );
  1032.  
  1033. formatex( szBuffer, charsmax( szBuffer ), "%L", pPlayer, "ZBS_MAIN_KNIFES" );
  1034. menu_additem( iBuySystemMenu, szBuffer, "7", _, iCallBackKnifes );
  1035.  
  1036. formatex( szBuffer, charsmax( szBuffer ), "\w%L", pPlayer, "ZBS_MAIN_MORE" );
  1037. menu_setprop( iBuySystemMenu, MPROP_NEXTNAME, szBuffer );
  1038. formatex( szBuffer, charsmax( szBuffer ), "\w%L", pPlayer, "ZBS_MAIN_BACK" );
  1039. menu_setprop( iBuySystemMenu, MPROP_BACKNAME, szBuffer );
  1040. formatex( szBuffer, charsmax( szBuffer ), "\w%L^n^n", pPlayer, "ZBS_MAIN_EXIT" );
  1041.  
  1042. menu_setprop( iBuySystemMenu, MPROP_EXITNAME, szBuffer );
  1043. menu_display( pPlayer, iBuySystemMenu, .page = 0 );
  1044.  
  1045. return PLUGIN_HANDLED;
  1046. }
  1047.  
  1048. public BuySystemMenuHandler( pPlayer, iMenu, iItem )
  1049. {
  1050. client_cmd(pPlayer, "spk cso_mod/select")
  1051. if( iItem == MENU_EXIT )
  1052. {
  1053. menu_destroy( iMenu )
  1054. return PLUGIN_HANDLED
  1055. }
  1056.  
  1057. new iAccess;
  1058. new iCallback;
  1059. new szInfo[ 3 ];
  1060.  
  1061. menu_item_getinfo( iMenu, iItem, iAccess, szInfo, charsmax( szInfo ), _, _, iCallback );
  1062. menu_destroy( iMenu );
  1063.  
  1064. if( str_to_num( szInfo ) == 7 )
  1065. {
  1066. client_cmd( pPlayer, "knife" );
  1067. return PLUGIN_HANDLED;
  1068. }
  1069.  
  1070. BuySystemSubMenu( pPlayer, str_to_num( szInfo ) )
  1071. return PLUGIN_HANDLED
  1072. }
  1073.  
  1074. public BuySystemSubMenu( pPlayer, iNum )
  1075. {
  1076. client_cmd(pPlayer, "spk cso_mod/select")
  1077. static szBuffer[ 1024 ];
  1078. static iAccess[ 5 ];
  1079. static iItems;
  1080.  
  1081. formatex( szBuffer, charsmax( szBuffer ), "%L", pPlayer, "ZBS_SUBMENU" );
  1082.  
  1083. new iBuySystemSubMenu = menu_create( szBuffer, "BuySystemSubMenuHandler" );
  1084.  
  1085. for( iItems = 0; iItems < g_iExtraItemsNum; iItems++ )
  1086. {
  1087. if( g_pItemsData[ iItems ][ g_iExtraItemCtype ] != iNum || g_pItemsData[ iItems ][ g_iExtraItemIndex ] <= 0 || ( IsHuman( pPlayer ) && g_pItemsData[ iItems ][ g_iExtraItemTeam ] == 1 ) || ( !IsHuman( pPlayer ) && g_pItemsData[ iItems ][ g_iExtraItemTeam ] == 2 ) )
  1088. continue;
  1089.  
  1090. if( g_pDataBuySystem[ pPlayer ][ g_iMoneyNum ] < g_pItemsData[ iItems ][ g_iExtraItemCost ] )
  1091. formatex( szBuffer, charsmax( szBuffer ) , "%L \r( \wÁra: \y%d$ \r)", pPlayer, g_pItemsData[ iItems ][ g_szExtraItemKeyName ], g_pItemsData[ iItems ][ g_iExtraItemCost ] );
  1092. else if( get_playersnum( .flag = true ) < g_pItemsData[ iItems ][ g_iExtraItemOnline ] )
  1093. formatex( szBuffer, charsmax( szBuffer ) , "%L \r( %d$ ) \r( \wMinimum Fent lévő \y%d Játékos \r)", pPlayer, g_pItemsData[ iItems ][ g_szExtraItemKeyName ], g_pItemsData[ iItems ][ g_iExtraItemCost ], g_pItemsData[ iItems ][ g_iExtraItemOnline ] );
  1094. else if( g_pDataBuySystem[ pPlayer ][ g_iLevelNum ] < g_pItemsData[ iItems ][ g_iExtraItemLevel ] )
  1095. formatex( szBuffer, charsmax( szBuffer ) , "%L \r( \wSzint: \y%d \d| \wÁra: \y%d$ \r)", pPlayer, g_pItemsData[ iItems ][ g_szExtraItemKeyName ], g_pItemsData[ iItems ][ g_iExtraItemLevel ], g_pItemsData[ iItems ][ g_iExtraItemCost ] );
  1096. else
  1097. formatex( szBuffer, charsmax( szBuffer ) , "\w%L \r( \wÁra: \y%d$ \r)", pPlayer, g_pItemsData[ iItems ][ g_szExtraItemKeyName ], g_pItemsData[ iItems ][ g_iExtraItemCost ] );
  1098.  
  1099. num_to_str( iItems, iAccess, charsmax( iAccess ) );
  1100. menu_additem( iBuySystemSubMenu, szBuffer, iAccess );
  1101. }
  1102.  
  1103. formatex( szBuffer, charsmax( szBuffer ), "\w%L", pPlayer, "ZBS_MAIN_MORE" );
  1104. menu_setprop(iBuySystemSubMenu, MPROP_NEXTNAME, szBuffer );
  1105. formatex(szBuffer, charsmax( szBuffer ), "\w%L", pPlayer, "ZBS_MAIN_BACK" );
  1106. menu_setprop(iBuySystemSubMenu, MPROP_BACKNAME, szBuffer );
  1107. formatex(szBuffer, charsmax( szBuffer ), "\w%L", pPlayer, "ZBS_MAIN_EXIT" );
  1108.  
  1109. menu_setprop( iBuySystemSubMenu, MPROP_EXITNAME, szBuffer );
  1110. menu_display( pPlayer, iBuySystemSubMenu, .page = 0 );
  1111.  
  1112. return PLUGIN_HANDLED;
  1113. }
  1114.  
  1115. public BuySystemSubMenuHandler( pPlayer, iMenu, iItem )
  1116. {
  1117. client_cmd(pPlayer, "spk cso_mod/select")
  1118. if( iItem == MENU_EXIT )
  1119. {
  1120. menu_destroy( iMenu );
  1121. return PLUGIN_HANDLED;
  1122. }
  1123.  
  1124. new iAccess;
  1125. new iCallback;
  1126. new szInfo[ 3 ];
  1127.  
  1128. menu_item_getinfo( iMenu, iItem, iAccess, szInfo, charsmax( szInfo ), _, _, iCallback );
  1129.  
  1130. new iNum = str_to_num( szInfo );
  1131. menu_destroy( iMenu );
  1132.  
  1133. if( g_pDataBuySystem[ pPlayer ][ g_iMoneyNum ] < g_pItemsData[ iNum ][ g_iExtraItemCost ] )
  1134. {
  1135. message_begin( MSG_ONE, g_iMessagesBlinkAcct, _, pPlayer );
  1136. write_byte( 2 );
  1137. message_end( );
  1138.  
  1139. return PLUGIN_HANDLED;
  1140. }
  1141.  
  1142. if( !is_user_alive( pPlayer ) || ( g_pDataBuySystem[ pPlayer ][ g_flBuyTime ] <= get_gametime( ) && g_pItemsData[ iNum ][ g_iExtraItemCtype ] != 6 ) )
  1143. return PLUGIN_HANDLED;
  1144.  
  1145. if( get_playersnum( .flag = true ) < g_pItemsData[ iNum ][ g_iExtraItemOnline ] || g_pDataBuySystem[ pPlayer ][ g_iLevelNum ] < g_pItemsData[ iNum ][ g_iExtraItemLevel ] )
  1146. return PLUGIN_HANDLED;
  1147.  
  1148. if( ( 1<< g_pItemsData[ iNum ][g_iExtraItemCtype]) & BITSUM_SECTION_DROP )
  1149. drop_weapons( pPlayer, g_pItemsData[ iNum ][g_iExtraItemCtype] == 1 ? 2 : 1);
  1150.  
  1151. switch( g_pItemsData[ iNum ][ g_szExtraItemMode ] )
  1152. {
  1153. case 'Z': zp_force_buy_extra_item( pPlayer, g_pItemsData[ iNum ][ g_iExtraItemIndex ], true );
  1154. case 'D':
  1155. {
  1156. client_cmd(pPlayer, "cso_mod/buy.wav")
  1157. give_item( pPlayer, g_pItemsData[ iNum ][ g_szExtraItemName ] );
  1158. }
  1159. }
  1160.  
  1161. g_pDataBuySystem[ pPlayer ][ g_iBonusNum ] -= g_pItemsData[ iNum ][ g_iExtraItemCost ];
  1162. g_pDataBuySystem[ pPlayer ][ g_iLastBought ] += g_pItemsData[ iNum ][ g_iExtraItemCost ];
  1163.  
  1164. if( !task_exists( pPlayer ) )
  1165. set_task( 0.1, "CTask__CalculateMoney", pPlayer );
  1166.  
  1167. return PLUGIN_HANDLED;
  1168.  
  1169. }
  1170.  
  1171. public avoid_duplicated (msgId, msgDest, receiver)
  1172. {
  1173. return PLUGIN_HANDLED
  1174. }
  1175. stock drop_weapons(id, dropwhat)
  1176. {
  1177. static weapons[32], num, i, weaponid
  1178. num = 0
  1179. get_user_weapons(id, weapons, num)
  1180.  
  1181. for (i = 0; i < num; i++)
  1182. {
  1183. weaponid = weapons[i]
  1184.  
  1185. if ((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
  1186. {
  1187. static wname[32]
  1188. get_weaponname(weaponid, wname, sizeof wname - 1)
  1189.  
  1190. engclient_cmd(id, "drop", wname)
  1191. }
  1192. }
  1193. }
  1194. public FW_playerprethink(id)
  1195. {
  1196. if(g_speed[id] == true)
  1197. {
  1198. set_user_maxspeed(id, get_cvar_float("zp_human_speed") + 50)
  1199. }
  1200.  
  1201. if(can_leap(id))
  1202. {
  1203. if(g_leap[id] == true)
  1204. {
  1205. static Float:velocity[3]
  1206. velocity_by_aim(id, 570, velocity)
  1207. velocity[2] = 275.00
  1208. set_pev(id, pev_velocity, velocity)
  1209. g_lastLeaptime[id] = get_gametime()
  1210. }
  1211. }
  1212. }
  1213. can_leap(id)
  1214. {
  1215. static buttons
  1216. buttons = pev(id, pev_button)
  1217. if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 20 || !(buttons & IN_JUMP) || !(buttons & IN_DUCK))
  1218. return false
  1219. if (get_gametime() - g_lastLeaptime[id] < 4.0)
  1220. return false
  1221. return true
  1222. }
  1223. stock fm_get_speed(entity)
  1224. {
  1225. static Float:velocity[3]
  1226. pev(entity, pev_velocity, velocity)
  1227. return floatround(vector_length(velocity))
  1228. }
  1229. public CTask__CalculateMoney( pPlayer )
  1230. {
  1231. UTIL__MessagesMoney( pPlayer, g_pDataBuySystem[ pPlayer ][ g_iMoneyNum ] + g_pDataBuySystem[ pPlayer ][ g_iBonusNum ], .bShow = true );
  1232. }
  1233.  
  1234. public CMessages__Money( Arg1, Arg2, pPlayer )
  1235. {
  1236. if( g_pDataBuySystem[ pPlayer ][ g_flBlockMoney ] >= get_gametime( ) )
  1237. return PLUGIN_HANDLED;
  1238.  
  1239. set_msg_arg_int( 1, get_msg_argtype( 1 ), g_pDataBuySystem[ pPlayer ][ g_iMoneyNum ] );
  1240.  
  1241. return PLUGIN_CONTINUE;
  1242. }
  1243.  
  1244. UTIL__MessagesMoney( pPlayer, iAmount, bool:bShow = true )
  1245. {
  1246. g_pDataBuySystem[ pPlayer ][ g_flBlockMoney ] = _:( get_gametime( ) + 1.0 );
  1247. g_pDataBuySystem[ pPlayer ][ g_iMoneyNum ] = ( min( iAmount, g_bIsAdmin[ pPlayer ] ? MAX_MONEY_ADMIN : MAX_MONEY ) );
  1248. g_pDataBuySystem[ pPlayer ][ g_iBonusNum ] = 0;
  1249.  
  1250. message_begin( MSG_ONE, g_iMessagesMoney, { 0, 0, 0 }, pPlayer );
  1251. write_long( g_pDataBuySystem[ pPlayer ][ g_iMoneyNum ] );
  1252. write_byte( bShow );
  1253. message_end( );
  1254. }
  1255.  
  1256. public CallBackPistols( pPlayer, iMenu, iItem )
  1257. return ( !is_user_alive( pPlayer ) || !IsHuman( pPlayer ) || g_pDataBuySystem[ pPlayer ][ g_flBuyTime ] <= get_gametime( ) ) ? ITEM_DISABLED : ITEM_ENABLED;
  1258.  
  1259. public CallBackRifles( pPlayer, iMenu, iItem )
  1260. return ( !is_user_alive( pPlayer ) || !IsHuman( pPlayer ) || g_pDataBuySystem[ pPlayer ][ g_flBuyTime ] <= get_gametime( ) ) ? ITEM_DISABLED : ITEM_ENABLED;
  1261.  
  1262. public CallBackItems( pPlayer, iMenu, iItem )
  1263. return ( !is_user_alive( pPlayer ) || zp_get_user_nemesis( pPlayer ) || zp_get_user_survivor( pPlayer ) ) ? ITEM_DISABLED : ITEM_ENABLED;
  1264.  
  1265. public CallBackKnifes( pPlayer, iMenu, iItem )
  1266. return ( !is_user_alive( pPlayer ) || !IsHuman( pPlayer ) || g_pDataBuySystem[ pPlayer ][ g_flBuyTime ] <= get_gametime( ) ) ? ITEM_DISABLED : ITEM_ENABLED;
  1267.  
  1268. bool:IsHuman( pPlayer )
  1269. return !!( !zp_get_user_zombie( pPlayer ) && !zp_get_user_nemesis( pPlayer ) && !zp_get_user_survivor( pPlayer ) );
  1270.  
  1271. public _ZBS_SetUserMoney_( pPlayer, iMoneyNum )
  1272. {
  1273. g_pDataBuySystem[ pPlayer ][ g_iMoneyNum ] = iMoneyNum;
  1274. UTIL__MessagesMoney( pPlayer, iMoneyNum , .bShow = true );
  1275. }
  1276. public _ZBS_SetUserLevel_( pPlayer, iLevelNum ){
  1277. g_pDataBuySystem[ pPlayer ][ g_iLevelNum ] = iLevelNum;
  1278.  
  1279. }
  1280. public _ZBS_SetUserExp_( pPlayer, iExplNum )
  1281. g_pDataBuySystem[ pPlayer ][ g_iExpNum ] = iExplNum;
  1282.  
  1283. public _ZBS_GetUserMoney_( pPlayer )
  1284. return g_pDataBuySystem[ pPlayer ][ g_iMoneyNum ];
  1285.  
  1286. public _ZBS_GetUserExp_( pPlayer )
  1287. return g_pDataBuySystem[ pPlayer ][ g_iExpNum ];
  1288.  
  1289. public _ZBS_GetUserLevel_( pPlayer )
  1290. return g_pDataBuySystem[ pPlayer ][ g_iLevelNum ];
  1291.  
  1292. public _ZBS_GetUserNextExp_( pPlayer )
  1293. return g_szStatsLevel[ g_pDataBuySystem[ pPlayer ][ g_iLevelNum ] ];
  1294.  
  1295. public _ZBS_GetUserMaxLevel_( pPlayer )
  1296. return sizeof( g_szStatsLevel );
  1297.  
  1298. public plugin_precache()
  1299.  
  1300. // MENU SELECT SOUND
  1301. precache_sound("cso_mod/select.wav");
  1302.  
  1303.  
  1304. stock zp_colored_print(const id, const input[], any:...)
  1305. {
  1306. new count = 1, players[32]
  1307. static msg[191]
  1308. vformat(msg, sizeof(msg) - 1, input, 3)
  1309.  
  1310. replace_all(msg, 190, "!n", "^x01")
  1311. replace_all(msg, 190, "!g", "^x04")
  1312. replace_all(msg, 190, "!t", "^x03")
  1313.  
  1314. if(id) players[0] = id; else get_players(players, count, "ch")
  1315. for(new i = 0; i < count; i++)
  1316. {
  1317. if(is_user_connected(players[i]))
  1318. {
  1319. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  1320. write_byte(players[i])
  1321. write_string(msg)
  1322. message_end()
  1323. }
  1324. }
  1325. }
  1326. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  1327. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
  1328. */
  1329. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  1330. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
  1331. */
  1332.