Raised This Month: $ Target: $400
 0% 

[Help] Weapon Chance


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
tepAse
Junior Member
Join Date: Jun 2009
Old 07-25-2009 , 14:17   [Help] Weapon Chance
Reply With Quote #1

I've tried to make an Weapon Chance plugin, i get no error's but it doesnt give out items ingame.. Srry bad english.

[EDIT] It works with if you play without freezetime

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <engine>

#define PLUGIN    "Weapon Chance"
#define AUTHOR    "FaktuM"
#define VERSION    "1.0"

new gMaxPlayers;
new 
szName[32];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_event("HLTV""eventRoundStart""a""1=0""2=0");
    
    
gMaxPlayers get_maxplayers();
}

public 
eventRoundStart()
{
    
set_task(5.0"WeaponChance");
}

public 
WeaponChance()
{
    for(new 
id 1id <= gMaxPlayersid++)
    {
        if(
is_user_connected(id) && is_user_alive(id))
        {
            switch(
get_user_team(id))
            {
                case 
1:
                {
                    if(
random_num(0100) <= 20)
                    {
                        
give_item(id"weapon_hegrenade");
                        
client_print(idprint_chat"You got a HE! (20%% chance)");
                    }
                }
                case 
2:
                {
                    if(
random_num(0100) <= 30)
                    {
                        
give_item(id"weapon_flashbang");
                        
client_print(idprint_chat"You got a flashbang! (30%% chance)");
                    }
                }
                case 
3:
                {
                    if(
random_num(0100) <= 1)
                    {
                        
give_item(id"weapon_awp");
                        
cs_set_weapon_ammo(find_ent_by_owner(2"weapon_awp"id), 1);
                        
client_print(idprint_chat"You got an awp with 2 bullets! (1%% chance)");
                        
                        
get_user_name(idszName31);
                        
client_print(0print_chat"[Weapon Chance] %s has recived an awp with two bullets, aware!"szName);
                    }
                }
                case 
4:
                {
                    if(
random_num(0100) <= 5)
                    {
                        
set_user_health(id150);
                        
client_print(idprint_chat"You recived 150 health! (5%% chance)");
                    }
                }
                case 
5:
                {
                    if(
random_num(0100) <= 10)
                    {
                        
give_item(id"weapon_fiveseven");
                        
cs_set_weapon_ammo(find_ent_by_owner(1"weapon_fiveseven"id), 1);
                        
client_print(idprint_chat"You recived an Fiveseven with 1 bullet! (10%% chance)");
                    }
                }
                case 
6:
                {
                    if(
random_num(0100) <= 5)
                    {
                        
give_item(id"weapon_deagle");
                        
cs_set_weapon_ammo(find_ent_by_owner(1"weapon_deagle"id), 1);
                        
client_print(idprint_chat"You recived an Deagle with 1 bullet! (5%% chance)");
                    }
                }
                case 
7:
                {
                    if(
random_num(0100) <= 10)
                    {
                        
give_item(id"weapon_usp");
                        
cs_set_weapon_ammo(find_ent_by_owner(1"weapon_usp"id), 1);
                        
client_print(idprint_chat"You recived an Usp with 1 bullet! (10%% chance)");
                    }
                }
                case 
8:
                {
                    if(
random_num(0100) <= 5)
                    {
                        
give_item(id"weapon_scout");
                        
cs_set_weapon_ammo(find_ent_by_owner(1"weapon_scout"id), 1);
                        
client_print(idprint_chat"You recived an Scout with 1 bullets! (5%% chance)");
                    }
                }
                case 
9:
                {
                    if(
random_num(0100) <= 35)
                    {
                        
set_user_armor(id100);
                        
client_print(idprint_chat"You recived 100 armor! (35%% chance)");
                    }
                }
                case 
10:
                {
                    if(
random_num(0100) <= 20)
                    {
                        
set_user_health(id115);
                        
client_print(idprint_chat"You recived 115 health! (20%% chance)");
                    }
                }
            }
        }
    }

tepAse is offline
 



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 18:18.


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