Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
Wklejka hk8on6wf16py dodana przez Kawon, 01.09.2013 23:47
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321. 322. 323. 324. 325. 326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340. 341. 342. 343. 344. 345. 346. 347. 348. 349. 350. 351. 352. 353. 354. 355. 356. 357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383. 384. 385. 386. 387. 388. 389. 390. 391. 392. 393. 394. 395. 396. 397. 398. 399. 400. 401. 402. 403. 404. 405. 406. 407. 408. 409. 410. 411. 412. 413. 414. 415. 416. 417. 418. 419. 420. 421. 422. 423. 424. 425. 426. 427. 428.
#include <amxmodx> #include <amxmisc> #include <fun> #include <nvault> #include <hamsandwich> #include <fakemeta> /* --| Let's force the semicolon on every endline */ #pragma semicolon 1 /* --| Some defines :) */ #define PICKUP_SND "items/gunpickup2.wav" #define HEALTH_SOUND "items/smallmedkit1.wav" #define ARMOR_SOUND "items/ammopickup2.wav" #define CLOACK_SOUND "hornet/ag_buzz1.wav" #define LJ_SOUND "fvox/powermove_on.wav" #define SOUND_NVGOFF "items/nvg_off.wav" #define ADMIN_ACCESS_CMD ADMIN_KICK #define HAS_NVGS (1<<0) #define USES_NVGS (1<<8) #define get_user_nvg(%1) (get_pdata_int(%1,m_iNvg) & HAS_NVGS) /* --| Plugin informations */ new const PLUGIN[] = "Deathrun Shop"; new const VERSION[] = "4.0"; new const AUTHOR[] = "tuty"; /* --| Zomg lot of globals :) */ new gDrShopOn; new gHeCost; new gBothGrenadesCost; new gSilentCost; new gHealthCost; new gArmorCost; new gSpeedCost; new gGravityCost; new gInvisCost; new gSpeedCvar; new gGravityCvar; new gAdvertiseCvar; new gHealthPointCvar; new gArmorPointCvar; new gAdvertiseTimeCvar; new gInvisPercent; new gKillerPointsCvar; new gSuiciderPointsCvar; new gSavePlayerPoints; new gNoclipCost; new gVault; new gNoclipTime; new gJetSprite; new gJetPackCost; new gJetTime; new gDeagleCost; new gMsgItemPickup; new gLongJumpTime; new gLongJumpCost; new gGlowCost; new gNvgCost; new gMessageNVG; /* --| Item variables */ new HasHe[ 33 ]; new HasBothGren[ 33 ]; new HasSilent[ 33 ]; new HasHealth[ 33 ]; new HasArmor[ 33 ]; new HasSpeed[ 33 ]; new HasGravity[ 33 ]; new HasInvis[ 33 ]; new HasNoclip[ 33 ]; new HasJet[ 33 ]; new HasDeagle[ 33 ]; new HasLongJump[ 33 ]; new HasGlow[ 33 ]; new HasNVG[ 33 ]; new gName[ 32 char ]; new gSteamID[ 32 ]; new vKey[ 64 ]; new vData[ 64 ]; /* --| Player points, need this to save points, load points, etc */ new gKillerPoints[ 33 ]; /* --| Offsets for nvg */ const m_iNvg = 129; const m_iLinuxDiff = 5; /* --| So, let's get started */ public plugin_init() { /* --| Registering the plugin to show when you type amx_plugins.. */ register_plugin( PLUGIN, VERSION, AUTHOR ); /* --| Registering a little cvar to see wich servers using this plugin */ register_cvar( "drshop_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY ); /* --| Register some usefull events */ register_logevent( "logevent_round_start", 2, "1=Round_Start" ); register_event( "DeathMsg", "Hook_Deathmessage", "a" ); register_event( "CurWeapon", "HookCurWeapon", "be", "1=1" ); /* --| Called when a player is performing a jump */ RegisterHam( Ham_Player_Jump, "player", "bacon_playerJumping" ); /* --| We need this forward to find if player has suicided with kill in console */ /* --| We can't do that on deathmsg because player die in traps by suicide,.. trigger_hurt or world.. etc */ register_forward( FM_ClientKill, "forward_kill" ); /* --| Command for setting points to player/@all */ register_concmd( "deathrun_set_points", "cmdSetPoints", ADMIN_ACCESS_CMD, "<name/@all> <points> - set points to a player" ); /* --| Command for reseting points to palyer/@all */ register_concmd( "deathrun_reset_points", "cmdResetPoints", ADMIN_ACCESS_CMD, "<name/@all> - reset player points" ); /* --| Command for opening the menu */ register_clcmd( "say /drshop", "DeathrunShop" ); register_clcmd( "say_team /drshop", "DeathrunShop" ); /* --| Command to see our points :) */ register_clcmd( "say /mypoints", "ShowPoints" ); register_clcmd( "say_team /mypoints", "ShowPoints" ); /* --| Let's register the cvars, a lot of cvars but huh.. stf :) */ gDrShopOn = register_cvar( "deathrun_shop", "1" ); gHeCost = register_cvar( "deathrun_he_cost", "10" ); gBothGrenadesCost = register_cvar( "deathrun_bothgrenades_cost", "20" ); gSilentCost = register_cvar( "deathrun_silent_cost", "24" ); gHealthCost = register_cvar( "deathrun_health_cost", "30" ); gArmorCost = register_cvar( "deathrun_armor_cost", "15" ); gSpeedCost = register_cvar( "deathrun_speed_cost", "39" ); gGravityCost = register_cvar( "deathrun_gravity_cost", "41" ); gNoclipCost = register_cvar( "deathrun_noclip_cost", "50" ); gJetPackCost = register_cvar( "deathrun_jetpack_cost", "60" ); gInvisCost = register_cvar( "deathrun_invisibility_cost", "69" ); gSpeedCvar = register_cvar( "deathrun_speed_power", "400.0" ); gNoclipTime = register_cvar( "deathrun_noclip_duration", "2" ); gJetTime = register_cvar( "deathrun_jetpack_duration", "10" ); gDeagleCost = register_cvar( "deathrun_deagle_cost", "31" ); gGravityCvar = register_cvar( "deathrun_gravity_power", "0.7" ); gAdvertiseCvar = register_cvar( "deathrun_advertise_message", "1" ); gHealthPointCvar = register_cvar( "deathrun_health_points", "255" ); gArmorPointCvar = register_cvar( "deathrun_armor_points", "400" ); gAdvertiseTimeCvar = register_cvar( "deathrun_advertise_time", "7.0" ); gInvisPercent = register_cvar( "deathrun_invisibility_percentage", "111" ); gKillerPointsCvar = register_cvar( "deathrun_killer_bonuspoints", "5" ); gSuiciderPointsCvar = register_cvar( "deathrun_suicider_loose_points", "3" ); gSavePlayerPoints = register_cvar( "deathrun_save_points", "1" ); gLongJumpTime = register_cvar( "deathrun_longjump_duration", "6" ); gLongJumpCost = register_cvar( "deathrun_longjump_cost", "46" ); gGlowCost = register_cvar( "deathrun_glow_cost", "8" ); gNvgCost = register_cvar( "deathrun_nvg_cost", "33" ); /* --| Let's find/do some stuff here */ gMsgItemPickup = get_user_msgid( "ItemPickup" ); gMessageNVG = get_user_msgid( "NVGToggle" ); /* --| Register the multilingual file */ register_dictionary( "DeathrunShopLang.txt" ); } /* --| Precache stuff */ public plugin_precache() { gJetSprite = precache_model( "sprites/explode1.spr" ); precache_sound( PICKUP_SND ); precache_sound( HEALTH_SOUND ); precache_sound( ARMOR_SOUND ); precache_sound( CLOACK_SOUND ); precache_sound( LJ_SOUND ); } /* --| Plugin cfg, here we do some ugly shit ever -.- */ public plugin_cfg() { new iCfgDir[ 32 ], iFile[ 192 ]; /* --| We need to find the configs directory, and to add the configuration file */ get_configsdir( iCfgDir, charsmax( iCfgDir ) ); formatex( iFile, charsmax( iFile ), "%s/DeathrunShop_Cfg.cfg", iCfgDir ); /* --| If file not exists, let's create one but empty */ if( !file_exists( iFile ) ) { server_print( "[DrShop] %L", LANG_SERVER, "DRSHOP_SVPRINT", iFile ); write_file( iFile, " ", -1 ); } /* --| Else, let's load the cvars from cfg */ else { server_print( "[DrShop] %L", LANG_SERVER, "DRSHOP_SVPRINT_DONE", iFile ); server_cmd( "exec %s", iFile ); } /* --| Set the server maxspeed to a high value, need it for speed item */ server_cmd( "sv_maxspeed 99999999.0" ); } /* --| When client is connecting, let's reset stuff and load client's points */ public client_connect( id ) { HasHe[ id ] = false; HasBothGren[ id ] = false; HasSilent[ id ] = false; HasHealth[ id ] = false; HasArmor[ id] = false; HasSpeed[ id ] = false; HasGravity[ id ] = false; HasInvis[ id ] = false; HasNoclip[ id ] = false; HasJet[ id ] = false; HasDeagle[ id ] = false; HasLongJump[ id ] = false; HasGlow[ id ] = false; HasNVG[ id ] = false; /* --| Load client points */ load_client_points( id ); } /* --| When client has disconnected let's reset stuff and save points */ public client_disconnect( id ) { HasHe[ id ] = false; HasBothGren[ id ] = false; HasSilent[ id ] = false; HasHealth[ id ] = false; HasArmor[ id] = false; HasSpeed[ id ] = false; HasGravity[ id ] = false; HasInvis[ id ] = false; HasNoclip[ id ] = false; HasJet[ id ] = false; HasDeagle[ id ] = false; HasLongJump[ id ] = false; HasGlow[ id ] = false; HasNVG[ id ] = false; /* --| If player is not a bot, let's save the points */ if( get_pcvar_num( gSavePlayerPoints ) != 0 && !is_user_bot( id ) ) { /* --| Save player points is cvar is 1 */ save_client_points( id ); } } /* --| When client has entered on sv, need to show him a hudmessage :) */ public client_putinserver( id ) { if( get_pcvar_num( gAdvertiseCvar ) != 0 ) { /* --| Need to set task, 7 default because need to wait for player choosing a team or something */ set_task( get_pcvar_float( gAdvertiseTimeCvar ), "ShowPlayerInfo", id ); } } /* --| Deathrun shop menu with items ^^ */ public DeathrunShop( id ) { /* --| If cvar is set to 0, player can't open the shop */ if( get_pcvar_num( gDrShopOn ) != 1 ) { client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_DISABLED" ); return PLUGIN_HANDLED; } /* --| If player is dead, cant buy items :) */ if( !is_user_alive( id ) ) { client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_ONLY_ALIVE" ); return PLUGIN_HANDLED; } /* --| Menu stuff */ new szText[ 555 char ]; formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_MENU_TITLE", VERSION, gKillerPoints[ id ] ); new menu = menu_create( szText, "shop_handler" ); /* --| Menu item 1 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_1", get_pcvar_num( gHeCost ) ); menu_additem( menu, szText, "1", 0 ); /* --| Menu item 2 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_2", get_pcvar_num( gBothGrenadesCost ) ); menu_additem( menu, szText, "2", 0 ); /* --| Menu item 3 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_3", get_pcvar_num( gSilentCost ) ); menu_additem( menu, szText, "3", 0 ); /* --| Menu item 4 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_4", get_pcvar_num( gHealthPointCvar ), get_pcvar_num( gHealthCost ) ); menu_additem( menu, szText, "4", 0 ); /* --| Menu item 5 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_5", get_pcvar_num( gArmorPointCvar ), get_pcvar_num( gArmorCost ) ); menu_additem( menu, szText, "5", 0 ); /* --| Menu item 6 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_6", get_pcvar_num( gSpeedCost ) ); menu_additem( menu, szText, "6", 0 ); /* --| Menu item 7 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_7", get_pcvar_num( gGravityCost ) ); menu_additem( menu, szText, "7", 0 ); /* --| Menu item 8 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_8", get_pcvar_num( gInvisPercent ), get_pcvar_num( gInvisCost ) ); menu_additem( menu, szText, "8", 0 ); /* --| Menu item 9 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_9", get_pcvar_num( gNoclipTime ), get_pcvar_num( gNoclipCost ) ); menu_additem( menu, szText, "9", 0 ); /* --| Menu item 10 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_10", get_pcvar_num( gJetTime ), get_pcvar_num( gJetPackCost ) ); menu_additem( menu, szText, "10", 0 ); /* --| Menu item 11 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_11", get_pcvar_num( gDeagleCost ) ); menu_additem( menu, szText, "11", 0 ); /* --| Menu item 12 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_12", get_pcvar_num( gLongJumpTime ), get_pcvar_num( gLongJumpCost ) ); menu_additem( menu, szText, "12", 0 ); /* --| Menu item 13 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_13", get_pcvar_num( gGlowCost ) ); menu_additem( menu, szText, "13", 0 ); /* --| Menu item 14 */ formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_14", get_pcvar_num( gNvgCost ) ); menu_additem( menu, szText, "14", 0 ); menu_setprop( menu, MPROP_EXIT, MEXIT_ALL ); /* --| Show the menu, with current page 0 */ menu_display( id, menu, 0 ); return PLUGIN_CONTINUE; } /* --| Menu commands */ public shop_handler( id, menu, item ) { /* --| If key is 0, let's close the menu */ if( item == MENU_EXIT ) { menu_destroy( menu ); return PLUGIN_HANDLED; } /* --| Getting the menu information */ new data[ 6 ], iName[ 64 ], access, callback; menu_item_getinfo( menu, item, access, data, charsmax( data ), iName, charsmax( iName ), callback ); /* --| Get menu keys */ new key = str_to_num( data ); /* --| Here we find the player points */ new points = gKillerPoints[ id ]; switch( key ) { /* --| Menu item 1 */ case 1: { /* --| If already has item, show a damn print and return */ if( HasHe[ id ] ) { allready_have( id ); return PLUGIN_HANDLED; } /* --| If player does not have enough points, show a print and return */ if( points < get_pcvar_num( gHeCost ) ) { dont_have( id ); return PLUGIN_HANDLED; } /* --| Let's give the item, and do some stuff */ give_item( id, "weapon_hegrenade" ); client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_GRENADE_ITEM" ); HasHe[ id ] = true; gKillerPoints[ id ] -= get_pcvar_num( gHeCost ); emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM ); menu_display( id, menu, 0 ); } /* --| Menu item 2 */ case 2: { /* --| If already has item, show a damn print and return */ if( HasBothGren[ id ] ) { allready_have( id ); return PLUGIN_HANDLED; } /* --| If player does not have enough points, show a print and return */ if( points < get_pcvar_num( gBothGrenadesCost ) ) { dont_have( id ); return PLUGIN_HANDLED; } /* --| Let's give the item, and do some stuff */ give_item( id, "weapon_hegrenade" ); give_item( id, "weapon_flashbang" ); give_item( id, "weapon_flashbang" ); client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_BOTHGREN_ITEM" ); HasBothGren[ id ] = true; gKillerPoints[ id ] -= get_pcvar_num( gBothGrenadesCost ); emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM ); menu_display( id, menu, 0 ); } /* --| Menu item 3 */ case 3:
Dodanych wklejek: 11179
Powered By (Pav32) Pastebin © 2011