AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   10 Sec and break. (https://forums.alliedmods.net/showthread.php?t=140147)

zirualas 10-09-2010 08:29

10 Sec and break.
 
How i can do than hud to count 10 and all glass gona break?

Xalus 10-09-2010 09:24

Re: 10 Sec and break.
 
Try this:

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>

#define PLUGIN "Countdown - Glass"
#define VERSION "1.0"
#define AUTHOR "Xalus"

#define ACCESS ADMIN_KICK

new cCountdown;
new 
Float:g_fStartTime;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
/* Cvar */
    
cCountdown     register_cvar("countdown_status""10");
    
    
/* Say Commands */
    
register_clcmd("say /countdown""Handler");
    
register_clcmd("say countdown""Handler");
}
/*
CountDown Glass:
    - Handler
*/
public Handler(id) {
    if(
get_user_flags(id) & ACCESS) {
        
g_fStartTime get_gametime()
        
StartCountdown()    
    }
}
/*
CountDown Glass:
    - CountDown
*/
public StartCountdown() {
    new 
Float:fRemainingTime = (get_gametime() - g_fStartTime)
    
    if(
get_pcvar_float(cCountdown) <= fRemainingTime) {
        
client_cmd("spk radio/com_go")
        
        new 
ent 0
        
while((ent find_ent_by_class(ent,"func_breakable")) != 0) {
            
ExecuteHamBHam_TakeDamageent009999.0DMG_GENERIC )
        }
    } else {
        new 
Time floatround(get_pcvar_float(cCountdown) - fRemainingTime)
        new 
szTime[32]
        
        
num_to_word(TimeszTime31)
        
        if(
Time <= 10)
            if(
Time)
                
client_cmd(0,"speak ^"vox/%s^""szTime)
                
        
set_hudmessage(random(255), random(255), random(255), -1.00.0506.01.00.00.0, -2);
        
show_hudmessage(0"[Glass Break in: %d Seconds]"Time)
        
// timer
        
set_task(1.0"StartCountdown")
    }
    
    return 
PLUGIN_CONTINUE;



zirualas 10-09-2010 10:57

Re: 10 Sec and break.
 
Not working, I even create own map , but this not work, or I need to type that for my "func_breakable"? I give it name "breakable" but nothing..

Xalus 10-09-2010 11:36

Re: 10 Sec and break.
 
ye sorry, It has to be func_breakable in the plugin, not breakable
-> My fault ;)

Try again.

zirualas 10-09-2010 11:40

Re: 10 Sec and break.
 
Now it's working and i want to ask one more question, what i need to type to .sma file that break glass only with name breakable?

Xalus 10-09-2010 11:50

Re: 10 Sec and break.
 
if its a func_breakable & the name of it = breakable ?

zirualas 10-09-2010 11:55

Re: 10 Sec and break.
 
Yes if that "THING" is func_breakable and have name breakable it's gona broked then end countdown

Xalus 10-09-2010 12:00

Re: 10 Sec and break.
 
Try this:

PHP Code:

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

#define PLUGIN "Countdown - Glass"
#define VERSION "1.0"
#define AUTHOR "Xalus"

#define ACCESS ADMIN_KICK

new cCountdown;
new 
Float:g_fStartTime;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
/* Cvar */
    
cCountdown     register_cvar("countdown_status""10");
    
    
/* Say Commands */
    
register_clcmd("say /countdown""Handler");
    
register_clcmd("say countdown""Handler");
}
/*
CountDown Glass:
    - Handler
*/
public Handler(id) {
    if(
get_user_flags(id) & ACCESS) {
        
g_fStartTime get_gametime()
        
StartCountdown()    
    }
}
/*
CountDown Glass:
    - CountDown
*/
public StartCountdown() {
    new 
Float:fRemainingTime = (get_gametime() - g_fStartTime)
    
    if(
get_pcvar_float(cCountdown) <= fRemainingTime) {
        
client_cmd("spk radio/com_go")
        new 
ent 0
        
while((ent find_ent_by_class(ent,"func_breakable")) != 0) {
            new 
target[32]; pev(entpev_targetnametarget31); 
            if(
equal(target"breakable")) {
                
ExecuteHamBHam_TakeDamageent009999.0DMG_GENERIC )
            }
        }
    } else {
        new 
Time floatround(get_pcvar_float(cCountdown) - fRemainingTime)
        new 
szTime[32]
        
        
num_to_word(TimeszTime31)
        
        if(
Time <= 10)
            if(
Time)
                
client_cmd(0,"speak ^"vox/%s^""szTime)
                
        
set_hudmessage(random(255), random(255), random(255), -1.00.0506.01.00.00.0, -2);
        
show_hudmessage(0"[Glass Break in: %d Seconds]"Time)
        
// timer
        
set_task(1.0"StartCountdown")
    }
    
    return 
PLUGIN_CONTINUE;



zirualas 10-09-2010 12:22

Re: 10 Sec and break.
 
Again you do your mistake

while((ent = find_ent_by_class(ent,"breakable")) != 0) {
new
target[32]; pev(ent, pev_targetname, target, 31);
if(
equal(target, "breakable")) {
ExecuteHamB( Ham_TakeDamage, ent, 0, 0, 9999.0, DMG_GENERIC )
:arrow:
while((ent = find_ent_by_class(ent,"func_breakable")) != 0) {
new
target[32]; pev(ent, pev_targetname, target, 31);
if(
equal(target, "breakable")) {
ExecuteHamB( Ham_TakeDamage, ent, 0, 0, 9999.0, DMG_GENERIC )

-EDIT-
Ok all is working but why than round starts it's saying "Ten Ten", "Nine Nine", "Eight Eight" ...
BTW i reconstruct your given plugin .
Code :
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fun>
#include <amxmisc>
#include <engine>
#include <fakemeta>

#define PLUGIN "Silent Ninjas Attack"
#define VERSION "1.0"
#define AUTHOR "Zirual"

new const mdlTs[]="arctic";
new const 
mdlCTs[]="urban";
new 
cCountdown;
new 
Float:g_fStartTime;

public 
plugin_init()
{
    
/* Cvar */
    
cCountdown     register_cvar("countdown_status""10");
    
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_Spawn,"player","runda"1);
    
RegisterHam(Ham_Spawn,"player","PlayerSpawn"1);
    
RegisterHam(Ham_Spawn,"player","Handler"1);

}
/*
CountDown Glass:
    - Handler
*/
public Handler(id)
{
        
g_fStartTime get_gametime()
        
StartCountdown()
}

public 
runda(id)
{
    
set_user_rendering(idkRenderFxNone255255255kRenderTransAlpha192);
}
public 
PlayerSpawn(id)
{
    if( 
is_user_alive(id) )
    {
        switch(
cs_get_user_team(id))
        {
            case 
CS_TEAM_T:
            {
                
cs_set_user_model(id,mdlTs)
            }
            case 
CS_TEAM_CT:
            {
                
cs_set_user_model(id,mdlCTs)
            }
        }
    }
    
give_item(id"weapon_deagle");
    
cs_set_user_bpammo(idCSW_DEAGLE35
}
/*
CountDown Glass:
    - CountDown
*/
public StartCountdown() {
    new 
Float:fRemainingTime = (get_gametime() - g_fStartTime)
    
    if(
get_pcvar_float(cCountdown) <= fRemainingTime) {
        
client_cmd("spk radio/com_go")
        new 
ent 0
        
while((ent find_ent_by_class(ent,"func_breakable")) != 0) {
            new 
target[32]; pev(entpev_targetnametarget31); 
            if(
equal(target"breakable")) {
                
ExecuteHamBHam_TakeDamageent009999.0DMG_GENERIC )
            }
        }
    } else {
        new 
Time floatround(get_pcvar_float(cCountdown) - fRemainingTime)
        new 
szTime[32]
        
        
num_to_word(TimeszTime31)
        
        if(
Time <= 10)
            if(
Time)
                
client_cmd(0,"speak ^"vox/%s^""szTime)
                
        
set_hudmessage(random(255), random(255), random(255), -1.00.0506.01.00.00.0, -2);
        
show_hudmessage(0"[Glass Break in: %d Seconds]"Time)
        
// timer
        
set_task(1.0"StartCountdown")
    }
    
    return 
PLUGIN_CONTINUE;


In code is 3 Ham_Spawn I use because for me is
convenience.

Xalus 10-09-2010 12:41

Re: 10 Sec and break.
 
U got Hns on it?

Becuase Hns also count down? I dunno..


All times are GMT -4. The time now is 10:23.

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