Raised This Month: $ Target: $400
 0% 

kill hostages.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vbSteve
Junior Member
Join Date: Jun 2006
Old 07-09-2007 , 09:33   kill hostages.
Reply With Quote #1

Hi,

I was wondering if any of you guys can tell me how to kill all the hostages on round start? The goal is to make a plugin that removes the objectives from the map.

But without removing them entirely. -> When the plugin is disabled with a cvar the hostages mustn't die



Thanks in advance,
vbSteve is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 07-09-2007 , 12:55   Re: kill hostages.
Reply With Quote #2

Just force Ham_TakeDamage (see http://forums.alliedmods.net/showthread.php?t=51824 for details) or fakedamage().

Last edited by VEN; 07-09-2007 at 12:58.
VEN is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-09-2007 , 15:26   Re: kill hostages.
Reply With Quote #3

Hum...look! Tested and works.

Code:
#include <amxmodx>
#include <fakemeta_util>
 
#define PLUGIN "Kill Hostages"
#define VERSION "1.0"
#define AUTHOR "AMXX"
 
public plugin_init() {
 
 register_plugin(PLUGIN, VERSION, AUTHOR)
 register_logevent("round_start", 2, "1=Round_Start")
 
}
 
public round_start()
{
     new ent;
     while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "hostage_entity")) != 0)
     {
           if(pev_valid(ent))
           {
                 set_pev(ent, pev_origin, Float:{5000.0,5000.0,5000.0});
           }
     }
}
Thanks Avalanche.
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 07-10-2007 at 15:08.
Alka is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 07-09-2007 , 16:18   Re: kill hostages.
Reply With Quote #4

Change your -1 parameter to ent. Also GunGame removes all objectives without actually removing them, except for VIP, if you're curious.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-09-2007 , 17:01   Re: kill hostages.
Reply With Quote #5

Quote:
Originally Posted by XxAvalanchexX View Post
Change your -1 parameter to ent. Also GunGame removes all objectives without actually removing them, except for VIP, if you're curious.
Ok...thanks for the tip!
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-09-2007 , 21:34   Re: kill hostages.
Reply With Quote #6

if you kill them...wont the round end? Just move them out the map like GunGame and my SewerMonster plugins do. (I stole your method for my sewermonster plug ava )
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-10-2007 , 04:38   Re: kill hostages.
Reply With Quote #7

Hum...0o right! I edited the post.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
vbSteve
Junior Member
Join Date: Jun 2006
Old 07-10-2007 , 05:20   Re: kill hostages.
Reply With Quote #8

Um no, when you kill all the hostages, that map round doesn't end, cuz otherwise the round will end if the terrorists kill all the hostages...

But yeah, maybe moving them outside the map might be better, then you don't see their corpses =)


Thanks for the tips, I'll sure try out these this afternoon



***** Edit *****

Compiled and received error "invalid symbol pev_valid"
fakemeta_utill added to inculde files.

Code:
Code:
// ========== CTF Classic Mod. © 2007. mCoDev Systems ============
// 
// Description: Removes CS Objectives C4 and Hostages
// Keywords:	c4, hostages, objectives
// References:	ctf_core
//
// ===============================================================


#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <engine>


// ==  Plugin Info:
#define AppVersion		"2.0"
#define AppName			"CTF Classic - rObj"
#define AppAuthor		"mCoDev Systems"
#define AppCopyright		"© 2007."

// ==  Team definition:
#define T_TEAM			1
#define CT_TEAM			2
#define SPEC_TEAM		3

// ==  Print text prefix:
#define chatPref		"[CTF Classic - rObj]"



// --------------------------------------------------------
//  Purpose:	Initializes plugin.
// --------------------------------------------------------
public plugin_init(){
	register_plugin(AppName, AppVersion, AppAuthor);
	
	register_srvcmd("ctf_remove_c4", "remove_c4");
	register_srvcmd("ctf_remove_hostages", "remove_hostages");
	
	register_cvar("ctf_remove_objectives", "0");
	register_cvar("ctf_robj_debug", "0");
	
	register_logevent("round_start", 2, "1=Round_Start");
	
	
	server_print("%s Loaded success full. rObj Ver %s", chatPref, AppVersion);
	return PLUGIN_HANDLED;
}



// ----------------------------------------------------------
//  Purpose:	This proc is triggered on each round start.
// ----------------------------------------------------------
public round_start(){
	if(get_cvar_num("ctf_robj_debug")) server_print("%s Triggered ROUND_STAR", chatPref);
	
	if(get_cvar_num("ctf_remove_objectives")){ //Only when cvar is on
		if(get_cvar_num("ctf_robj_debug")) server_print("%s Removing objective...", chatPref);
		set_task(0.1, "remove_c4");		// Remove c4
		set_task(0.2, "remove_hostages");	// Removes hossies
	}
	
	return PLUGIN_HANDLED;
}



// ---------------------------------------------------------
//  Purpose:	Removes the bomb from the game.
// ---------------------------------------------------------
public remove_c4(){
	if(get_cvar_num("ctf_robj_debug")) server_print("%s Attempting to remove C4 (if Any)...", chatPref);
	
	new iWeapons[32];
	new iNum;
	new szWeaponName[32];
	
	new weapbox, carrier = 0, ownerent, bomb = find_ent_by_class(-1, "weapon_c4")

	// First find out who carries the bomb, or if it's dropped...
	if (bomb && (ownerent = pev(bomb, pev_owner)) <= get_maxplayers()){
		carrier = ownerent;
	}
	
	
	
	if (carrier){
		// Found player
		// Strip all weapons and give back all weapons except the c4
		if(get_cvar_num("ctf_robj_debug")) server_print("%s C4 is being carried.", chatPref);
		get_user_weapons(carrier, iWeapons, iNum);
		strip_user_weapons(carrier); // Strip all weapons including C4
		// Give back all weapons:
		for( new i = 0; i < iNum; i++ ){
			get_weaponname(iWeapons[i], szWeaponName, 31);
			if(!equali(szWeaponName, "weapon_c4")){
				give_item(carrier, szWeaponName);
			}
		}
		// Inform the player what just has happened:
		client_print(carrier, print_chat, "%s Removed C4! Don't forget to rebuy ammo.");
		
		if(get_cvar_num("ctf_robj_debug")) server_print("%s C4 removed", chatPref);
	} else{
		// Noone carries the bomb. Dropped maybe? remove the dropped bomb...
		if(get_cvar_num("ctf_robj_debug")) server_print("%s C4 is not carried... Dropped maybe?", chatPref);
		if (bomb && (weapbox = pev(bomb, pev_owner)) > get_maxplayers()) {
		        dllfunc(DLLFunc_Think, weapbox);
		        // remove blinking red bomb mark on the radar
		        message_begin(MSG_ALL, get_user_msgid("BombPickup"));
		        message_end();
		        
		        if(get_cvar_num("ctf_robj_debug")) server_print("%s C4 removed.", chatPref);
		}
	}

}



// --------------------------------------------------------
//  Purpose:	Removes all the hostages from sight
// --------------------------------------------------------
public remove_hostages(){
	if(get_cvar_num("ctf_robj_debug")) server_print("%s Attempting to remove hostages (if Any)...", chatPref);

	
	// By Alka from the AMXX forums
	new ent;
	
	while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "hostage_entity")) != 0){
		if(pev_valid(ent)){
			set_pev(ent, pev_origin, Float:{5000.0,5000.0,5000.0});
		}
	}
	
	if(get_cvar_num("ctf_robj_debug")) server_print("%s Hostages removed from sight", chatPref);
}




//
// End of File.
// Created with UltraEdit-32 on Tuesday, July 10th, 2007.
//
Code:
D:\SAVINGS\Small Compiler\old>compile ctf_remove_objects
Small compiler 2.6.0            Copyright (c) 1997-2004, ITB CompuPhase

ctf_remove_objects.sma(136) : error 017: undefined symbol "pev_valid"

1 Error.

Last edited by vbSteve; 07-10-2007 at 06:38.
vbSteve is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-10-2007 , 10:29   Re: kill hostages.
Reply With Quote #9

compiles fine for me...
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 07-10-2007 , 13:41   Re: kill hostages.
Reply With Quote #10

Probably you have an old AMX Mod X version (<1.70)
VEN is offline
Reply


Thread Tools
Display Modes

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 21:28.


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