AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Distance between hostage and a player (https://forums.alliedmods.net/showthread.php?t=82602)

anakin_cstrike 12-26-2008 12:13

Distance between hostage and a player
 
Hi.
I was wondering what is the max. distance between a player and a hostage, enough to trigger "Touched_A_Hostage".
Or i'd like an example of checking if a player pressed USE button to stop the hostage following him. ( i have an ideea but i'm not sure about it and is kinda poor )

Thanks.

ConnorMcLeod 12-26-2008 12:27

Re: Distance between hostage and a player
 
In cs1.6, max distance you can be from an hostage and press +use so the hostage follows you is ~86 units

anakin_cstrike 12-26-2008 12:30

Re: Distance between hostage and a player
 
Quote:

Originally Posted by ConnorMcLeod (Post 733499)
In cs1.6, max distance you can be from an hostage and press +use so the hostage follows you is ~86 units

Thanks, i'll try.

ps: my mistake, i forgot to tell is for 1.6:mrgreen:

EDIT: this doesn't help me very much. Still i have no idea...

SnoW 12-26-2008 12:36

Re: Distance between hostage and a player
 
http://forums.alliedmods.net/showthread.php?t=28405

ConnorMcLeod 12-26-2008 12:59

Re: Distance between hostage and a player
 
But what do you want to do ?

Modify the distance ?

Also, you can have a look there, but it was made for condition zero :
https://forums.alliedmods.net/showthread.php?t=82482

anakin_cstrike 12-26-2008 13:41

Re: Distance between hostage and a player
 
Just an example:

- when press USE: "the hostage is following you"
- another USE press: "the hostage is not following you any more"

or smth like that...
thanks.

anakin_cstrike 12-26-2008 13:53

Re: Distance between hostage and a player
 
One more thing about hostages. I know there is a thread 'how to remove a hostage from radar', but i can't find it...

anakin_cstrike 12-29-2008 10:17

Re: Distance between hostage and a player
 
Nobody ?

SnoW 12-29-2008 10:28

Re: Distance between hostage and a player
 
Quote:

Originally Posted by anakin_cstrike (Post 733556)
One more thing about hostages. I know there is a thread 'how to remove a hostage from radar', but i can't find it...

HL event HostagePos, start message and then just set the coords out of the map.

Dores 12-29-2008 12:23

Re: Distance between hostage and a player
 
Try this:
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <cstrike>

#define VERSION "1.0"
#define HOSTAGE_CLASSNAME    "hostage_entity"

new g_iUsedBy];

public 
plugin_init()
{
    
register_plugin"Catch Using a Hostage"VERSION"Dores" );
    
    if( !
engfuncEngFunc_FindEntityByString, -1"classname"HOSTAGE_CLASSNAME ) )
    {
        return;
    }
    
    
register_forwardFM_Think"Forward_Think" );
    
register_event"HLTV""ev_newRound""a""1=0""2=0" );
}

public 
Forward_Thinkent )
{
    static 
szClass22 ] ; peventpev_classnameszClasscharsmaxszClass ) );
    
    if( !
equalszClassHOSTAGE_CLASSNAME ) )
        return 
FMRES_IGNORED;
    
    new 
hid cs_get_hostage_ident );
    new 
foll cs_get_hostage_follent );
    if( !( 
<= foll <= get_maxplayers() ) && foll != // Not following a player.
        
return FMRES_IGNORED;
    
    if( !
foll // Not following anything.
    
{
        if( 
g_iUsedhid ] )
        {
            
client_printg_iUsedhid ], print_chat"You are not followed by a hostage anymore." );
            
g_iUsedhid ] = 0;
        }
    }
    
    else
    {
        if( !
g_iUsedByhid ] )
        {
            
client_printfollprint_chat"You are now followed by a hostage[ID: %d]."hid );
            
g_iUsedByhid ] = foll;
        }
    }
    
    return 
FMRES_IGNORED;
}

public 
ev_newRound()
{
    for( new 
sizeof g_iUsedBy i++ )
    {
        
g_iUsedBy] = 0;
    }




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

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