iXdoctor

BaseBuilder Zombie Classes

Jul 13th, 2014
640
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.71 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include < amxmodx >
  4. #include < amxmisc >
  5. #include < cstrike >
  6. #include < hamsandwich >
  7. #include < fakemeta_util >
  8. #include < engine >
  9. #include < basebuilder >
  10.  
  11. enum _: MaxZombies
  12. {
  13. BB_Balanced,
  14. BB_Jumper,
  15. BB_Faster,
  16. BB_Rocker,
  17. BB_Shock,
  18. BB_KNOCK
  19. }
  20.  
  21. enum _: mZombies
  22. {
  23. mZombie[ 33 ],
  24. mPlace[ 33 ],
  25. mHands[ 33 ],
  26. mSkill[ 33 ],
  27. mSpeedStatus[ 33 ],
  28. mGravityStatus[ 33 ],
  29. mHealth,
  30. Float: mGravity,
  31. Float: mSpeed,
  32. mLevel,
  33. mAccess
  34. }
  35.  
  36. enum _: mLevels
  37. {
  38. iZom,
  39. iHum
  40. }
  41.  
  42. // Zombie Name || Zombie Model || Zombie Hands || Zombie Stats || Zombie Speed Stats || Zombie Gravity Stats || Zombie Health || Zombie Gravity || Zombie Speed || Zombie Level || Zombie Access //
  43.  
  44. new const szZombies [ MaxZombies ] [ mZombies ] =
  45. {
  46. { "Balanced Zombie", "bb_classic", "models/v_bloodyhands.mdl", "Stats +-", "Normal", "Normal", 3750, 0.9, 250.0, 0, ADMIN_ALL },
  47. { "Jumper Zombie", "jumper", "models/v_jumper.mdl", "Jump +", "Regular", "High", 3250, 0.5, 260.0, 0, ADMIN_ALL },
  48. { "Faster Zombie", "bb_fast", "models/v_knife_speed_zombi.mdl", "Speed +", "V Fast", "Midium", 2950, 0.9, 300.0, 0, ADMIN_ALL },
  49. { "Rock Zombie", "bb_tanker", "models/v_bloodyhands.mdl", "Health ++ Speed-", "Slow", "Normal", 5800, 1.0, 220.0, 5, ADMIN_ALL },
  50. { "Shocker Zombie", "bb_fast", "models/v_bloodyhands.mdl", "Health + Speed +", "Fast", "Normal", 4000, 1.0, 290.0, 8, ADMIN_ALL },
  51. { "Knock Zombie", "bb_fast", "models/v_knife_speed_zombi.mdl", "Knockback +", "Normal", "Normal", 4100, 1.0, 250.0, 15 , ADMIN_ALL }
  52. }
  53.  
  54. // Kill Zombies Times || Kill Humans Times //
  55.  
  56. new const szLevel [ ] [ mLevels ] =
  57. {
  58. { 150, 50 }, // Level Up to level 1
  59. { 250, 100 }, // Level Up to level 2
  60. { 400, 185 } // Level Up to level 3
  61. }
  62.  
  63. new const szBlockMessage [ ] = { "Server cannot recive information from the plugin ^"BaseBuilder Zombie Classes^" because its not your plugin !" }
  64.  
  65. new const szMyIp [ ] = { "1.1.1.1:99999" }
  66.  
  67. new iLevel[ 33 ], iZombie[ 33 ], pZombie[ 33 ], HumanKills[ 33 ], ZombieKills[ 33 ], RoundKills[ 33 ], iCash[ 33 ], iGainCash[ 33 ], iTotalKills[ 33 ];
  68.  
  69. public plugin_init()
  70. {
  71. register_plugin( "Zombie Classess", "1.0", "Xdoctor" );
  72.  
  73. register_clcmd( "say", "CmdHandleSay" );
  74.  
  75. register_clcmd( "say_team", "CmdHandleSay" );
  76.  
  77. register_clcmd( "chooseteam", "CmdClasses" );
  78.  
  79. RegisterHam( Ham_Item_Deploy, "weapon_knife", "fw_SetUserKnife", 1 );
  80.  
  81. RegisterHam( Ham_TakeDamage, "player", "FwdTakeDamage_Pre", 0 );
  82.  
  83. RegisterHam( Ham_Spawn, "player", "fw_ClientSpawn", 1 );
  84.  
  85. register_event( "DeathMsg", "evDeathMsg", "a" );
  86.  
  87. register_logevent( "EventRoundEnd", 2, "1=Round_End" );
  88.  
  89. new szIp[ 21 ];
  90.  
  91. get_user_ip( 0, szIp, charsmax( szIp ) );
  92.  
  93. if( !equali( szIp, szMyIp ) )
  94. set_fail_state( szBlockMessage );
  95.  
  96. }
  97.  
  98. public client_disconnect( client )
  99. {
  100. RoundKills[ client ] = 0;
  101.  
  102. iGainCash[ client ] = 0;
  103. }
  104.  
  105. public client_putinserver( client )
  106. {
  107. RoundKills[ client ] = 0;
  108.  
  109. iGainCash[ client ] = 0;
  110. }
  111.  
  112.  
  113. public plugin_precache()
  114. {
  115. for( new i = 0; i < sizeof( szZombies ); i++ )
  116. precache_model( szZombies[ i ][ mHands ] );
  117.  
  118. for( new i = 0; i < sizeof( szZombies ); i++ )
  119. {
  120. new szModel[ 555 ];
  121.  
  122. formatex( szModel, charsmax( szModel ), "models/player/%s/%s.mdl", szZombies[ i ][ mPlace ] );
  123.  
  124. precache_model( szModel[ i ] );
  125. }
  126. }
  127.  
  128. public fw_SetUserKnife( iEnt )
  129. {
  130. new iClient = get_pdata_cbase( iEnt, 41, 4 );
  131.  
  132. if( cs_get_user_team( iClient ) == CS_TEAM_T )
  133. {
  134. set_pev( iClient, pev_viewmodel2, szZombies[ iZombie[ iClient ] ][ mHands ] );
  135. }
  136. }
  137.  
  138. public EventRoundEnd( client )
  139. {
  140. iCash[ client ] += iGainCash[ client ];
  141.  
  142. ColorChat( client, "You have gained ^4%i$^1 dollars this ^4round^3.^1 for making totaly of ^4%i kills.", iGainCash[ client ], RoundKills[ client ] );
  143.  
  144. iGainCash[ client ] = 0;
  145.  
  146. RoundKills[ client ] = 0;
  147.  
  148. return 1;
  149. }
  150.  
  151. public evDeathMsg( client )
  152. {
  153. new iAttacker = read_data( 1 );
  154.  
  155. new iVictim = read_data( 2 );
  156.  
  157. if( !is_user_connected( iAttacker ) || !is_user_connected( iVictim ) || !is_user_alive( iAttacker ) )
  158. return 1;
  159.  
  160. if( is_user_bot( iAttacker ) || is_user_bot( iVictim ) || is_user_hltv( iAttacker ) || is_user_hltv( iVictim ) )
  161. return 1;
  162.  
  163. if( cs_get_user_team( iAttacker ) == CS_TEAM_T && cs_get_user_team( iVictim ) == CS_TEAM_CT )\
  164. {
  165. iGainCash[ client ] += 75; // Gain 75 Dollars for Killing a Zombie //
  166.  
  167. return HumanKills[ iAttacker ] += 1;
  168. }
  169.  
  170. else if( cs_get_user_team( iAttacker ) == CS_TEAM_CT && cs_get_user_team( iVictim ) == CS_TEAM_T )
  171. {
  172. iGainCash[ client ] += 50 // Gain 50 Dollars for Killing a Zombie //
  173.  
  174. return ZombieKills[ iAttacker ] +1;
  175.  
  176. }
  177.  
  178. CheckImprove( iAttacker );
  179.  
  180. RoundKills[ iAttacker ] += 1;
  181.  
  182. return 1;
  183. }
  184.  
  185.  
  186.  
  187. public fw_ClientSpawn( client )
  188. {
  189. if( cs_get_user_team( client ) == CS_TEAM_T )
  190. {
  191. fm_strip_user_weapons( client );
  192.  
  193. fm_give_item( client, "weapon_knife" );
  194.  
  195. fm_set_user_maxspeed( client, szZombies[ iZombie[ client ] ][ mSpeed ] );
  196.  
  197. fm_set_user_health( client, szZombies[ iZombie[ client ] ][ mHealth ] );
  198.  
  199. fm_set_user_gravity( client, szZombies[ iZombie[ client ] ][ mGravity ] );
  200. }
  201. }
  202.  
  203. public CmdHandleSay( client )
  204. {
  205. new szMsg[ 192 ], szArgs[ 3 ][ 66 ];
  206.  
  207. read_argv( 1, szMsg, charsmax( szMsg ) );
  208.  
  209. parse( szMsg, szArgs[ 0 ], charsmax( szArgs[] ), szArgs[ 1 ], charsmax( szArgs[] ), szArgs[ 2 ], charsmax( szArgs[] ) );
  210.  
  211. if( equali( szArgs[ 0 ], "/class" ) )
  212. return CmdClasses( client );
  213.  
  214. if( equali( szArgs[ 0 ], "/status" ) )
  215. {
  216. new iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  217.  
  218. if( iPlayer == client )
  219. {
  220. ColorChat( client, "Your Level Is:^4 %i/%i ^1 with ^3( ^4%i/%i human kills^3 )^1 and^3( ^4%i/%i zombie kills^3 )", iLevel[ client ], sizeof( szLevel ), HumanKills[ client ], szLevel[ iLevel[ client ] ][ iHum ], ZombieKills[ client ], szLevel[ iLevel[ client ] ][ iZom ] );
  221.  
  222. ColorChat( client, "Total Kills: ^4%i^1 Dollars Amount:^3 %i$^1.", iTotalKills[ client ], iCash[ client ] );
  223. }
  224.  
  225. if( !iPlayer )
  226. return ColorChat( client, "Target wasnt found" );
  227.  
  228. ColorChat( client, "%s Level Is:^4 %i/%i ^1 with ^3( ^4%i/%i human kills^3 )^1 and^3( ^4%i/%i zombie kills^3 )", GetUserName( iPlayer ), iLevel[ iPlayer ], sizeof( szLevel ), HumanKills[ iPlayer ], szLevel[ iLevel[ iPlayer ] ][ iHum ], ZombieKills[ client ], szLevel[ iLevel[ iPlayer ] ][ iZom ] );
  229.  
  230. ColorChat( client, "%s Total Kills: ^4%i^1 Dollars Amount:^3 %i$^1.", GetUserName( iPlayer ), iTotalKills[ iPlayer ], iCash[ iPlayer ] );
  231. }
  232.  
  233.  
  234. if( contain( szArgs[ 0 ], "/" ) || contain( szArgs[ 0 ], "." ) )
  235. return 1;
  236.  
  237. return 0;
  238. }
  239.  
  240.  
  241.  
  242.  
  243. public CmdClasses( client )
  244. {
  245. if( cs_get_user_team( client ) != CS_TEAM_T )
  246. return ColorChat( client, "^4%s^1 You are not a^4 Zombie.", GetUserName( client ) );
  247.  
  248. new szText[ 128 ];
  249.  
  250. formatex( szText, charsmax( szText ), "\d[ \yBaseBuilder\d ]\r%s\w Zombie Classes Menu\d( \wLevel %i\d )\w:", iLevel[ client ] );
  251.  
  252. new Menu = menu_create( szText, "CmdHandler" );
  253.  
  254. for( new i = 0; i < sizeof( szZombies ); i++ )
  255. {
  256. formatex( szText, charsmax( szText ), "\r%s\d( \yLevel %i\d ) %s %s", szZombies[ i ][ mZombie ], szZombies[ i ][ mLevel ], szZombies[ i ][ mAccess ] == ADMIN_BAN ? "\d[ \yOnly Admins\d ]" : "", i == iZombie[ client ] ? "\w- \d( \wCurrect Zombie\d )" : "" );
  257.  
  258. menu_additem( Menu, szText );
  259. }
  260.  
  261. menu_display( client, Menu, 0 );
  262.  
  263. return 1;
  264. }
  265.  
  266. public CmdHandler( client, Menu, Item )
  267. {
  268. if( Item == MENU_EXIT )
  269. menu_destroy( Menu );
  270.  
  271. pZombie[ client ] = Item;
  272.  
  273. new szText[ 128 ];
  274.  
  275. new cb = menu_makecallback( "mDisabled" );
  276.  
  277. new szcb2 = menu_makecallback( "mCallBack" );
  278.  
  279. formatex( szText, charsmax( szText ), "\d[ \yBaseBuilder\d ]\r %s\w Information\d:", szZombies[ pZombie[ client ] ][ mZombie ] );
  280.  
  281. new Menu = menu_create( szText, "CmdHandler2" );
  282.  
  283. formatex( szText, charsmax( szText ), "\rZombie Health: \d[ \y%i\d ]", szZombies[ pZombie[ client ] ][ mHealth ] );
  284.  
  285. menu_additem( Menu, szText,. callback=cb );
  286.  
  287. formatex( szText, charsmax( szText ), "\rZombie Speed: \d[ \y%s Speed\d ]", szZombies[ pZombie[ client ] ][ mSpeedStatus ] );
  288.  
  289. menu_additem( Menu, szText,. callback=cb );
  290.  
  291. formatex( szText, charsmax( szText ), "\rZombie Jump: \d[ \y%s Jump\d ]", szZombies[ pZombie[ client ] ][ mGravityStatus ] );
  292.  
  293. menu_additem( Menu, szText,. callback=cb );
  294.  
  295. formatex( szText, charsmax( szText ), "\rZombie Skills: \d[ \y%s\d ]", szZombies[ pZombie[ client ] ][ mSkill ] );
  296.  
  297. menu_additem( Menu, szText,. callback=cb );
  298.  
  299. formatex( szText, charsmax( szText ), "\rZombie Level Requird: \d[ \yLevel %i\d ]^n^n^n", szZombies[ pZombie[ client ] ][ mLevel ] );
  300.  
  301. menu_additem( Menu, szText,. callback=cb );
  302.  
  303. if( !is_user_admin( client ) )
  304. {
  305. formatex( szText, charsmax( szText ), "\rUse This Zombie\d[ \w \y%s\d ]", iLevel[ client ] < szZombies[ pZombie[ client ] ][ mLevel ] ? "Zombie Locked" : "Zombie Unlocked" );
  306.  
  307. menu_additem( Menu, szText,. callback=szcb2 );
  308. }
  309.  
  310. else if( is_user_admin( client ) )
  311. {
  312. formatex( szText, charsmax( szText ), "\rUse This Zombie\d[ \w Admin Unlocked\d ]" );
  313.  
  314. menu_additem( Menu, szText );
  315. }
  316.  
  317. menu_display( client, Menu, 0 );
  318.  
  319. return 1;
  320. }
  321.  
  322. public CmdHandler2( client, Menu, Item )
  323. {
  324. if( Item == MENU_EXIT )
  325. menu_destroy( Menu );
  326.  
  327. iZombie[ client ] = pZombie[ client ];
  328.  
  329. if( bb_is_user_zombie( client ) )
  330. {
  331. if( !bb_is_prep_phase() )
  332. {
  333. ExecuteHamB( Ham_CS_RoundRespawn, client );
  334.  
  335. return ColorChat( client, "^1 You have choosen^4 %s^1 has your new class.", szZombies[ iZombie[ client ] ][ mZombie ] );
  336. }
  337.  
  338. else if ( bb_is_prep_phase() && bb_is_build_phase() )
  339. return ColorChat( client, "^4%s^1 Your new class^4 %s^1 will be changed next respawn.", GetUserName( client ), szZombies[ iZombie[ client ] ][ mZombie ] );
  340. }
  341.  
  342. return CmdClasses( client );
  343. }
  344.  
  345. public FwdTakeDamage_Pre( iVictim, Inf, iAttacker, Float:fDamage, iDmgBits )
  346. {
  347. if( iZombie[ iAttacker ] == BB_KNOCK )
  348. {
  349. if( cs_get_user_team( iAttacker ) == CS_TEAM_T && cs_get_user_team( iVictim ) == CS_TEAM_CT )
  350. {
  351. // Credits to Rejack //
  352.  
  353. new Float:fRandom[ 3 ];
  354.  
  355. for ( new i; i < 3; i++ )
  356. fRandom[ i ] = random_float( 100.0, 150.0 );
  357.  
  358. entity_set_vector( iVictim, EV_VEC_punchangle, fRandom );
  359.  
  360. ShakeScreen( iVictim );
  361. }
  362. }
  363.  
  364. if( iZombie[ iAttacker ] == BB_Shock )
  365. {
  366. if( cs_get_user_team( iAttacker ) == CS_TEAM_T && cs_get_user_team( iVictim ) == CS_TEAM_CT )
  367. {
  368. set_user_freeze( iVictim, 1 );
  369.  
  370. fm_set_user_rendering( iVictim, kRenderFxGlowShell, 255, 0, 85, kRenderTransAlpha, 0 );
  371.  
  372. set_task( 4.0, "CmdRemoveFreeze", iVictim, _,_, "b" );
  373. }
  374. }
  375.  
  376. }
  377.  
  378. public CheckImprove( client )
  379. {
  380. if( iLevel[ client ] >= sizeof( szLevel ) )
  381. return 1;
  382.  
  383. if( HumanKills[ client ] >= szLevel[ iLevel[ client ] ][ iHum ] && ZombieKills[ client ] >= szLevel[ iLevel[ client ] ][ iZom ] )
  384. {
  385. iLevel[ client ] += 1;
  386.  
  387. HumanKills[ client ] = 0;
  388.  
  389. ZombieKills[ client ] = 0;
  390.  
  391. iCash[ client ] += 1500;
  392.  
  393. ColorChat( 0, "^4%s^1 has just reached^1 level^3 %i.", GetUserName( client ), iLevel[ client ] );
  394.  
  395. ColorChat( client, "You have gained^4 1500 Dollars^1 for leveling up^3 !" );
  396. }
  397.  
  398. return 1;
  399. }
  400.  
  401. public CmdRemoveFreeze( client )
  402. {
  403. set_user_freeze( client, 0 );
  404.  
  405. fm_set_user_rendering( client, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 0 );
  406. }
  407.  
  408.  
  409. stock ShakeScreen( index )
  410. {
  411. message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "ScreenShake" ), _, index );
  412. write_short( 10 << 12 );
  413. write_short( 5 << 12 );
  414. write_short( 10 << 12 );
  415. message_end( );
  416. }
  417.  
  418. stock GetUserName( const Index )
  419. {
  420. new szName[ 32 ];
  421.  
  422. get_user_name( Index, szName, charsmax( szName ) );
  423.  
  424. return szName;
  425. }
  426.  
  427. stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...)
  428. {
  429. new msg[191], players[32], count = 1
  430. static len
  431. len = formatex(msg, charsmax(msg), "^1[ ^4AMXX ^1] " )
  432. vformat(msg[len], charsmax(msg) - len, string, 3)
  433. if(id) players[0] = id
  434. else get_players(players,count,"ch")
  435.  
  436. for (new i = 0; i < count; i++)
  437. {
  438. if(is_user_connected(players[i]))
  439. {
  440. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i])
  441. write_byte(players[i])
  442. write_string(msg)
  443. message_end()
  444. }
  445. }
  446.  
  447. return 1;
  448. }
  449.  
  450.  
  451. stock set_user_freeze( client, freeze=1 )
  452. {
  453. new iFlags;
  454.  
  455. iFlags = pev( client, pev_flags );
  456.  
  457. set_pev( client, pev_flags, freeze ? iFlags | FL_FROZEN : iFlags & ~FL_FROZEN );
  458. }
  459.  
  460. public mDisabled( client, Menu, Item )
  461. return ITEM_DISABLED;
  462.  
  463. public mCallBack( client, Menu, Item )
  464. return( iLevel[ client ] >= szZombies[ pZombie[ client ] ][ mLevel ] ? ITEM_ENABLED : ITEM_DISABLED );
Advertisement
Add Comment
Please, Sign In to add comment