AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [DONE]How to check if map has bombsite? (https://forums.alliedmods.net/showthread.php?t=207917)

Unkolix 02-08-2013 09:00

[DONE]How to check if map has bombsite?
 
How to check if map has bombsite?

kketan77 02-08-2013 11:21

Re: How to check if map has bombsite?
 
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

ConnorMcLeod 02-08-2013 11:24

Re: How to check if map has bombsite?
 
in plugin_init :

PHP Code:

if( find_ent_by_class(-1"func_bomb_target") || find_ent_by_class(-1"info_bomb_target") ) 


Unkolix 02-08-2013 11:29

Re: How to check if map has bombsite?
 
I get error compiling: Error: Undefined symbol "find_ent_by_class" on line 69

simanovich 02-08-2013 11:42

Re: How to check if map has bombsite?
 
Add this to ur code:
PHP Code:

#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2) 


Unkolix 02-08-2013 11:44

Re: How to check if map has bombsite?
 
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


P1raten 02-08-2013 11:51

Re: How to check if map has bombsite?
 
Quote:

Originally Posted by Unkolix (Post 1890161)
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.

ConnorMcLeod 02-08-2013 14:01

Re: [DONE]How to check if map has bombsite?
 
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 


Unkolix 02-08-2013 14:19

Re: [DONE]How to check if map has bombsite?
 
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


ConnorMcLeod 02-08-2013 14:21

Re: [DONE]How to check if map has bombsite?
 
Correct.


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

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