HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <zombie_escape>
  2.  
  3. new cvar_allow_donation
  4.  
  5. public plugin_init()
  6. {
  7. register_plugin("[ZE] EC Donation", "1.0", "Raheem")
  8.  
  9. // Cvars
  10. cvar_allow_donation = register_cvar("ze_allow_donation", "1")
  11.  
  12. // Commands
  13. register_clcmd("say", "Cmd_Say")
  14. register_clcmd("say_team", "Cmd_Say")
  15.  
  16. // Tasks
  17. set_task(120.0, "Donate_Notice", _, _, _, "b")
  18. }
  19.  
  20. public Donate_Notice()
  21. {
  22. if(get_pcvar_num(cvar_allow_donation))
  23. {
  24. ze_colored_print(0, "!tMenekülő Pontok küldéséhez írd be!y, !tchatbe !g/donate")
  25. }
  26. }
  27.  
  28. public Cmd_Say(id)
  29. {
  30. new szSaid[64]
  31.  
  32. read_args(szSaid, charsmax(szSaid))
  33. remove_quotes(szSaid)
  34.  
  35. new szTemp1[16]
  36. new szTemp2[32]
  37.  
  38. strbreak(szSaid, szTemp1, charsmax(szTemp1), szTemp2, charsmax(szTemp2))
  39.  
  40. if (get_pcvar_num(cvar_allow_donation) && equal(szTemp1,"/donate", 7))
  41. {
  42. Donate(id, szTemp2)
  43. }
  44. }
  45.  
  46. public Donate(id, arg[])
  47. {
  48. new szReciverName[32], szAmount[10]
  49. strbreak(arg, szReciverName, charsmax(szReciverName), szAmount, charsmax(szAmount))
  50.  
  51. if (!szReciverName[0] || !szAmount[0])
  52. {
  53. ze_colored_print(id, "!tHasznált!y: !gírd be /donate <név> <összeg>")
  54. return
  55. }
  56.  
  57. new iCurrentEC = ze_get_escape_coins(id)
  58. new iECDonation
  59.  
  60. if (equal(szAmount, "all"))
  61. {
  62. iECDonation = iCurrentEC
  63. }
  64. else
  65. {
  66. iECDonation = str_to_num(szAmount)
  67. }
  68.  
  69. if (iECDonation <= 0)
  70. {
  71. ze_colored_print(id, "!tHibás Összeg!y!")
  72. return
  73. }
  74.  
  75. iCurrentEC -= iECDonation
  76.  
  77. if (iCurrentEC < 0)
  78. {
  79. iECDonation += iCurrentEC
  80. iCurrentEC = 0
  81.  
  82. }
  83.  
  84. new iReciver = get_user_index(szReciverName)
  85.  
  86. if (!iReciver || iReciver == id)
  87. {
  88. ze_colored_print(id, "!tJátékos !g%s !tnem található a szerveren!y!", szReciverName)
  89. return
  90. }
  91.  
  92. ze_set_escape_coins(iReciver, ze_get_escape_coins(iReciver) + iECDonation)
  93. ze_set_escape_coins(id, iCurrentEC)
  94.  
  95. new szDonatorName[32]
  96. get_user_name(id, szDonatorName, 31)
  97.  
  98. set_hudmessage(255, 0, 0, -1.0, 0.3, 0, 6.0, 6.0)
  99. show_hudmessage(0, "%s küldött %d Menekülő Pontot %s-nak/nek!", szDonatorName, iECDonation, szReciverName)
  100. }