Raised This Month: $ Target: $400
 0% 

Help with "random weapons"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Proz
AlliedModders Donor
Join Date: Apr 2005
Old 12-08-2007 , 12:49   Help with "random weapons"
Reply With Quote #1

Hi I got a plugin that will give players random weapons at the start of the round. It works fine , except one problem. When I want player to get 1 awp bullets they get 11 shots. And when I want player to get a fiveseven with 2 bullets they got 22 bullets. Can anyone help me here?

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

#define Plugin "Weapon Chance"
#define Version "1.0"
#define Author "Doombringer"

#define TIME_TO_WAIT 5.0

public plugin_init()
{
register_plugin(Plugin, Version, Author)
register_logevent("round_start", 2, "1=Round_Start")
}

public main_func()
{
new players[32], num
get_players(players, num)

new player
for(new i = 0; i < num; i++)
{
player = players[i]

if(random_num(0, 100) <= 5)
{
give_item(player, "weapon_awp")

cs_set_user_bpammo(player, CSW_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_user_bpammo(player, CSW_FIVESEVEN, 2)
client_print(player, print_chat, "You were lucky, you got a five seven with 2 bullets (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 round_start()
{
set_task(TIME_TO_WAIT, "main_func")
Proz is offline
uxMal
Member
Join Date: Oct 2007
Old 12-08-2007 , 18:07   Re: Help with "random weapons"
Reply With Quote #2

Replace your fiveseven code with the code in the code field...
with set_user_bpammo its not stting the clip magazine only the backpack
and for the awp just change the weapon_fiveseven and write weapon_awp
here you can change ammo count:
cs_set_weapon_ammo(weapon_id, 2 <--- Ammo Count);

Code:
if(random_num(0, 100) <= 10)
{
give_item(player,"weapon_fiveseven");
new weapon_id = find_ent_by_owner(-1, "weapon_fiveseven", player);
cs_set_weapon_ammo(weapon_id, 2);
client_print(player, print_chat, "You were lucky, you got a five seven with 2 bullets (10% chance)")
}
uxMal is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode