Stop PM-ing me if you posted here...
Here:
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <fakemeta>
#define Plugin "Weapon Chance"
#define Version "1.0"
#define Author "Doombringer"
#define TIME_TO_WAIT 3.0
public plugin_init()
{
register_plugin(Plugin, Version, Author);
register_event("HLTV", "_new_round", "a", "1=0", "2=0");
}
public _give_func()
{
new players[32], num, player;
get_players(players, num);
for(new i = 0; i < num; i++)
{
player = players[i];
if(random_num(0, 100) <= 5)
{
give_item(player, "weapon_awp");
cs_set_weapon_ammo(fm_get_weapon_id(player, "weapon_awp"), 1);
client_print(player, print_chat, "You were lucky, you got a AWP with 1 bullet (5%% chance)");
}
if(random_num(0, 100) <= 10)
{
give_item(player, "weapon_fiveseven");
cs_set_weapon_ammo(fm_get_weapon_id(player, "weapon_fiveseven"), 1);
client_print(player, print_chat, "You were lucky, you got a five seven with 1 bullet (10%% chance)");
}
if(random_num(0, 100) <= 15)
{
give_item(player, "weapon_hegrenade");
client_print(player, print_chat, "You were lucky, you got a hegrenade (15%% chance)");
}
}
}
public _new_round()
set_task(TIME_TO_WAIT, "_give_func");
stock fm_get_weapon_id(index, const weapon[])
{
new ent = -1;
while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", weapon)) != 0)
{
if(index == pev(ent, pev_owner))
return ent;
}
return 0;
}
__________________