Hello! I want a plugin: the bomb can be planted in the last X seconds, something like (amxx):
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#define PLUGIN "Bomb Time Set"
#define VERSION "1.0"
#define AUTHOR "eXtreamCS.Com"
#define TASK_CANPLANT 10001
new bool: g_bCanPlant;
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR );
register_event( "HLTV", "ev_RoundStart", "a", "1=0", "2=0" );
register_event( "TextMsg", "ev_BombMsg", "b", "2=#C4_Plant_At_Bomb_Spot" );
RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_c4", "ham_PrimaryAttack_C4" );
}
public ev_RoundStart()
{
g_bCanPlant = false;
remove_task( TASK_CANPLANT );
new Float: flTime = get_cvar_num( "mp_freezetime" ) + ( get_cvar_num( "mp_roundtime" ) * 60 ) - 30.0;
set_task( flTime, "task_CanPlant", TASK_CANPLANT );
}
public ham_PrimaryAttack_C4( iEnt )
{
new id = pev( iEnt, pev_owner );
if( !g_bCanPlant )
{
client_print( id, print_center, "You can plant the bomb in the last 30 seconds!" );
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
public ev_BombMsg( id )
{
if( !g_bCanPlant )
client_print( id, print_center, "" );
}
public task_CanPlant()
{
g_bCanPlant = true;
set_hudmessage( 255, 0, 0, -1.0, 0.35, 1, 0.01, 3.0, 1.0, 1.0 );
new iNum, iPlayers[ 32 ];
get_players( iPlayers, iNum, "ae", "TERRORIST" );
for( new i ; i < iNum ; i ++ )
show_hudmessage( iPlayers[ i ], "The bomb can be planted!" );
}
I tired like that, but doesn't work:
PHP Code:
/* Plugin generated by EditPlus */
#include < sourcemod >
#define PLUGIN "New Plug-In"
#define DESCRIPTION "Plugin Info"
#define LINK_URL "http://extreamcs.com/forum"
#define VERSION "0.Ox"
#define AUTHOR "Hades Ownage"
public Plugin: myinfo = {
name = PLUGIN,
author = AUTHOR,
description = DESCRIPTION,
version = VERSION,
url = LINK_URL
};
new bool: g_CanPlant = false;
public OnPluginStart ( ) {
CreateConVar ( "sm_name_version", VERSION, "Name Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY );
HookEvent( "bomb_beginplant", Event_BeginPlant );
HookEvent ( "round_start", EventRoundStart );
}
public Action:Event_BeginPlant( Handle:event, const String:name[], bool:dontBroadcast )
{
//new id = GetClientOfUserId( GetEventInt( event, "userid" ) ); // in anycase
if ( !g_CanPlant )
return Plugin_Handled;
return Plugin_Continue;
}
public Action: EventRoundStart ( Handle: event, const String: name [ ], bool: dontBroadcast ) {
CreateTimer ( 120.0, GiveBombAccess );
}
public Action: GiveBombAccess ( Handle: timer ) {
g_CanPlant = true;
PrintToChatAll ( "\x03Oh no! The bomb can be planted!" );
}
Anyone can help me? thanks!