Raised This Month: $ Target: $400
 0% 

how to check bot weapon?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-21-2012 , 06:13   Re: how to check bot weapon?
Reply With Quote #1

You should make loop into a loop into a loop (where you show the sprite as MSG_ONE_UNRELIABLE to all members of your team, including you), which I don't think it's really good... Maybe with another method, but I can't think of a better way.
__________________
<VeCo> is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-21-2012 , 06:18   Re: how to check bot weapon?
Reply With Quote #2

oh, okay.. thanks for your help
Randomize is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-21-2012 , 06:19   Re: how to check bot weapon?
Reply With Quote #3

can i added task to this code?
Randomize is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-21-2012 , 06:20   Re: how to check bot weapon?
Reply With Quote #4

It's better to use an entity.
__________________
<VeCo> is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-21-2012 , 06:27   Re: how to check bot weapon?
Reply With Quote #5

thinking entity?
Randomize is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-21-2012 , 06:28   Re: how to check bot weapon?
Reply With Quote #6

Yes...
__________________
<VeCo> is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-21-2012 , 06:32   Re: how to check bot weapon?
Reply With Quote #7

can i add thinking entity from last crosshair code to this code?
Randomize is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-21-2012 , 06:34   Re: how to check bot weapon?
Reply With Quote #8

Yes, just change the loop (and entity classname + think function name).
__________________
<VeCo> is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-21-2012 , 06:45   Re: how to check bot weapon?
Reply With Quote #9

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>

#define PLUGIN "CSPB Title"
#define VERSION "1.0"
#define AUTHOR "author"

// store weapon type ids
new const weapon_type_id[] =
{
 (
<< CSW_GALIL << CSW_FAMAS << CSW_AK47 << CSW_SG552 << CSW_AUG),
 (
<< CSW_MAC10 << CSW_TMP << CSW_MP5NAVY << CSW_UMP45 << CSW_P90 << CSW_M249 << CSW_GLOCK18 << CSW_USP << CSW_P228 << CSW_DEAGLE << CSW_ELITE << CSW_FIVESEVEN),
 (
<< CSW_AWP << CSW_SCOUT << CSW_G3SG1 << CSW_SG550),
 (
<< CSW_M3 << CSW_XM1014),
 
}
 
// store sprite names for the weapon types
new const sprite_names[][] =
{
 
"sprites/title/assault.spr",
 
"sprites/title/smg.spr",
 
"sprites/title/sniper.spr",
 
"sprites/title/blower.spr"
}
 
// store sprite precache id
new hudsprite[sizeof sprite_names]  

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
entity_set_string(ent,EV_SZ_classname,"pb_title"// classname
    
entity_set_float(ent,EV_FL_nextthink,get_gametime() + 1.0// think every second
    
    //thinking entity
    
register_think("pb_title","title"// call "dot_crosshair_think" function on think
}
public 
plugin_precache()
{
    for(new 
i=0;i<sizeof sprite_names;i++) hudsprite[i] = precache_model(sprite_names[i]) 
}
public 
title(ent)
{
    
entity_set_float(ent,EV_FL_nextthink,get_gametime() + 1.0// continue thinking every second
 
    
if(!get_playersnum()) return // server is empty, there's no need to show HUD messages...
 
    
static players[32],numi,id
    get_players
(players,num,"a"// get all alive players in the server
 
    
for(i=0;i<num;i++) // loop trough them...
    
{
        
id players[i// store player index in a more convenient variable
 
        
for(ii=0;ii<sizeof weapon_type_id;ii++) // loop trough all types of weapons
            
{
                if(!(
<< get_user_weapon(id) & weapon_type_id[ii])) continue // our weapon isn't this type - continue with the others
 
                // Else - show the sprite...
                
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
                
write_byte(TE_PLAYERATTACHMENT// not write_short
                
write_byte(id// not write_entity
                
write_coord(32)
                
write_short(hudsprite[ii]) // display the sprite of that weapon type
                
write_short(10// life = 10 : should be around 1 second
                
message_end()  
 
                break 
// don't loop trough the other weapon types if we have found our
            
}
    }  

I think i should remove this?
PHP Code:
if(!get_playersnum()) return // server is empty, there's no need to show HUD messages... 
Randomize is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-21-2012 , 06:53   Re: how to check bot weapon?
Reply With Quote #10

I added it just not to continue with get_players and the loop if the server is empty. I think this is more fast than reaching the loop after get_players and then see the loop can't start, because i=0 and i<0 can't be true.

Also I added the comments only to tell you what exactly the specific line does, you can remove them.
__________________

Last edited by <VeCo>; 05-21-2012 at 06:54.
<VeCo> 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 00:28.


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