Raised This Month: $ Target: $400
 0% 

Infinite roundtime, remove bombsites


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
4JOKE
Member
Join Date: Jan 2008
Old 12-20-2008 , 20:28   Infinite roundtime, remove bombsites
Reply With Quote #1

I find out in this forum, that is only one way to set infinite roundtime. I have to remove bombsites.

So I find some sources and tryed to make my own amx plugin. Here is my code to remove/create 2 bombsites:

PHP Code:
public create_bs() {
    
enum siteinfo
{
Float:mins[3],
Float:maxx[3],
Float:origin[3]
}
new 
g_BombSites[2][siteinfo]
new 
target = -1    
    
target 
create_entity("func_bomb_target")
entity_set_size(entg_BombSites[1][mins], g_BombSites[1][maxs])
entity_set_origin(entg_BombSites[1][origin])

target create_entity("func_bomb_target")
entity_set_size(entg_BombSites[2][mins], g_BombSites[2][maxs])
entity_set_origin(entg_BombSites[2][origin])

}

public 
destroy_bs()
{
enum siteinfo
{
Float:mins[3],
Float:maxx[3],
Float:origin[3]
};
new 
g_BombSites[2][siteinfo]
new 
target = -1

find_ent_by_class
(target"func_bomb_target")
entity_get_vector(targetEV_VEC_minsg_BombSites[1][mins])
entity_get_vector(targetEV_VEC_maxsg_BombSites[1][maxs])
entity_get_vector(targetEV_VEC_origing_BombSites[1][origin])
remove_entity(target)

find_ent_by_class(target"func_bomb_target")
entity_get_vector(targetEV_VEC_minsg_BombSites[2][mins])
entity_get_vector(targetEV_VEC_maxsg_BombSites[2][maxs])
entity_get_vector(targetEV_VEC_origing_BombSites[2][origin])
remove_entity(target)

But I am not good at amx, so I realy don't understant to type enum .
I am getting this error : Error: Invalid expression, assumed zero on line...

Can somebody help?
Thnx.
4JOKE is offline
hzqst
Senior Member
Join Date: Jul 2008
Old 12-20-2008 , 20:40   Re: Infinite roundtime, remove bombsites
Reply With Quote #2

why not using fakemeta?..

Quote:
new Float:g_BombSites_origin[3]
new Float:g_BombSites_mins[3]
new Float:g_BombSites_maxs[3]

public create_bs() {
new ent
ent = engfunc(EngFunc_CreateNamedEntity, engfunc (EngFunc_AllocString, "info_bomb_target"))
if(pev_valid(ent))
set_pev(ent, pev_origin, g_BombSites_oigin)
dllfunc(DLLFunc_Spawn, ent)
}
Quote:
public destroy_bs(){
new ent
while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "info_bomb_target")) != 0)
engfunc(EngFunc_RemoveEntity,ent)
}
and you should know that entity_set_origin doesn't work for brush entity

Quote:
public create_bs_brushent() {//brush entity
new ent
ent = engfunc(EngFunc_CreateNamedEntity, engfunc (EngFunc_AllocString, "func_bomb_target"))
if(pev_valid(ent)){
engfunc(EngFunc_SetSize, ent, g_bombsites_mins, g_bombsites_maxs)
engfunc(EngFunc_SetOrigin, ent, g_bombsites_origin)
dllfunc(DLLFunc_Spawn, ent)
}
}

Last edited by hzqst; 12-20-2008 at 20:48.
hzqst is offline
4JOKE
Member
Join Date: Jan 2008
Old 12-21-2008 , 05:46   Re: Infinite roundtime, remove bombsites
Reply With Quote #3

hmm, I found some mistakes in your code.
1) To stop roundtimer, I have to destroy entity "func_bomb_target"
2) In destroy() you have to somewhere save max,minx,origin of all bombsites

Why I don't use fakemeta? Because I'm not so much skilled in amx, and my code is easier for me to understand.

So, these my code should be alright? (I wrote only scheme here) :
PHP Code:
new float:mins,maxs

destroy
() {
save mins,maxs of 1.Bombsite ("func_bomb_target")
destroy 1.bombsite
save mins
,maxs of 2.Bombsite ("func_bomb_target")
destroy 2.bombsite
}

create() {
create 1.bombsite ("func_bomb_target")
set mins,maxs to 1.bombsite which I saved
create 2.bombsite 
("func_bomb_target")
set mins,maxs to 1.bombsite which I saved

Is it alright ?
- because i don't know if I destroy "func_bomb_target", if I have to create "func_bomb_target" and also "info_bomb_target" ?
- because to stoptimer, I only need to destroy "func_bomb_target".

Last edited by 4JOKE; 12-21-2008 at 05:50.
4JOKE is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 12-21-2008 , 05:55   Re: Infinite roundtime, remove bombsites
Reply With Quote #4

There exists many plugins for this, even only for this, and they work. If you still want to make your own, you can get help from them.
SnoW is offline
Send a message via MSN to SnoW
4JOKE
Member
Join Date: Jan 2008
Old 12-21-2008 , 06:17   Re: Infinite roundtime, remove bombsites
Reply With Quote #5

For first I found only No Objectives v0.3 , but I changed searching words and I think that I found some new...
4JOKE is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 12-21-2008 , 16:24   Re: Infinite roundtime, remove bombsites
Reply With Quote #6

Removing bombsites is simple:
You search for entities with the bombsite classname, and remove them.
Code:
new iEnt = -1;     while( engfunc( EngFunc_FindEntityByString, iEnt, "classname", "func_bomb_target" ) > 0 )     {         fm_remove_entity( iEnt );     }          new iEnt = -1;     while( engfunc( EngFunc_FindEntityByString, iEnt, "classname", "info_bomb_target" ) > 0 )     {         fm_remove_entity( iEnt );     }
Not sure about the info_bomb_target thought, added it to be safe.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-21-2008 , 16:38   Re: Infinite roundtime, remove bombsites
Reply With Quote #7

You can try this, it's not fully tested.

PHP Code:
/*    Copyright İ 2008, ConnorMcLeod

    No Objectives is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with No Objectives; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

#pragma semicolon    1

#define PLUGIN "Block Round End"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.3"

#define MAX_PLAYERS    32

#define HITGROUP_HEAD    1

#define MAX_OBJECTIVES    9
#define HIDE_TIMER    (1<<4)

#define fm_get_user_team(%1)    get_pdata_int(%1,114,5)

#define OFFSET_CSDEATHS                444
#define cs_get_user_deaths(%1)    get_pdata_int(%1,OFFSET_CSDEATHS)
#define fm_set_user_deaths(%1,%2)    set_pdata_int(%1,OFFSET_CSDEATHS,%2)

new const g_szObjectivesClasses[MAX_OBJECTIVES][] = {
    
"func_bomb_target",
    
"info_bomb_target",
    
"hostage_entity",
    
"monster_scientist",
    
"func_hostage_rescue",
    
"info_hostage_rescue",
    
"info_vip_start",
    
"func_vip_safetyzone",
    
"func_escapezone"
};

new const 
g__szObjectivesClasses[MAX_OBJECTIVES][] = {
    
"_func_bomb_target",
    
"_info_bomb_target",
    
"_hostage_entity",
    
"_monster_scientist",
    
"_func_hostage_rescue",
    
"_info_hostage_rescue",
    
"_info_vip_start",
    
"_func_vip_safetyzone",
    
"_func_escapezone"
};

new 
sv_restartround;
new 
gmsgHideWeapongmsgCrosshairgmsgDeathMsggmsgScoreInfo;
new 
g_iHideWeapon;
new 
g_iMaxPlayers;
new 
bool:g_bBlockRoundEnd;
new 
bool:g_bAlive[MAX_PLAYERS+1];
new 
bool:g_bHeadShot[MAX_PLAYERS+1][MAX_PLAYERS+1];

public 
plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR );

    
register_event("ResetHUD""Event_ResetHUD""b");

    
register_concmd("roundend_block""ConsoleCommand_Block"ADMIN_CFG);
    
register_concmd("roundend_allow""ConsoleCommand_Allow"ADMIN_CFG);

    
RegisterHam(Ham_Spawn"player""Player_Spawn");
    
RegisterHam(Ham_Killed"player""Player_Killed");
    
RegisterHam(Ham_TraceAttack"player""Player_TraceAttack"1);

    
sv_restartround get_cvar_pointer("sv_restartround");
    
gmsgHideWeapon get_user_msgid("HideWeapon");
    
gmsgCrosshair get_user_msgid("Crosshair");
    
gmsgDeathMsg get_user_msgid("DeathMsg");
    
gmsgScoreInfo get_user_msgid("ScoreInfo");
    
g_iMaxPlayers get_maxplayers();
}

public 
ConsoleCommand_Block(idlevelcid)
{
    if( !
cmd_access(idlevelcid1) )
    {
        return 
PLUGIN_HANDLED;
    }

    if( 
g_bBlockRoundEnd )
    {
        return 
PLUGIN_HANDLED;
    }

    
g_bBlockRoundEnd true;

    for(new 
ii<MAX_OBJECTIVESi++)
    {
        
Change_Classname(g_szObjectivesClasses[i], g__szObjectivesClasses[i]);
    }

    if(!
g_iHideWeapon)
    {
        
g_iHideWeapon register_message(gmsgHideWeapon"Message_HideWeapon");
    }

    
set_pcvar_float(sv_restartround1.0);

    return 
PLUGIN_HANDLED;
}

public 
ConsoleCommand_Allow(idlevelcid)
{
    if( !
cmd_access(idlevelcid1) )
    {
        return 
PLUGIN_HANDLED;
    }

    if( !
g_bBlockRoundEnd )
    {
        return 
PLUGIN_HANDLED;
    }

    
g_bBlockRoundEnd false;

    for(new 
ii<MAX_OBJECTIVESi++)
    {
        
Change_Classname(g__szObjectivesClasses[i], g_szObjectivesClasses[i]);
    }

    if( 
g_iHideWeapon )
    {
        
unregister_message(gmsgHideWeapong_iHideWeapon);
        
g_iHideWeapon 0;
    }

    
set_pcvar_float(sv_restartround1.0);

    return 
PLUGIN_HANDLED;
}

Change_Classname(szOldClassName[], szNewClassname[])
{
    new 
iEntszClassname[] = "classname";
    while(  ( 
iEnt engfunc(EngFunc_FindEntityByStringiEntszClassnameszOldClassName) )  )
    {
        
set_pev(iEntpev_classnameszNewClassname);
    }
}

public 
Message_HideWeapon(iMsgIdMSG_DESTid)
{
    
set_msg_arg_int(1ARG_BYTEget_msg_arg_int(1) | HIDE_TIMER);
}

public 
Event_ResetHUD(id)
{
    if(
g_bBlockRoundEnd)
    {
        
Hide_Timer(id);
        
set_task(0.01"Hide_Timer_Full"id);
    }
}

public 
Hide_Timer_Full(id)
{
    
Hide_Timer(id);

    
message_begin(MSG_ONE_UNRELIABLEgmsgCrosshair_id);
    
write_byte(0);
    
message_end();
}

Hide_Timer(id)
{
    
message_begin(MSG_ONE_UNRELIABLEgmsgHideWeapon_id);
    
write_byte(HIDE_TIMER);
    
message_end();
}

public 
Player_Spawnid )
{
    if( 
is_user_alive(id) )
    {
        
g_bAlive[id] = true;
    }
}

public 
Player_TraceAttack(ididattackerFloat:damageFloat:fDirection[3], trace_handledamagebits)
{
    if( (
<= idattacker <= g_iMaxPlayers) )
    {
        
g_bHeadShot[idattacker][id] = bool:(get_tr2(trace_handle,TR_iHitgroup) == HITGROUP_HEAD);
    }
}

public 
Player_Killed(iVictimiKiller)
{
    
g_bAlive[iVictim] = false;
    if( !
get_alives(fm_get_user_team(iVictim)) )
    {
        
// fake death msg + log_message + score update
        
fake_death(iVictimiKiller);
        
ExecuteHamBHam_SpawniVictim );
        return 
HAM_SUPERCEDE;
    }
    return 
HAM_IGNORED;
}

public 
client_disconnect(id)
{
    
g_bAlive[id] = false;
}

get_alives(iTeam)
{
    new 
iCount;
    for(new 
id 1id <= g_iMaxPlayersid++)
    {
        if( 
g_bAlive[id] && fm_get_user_team(id) == iTeam )
            
iCount++;
    }
    return 
iCount;
}

fake_death(iVictimiKiller)
{
    new 
iEnt pev(iVictimpev_dmg_inflictor);
    new 
szWeaponName[32];
    if( (
<= iKiller <= g_iMaxPlayers) && iKiller == iEnt)
    {
        
get_weaponname(get_user_weapon(iKiller), szWeaponNamecharsmax(szWeaponName));
        
MakeDeathMsg(iKilleriVictimg_bHeadShot[iKiller][iVictim], szWeaponName[7]);
        if(
iKiller != iVictim)
        {
            new 
Float:flFrags;
            
pev(iKillerpev_fragsflFrags);
            
set_pev(iKillerpev_frags, ++flFrags);
            
Make_ScoreInfo(iKillerfloatround(flFrags), cs_get_user_deaths(iKiller), fm_get_user_team(iKiller));
        }
    }
    else
    {
        
pev(iEntpev_classnameszWeaponNamecharsmax(szWeaponName));
        
MakeDeathMsg(iKilleriVictim0szWeaponName);
    }
    new 
iDeaths cs_get_user_deaths(iVictim);
    
fm_set_user_deaths(iVictimiDeaths);
    
Make_ScoreInfo(iVictimget_user_frags(iVictim), iDeathsfm_get_user_team(iVictim));
}

MakeDeathMsg(killervictimheadshot, const weapon[], log=1)
{
    
emessage_begin(MSG_BROADCASTgmsgDeathMsg);
    
ewrite_byte(killer);
    
ewrite_byte(victim);
    
ewrite_byte(headshot);
    
ewrite_string(weapon);
    
emessage_end();

    if( !
log )
        return;

    new 
kname[32], kid[20], kteam[10], vname[32], vid[20], vteam[10];
    
get_user_name(killerknamecharsmax(kname));
    
get_user_authid(killerkidcharsmax(kid));
    
get_user_team(killerkteamcharsmax(kteam));
    
get_user_name(victimvnamecharsmax(vname));
    
get_user_authid(victimvidcharsmax(vid));
    
get_user_team(victimvteamcharsmax(vteam));
    
log_message("^"%s<%d><%s><%s>^" killed ^"[P*D]Eliza (100)<5><BOT><CT>^" with ^"deagle^"",
                
knameget_user_userid(killer), kidkteam,
                
vnameget_user_userid(victim), vidvteamweapon);
}

Make_ScoreInfo(idfragsdeathsteam)
{
    
message_begin(MSG_BROADCASTgmsgScoreInfo);
    
write_byte(id);
    
write_short(frags);
    
write_short(deaths);
    
write_short(0);
    
write_short(team);
    
message_end();

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-21-2008 , 17:39   Re: Infinite roundtime, remove bombsites
Reply With Quote #8

@Connor
What a clever way to hide the entities and still keep them!
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-22-2008 , 01:50   Re: Infinite roundtime, remove bombsites
Reply With Quote #9

Quote:
Originally Posted by Exolent[jNr] View Post
@Connor
What a clever way to hide the entities and still keep them!
Well, that part is the tested and working part.
__________________
- 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 09:09.


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