Raised This Month: $ Target: $400
 0% 

Make/remove end every round.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 01-12-2009 , 02:01   Make/remove end every round.
Reply With Quote #1

I'm trying load my ent as well as remove it on a new round.
It removes the ents but doesn't load them but it prints both messages.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>

new menu[512]
new 
Keysmenu_1 MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_0

public plugin_init() {
    
register_plugin("Sabotage","1.0","Mazza")
    
    
register_logevent("logevent_round_end"2"1=Round_End")  
    
register_event("HLTV""event_new_round""a""1=0""2=0")  

    
register_clcmd("say /menu","Showmenu_1")
    
register_menucmd(register_menuid("menu_press"), Keysmenu_1"Pressedmenu_1")
}

public 
plugin_precache()
{
    
precache_model("models/w_isotopebox.mdl");    
}

public 
plugin_cfg()
{
    
load_objective()
}
public 
logevent_round_end()
{
    new 
iEnt = -1
    
while((iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname""sabotage_t")))
    {
        
engfunc(EngFunc_RemoveEntityiEnt)
    }
    while((
iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname""sabotage_ct")))
    {
        
engfunc(EngFunc_RemoveEntityiEnt)
    }        
    
client_print(0print_chat"OMGLOLOLOLOLOL")

}

public 
event_new_round()
{
    
client_print(0print_chat"OMGWTFBBQ")
    
load_objective()
}

public 
Showmenu_1(id
{
    new 
len formatex(menu511"\rSabotage Menu^n^n")
    
len += formatex(menu[len], 511-len"\y1. \wCreate T bombsite ^n")
    
len += formatex(menu[len], 511-len"\y2. \wCreate CT bombsite ^n^n")
        
    
len += formatex(menu[len], 511-len"\y5. \wSave bombsites ^n^n")
    
    
len += formatex(menu[len], 511-len"\y0. \wExit")
    
    
show_menu(idKeysmenu_1menu, -1"menu_press")
}

public 
Pressedmenu_1(idkey) {
    
/* 
    *     Sabotage Menu
    * 1: Create T bombsite
    * 2: Create CT bombsite
    
    * 4: SomeThing
    
    * 6: SomeThing
    
    * 0: Exit
    */
    
    
new iEnt = -1
    
    
switch (key
    {
        case 
0
        { 
            while((
iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname""sabotage_t")))
            {
                
engfunc(EngFunc_RemoveEntityiEnt)
            }
            
//client_print(id, print_chat, "First selection")
            
create_objective(1id)
        }
        case 
1
        {
            while((
iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname""sabotage_ct")))
            {
                
engfunc(EngFunc_RemoveEntityiEnt)
            }
            
//client_print(id, print_chat, "Second selection")
            
create_objective(2id)
        } 
        case 
4
        { 
// 5
            
client_print(idprint_chat"[AMXX] Saved objective(s)")
            
save_objective()
            return 
PLUGIN_HANDLED
            
        
}
        case 
9
        {
            
//client_print(id, print_chat, "Last selection")
            
return PLUGIN_HANDLED
        
}
    }
    
Showmenu_1(id)

    return 
PLUGIN_HANDLED 
}

create_objective(teamidFloat:origin[3]= { 0.00.00.0 }, Float:angle[3]= { 0.00.00.0 })
{
    new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));

    if( 
id ){
        
pev(idpev_originorigin);
        
engfunc(EngFunc_SetOriginentorigin );
        
origin[2] += 80.0;
        
engfunc(EngFunc_SetOriginidorigin);

        
pev(id,pev_v_angle,angle);
        
angle[0] = 0.0;
        
set_pev(ent,pev_angles,angle);
    }
    else {
        
engfunc(EngFunc_SetOriginentorigin );
        
set_pev(entpev_anglesangle);
    }

    
set_pev(entpev_takedamage1.0);
    
set_pev(entpev_health100.0);

    switch( 
team )
    {
        case 
1set_pev(entpev_classname"sabotage_t");
        case 
2set_pev(entpev_classname"sabotage_ct");
        default: 
set_pev(entpev_classname"sabotage_box");
    }
    
set_pev(entpev_teamteam);

    
engfunc(EngFunc_SetModelent"models/w_isotopebox.mdl");
    
set_pev(entpev_movetypeMOVETYPE_PUSHSTEP);
    
set_pev(entpev_solidSOLID_BBOX);
    
    new 
Float:mins[3] = { -19.340000, -16.5499990.000000 };
    new 
Float:maxs[3] = { 19.34000015.28000026.180000 };
    
engfunc(EngFunc_SetSizeentminsmaxs);
    
    
engfunc(EngFunc_DropToFloorent);
}

load_objective()
{
    static 
sConfigsDir[256], sFile[256], SabDir[256];
    
    
get_configsdir(sConfigsDirsizeof sConfigsDir 1);
    
    static 
sMapName[32];
    
get_mapname(sMapNamesizeof sMapName 1);
    
    
formatex(SabDirsizeof SabDir 1,"%s/Sabotage",sConfigsDir);
    
formatex(sFilesizeof sFile 1"%s/%s.cfg",SabDir,sMapName);
        
    
    if(!
dir_exists(SabDir))
    {
        
mkdir(SabDir);
    }
    
    if(!
file_exists(sFile))
    {
        
write_file(sFile,"");
    }
    
    static 
sFileOrigin[3][32]
    static 
sTeam[128], sOrigin[128], sAngle[128];
    static 
fTeamFloat:fOrigin[3], Float:fAngles[3];
    static 
iLineiLengthsBuffer[256];
    
    while(
read_file(sFileiLine++, sBuffersizeof sBuffer 1iLength))
    {
        if((
sBuffer[0]== ';') || !iLength)
            continue;
        
        
strtok(sBuffersOriginsizeof sOrigin 1sAnglesizeof sAngle 1'|'0);
        
        
strtok(sOriginsTeamsizeof sTeam 1sOriginsizeof sOrigin -1'~'0);
        
        
parse(sOriginsFileOrigin[0], sizeof sFileOrigin[] - 1sFileOrigin[1], sizeof sFileOrigin[] - 1sFileOrigin[2], sizeof sFileOrigin[] - 1);
        
        
fOrigin[0] = str_to_float(sFileOrigin[0]);
        
fOrigin[1] = str_to_float(sFileOrigin[1]);
        
fOrigin[2] = str_to_float(sFileOrigin[2]);
        
        
fTeam str_to_num(sTeam[0])
        
        
fAngles[1] = str_to_float(sAngle[1]);
        
        
create_objective(fTeam0fOriginfAngles)
    }
}

save_objective()
{
    static 
sConfigsDir[256], sFile[256], SabDir[256];
    
    
get_configsdir(sConfigsDirsizeof sConfigsDir 1);
    
    static 
sMapName[32];
    
get_mapname(sMapNamesizeof sMapName 1);
    
    
formatex(SabDirsizeof SabDir 1,"%s/Sabotage",sConfigsDir);
    
formatex(sFilesizeof sFile 1"%s/%s.cfg",SabDir,sMapName);
        
    if(
file_exists(sFile))
        
delete_file(sFile);
    
    new 
iEnt = -1Float:fEntTeamFloat:fEntOrigin[3], Float:fEntAngles[3];
    static 
sBuffer[256];
    
    while((
iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname""sabotage_t")))
    {
        
pev(iEntpev_teamfEntTeam);
        
pev(iEntpev_originfEntOrigin);
        
pev(iEntpev_anglesfEntAngles);
        
        
formatex(sBuffersizeof sBuffer 1"%d ~ %d %d %d | %d"floatround(fEntTeam), floatround(fEntOrigin[0]), floatround(fEntOrigin[1]), floatround(fEntOrigin[2]), floatround(fEntAngles[1]));
        
        
write_file(sFilesBuffer, -1);
    }
    
    while((
iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname""sabotage_ct")))
    {
        
pev(iEntpev_teamfEntTeam);
        
pev(iEntpev_originfEntOrigin);
        
pev(iEntpev_anglesfEntAngles);
        
        
formatex(sBuffersizeof sBuffer 1"%d ~ %d %d %d | %d"floatround(fEntTeam), floatround(fEntOrigin[0]), floatround(fEntOrigin[1]), floatround(fEntOrigin[2]), floatround(fEntAngles[1]));
        
        
write_file(sFilesBuffer, -1);
    } 

__________________
It's a mystery.
Mini_Midget is offline
 



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 01:44.


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