Raised This Month: $ Target: $400
 0% 

Hostage events


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sputnik53
Senior Member
Join Date: Jun 2005
Old 03-05-2008 , 09:32   Hostage events
Reply With Quote #1

Hey I need to get 3 different hostage events.

1. Player tells a hostage to follow (+use), I need to get both hostage ID and player's ID.
2. Player rescues one hostage, need player's id.
3. Player kills a hostage, need player's id.

I tried to search but found nothing I could get working. :/
Sputnik53 is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 03-05-2008 , 12:28   Re: Hostage events
Reply With Quote #2

Just hook Ham_Use and Ham_TakeDamage (see Ham Sandwich includes).
VEN is offline
Sputnik53
Senior Member
Join Date: Jun 2005
Old 03-05-2008 , 12:34   Re: Hostage events
Reply With Quote #3

I was kinda hoping for Fakemeta or Engine because I have no idea how to use Ham Sandwich. :/
Sputnik53 is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 03-05-2008 , 12:46   Re: Hostage events
Reply With Quote #4

For hostage thing you can use fakemeta..."FM_Use" forward, but for takedamage you must use hamsandwich, search on forums for Ham_TakeDamage and you will find some examples...
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-05-2008 , 13:10   Re: Hostage events
Reply With Quote #5

For 2 and 3 :
PHP Code:
#include <amxmodx>
 
public plugin_init()
{
    
register_logevent("Hostage_Rescued"3"2=Rescued_A_Hostage")
    
register_event("TextMsg""Hostage_Kill""b""1=4""2=#Killed_Hostage")
}
 
public 
Hostage_Rescued()
{
    static 
loguser[80], name[32], id
    read_logargv
(0loguser79)
    
parse_loguser(logusername31)
    
id get_user_index(name)
}

public 
Hostage_Kill(id)
{

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 03-05-2008 , 13:29   Re: Hostage events
Reply With Quote #6

Quote:
you can use fakemeta..."FM_Use" forward
FM_Use will not work. The reason in some other threads.
VEN is offline
Sputnik53
Senior Member
Join Date: Jun 2005
Old 03-05-2008 , 15:14   Re: Hostage events
Reply With Quote #7

Code:
L 03/05/2008 - 22:07:38: [AMXX] Plugin "hostagestuff.amxx" failed to load: Plugin uses an unknown function (name "RegisterHam") - check your modules.ini
Code:
] amxx modules
Currently loaded modules:
      name                    version     author               status     
 [ 1] Fun                     1.8.0.3660  AMX Mod X Dev Team   running    
 [ 2] CStrike                 1.8.0.3660  AMX Mod X Dev Team   running    
 [ 3] CSX                     1.8.0.3660  AMX Mod X Dev Team   running    
 [ 4] Engine                  1.8.0.3660  AMX Mod X Dev Team   running    
 [ 5] FakeMeta                1.8.0.3660  AMX Mod X Dev Team   running    
 [ 6] Ham Sandwich            1.8.0.3660  AMX Mod X Dev Team   running    
6 modules, 6 correct
PHP Code:
#include <amxmodx>
#include <hamsandwich>

new bool:IAmUsed[33]

public 
plugin_init() {
    
RegisterHam(Ham_Use,"hostage_entity","event_hostage_used",1)
}

public 
event_hostage_used(hostageid) {
    if(!
IAmUsed[hostage]) {
        
IAmUsed[hostage] = true
        client_print
(id,print_chat,"Used a hostage")
    }


Last edited by Sputnik53; 03-05-2008 at 15:26.
Sputnik53 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-05-2008 , 16:15   Re: Hostage events
Reply With Quote #8

Works for me, try latest builds :
http://www.amxmodx.org/nightly.php


also, you should pass all args :
(this, idcaller, idactivator, use_type, Float:value)

so you can check that value is equal to 1.0

You also may want to check player team.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Sputnik53
Senior Member
Join Date: Jun 2005
Old 03-05-2008 , 16:41   Re: Hostage events
Reply With Quote #9

PHP Code:
public event_hostage_used(hostageididactivatoruse_typeFloat:value) {
    new 
hostageID cs_get_hostage_id(hostage)
    if(!
IAmUsed[hostageID] && value == 1.0 && cs_get_user_team(id) == CS_TEAM_CT) {
        
IAmUsed[hostageID] = true
        client_print
(id,print_chat,"Used a hostage")
    }

Working thanks VEN and conorr.
Sputnik53 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-06-2008 , 06:04   Re: Hostage events
Reply With Quote #10

You also may pre-register the forward, and compare gametime with hostage offset OFFSET_HOSTAGE_NEXTUSE

#define OFFSET_HOSTAGE_NEXTUSE 100

I'm not sure of what you exactly have to do, but sometime, a CT can "stole" an hostage from another CT.
__________________
- 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 04:30.


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