This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Why doesn't this work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LukeyB
Member
Join Date: Dec 2011
Old 01-18-2012 , 04:15   Why doesn't this work?
Reply With Quote #1

I want to force ct player to pull out knife when bomb is planted.

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
stock get_loguser_index()
{
    new 
loguser[80], name[32]
    
read_logargv(0loguser79)
    
parse_loguser(logusername31)
 
    return 
get_user_index(name)

public 
plugin_init()
{
     
register_logevent("BombPlantEvent"3"2=Planted_The_Bomb");
}
public 
BombPlantEvent()
{
 new 
id get_loguser_index()
 if (
is_user_aliveid ) && get_user_weaponid ) != CSW_KNIFE && cs_get_user_team(id) == CS_TEAM_CT)
 {
 
engclient_cmd(id "weapon_knife")
 }

LukeyB is offline
JoKeR LauGh
Veteran Member
Join Date: May 2011
Location: Malaysia
Old 01-18-2012 , 04:57   Re: Why doesn't this work?
Reply With Quote #2

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

new g_max

public plugin_init()
{
    
register_logevent("BombPlantEvent"3"2=Planted_The_Bomb");
    
    
g_max get_maxplayers()
}
public 
BombPlantEvent()
{
    for ( new 
id=1id<=g_maxid++ )
    {
        if ( 
is_user_alive(id) )
        {
            if ( 
cs_get_user_team(id) == CS_TEAM_CT )
            {
                
strip_user_weapons(id)
                
give_item(id"weapon_knife")
            }
        }
    }

__________________
Quote:
Originally Posted by addons_zz View Post
Also, just to not read `the article`, read all you find. Read and read, for ever and ever. Never stop reading.
Why? Because there is not one single universal truth which holds the meaning for everything.
JoKeR LauGh is offline
Ex1ne
Senior Member
Join Date: Oct 2011
Location: Norway
Old 01-18-2012 , 08:21   Re: Why doesn't this work?
Reply With Quote #3

Quote:
Originally Posted by JoKeR LauGh View Post
PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>

new g_max

public plugin_init()
{
    
register_logevent("BombPlantEvent"3"2=Planted_The_Bomb");
    
    
g_max get_maxplayers()
}
public 
BombPlantEvent()
{
    for ( new 
id=1id<=g_maxid++ )
    {
        if ( 
is_user_alive(id) )
        {
            if ( 
cs_get_user_team(id) == CS_TEAM_CT )
            {
                
strip_user_weapons(id)
                
give_item(id"weapon_knife")
            }
        }
    }

Lol, this strips all the ct's weapon's rather than forcing the knife out.
__________________

Last edited by Ex1ne; 01-18-2012 at 08:22.
Ex1ne is offline
LukeyB
Member
Join Date: Dec 2011
Old 01-19-2012 , 03:31   Re: Why doesn't this work?
Reply With Quote #4

This works great, but I would like to give previous weapons back when they spot an enemy.
LukeyB is offline
LukeyB
Member
Join Date: Dec 2011
Old 01-19-2012 , 03:40   Re: Why doesn't this work?
Reply With Quote #5

Could also use this, but need to block weapon switch until enemy is spotted so that bots won't pull out their guns immediately after switching to knife.

PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
new g_max
public plugin_init()
{
    
register_logevent("BombPlantEvent"3"2=Planted_The_Bomb");
    
    
g_max get_maxplayers()
}
public 
BombPlantEvent()
{
    for ( new 
id=1id<=g_maxid++ )
    {
        if ( 
is_user_bot(id) )
        {
            if ( 
cs_get_user_team(id) == CS_TEAM_CT )
            {
            
engclient_cmd(id "weapon_knife")
            }
        }
    }


Last edited by LukeyB; 01-19-2012 at 03:41.
LukeyB is offline
Reply



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 14:44.


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