Advertisement
Guest User

Untitled

a guest
Jul 13th, 2013
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.29 KB | None | 0 0
  1. /*
  2.  
  3. Plugin generated by AMXX-Studio
  4.  
  5. Plugin Autor: Unknown
  6.  
  7. Plugin Name: Score Generator
  8.  
  9. Plugin Version: 1.0
  10.  
  11.  
  12.  
  13. Opis: Kada igrac napravi kill dobije odredjenu nagradu i X Score Poena.
  14.  
  15. Kad skupi dovoljno score poena moze da kupuje neke stvari u Extra Itemima
  16.  
  17. koristeci komandu /shop
  18.  
  19. */
  20.  
  21.  
  22.  
  23. /* Potrebni Includovi */
  24.  
  25. #include <amxmodx>
  26.  
  27. #include <hamsandwich>
  28.  
  29. #include <colorchat>
  30.  
  31. #include <cstrike>
  32.  
  33. #include <fun>
  34.  
  35.  
  36.  
  37. /* Promenljive */
  38.  
  39.  
  40.  
  41. new brojac[33]
  42.  
  43. new smrti[33]
  44.  
  45. new score_id_poeni[33]
  46.  
  47. new hpnagrada50
  48.  
  49. new hpnagrada20
  50.  
  51. new hpnagrada40
  52.  
  53. new hpnagrada60
  54.  
  55. new hpnagrada80
  56.  
  57. new hpnagrada100
  58.  
  59. new poeni_20
  60.  
  61. new poeni_40
  62.  
  63. new poeni_50
  64.  
  65. new poeni_60
  66.  
  67. new poeni_80
  68.  
  69. new poeni_100
  70.  
  71.  
  72.  
  73. #define PLUGIN "Score Generator"
  74.  
  75. #define VERSION "1.0"
  76.  
  77. #define AUTHOR "MiljanX"
  78.  
  79.  
  80.  
  81.  
  82.  
  83. public plugin_init() {
  84.  
  85. register_plugin(PLUGIN, VERSION, AUTHOR)
  86.  
  87. RegisterHam(Ham_Spawn, "player", "fw_hamspawnpost", 1)
  88.  
  89. register_logevent("PocetakRunde", 2, "1=Round_Start");
  90.  
  91. register_clcmd("say /points","proveripoene")
  92.  
  93. register_clcmd("say_team /points","proveripoene")
  94.  
  95. register_clcmd("say points","proveripoene")
  96.  
  97. register_clcmd("say_team points","proveripoene")
  98.  
  99. register_clcmd("say /shop","extraitems")
  100.  
  101. register_clcmd("say_team /shop","extraitems")
  102.  
  103. register_clcmd("say shop","extraitems")
  104.  
  105. register_clcmd("say_team shop","extraitems")
  106.  
  107. register_clcmd("say /scoreopis","opis")
  108.  
  109. register_clcmd("say_team /scoreopis","opis")
  110.  
  111. register_clcmd("say scoreopis","opis")
  112.  
  113. register_clcmd("say_team scoreopis","opis")
  114.  
  115.  
  116.  
  117. /* Cvarovi koje upisujete u amxx.cfg */
  118.  
  119. hpnagrada50 = register_cvar("score_nagrada_5-0","15",ADMIN_RCON)
  120.  
  121. hpnagrada20 = register_cvar("score_nagrada_2-0","20",ADMIN_RCON)
  122.  
  123. hpnagrada40 = register_cvar("score_nagrada_4-0","30",ADMIN_RCON)
  124.  
  125. hpnagrada60 = register_cvar("score_nagrada_6_0","40",ADMIN_RCON)
  126.  
  127. hpnagrada80 = register_cvar("score_nagrada_8_0","50",ADMIN_RCON)
  128.  
  129. hpnagrada100 = register_cvar("score_nagrada_10_0","60",ADMIN_RCON)
  130.  
  131.  
  132.  
  133. poeni_20 = register_cvar("score_poeni_2-0","1",ADMIN_RCON)
  134.  
  135. poeni_40 = register_cvar("score_poeni_4-0","3",ADMIN_RCON)
  136.  
  137. poeni_50 = register_cvar("score_poeni_5-0","5",ADMIN_RCON)
  138.  
  139. poeni_60 = register_cvar("score_poeni_6-0","7",ADMIN_RCON)
  140.  
  141. poeni_80 = register_cvar("score_poeni_8-0","8",ADMIN_RCON)
  142.  
  143. poeni_100 = register_cvar("score_poeni_10-0","10",ADMIN_RCON)
  144.  
  145.  
  146.  
  147. set_task(90.0, "reklama", 1)
  148.  
  149. }
  150.  
  151.  
  152.  
  153. public napravljenkill(id)
  154.  
  155. {
  156.  
  157. new name[32]
  158.  
  159. get_user_name(id, name, 31)
  160.  
  161. brojac[id] = get_user_frags(id)
  162.  
  163. smrti[id] = get_user_deaths(id)
  164.  
  165.  
  166.  
  167. /* Kada je score igraca 2-0 */
  168.  
  169. if(brojac[id]==2 && smrti[id]==0)
  170.  
  171. {
  172.  
  173. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1For achieved ^3 2 ^1frags you obtained ^3 %dHP ^1and ^3 %d Score Points",get_pcvar_num(hpnagrada20),get_pcvar_num(poeni_20))
  174.  
  175. set_user_health(id,get_user_health(id)+get_pcvar_num(hpnagrada20));
  176.  
  177. score_id_poeni[id] += get_pcvar_num(poeni_20)
  178.  
  179. set_hudmessage(85, 170, 255, 0.02, 0.65, 0, 6.0, 10.0)
  180.  
  181. show_hudmessage(id, "[Score Generator] For every 1 frag you obtain %dHP and %d Score Points",get_pcvar_num(hpnagrada20),get_pcvar_num(poeni_20))
  182.  
  183. }
  184.  
  185.  
  186.  
  187. /* Kada je score igraca 4-0 */
  188.  
  189. else if(brojac[id]==4 && smrti[id]==0)
  190.  
  191. {
  192.  
  193. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1For achieved ^3 4 ^1frags you obtained ^3 %dHP ^1and ^3 %d Score Points",get_pcvar_num(hpnagrada40),get_pcvar_num(poeni_40))
  194.  
  195. set_user_health(id,get_user_health(id)+get_pcvar_num(hpnagrada40));
  196.  
  197. score_id_poeni[id] += get_pcvar_num(poeni_40)
  198.  
  199. set_hudmessage(85, 170, 255, 0.02, 0.65, 0, 6.0, 10.0)
  200.  
  201. show_hudmessage(id, "[Score Generator] For every 4 frags you obtain %dHP and %d Score Points",get_pcvar_num(hpnagrada40),get_pcvar_num(poeni_40))
  202.  
  203. }
  204.  
  205.  
  206.  
  207. /* Kada je score igraca 5-0 */
  208.  
  209. else if(brojac[id]==5 && smrti[id]==0)
  210.  
  211. {
  212.  
  213. set_hudmessage(85, 170, 255, 0.02, 0.65, 0, 6.0, 10.0)
  214.  
  215. show_hudmessage(0, "[Score Generator] %s made the score 5-0 !",name)
  216.  
  217. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1You reached the score ^3 5-0. ^1Obtained ^3 %dHP! ^1and ^3 %d Score Points",get_pcvar_num(hpnagrada50),get_pcvar_num(poeni_50))
  218.  
  219. set_user_health(id,get_user_health(id)+get_pcvar_num(hpnagrada50));
  220.  
  221. score_id_poeni[id] += get_pcvar_num(poeni_50)
  222.  
  223. }
  224.  
  225.  
  226.  
  227. /* Kada je score igraca 6-0 */
  228.  
  229. else if(brojac[id]==6 && smrti[id]==0)
  230.  
  231. {
  232.  
  233. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1For ^3 6 ^1frags you obtained ^3 %dHP ^1and ^3 %d Score Points",get_pcvar_num(hpnagrada60),get_pcvar_num(poeni_60))
  234.  
  235. set_user_health(id,get_user_health(id)+get_pcvar_num(hpnagrada60));
  236.  
  237. score_id_poeni[id] += get_pcvar_num(poeni_60)
  238.  
  239. set_hudmessage(85, 170, 255, 0.02, 0.65, 0, 6.0, 10.0)
  240.  
  241. show_hudmessage(id, "[Score Generator] For reached 6 frags you obtained %dHP and %d Score Points",get_pcvar_num(hpnagrada60),get_pcvar_num(poeni_60))
  242.  
  243. }
  244.  
  245.  
  246.  
  247. /* Kada je score igraca 8-0 */
  248.  
  249. else if(brojac[id]==8 && smrti[id]==0)
  250.  
  251. {
  252.  
  253. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1You reached ^3 8 ^1frags and obtained ^3 %dHP ^1and ^3 %d Score Points",get_pcvar_num(hpnagrada80),get_pcvar_num(poeni_80))
  254.  
  255. set_user_health(id,get_user_health(id)+get_pcvar_num(hpnagrada80));
  256.  
  257. score_id_poeni[id] += get_pcvar_num(poeni_80)
  258.  
  259. set_hudmessage(85, 170, 255, 0.02, 0.65, 0, 6.0, 10.0)
  260.  
  261. show_hudmessage(id, "[Score Generator] For reached 8 frags you obtained %dHP i %d Score Points",get_pcvar_num(hpnagrada80),get_pcvar_num(poeni_80))
  262.  
  263. }
  264.  
  265.  
  266.  
  267. /* Kada je score igraca 10-0 */
  268.  
  269. else if(brojac[id]==10 && smrti[id]==0)
  270.  
  271. {
  272.  
  273. set_hudmessage(85, 170, 255, 0.02, 0.65, 0, 6.0, 10.0)
  274.  
  275. show_hudmessage(0, "[Score Generator] %s made the score 10-0 !",name)
  276.  
  277. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1You reached ^3 10 ^1frags and obtained ^3 %dHP ^1and ^3 %d Score Points",get_pcvar_num(hpnagrada100),get_pcvar_num(poeni_100))
  278.  
  279. set_user_health(id,get_user_health(id)+get_pcvar_num(hpnagrada100));
  280.  
  281. score_id_poeni[id] += get_pcvar_num(poeni_100)
  282.  
  283. }
  284.  
  285.  
  286.  
  287. }
  288.  
  289. public fw_hamspawnpost(id)
  290.  
  291. {
  292.  
  293. napravljenkill(id);
  294.  
  295. }
  296.  
  297.  
  298.  
  299. /* Extra Itemi, komanda say /shop */
  300.  
  301. public extraitems(id)
  302.  
  303. {
  304.  
  305. new menu= menu_create("Extra Items","menu_handler")
  306.  
  307. menu_additem(menu,"\r200HP \y[10 Points]")
  308.  
  309. menu_additem(menu,"\rGravity \y[8 Points]")
  310.  
  311. menu_additem(menu,"\rNoclip 20sec. \y[30 Points]")
  312.  
  313. menu_display(id,menu)
  314.  
  315. }
  316.  
  317. public menu_handler ( id , menu , item )
  318.  
  319. {
  320.  
  321. if( item == MENU_EXIT )
  322.  
  323. {
  324.  
  325. menu_destroy ( menu )
  326.  
  327. return PLUGIN_HANDLED;
  328.  
  329. }
  330.  
  331. switch(item)
  332.  
  333. {
  334.  
  335. case 0:
  336.  
  337. {
  338.  
  339. if(score_id_poeni[id] < 10)
  340.  
  341. {
  342.  
  343. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1You do not have enough Points Score")
  344.  
  345. }
  346.  
  347. else
  348.  
  349. {
  350.  
  351. score_id_poeni[id] -= 10;
  352.  
  353. new hp = get_user_health(id)
  354.  
  355. set_user_health(id,hp+200)
  356.  
  357. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1You bought ^3 200HP ^1for ^3 10 Score Points")
  358.  
  359. }
  360.  
  361. }
  362.  
  363.  
  364.  
  365. case 1:
  366.  
  367. {
  368.  
  369. if(score_id_poeni[id] < 8)
  370.  
  371. {
  372.  
  373. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1You do not have enough Points Score")
  374.  
  375. }
  376.  
  377. else
  378.  
  379. {
  380.  
  381. score_id_poeni[id] -= 8;
  382.  
  383. set_user_gravity(id,0.4)
  384.  
  385. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1You bought ^3 Gravity ^1for ^3 8 Score Points")
  386.  
  387. }
  388.  
  389. }
  390.  
  391.  
  392.  
  393. case 2:
  394.  
  395. {
  396.  
  397. if(score_id_poeni[id] < 30)
  398.  
  399. {
  400.  
  401. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1You do not have enough Points Score")
  402.  
  403. }
  404.  
  405. else
  406.  
  407. {
  408.  
  409. score_id_poeni[id] -= 30;
  410.  
  411. set_user_noclip(id,1)
  412.  
  413. set_task(20.0, "noclip_off", id)
  414.  
  415. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1You bought ^3 Noclip 20 seconds ^1for ^3 30 Score Points")
  416.  
  417. }
  418.  
  419. }
  420.  
  421. }
  422.  
  423. return PLUGIN_CONTINUE;
  424.  
  425. }
  426.  
  427.  
  428.  
  429. public proveripoene(id)
  430.  
  431. {
  432.  
  433. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1You have right now ^3 %d ^1Score Points",score_id_poeni[id])
  434.  
  435. }
  436.  
  437.  
  438.  
  439. public client_putinserver(id)
  440.  
  441. {
  442.  
  443. if(is_user_connected(id))
  444.  
  445. {
  446.  
  447. if(is_user_alive(id))
  448.  
  449. {
  450.  
  451. set_hudmessage(85, 170, 255, 0.02, 0.65, 0, 6.0, 10.0)
  452.  
  453. show_hudmessage(id, "[Score Generator] The points are reseted every map changing or reconnect")
  454.  
  455. }
  456.  
  457. }
  458.  
  459. }
  460.  
  461.  
  462.  
  463. public PocetakRunde(id)
  464.  
  465. {
  466.  
  467. set_user_noclip(id,0)
  468.  
  469. set_user_gravity(id,1.0)
  470.  
  471. }
  472.  
  473.  
  474.  
  475. public noclip_off(id)
  476.  
  477. {
  478.  
  479. set_user_noclip(id,0)
  480.  
  481. }
  482.  
  483.  
  484.  
  485. public reklama(id)
  486.  
  487. {
  488.  
  489. if(is_user_connected(id))
  490.  
  491. {
  492.  
  493. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1This server runing ^3%s v%s by %s^1more informations about plugin ^3say /scoreopis", PLUGIN, VERSION, AUTHOR)
  494.  
  495. set_task(90.0, "reklama", 1)
  496.  
  497. }
  498.  
  499. }
  500.  
  501.  
  502.  
  503. public opis(id)
  504.  
  505. {
  506.  
  507. if(is_user_connected(id))
  508.  
  509. {
  510.  
  511. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1Score generator rewards your frags with ^3Score Points")
  512.  
  513. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1When you collect enough ^3Score Points, ^1you can buy ^3Extra Items")
  514.  
  515. ColorChat(id, TEAM_COLOR,"^4[Score Generator] ^1To buy ^3Extra Items ^1say /shop")
  516.  
  517. }
  518.  
  519. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement