Raised This Month: $ Target: $400
 0% 

get_user_weapon errors w/ bots


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
urban_ninja
Senior Member
Join Date: Feb 2009
Old 09-28-2011 , 00:08   get_user_weapon errors w/ bots
Reply With Quote #1

The get_user_weapon seems to have mad compatibility issues with FoxBot. Is there an other function that does the exact same thing but is stable with bots?

You guys would probably recommend I use is_user_bot function to disclude bots but it would feel to awkward that extra dynamic light flashes with weapon fire would only work with real players.

My usage of this funtion
PHP Code:
if(get_user_weapon(id) == TFC_WPN_AC
Resulting in an error spam in the amxx error logs if bots were ever spawned any time from map start to map end. amxx error logs would range up to 1 terabyte after a day filled with nothing but the following error.
Code:
L 09/27/2011 - 00:00:00: [AMXX] Displaying debug trace (plugin "myplugin.amxx")
L 09/27/2011 - 00:00:00: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 09/27/2011 - 00:00:00: [AMXX]    [0] huf.sma::tfc_ac_FireFlash (line 446)
L 09/27/2011 - 00:00:00: Invalid player id 0
Severity of the error spam varies.
__________________
urban_ninja is offline
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 09-28-2011 , 00:28   Re: get_user_weapon errors w/ bots
Reply With Quote #2

code?
__________________
Preparing to release my plugins..
r0ck is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-28-2011 , 01:11   Re: get_user_weapon errors w/ bots
Reply With Quote #3

Seems to be a code error rather than a bot issue.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
urban_ninja
Senior Member
Join Date: Feb 2009
Old 09-28-2011 , 03:08   Re: get_user_weapon errors w/ bots
Reply With Quote #4

Spectator used just to start the infinite loop
PHP Code:
public plugin_init(){
 
register_event("Spectator""speed""abcde")

The loop.
PHP Code:
public speed(id)
{
    
set_task(0.0"tfc_ac_FireFlash"id,_,_,"b")

Whats being looped
PHP Code:
public tfc_ac_FireFlash(id)
{
    if(
get_user_weapon(id) == TFC_WPN_AC)
    {    
        if(
pev(idpev_button) & IN_ATTACK)
        {
            new 
origin[3]
            
get_user_origin(idorigin)
            
set_dynamic_light(origin32150130700.1150)
        }
    }

Thats pretty much all there is thats relevant to this part of the plugin with the error. Very small and simple.

The code works in game on both player and bot HW guys shooting the auto-cannon but the errors only happen if theres bots. More bots the more harder the error spams.

EDIT:
Quote:
L 09/27/2011 - 00:00:00: [AMXX] Displaying debug trace (plugin "myplugin.amxx") L 09/27/2011 - 00:00:00: [AMXX] Run time error 10: native error (native "get_user_weapon") L 09/27/2011 - 00:00:00: [AMXX] [0] huf.sma::tfc_ac_FireFlash (line 446) L 09/27/2011 - 00:00:00: Invalid player id 0
Im guessing bots id is 0 for every bot and amxx is not liking it?
__________________

Last edited by urban_ninja; 09-28-2011 at 03:13.
urban_ninja is offline
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 09-28-2011 , 04:23   Re: get_user_weapon errors w/ bots
Reply With Quote #5

PHP Code:
public speed(id)
{
    
set_task(0.1"tfc_ac_FireFlash"id,_,_,"b")

PHP Code:
public tfc_ac_FireFlash(id)
{
    if(!
is_user_connected(id))
         return 
PLUGIN_HANDLED

    
if(get_user_weapon(id) == TFC_WPN_AC)
    {    
        if(
pev(idpev_button) & IN_ATTACK)
        {
            new 
origin[3]
            
get_user_origin(idorigin)
            
set_dynamic_light(origin32150130700.1150)
        }
    }
    return 
PLUGIN_HANDLED

__________________
Preparing to release my plugins..
r0ck is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-28-2011 , 11:28   Re: get_user_weapon errors w/ bots
Reply With Quote #6

register_event("Spectator", "speed", "abcde")

Flags are wrong.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Stereo
Veteran Member
Join Date: Dec 2010
Old 09-28-2011 , 11:51   Re: get_user_weapon errors w/ bots
Reply With Quote #7

PHP Code:
new g_maxplayers
#define IsPlayer(%1) (1 <= %1 <= g_maxplayers)


//init
g_maxplayers get_maxplayers() 

PHP Code:
//function
if(!IsPlayer(index) ) return PLUGIN_HANDLED 
Stereo is offline
urban_ninja
Senior Member
Join Date: Feb 2009
Old 09-29-2011 , 01:41   Re: get_user_weapon errors w/ bots
Reply With Quote #8

Quote:
Originally Posted by r0ck View Post
PHP Code:
public speed(id)
{
    
set_task(0.1"tfc_ac_FireFlash"id,_,_,"b")

PHP Code:
public tfc_ac_FireFlash(id)
{
    if(!
is_user_connected(id))
         return 
PLUGIN_HANDLED

    
if(get_user_weapon(id) == TFC_WPN_AC)
    {    
        if(
pev(idpev_button) & IN_ATTACK)
        {
            new 
origin[3]
            
get_user_origin(idorigin)
            
set_dynamic_light(origin32150130700.1150)
        }
    }
    return 
PLUGIN_HANDLED

Thanks man. That fixed the issue.
__________________
urban_ninja is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-29-2011 , 02:07   Re: get_user_weapon errors w/ bots
Reply With Quote #9

This is not the good way to fix it, check flags in register_event !!

http://www.amxmodx.org/funcwiki.php?...vent&go=search

Don't put "a" in flags but only "b", for other flags, it depends on what you need.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
urban_ninja
Senior Member
Join Date: Feb 2009
Old 09-29-2011 , 04:45   Re: get_user_weapon errors w/ bots
Reply With Quote #10

Quote:
Originally Posted by ConnorMcLeod View Post
This is not the good way to fix it, check flags in register_event !!

http://www.amxmodx.org/funcwiki.php?...vent&go=search

Don't put "a" in flags but only "b", for other flags, it depends on what you need.
Yep, Already set flags to only "b" when I added the fix.
__________________
urban_ninja 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 19:32.


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