Raised This Month: $32 Target: $400
 8% 

Solved help finding all players that is near the bombsite


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Siveroo
Junior Member
Join Date: Apr 2020
Old 09-23-2020 , 04:01   help finding all players that is near the bombsite
Reply With Quote #1

i tried to use find_entity_by_class , find their origin, and then use find_sphere_class, but i dont think it's working

Code:
    new bs_ent = find_ent_by_class(bs_ent, "info_bomb_target")     get_brush_entity_origin(bs_ent, SITES_ORIGIN)         console_print(1, "test 1 %f", SITES_ORIGIN[1])     new bs_players[33]     new playerfound = find_sphere_class(0, "player", 300.0, bs_players, 33, SITES_ORIGIN)         for(new i = 0; i < playerfound; i++){         console_print(1, "test 2 %f", SITES_ORIGIN[2])     }     return PLUGIN_CONTINUE;

if i run my code, the console_print function will just output 0.0000, so i believe my code still can't find the bombsite origin...

pls help me XD

Last edited by Siveroo; 09-23-2020 at 21:35.
Siveroo is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-23-2020 , 04:12   Re: help finding all players that is on the bombsite
Reply With Quote #2

Search for func_bomb_target. If it is missing try info_bomb_target.
It's easy to check if you found the entity or not: check if the return value of find_ent_by_class is a valid entity(use pev_valid).
__________________

Last edited by HamletEagle; 09-23-2020 at 04:14.
HamletEagle is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 09-23-2020 , 08:29   Re: help finding all players that is on the bombsite
Reply With Quote #3

Have you tried func_bomb_target?

grep func_bomb_target *
Spoiler


grep info_bomb_target *
  1. Binary file de_flatout.bsp matches
  2. Binary file de_jeepathon2k19.bsp matches
  3. Binary file de_jeepathon2k.bsp matches
  4. Binary file de_simpsons.bsp matches
  5. Binary file flatout-de.bsp matches
  6. Binary file st_bessjump.bsp matches

Quote:
Originally Posted by Siveroo View Post
i tried to use find_entity_by_class , find their origin, and then use find_sphere_class, but i dont think it's working

Code:
    new bs_ent = find_ent_by_class(bs_ent, "info_bomb_target")     get_brush_entity_origin(bs_ent, SITES_ORIGIN)         console_print(1, "test 1 %f", SITES_ORIGIN[1])     new bs_players[33]     new playerfound = find_sphere_class(0, "player", 300.0, bs_players, 33, SITES_ORIGIN)         for(new i = 0; i < playerfound; i++){         console_print(1, "test 2 %f", SITES_ORIGIN[2])     }     return PLUGIN_CONTINUE;

if i run my code, the console_print function will just output 0.0000, so i believe my code still can't find the bombsite origin...

pls help me XD

Code:
/*  * This program is free software; you can redistribute it and/or modify  * it under the terms of the GNU General Public License as published by  * the Free Software Foundation; either version 2 of the License, or  * (at your option) any later version.  *  * This program is distributed in the hope that it will be useful,  * but WITHOUT ANY WARRANTY; without even the implied warranty of  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  * GNU General Public License for more details.  *  * You should have received a copy of the GNU General Public License  * along with this program; if not, write to the Free Software  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  * MA 02110-1301, USA.  *  * C4 target coordinates miner.  *  */ #include amxmodx #include amxmisc #include cstrike #include engine #include fakemeta #if !defined MAX_NAME_LENGTH #define MAX_NAME_LENGTH 32 #endif #if !defined MAX_PLAYERS #define MAX_PLAYERS 32 #endif #define charsmin -1 #define SCOREATTRIB_BOMB    (1<<1) #define PLUGIN        "C4 target coordinates" new szMapname[MAX_NAME_LENGTH], szName[MAX_NAME_LENGTH]; new g_miner, origin[3]; public plugin_init() {     register_plugin(PLUGIN, "1.0", "SPiNX");     get_mapname(szMapname, charsmax(szMapname) );     if (containi(szMapname,"de_") == charsmin)         pause ("a");     else     register_forward(FM_PlayerPreThink, "zone_think", 0);     g_miner = register_cvar("mine_c4", "0");     register_message(get_user_msgid("ScoreAttrib"), "Message_ScoreAttrib") } //affects showscores so we remove it. public Message_ScoreAttrib() {     new iFlags = get_msg_arg_int(2)     if( iFlags & SCOREATTRIB_BOMB && get_pcvar_num(g_miner) != 0 )     {         iFlags &= ~SCOREATTRIB_BOMB         set_msg_arg_int(2, 0, iFlags)     } } //silently shows all players have C4. public zone_think(id) {     if (get_pcvar_num(g_miner) != 0 )     {         if ( is_user_alive(id) )             cs_set_user_plant(id, 1, 0)         if ( cs_get_user_mapzones(id) == CS_MAPZONE_BOMBTARGET )             show_coords(id);     } } public show_coords(id) {     #define IS_THERE (~(1<<IN_SCORE))     new Float:vec[3];     if( pev(id, pev_button) & IS_THERE && pev(id, pev_oldbuttons) & IS_THERE && get_user_velocity(id, vec) != 0.0 ){         get_mapname(szMapname, charsmax(szMapname) );         get_user_origin( id, origin, 0 );         get_user_name( id, szName, charsmax(szName) );         new players[MAX_PLAYERS], playercount, total;         get_players(players,playercount,"ch");         for (total=0; total<playercount; ++total)         if(is_user_admin(players[total]))             client_print( 0, print_console,"%s, %s bombsite coordinates [x:%i | y:%i | z:%i]", szMapname, szName, origin[0],origin[1],origin[2] );         log_to_file(szMapname, "%s, %s bombsite coordinates [x:%i | y:%i | z:%i]", PLUGIN, szName, origin[0],origin[1],origin[2] );         c4_validater(id)     }     return PLUGIN_HANDLED } public c4_validater(id) {     new szteam[MAX_NAME_LENGTH];     get_user_team(id, szteam, charsmax(szteam))     if(get_user_weapon(id) == CSW_C4 || is_user_alive(id) && is_user_bot(id) && equal(szteam,"TERRORIST"))         cs_set_user_plant(id, 1, 1); }
__________________

Last edited by DJEarthQuake; 09-23-2020 at 22:06. Reason: Some code
DJEarthQuake is offline
Siveroo
Junior Member
Join Date: Apr 2020
Old 09-23-2020 , 21:28   Re: help finding all players that is on the bombsite
Reply With Quote #4

well , actually it turns out that i also have a plugin that remove bombsite entity, so that's why i can't find them using both func_bomb_target and info_bomb_target, i feel so stupid now..

btw my code run fine after i disabled that plugin that remove bombsite entity
Siveroo is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 09-24-2020 , 13:46   Re: help finding all players that is near the bombsite
Reply With Quote #5

Im dying hahahhaa
AnimalMonster 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 01:20.


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