Sorinel

Medic Kit

Aug 5th, 2020
1,349
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include < amxmodx >
  2. #include < cstrike >
  3. #include < fakemeta_util >
  4.  
  5. #define HP 20
  6. #define COST 50
  7. #define HP_LIMIT 120
  8.  
  9. new bool:usemedic[33];
  10.  
  11. public plugin_init( )
  12. {
  13.     register_plugin( "Medic Kit", "1.0", "Sorinel");
  14.     register_clcmd("say /medic","call_medic");
  15.     register_event("HLTV", "event_new_round", "a", "1=0", "2=0");
  16. }
  17.  
  18. public event_new_round() for(new id=1;id<=get_maxplayers();id++) usemedic[id]= false;
  19.  
  20. public call_medic(id)
  21. {
  22.     if(!is_user_alive(id) || usemedic[id])
  23.         return 1;
  24.    
  25.     new cost = cs_get_user_money(id);    
  26.    
  27.     if(cs_get_user_money(id) > COST)
  28.     {  
  29.         cs_set_user_money(id, cs_get_user_money(id) - COST)
  30.         fm_set_user_health(id, clamp((get_user_health(id) + HP), 1, HP_LIMIT));
  31.         client_cmd(id, "spk ^"items/medshot4.wav");
  32.        
  33.         //print_color(id, "!ePoti folosi comanda doar odata pe runda")
  34.         usemedic[id] = true;
  35.         return 1;
  36.        
  37.     }
  38.     else {
  39.         new Money = cost
  40.         print_color(id, "!v[MEDIC]!e Nu ai suficienti bani, mai ai nevoie de !g%i$", Money);
  41.         return 1;
  42.     }
  43.     return 0;
  44. }
  45.  
  46. stock print_color( const id, const input[ ], any:... )
  47. {
  48.     new count = 1, players[ 32 ]
  49.    
  50.     static msg[ 191 ]
  51.     vformat( msg, 190, input, 3 )
  52.    
  53.     replace_all( msg, 190, "!v", "^4" ) //- verde
  54.     replace_all( msg, 190, "!g", "^1" ) //- galben
  55.     replace_all( msg, 190, "!e", "^3" ) //- echipa
  56.     replace_all( msg, 190, "!n", "^0" ) //- normal
  57.    
  58.     if( id ) players[ 0 ] = id; else get_players( players, count, "ch" )
  59.        {
  60.  
  61.     for( new i = 0; i < count; i++ )
  62.     {
  63.         if( is_user_connected( players[ i ] ) )
  64.         {
  65.             message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] )
  66.             write_byte( players[ i ] );
  67.             write_string( msg );
  68.             message_end( );
  69.         }
  70.     }
  71. }
  72. }
RAW Paste Data