Raised This Month: $ Target: $400
 0% 

[DONE]How to check if map has bombsite?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-08-2013 , 09:00   [DONE]How to check if map has bombsite?
Reply With Quote #1

How to check if map has bombsite?

Last edited by Unkolix; 02-08-2013 at 12:13.
Unkolix is offline
kketan77
Member
Join Date: Apr 2012
Location: India
Old 02-08-2013 , 11:21   Re: How to check if map has bombsite?
Reply With Quote #2

PHP Code:
// Is map contain bomb targets?
    
if (fm_find_ent_by_class(-1"func_bomb_target") || fm_find_ent_by_class(-1"info_bomb_target")) 

Read more about this here:

[FAQ/Tutorial] CS Bomb Scripting : https://forums.alliedmods.net/showthread.php?t=40164
__________________
♚ || -=[ḰḝṮẫṊ]=- || ᕙ(`▽´)ᕗ || (⊙.⊙(☉_☉)⊙.⊙) || ⁀⊙﹏☉⁀
kketan77 is offline
Send a message via Yahoo to kketan77
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-08-2013 , 11:24   Re: How to check if map has bombsite?
Reply With Quote #3

in plugin_init :

PHP Code:
if( find_ent_by_class(-1"func_bomb_target") || find_ent_by_class(-1"info_bomb_target") ) 
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 02-08-2013 at 11:24.
ConnorMcLeod is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-08-2013 , 11:29   Re: How to check if map has bombsite?
Reply With Quote #4

I get error compiling: Error: Undefined symbol "find_ent_by_class" on line 69

Last edited by Unkolix; 02-08-2013 at 11:29.
Unkolix is offline
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 02-08-2013 , 11:42   Re: How to check if map has bombsite?
Reply With Quote #5

Add this to ur code:
PHP Code:
#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2) 
__________________
simanovich is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-08-2013 , 11:44   Re: How to check if map has bombsite?
Reply With Quote #6

Still the same probelm.

EDIT: I removed the fm_ and it compiled.

I mean, how do I now check if that is true?
Something like:
PHP Code:
if(has_bombsite

Last edited by Unkolix; 02-08-2013 at 11:47.
Unkolix is offline
P1raten
Senior Member
Join Date: Feb 2010
Old 02-08-2013 , 11:51   Re: How to check if map has bombsite?
Reply With Quote #7

Quote:
Originally Posted by Unkolix View Post
Still the same probelm.

EDIT: I removed the fm_ and it compiled.

I mean, how do I now check if that is true?
Something like:
PHP Code:
if(has_bombsite
I'm guessing you forgot to include engine.
__________________
No salvation. Only madness.
P1raten is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-08-2013 , 14:01   Re: [DONE]How to check if map has bombsite?
Reply With Quote #8

PHP Code:
new bool:g_bHasBombSite

public plugin_init()
{
    
g_bHasBombSite = !!( find_ent_by_class(-1"func_bomb_target") || find_ent_by_class(-1"info_bomb_target") )


Then you can use where you want in plugin (excepted in plugin_precache and plugin_natives) :

PHP Code:
if( g_bHasBombSite 
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-08-2013 , 14:19   Re: [DONE]How to check if map has bombsite?
Reply With Quote #9

I've done like this:
PHP Code:
new bool:g_bHasBombSite
//In plugin init
if( find_ent_by_class(-1"func_bomb_target") || find_ent_by_class(-1"info_bomb_target") )  
{
    
g_bHasBombSite true;

Then
PHP Code:
if(g_bHasBombSite
Unkolix is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-08-2013 , 14:21   Re: [DONE]How to check if map has bombsite?
Reply With Quote #10

Correct.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 11:11.


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