AlliedModders

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

vbSteve 07-09-2007 09:33

kill hostages.
 
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,

VEN 07-09-2007 12:55

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

Alka 07-09-2007 15:26

Re: kill hostages.
 
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.

XxAvalanchexX 07-09-2007 16:18

Re: kill hostages.
 
Change your -1 parameter to ent. Also GunGame removes all objectives without actually removing them, except for VIP, if you're curious.

Alka 07-09-2007 17:01

Re: kill hostages.
 
Quote:

Originally Posted by XxAvalanchexX (Post 501159)
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!

Rolnaaba 07-09-2007 21:34

Re: kill hostages.
 
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 :D)

Alka 07-10-2007 04:38

Re: kill hostages.
 
Hum...0o right! I edited the post. :wink:

vbSteve 07-10-2007 05:20

Re: kill hostages.
 
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.


Rolnaaba 07-10-2007 10:29

Re: kill hostages.
 
compiles fine for me...

VEN 07-10-2007 13:41

Re: kill hostages.
 
Probably you have an old AMX Mod X version (<1.70)


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

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