Raised This Month: $ Target: $400
 0% 

how to check bot weapon?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-19-2012 , 04:37   how to check bot weapon?
Reply With Quote #1

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

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Title"
#define VERSION "1.0"
#define AUTHOR "DavidJr"

#define TE_PLAYERATTACHMENT         124      // Attaches a TENT to a player (this is a high-priority tent)

#define ASSAULT_WEAPONS (1 << CSW_GALIL | 1 << CSW_FAMAS | 1 << CSW_AK47 | 1 << CSW_SG552 << CSW_AUG)
#define SMG_WEAPONS (1 << CSW_MAC10 | 1 << CSW_TMP | 1 << CSW_MP5NAVY | 1 << CSW_UMP45 | 1 << CSW_P90)
#define SNIPER_WEAPONS (1 << CSW_AWP | 1 << CSW_SCOUT | 1 << CSW_G3SG1 | 1 << CSW_SG550)
#define SHOTGUN_WEAPONS (1 << CSW_M3 | 1 << CSW_XM1014)
#define HANDGUN_WEAPONS (1 << CSW_GLOCK18 | 1 << CSW_USP | 1 << CSW_P228 | 1 << CSW_DEAGLE << CSW_ELITE | 1 << CSW_FIVESEVEN)
#define MACHINEGUN (1 | << CSW_M249)
#define EXPLOSIVE_ITEM (1 << CSW_C4 | 1 << CSW_HEGRENADE | 1 << CSW_SMOKEGRENADE | 1 << CSW_FLASHBANG)

new hudsprite

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd("title_on","title")
}
public 
plugin_precache()

    
hudsprite=precache_model("sprites/title/assault.spr")
    
hudsprite=precache_model("sprites/title/smg.spr")
    
hudsprite=precache_model("sprites/title/sniper.spr")
    
hudsprite=precache_model("sprites/title/shotgun.spr")
    
hudsprite=precache_model("sprites/title/handgun.spr")
    
hudsprite=precache_model("sprites/title/machinegun.spr")
    
hudsprite=precache_model("sprites/title/explosive.spr")
    return 
PLUGIN_CONTINUE
}
public 
title(id){
    new 
wpnidwpnclipwpnammo 
    wpnid 
get_user_weapon(idwpnclip wpnammo)
    
    
message_begin(MSG_ONE,SVC_TEMPENTITY,{0,0,0},id)
    
write_short(TE_PLAYERATTACHMENT)
    
write_entity(id)
    
write_coord(32)
    
write_short(hudsprite)
    
write_short(100)
    
message_end()

How to check bot weapons? and show a sprites above their head about what's their weapon use.
Randomize is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-19-2012 , 08:11   Re: how to check bot weapon?
Reply With Quote #2

Make hudsprite an array, that code for precache doesn't make sense, because you set new value for hudsprite on every line and at the end, hudsprite will contain only the id of explosive.spr precache.

That "title" function is called by a console command (and the sprite doesn't stay forever, only for some seconds). How bots can write commands?
__________________
<VeCo> is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-19-2012 , 19:14   Re: how to check bot weapon?
Reply With Quote #3

i want to make it show forever.. The command for all bot
Randomize is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-20-2012 , 06:45   Re: how to check bot weapon?
Reply With Quote #4

Make a thinking entity then which will loop trough all players and will show the sprites (then it will work for bots too).
__________________
<VeCo> is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-20-2012 , 06:51   Re: how to check bot weapon?
Reply With Quote #5

like the crosshair right? lol
Randomize is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-20-2012 , 06:52   Re: how to check bot weapon?
Reply With Quote #6

Yep, something like that.

The life (a.k.a. last write_short) specifies the time of the effect. 100 should be around 10 secs (i'm not really sure).
__________________

Last edited by <VeCo>; 05-20-2012 at 06:53.
<VeCo> is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-20-2012 , 06:54   Re: how to check bot weapon?
Reply With Quote #7

register concmd change to thinking entity
Randomize is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-20-2012 , 07:15   Re: how to check bot weapon?
Reply With Quote #8

I got this code like this:
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Title"
#define VERSION "1.0"
#define AUTHOR "DavidJr"

#define TE_PLAYERATTACHMENT         124      // Attaches a TENT to a player (this is a high-priority tent)

#define ASSAULT_WEAPONS (1 << CSW_GALIL | 1 << CSW_FAMAS | 1 << CSW_AK47 | 1 << CSW_SG552 << CSW_AUG)
#define SMG_WEAPONS (1 << CSW_MAC10 | 1 << CSW_TMP | 1 << CSW_MP5NAVY | 1 << CSW_UMP45 | 1 << CSW_P90)
#define SNIPER_WEAPONS (1 << CSW_AWP | 1 << CSW_SCOUT | 1 << CSW_G3SG1 | 1 << CSW_SG550)
#define SHOTGUN_WEAPONS (1 << CSW_M3 | 1 << CSW_XM1014)
#define HANDGUN_WEAPONS (1 << CSW_GLOCK18 | 1 << CSW_USP | 1 << CSW_P228 | 1 << CSW_DEAGLE << CSW_ELITE | 1 << CSW_FIVESEVEN)
#define MACHINEGUN_WEAPONS (1 | << CSW_M249)
#define EXPLOSIVE_ITEM (1 << CSW_C4 | 1 << CSW_HEGRENADE | 1 << CSW_SMOKEGRENADE | 1 << CSW_FLASHBANG)

new sync

new assault
new smg
new sniper
new shotgun
new handgun
new machinegun
new explosive

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
sync CreateHudSyncObj() // HUD sync object
    
new ent create_entity("info_target")
    
entity_set_string(ent,EV_SZ_classname,"title_weapon"// classname
    
entity_set_float(ent,EV_FL_nextthink,get_gametime() + 1.0// think every second
    
register_think("title_weapon","title"// call "cross_crosshair_think" function on think
}
public 
plugin_precache()

    
assault precache_model("sprites/title/assault.spr")
    
smg precache_model("sprites/title/smg.spr")
    
sniper precache_model("sprites/title/sniper.spr")
    
shotgun precache_model("sprites/title/shotgun.spr")
    
handgun precache_model("sprites/title/handgun.spr")
    
machinegun precache_model("sprites/title/machinegun.spr")
    
explsive precache_model("sprites/title/explosive.spr")
    return 
PLUGIN_CONTINUE
}
public 
title(id){
    new 
wpnidwpnclipwpnammo 
    wpnid 
get_user_weapon(idwpnclip wpnammo)
    
    
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 Sprite
 
    
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
 
        
if(<< get_user_weapon(id) & ASSAULT_WEAPONS) continue // if this player is holding an assault - continue with the next player
    
    
message_begin(MSG_ONE,SVC_TEMPENTITY,{0,0,0},id)
    
write_short(TE_PLAYERATTACHMENT)
    
write_entity(id)
    
write_coord(32)
    
write_short(assault)
    
write_short(100)
    
message_end()
    
    if(!
get_playersnum()) return // server is empty, there's no need to show Sprite
 
    
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
 
        
if(<< get_user_weapon(id) & SMG_WEAPONS) continue // if this player is holding a sniper - continue with the next player
    
    
message_begin(MSG_ONE,SVC_TEMPENTITY,{0,0,0},id)
    
write_short(TE_PLAYERATTACHMENT)
    
write_entity(id)
    
write_coord(32)
    
write_short(smg)
    
write_short(100)
    
message_end()
    
    if(!
get_playersnum()) return // server is empty, there's no need to show Sprite
 
    
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
 
        
if(<< get_user_weapon(id) & SNIPER_WEAPONS) continue // if this player is holding a sniper - continue with the next player
    
    
message_begin(MSG_ONE,SVC_TEMPENTITY,{0,0,0},id)
    
write_short(TE_PLAYERATTACHMENT)
    
write_entity(id)
    
write_coord(32)
    
write_short(sniper)
    
write_short(100)
    
message_end()
    
    if(!
get_playersnum()) return // server is empty, there's no need to show Sprite
 
    
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
 
        
if(<< get_user_weapon(id) & SHOTGUN_WEAPONS) continue // if this player is holding a sniper - continue with the next player
    
    
message_begin(MSG_ONE,SVC_TEMPENTITY,{0,0,0},id)
    
write_short(TE_PLAYERATTACHMENT)
    
write_entity(id)
    
write_coord(32)
    
write_short(shotgun)
    
write_short(100)
    
message_end()
    
    if(!
get_playersnum()) return // server is empty, there's no need to show Sprite
 
    
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
 
        
if(<< get_user_weapon(id) & HANDGUN_WEAPONS) continue // if this player is holding a sniper - continue with the next player
    
    
message_begin(MSG_ONE,SVC_TEMPENTITY,{0,0,0},id)
    
write_short(TE_PLAYERATTACHMENT)
    
write_entity(id)
    
write_coord(32)
    
write_short(handgun)
    
write_short(100)
    
message_end()
    
    if(!
get_playersnum()) return // server is empty, there's no need to show Sprite
 
    
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
 
        
if(<< get_user_weapon(id) & MACHINEGUN_WEAPONS) continue // if this player is holding a sniper - continue with the next player
    
    
message_begin(MSG_ONE,SVC_TEMPENTITY,{0,0,0},id)
    
write_short(TE_PLAYERATTACHMENT)
    
write_entity(id)
    
write_coord(32)
    
write_short(machinegun)
    
write_short(100)
    
message_end()
    
    if(!
get_playersnum()) return // server is empty, there's no need to show Sprite
 
    
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
 
        
if(<< get_user_weapon(id) & EXPLOSIVE_WEAPONS) continue // if this player is holding a sniper - continue with the next player
    
    
message_begin(MSG_ONE,SVC_TEMPENTITY,{0,0,0},id)
    
write_short(TE_PLAYERATTACHMENT)
    
write_entity(id)
    
write_coord(32)
    
write_short(explosive)
    
write_short(100)
    
message_end()

What should i do with sync?

Last edited by Randomize; 05-20-2012 at 07:15.
Randomize is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-20-2012 , 07:56   Re: how to check bot weapon?
Reply With Quote #9

No, that's all wrong...

You don't need sync - that's for HUD messages...
__________________
<VeCo> is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-20-2012 , 08:33   Re: how to check bot weapon?
Reply With Quote #10

new ent?
Randomize 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