AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Find bombsite class! (https://forums.alliedmods.net/showthread.php?t=225128)

kiki33hun 09-01-2013 06:13

Find bombsite class!
 
Hello guys. How to get Bombsite A and Bombsite B valid cordiantes?

I am probaly this code:
PHP Code:

stock find_bomb_targets(Float:location1[3],Float:location2[3])
{
    new 
ent1=find_ent_by_class(32,"func_bomb_target")
    new 
ent2=find_ent_by_class(ent1,"info_bomb_target")
    
get_brush_entity_origin(ent1location1)
    
get_brush_entity_origin(ent2location2)
    return 
PLUGIN_CONTINUE


and dont set valid cordiantes? Example: I am set user orifin the bombsite origin, and put in the wall! Thanks for helping.

Black Rose 09-01-2013 09:43

Re: Find bombsite class!
 
XY-problem will only make your plugin bad.

This works fine for me. I tried it by running beampoints along the Z-axis and both of them hit the red cross on de_dust.
Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_plugin("", "", "");     new Float:locations[2][3]     find_bomb_targets(locations);     server_print("Location 1: %d, %d, %d", floatround(locations[0][0]), floatround(locations[0][1]), floatround(locations[0][2]));     server_print("Location 2: %d, %d, %d", floatround(locations[1][0]), floatround(locations[1][1]), floatround(locations[1][2])); } stock find_bomb_targets(Float:locations[2][3]) {     new ent, i;     while ( i < 2 && (ent = find_ent_by_class(ent,"func_bomb_target") ) ) {         get_brush_entity_origin(ent, locations[i]);         i++;     } }

Code:

Location 1: 1952, 608, 80
Location 2: 352, -1656, 128


kiki33hun 09-02-2013 01:30

Re: Find bombsite class!
 
Thanks worked.

devilicioux 09-02-2013 05:04

Re: Find bombsite class!
 
Sweet !! can we direct player somehow to the closest bombsite or show him direction via some sprite or something or beam or anything ?

bLacK-bLooD 09-02-2013 14:30

Re: Find bombsite class!
 
Quote:

Originally Posted by devilicioux (Post 2026803)
Sweet !! can we direct player somehow to the closest bombsite or show him direction via some sprite or something or beam or anything ?

https://forums.alliedmods.net/showthread.php?t=225234

G[o]Q 09-03-2013 10:13

Re: Find bombsite class!
 
i Use something like that

Code:

public find_all_bombsites(){
    new bs = -1
    while ((bs = find_ent_by_class(bs, "func_bomb_target"))){
        bomb_sites_ids[bomb_sites_count]=bs;
        entity_get_vector(bs,EV_VEC_absmin,bomb_sites[bomb_sites_count][MINS]);
        entity_get_vector(bs,EV_VEC_absmax,bomb_sites[bomb_sites_count++][MAXS]);
    }
    while ((bs = find_ent_by_class(bs, "info_bomb_target"))){
        bomb_sites_ids[bomb_sites_count]=bs;
        entity_get_vector(bs,EV_VEC_absmin,bomb_sites[bomb_sites_count][MINS]);
        entity_get_vector(bs,EV_VEC_absmax,bomb_sites[bomb_sites_count++][MAXS]);
    }
}

and
Code:

#define MAX_BS 5

new Float:bomb_sites[MAX_BS][2][3]
new bomb_sites_ids[MAX_BS];
new bomb_sites_count=0;

enum {MINS=0,MAXS=1}

remember there are maps with 3 bomb-sites or with 1 bomb-site

ConnorMcLeod 09-03-2013 12:09

Re: Find bombsite class!
 
You can have a look to c4 management plugin, all you have to do is to implement brush origin and to store it in the dynamic array.


All times are GMT -4. The time now is 19:05.

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