Spoiler
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fun>
new m_on, m_cena, m_damage;
new user_buy[33];
public plugin_init()
{
register_plugin( "Masaker", "1.0", "Patrick." );
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
register_clcmd( "say /masaker", "masaker" );
register_clcmd( "say masaker", "masaker" );
m_on = register_cvar( "amx_masaker", "1" );
m_damage = register_cvar( "amx_masaker_damage", "2" );
m_cena = register_cvar( "amx_cena", "16000" );
}
public TakeDamage(id, this, attacker, Float:damage)
{
if(user_buy[id]) //jeśli kupił to dopiero odpala pomnożone damage!
{
if(get_user_weapon(attacker) == CSW_M249) damage*get_pcvar_float(m_damage);
}
}
public masaker(id)
{
if ( is_user_alive( id ) || get_pcvar_num( m_on ) == 1 ) return PLUGIN_CONTINUE; //Czy gracz żyje i czy plugin ON
if ( !Buyformoney( id, get_pcvar_num( m_cena ) ) ) return PLUGIN_HANDLED; // Kupno
user_buy[id] = true
strip_user_weapons( id ); //zabiera inne bronie i zostawia tylko daną broń w tym przypadku dostaje tylko KROWE!
set_user_health( id, 500 ); // ustawia mu 500HP
give_item( id, "weapon_m249" ); // daje graczowi krowe
cs_set_user_bpammo( id, CSW_M249, 200) //dodaje 200 ammo
return PLUGIN_CONTINUE;
}
public bool:Buyformoney( id, amount )
{
if( cs_get_user_money( id ) >= amount )
{
cs_set_user_money( id, cs_get_user_money( id ) - amount ); // zabiera daną ilość $
return true
}
else
{
set_hudmessage( 255, 0, 0, -1.0, 0.2, 1, 6.0, 5.0 );
show_hudmessage( id, "Nie stac cie!" ); // Nie masz tyle kasy jeśli gracz w tym wypadku będzie mieć
return false // mneij niż 16 tyś to to się mu po wpisaniu pokaze
}
return false
}
public client_disconnect(id) user_buy[id] = false
public client_connect(id) user_buy[id] = false