hey guys i need some help with this.. please..
what this plugin should do is at round start, every one's screen should be black and the blackness has transparency, every player will freeze and there will be a countdown that Match Begins in 3..2..1.. .,and after the countdown has stop., the blackness and freezing of players should stop and the game starts killing
PHP Code:
#include <amxmodx>
#include <fun>
#include <csx>
#include <amxmisc>
#include <engine>
#define PLUGIN "Starting Screen"
#define VERSION "1.0"
#define AUTHOR "razieljohn619"
#define NORMAL_VELOCITY 240.0
#define FROZEN_VELOCITY 0.1
#define ID_UNFREEZE ( taskid - TASK_UNFREEZE )
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
new const Version[] = "1.0";
const iCountTime = 1500;
new g_iCountdownEntity;
new g_iCounter;
new g_iMaxPlayers, msgScreenFade
const TASK_UNFREEZE = 1589;
new g_frozen[33]
public plugin_init()
{
register_plugin("Starting Screen", "1.0" , "razieljohn619")
register_event("HLTV", "freezeplayers", "a", "1=0", "2=0");
register_event("HLTV", "ShowCountdown", "a", "1=0", "2=0");
g_iCountdownEntity = create_entity( "info_target" );
entity_set_string( g_iCountdownEntity , EV_SZ_classname , "countdown_entity" );
register_think( "countdown_entity" , "fw_CountdownEntThink" );
msgScreenFade = get_user_msgid("ScreenFade")
g_iMaxPlayers = get_maxplayers()
}
public freezeplayers(id)
{
if(!is_user_alive(id) || g_frozen[id] || task_exists(id+TASK_UNFREEZE))
return;
g_frozen[id] = 1
set_user_maxspeed(id, FROZEN_VELOCITY)
fadeblack(id, amount)
set_task(3.0, "remove_freeze", id+TASK_UNFREEZE)
}
public remove_freeze(taskid)
{
g_frozen[ID_UNFREEZE] = 0
set_user_maxspeed(ID_UNFREEZE, NORMAL_VELOCITY)
}
public countdown
stock fadeblack(id, ammount)
{
if (ammount > 255)
ammount = 255
message_begin(MSG_ONE_UNRELIABLE, msgScreenFade, {0,0,0}, id)
write_short(ammount * 3) //Durration
write_short(0) //Hold
write_short(0) //Type
write_byte(100) //R
write_byte(100) //G
write_byte(100) //B
write_byte(ammount) //B
message_end()
}
public ShowCountdown()
{
g_iCounter = iCountTime;
entity_set_float( g_iCountdownEntity , EV_FL_nextthink , get_gametime() + 0.01 );
}
public fw_CountdownEntThink( iEntity )
{
if ( iEntity == g_iCountdownEntity )
{
set_hudmessage( 255 , 255 , 255 , -1.0 , -1.0 , 0 , 0.1 , 0.1 );
show_hudmessage( 0 , " Match Begins in %d " , --g_iCounter );
if ( g_iCounter )
entity_set_float( g_iCountdownEntity , EV_FL_nextthink , get_gametime() + 0.01 );
else
}
}
THANKS
__________________