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-10-2007 , 05:20   Re: kill hostages.
Reply With Quote #1

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


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