Advertisement
Akc3n7

medic

Dec 30th, 2023
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.92 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < cstrike >
  3. #include < fakemeta_util >
  4.  
  5. #define HP 50
  6. #define HP_LIMIT 100
  7.  
  8. new bool:oneround[33];
  9.  
  10. new const MoneySound[ ] = "killingfloor/MoneyMoneyMoney.wav"
  11.  
  12. public plugin_init( )
  13. {
  14.     register_plugin( "Medic Kit", "1.0", "Sorinel");
  15.     register_clcmd("say /medic","call_medic");
  16.         register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
  17.  
  18. }
  19.  
  20. public plugin_precache( )
  21.        engfunc( EngFunc_PrecacheSound, MoneySound );
  22.  
  23. public event_new_round(id) {
  24.  
  25.         if(!oneround[id])
  26.         oneround[id] = false
  27. }
  28.  
  29. public call_medic(id)
  30. {
  31.     if(!is_user_alive(id))
  32.         return;
  33.    
  34.         if(oneround[id]) {
  35.        
  36.                 print_color(id, "!v[MEDIC]!e Poti folosi comanda doar o data pe runda!");
  37.                 return;
  38.     }
  39.  
  40.     new cost = cs_get_user_money(id);    
  41.    
  42.     if(cs_get_user_money(id) > 200 )
  43.     {  
  44.         cs_set_user_money(id, cs_get_user_money(id) - 200)
  45.         fm_set_user_health(id, clamp((get_user_health(id) + HP), 1, HP_LIMIT));
  46.         client_cmd(id, "spk ^"items/medshot4.wav");          
  47.     }
  48.     else {
  49.         new Money = 1000 - cost
  50.         print_color(id, "!v[MEDIC]!e Nu ai suficienti bani, mai ai nevoie de !g%i$", Money);
  51.                client_cmd(id, "spk ^"%s^"", MoneySound);
  52.     }
  53. }
  54.  
  55. stock print_color( const id, const input[ ], any:... )
  56. {
  57.     new count = 1, players[ 32 ]
  58.    
  59.     static msg[ 191 ]
  60.     vformat( msg, 190, input, 3 )
  61.    
  62.     replace_all( msg, 190, "!v", "^4" ) //- verde
  63.     replace_all( msg, 190, "!g", "^1" ) //- galben
  64.     replace_all( msg, 190, "!e", "^3" ) //- echipa
  65.     replace_all( msg, 190, "!n", "^0" ) //- normal
  66.    
  67.     if( id ) players[ 0 ] = id; else get_players( players, count, "ch" )
  68.        {
  69.    
  70.     for( new i = 0; i < count; i++ )
  71.     {
  72.         if( is_user_connected( players[ i ] ) )
  73.         {
  74.             message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] )
  75.             write_byte( players[ i ] );
  76.             write_string( msg );
  77.             message_end( );
  78.         }
  79.     }
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement