Advertisement
Guest User

BB Human Class example

a guest
Dec 3rd, 2015
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.12 KB | None | 0 0
  1. /*
  2.     This is just an example of how new human class can be registered using existing BB Human classes Api
  3. */
  4.  
  5. #include <amxmodx>
  6. #include <fun>
  7. #include <cstrike>
  8.  
  9. native bb_is_user_zombie(client);
  10. native bb_register_hclass(const cName[], const cDesc[], const cMenuName[], iClassFlag);
  11. forward bb_human_spawned(client, class);
  12.  
  13. new current_class[33], MONEYMAKER
  14.  
  15. public plugin_init() {
  16.     register_plugin("BB Human Class Sample", "1.0", "Mega")
  17.     register_event("DeathMsg", "eDeath", "ade");
  18.  
  19.     MONEYMAKER = bb_register_hclass("Moneymaker", "\r[\dGets bonus money when kills an enemy\r]", "\rMoneymaker", ADMIN_ALL)
  20. }
  21.  
  22. public eDeath() {
  23.     new id = read_data(2);
  24.     new attacker = read_data(1);
  25.    
  26.     if(attacker != id && !bb_is_user_zombie(attacker) && current_class[attacker] == MONEYMAKER)
  27.     {
  28.            cs_set_user_money(id, cs_get_user_money(id) + 3000) // primer          
  29.     }
  30. }
  31.  
  32. public bb_human_spawned(id, class) {
  33.     current_class[id] = class
  34.  
  35.     if(current_class[id] == MONEYMAKER) {
  36.         set_user_health(id, get_user_health(id) + 20) // primer
  37.     }
  38. }
  39.  
  40. public client_putinserver(id) {
  41.     current_class[id] = 0
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement