MegastoRM

Untitled

Nov 22nd, 2012
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. //U Txt fajl upises ovako
  2.  
  3. /*
  4.  
  5. #if defined _heal_user_included
  6. #endinput
  7. #endif
  8. #define _heal_user_included
  9.  
  10. native uzmi_hp(index)
  11. native setuj_hp(index, kolicina)
  12.  
  13. */
  14.  
  15. //I sacuvas kao heal_user.inc
  16.  
  17. #include <amxmodx>
  18. #include <fakemeta>
  19.  
  20. #define is_user_valid(%1) (1 <= %1 <= g_maxplayers)
  21. new g_maxplayers
  22.  
  23. public plugin_init() {
  24. register_plugin("","","")
  25.  
  26.  
  27. register_library("heal_user")
  28.  
  29. g_maxplayers = get_maxplayers()
  30. // Add your code here...
  31. }
  32.  
  33. public plugin_natives()
  34. {
  35. register_native("uzmi_hp","native_uzmi_hp_igracu", 1)
  36. register_native("setuj_hp","native_setuj_hp_igracu", 1)
  37. }
  38.  
  39. public native_uzmi_hp(id) //Ovo se poziva kada se ucitavaju korisniku HP
  40. {
  41. if (!is_user_valid(id)) // Ovo je da se proveri jel vazeci igrac
  42. {
  43. log_error(AMX_ERR_NATIVE, "Error (%d)", id)
  44. return -1;
  45. }
  46.  
  47. return pev(id, pev_health);
  48. }
  49.  
  50. public native_setuj_hp(id, Float:kolicina) // funkcija koja ce da obavlja odredjen posao(setovanje HP-a) kada se pozove
  51. {
  52. if (!is_user_valid(id))
  53. {
  54. log_error(AMX_ERR_NATIVE, "Error (%d)", id)
  55. return false;
  56. }
  57.  
  58. set_pev(id, pev_health, kolicina);
  59. return true;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment