AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   func_bomb_target (https://forums.alliedmods.net/showthread.php?t=143229)

njee 11-16-2010 13:30

func_bomb_target
 
how to catch an event when a player is in the area func_bomb_target ?

ConnorMcLeod 11-16-2010 13:32

Re: func_bomb_target
 
For all players or only for c4 carrier ?

njee 11-16-2010 13:34

Re: func_bomb_target
 
Quote:

Originally Posted by ConnorMcLeod (Post 1350702)
For all players or only for c4 carrier ?

if not complicate both examples... If a player performs an action in the area

Emp` 11-16-2010 16:25

Re: func_bomb_target
 
Catch the event you want and check if cs_get_user_mapzones for the player has the corresponding bit for bomb target.
Code:

#define CS_MAPZONE_BUY                        (1<<0)
#define CS_MAPZONE_BOMBTARGET                (1<<1)
#define CS_MAPZONE_HOSTAGE_RESCUE        (1<<2)
#define CS_MAPZONE_ESCAPE                (1<<3)
#define CS_MAPZONE_VIP_SAFETY                (1<<4)

/* Returns in bitwise form if the user is in a specific map zone.
 * NOTE: If user can't plant (cs_get_user_plant(index) is 0) then cs_get_user_mapzones(index) & CS_MAPZONE_BOMBTARGET will return 0 too.
 */
native cs_get_user_mapzones(index);

However, looking at the NOTE, it seems you would be able to just check cs_get_user_plant.

If you need to know for a player without the ability to plant, you could attempt to find the bounds of the bomb target's entity (pev_mins and pev_maxs) and check if the player is within that space.

njee 11-17-2010 02:06

Re: func_bomb_target
 
Quote:

Originally Posted by Emp` (Post 1350829)
Catch the event you want and check if cs_get_user_mapzones for the player has the corresponding bit for bomb target.
Code:

#define CS_MAPZONE_BUY                        (1<<0)
#define CS_MAPZONE_BOMBTARGET                (1<<1)
#define CS_MAPZONE_HOSTAGE_RESCUE        (1<<2)
#define CS_MAPZONE_ESCAPE                (1<<3)
#define CS_MAPZONE_VIP_SAFETY                (1<<4)

/* Returns in bitwise form if the user is in a specific map zone.
 * NOTE: If user can't plant (cs_get_user_plant(index) is 0) then cs_get_user_mapzones(index) & CS_MAPZONE_BOMBTARGET will return 0 too.
 */
native cs_get_user_mapzones(index);

However, looking at the NOTE, it seems you would be able to just check cs_get_user_plant.

If you need to know for a player without the ability to plant, you could attempt to find the bounds of the bomb target's entity (pev_mins and pev_maxs) and check if the player is within that space.

can be an example, please

abdul-rehman 11-17-2010 02:52

Re: func_bomb_target
 
You can make a stock or macro for it:
Code:
stock is_user_in_plant_zone( id ) {     return (cs_get_user_mapzones(index) & CS_MAPZONE_BOMBTARGET) } // Or a macro will be more effecient #define is_user_in_plant_zone(%1) (cs_get_user_mapzones(index) & CS_MAPZONE_BOMBTARGET)
Usage:
Code:
public some_function( id ) {     if ( is_user_in_plant_zone( id ) )         client_print( id, print_chat, "What r u waiting for ?? Plant the Bomb !!" ) }
But it would be better if you check whether the user is in the plant zone by using emps' method ( Checking min's and max's )

njee 11-17-2010 03:06

Re: func_bomb_target
 
Quote:

Originally Posted by abdul-rehman (Post 1351065)
You can make a stock or macro for it:
Code:
stock is_user_in_plant_zone( id ) {     return (cs_get_user_mapzones(index) & CS_MAPZONE_BOMBTARGET) } // Or a macro will be more effecient #define is_user_in_plant_zone(%1) (cs_get_user_mapzones(index) & CS_MAPZONE_BOMBTARGET)
Usage:
Code:
public some_function( id ) {     if ( is_user_in_plant_zone( id ) )         client_print( id, print_chat, "What r u waiting for ?? Plant the Bomb !!" ) }
But it would be better if you check whether the user is in the plant zone by using emps' method ( Checking min's and max's )

thanks guys! karma:up:


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

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