Raised This Month: $ Target: $400
 0% 

BombSites Origins [ Solved ]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-16-2014 , 10:41   BombSites Origins [ Solved ]
Reply With Quote #1

So , I want to know in which bomb site the bomb is. So, I'm getting bomb origin when it's planted and the bomb sites origins.
From now, I tryed a lot of things but they aren't working. So, do you have an ideea about this ?How should I check if the origins match ?

If it is needed, I'll post here my code.

Last edited by HamletEagle; 05-17-2014 at 05:30.
HamletEagle is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 05-16-2014 , 12:04   Re: BombSites Origins
Reply With Quote #2

Hmm not tested but it will help you

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

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define MAX_BS 2

new const site_name[][] =
{
    
"Site A",
    
"Site B",
    
"Site C"
    
//etc
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("bomb_planted"3"2=Planted_The_Bomb")
}

public 
bomb_planted()
{
    new 
sites_ent[MAX_BS]
    new 
Float:sites_origin[MAX_BS][3]
    new 
Float:c4_origin[3]
    new 
sites find_bs(sites_entsites_origin)
    new 
c4 find_c4(c4_origin)
    
    if(!
sites || !c4)
        return

    
//new planted_site = sites_ent[0]
    
new Float:planted_origin[3]
    
planted_origin[0] = sites_origin[0][0]
    
planted_origin[1] = sites_origin[0][1]
    
planted_origin[2] = sites_origin[0][2]
    new 
site 0
    
for(new 1sitesi++)
    {
        if(
get_distance_f(c4_originplanted_origin) > get_distance_f(c4_originsites_origin[i]))
        {
            
planted_origin[0] = sites_origin[i][0]
            
planted_origin[1] = sites_origin[i][1]
            
planted_origin[2] = sites_origin[i][2]
            
//planted_site = sites_ent[i]
            
site i
        
}
    }
    
    
client_print(0print_chat"Bomb planted on %s"site_name[site])
    
client_print(0print_chat"Bomb site origin %.0f %.0f %.0f"planted_origin[0], planted_origin[1], planted_origin[2])
    
    return
}

stock find_bs(bs_ent[MAX_BS], Float:bs_origin[MAX_BS][3])
{
    new 
bs_found 0
    bs_ent
[0] = -1
    
for(new 0MAX_BSi++)
    {
        
bs_ent[i] = engfunc(EngFunc_FindEntityByStringbs_ent[i], "classname""func_bomb_target")
        if(
MAX_BS 1)
            
bs_ent[i+1] = bs_ent[i]
        
bs_found++
        
get_brush_entity_origin(bs_ent[i], bs_origin[i])
    }
    return 
bs_found
}

stock find_c4(Float:origin[3])
{
    new 
ent = -1
    
while((ent engfunc(EngFunc_FindEntityByStringent"classname""grenade")) && (!(get_pdata_int(ent96) & (1<<8)))) { }
    if(
ent)
    {
        
pev(entpev_originorigin)
        return 
1
    
}
    return 
0

Also, some maps have swapped the site names. I saw a plugin that has a stock to correct that, I can't remember the name right now
NikKOo31 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-16-2014 , 12:26   Re: BombSites Origins
Reply With Quote #3

It helps a lot, I will test to understand why my code didn't work, since it is something like this. Thx.

Last edited by HamletEagle; 05-16-2014 at 12:26.
HamletEagle is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 05-16-2014 , 20:54   Re: BombSites Origins
Reply With Quote #4

What do you want to do? Get bomb's origin, or get bombsite origin?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 05-16-2014 , 23:55   Re: BombSites Origins
Reply With Quote #5

Quote:
Originally Posted by HamletEagle View Post
So , I want to know in which bomb site the bomb is. So, I'm getting bomb origin when it's planted and the bomb sites origins.
From now, I tryed a lot of things but they aren't working. So, do you have an ideea about this ?How should I check if the origins match ?

If it is needed, I'll post here my code.
He wants both the bomb's and bombsite's origin
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
ezio_auditore
Senior Member
Join Date: May 2013
Old 05-16-2014 , 23:57   Re: BombSites Origins
Reply With Quote #6

For bomb's origin, you may try
Code:
#include <amxmodx> #include <csx> #include <fakemeta_util> new Float:f_bOrigin[3] public plugin_init(){     register_plugin("x", "x", "x") } public bomb_planted(planter) {     new iBomb; isPlanted = true     if ((iBomb = fm_find_ent_by_model(-1, "grenade", "models/w_c4.mdl")))     {               pev(iBomb, pev_origin, f_bOrigin)     } }
__________________

Last edited by ezio_auditore; 05-16-2014 at 23:58.
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 05-17-2014 , 02:27   Re: BombSites Origins
Reply With Quote #7

Or better:

https://wiki.alliedmods.net/Half-Lif...vents#BombDrop
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-17-2014 , 05:29   Re: BombSites Origins
Reply With Quote #8

I didn't asked how to find them. I asked something differently,how to compare the bomb and bomb sites origins. Questions is solved as I sai above.

Last edited by HamletEagle; 05-17-2014 at 05:29.
HamletEagle 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 09:36.


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