rendered paste body#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n----------------------------------------");
print(" Thomas_Conroy's Countdown FilterScript");
print("----------------------------------------\n");
return 1;
}
#else
#endif
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_PINK 0xFF00FFAA
#define FREEZEZONE 15 //Change this to increase the freeze radius! (default 15)
forward countdown();
new Float:X, Float:Y, Float:Z, Float:X2, Float:Y2, Float:Z2, CountStage = 0, timer, Float:dist;
new pName[MAX_PLAYER_NAME], string[25 + MAX_PLAYER_NAME], Frozen[MAX_PLAYERS];
new Freeze = 0;
/*
Variables Explained:
Floats: X,Y and Z refer to the position of the player who types the command
Floats: X2, Y2 and Z2 refer to the position of the player currently being compared
CountStage determines where the counter is at, 0 means it is off
timer stores the timerid used in the KillTImer()
Float dist stores the distance found in the Distance stock
pname[] is the Playername, string[] is the string sent, frozen[] stores the players freeze status (on(1) or off(0))
Freeze determines whether player freezing is on/off - it is changed ingame with the command /togfreeze
*/
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext,"/count",true) == 0)
{
if(CountStage ==0)
{
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "*** %s started count.", pName);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 3 ~g~-",1000,3);
timer = SetTimer("countdown",1000,1);
CountStage = 3;
GetPlayerPos(playerid, X, Y, Z);
if(Freeze == 1)
{
for(new i; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, X2, Y2, Z2);
dist = Distance(X, Y, Z, X2, Y2, Z2);
if(dist <= FREEZEZONE) TogglePlayerControllable(i, 0), Frozen[i] = 1;
}
}
}
else SendClientMessage(playerid, COLOR_PINK, "The CountDown is busy!");
return 1;
}
if(strcmp(cmdtext,"/togfreeze",true) == 0)
{
if(Freeze == 0) Freeze = 1, SendClientMessage(playerid, COLOR_PINK, "Freeze now ON!");
else Freeze = 0, SendClientMessage(playerid, COLOR_PINK, "Freeze now OFF!");
return 1;
}
return 0;
}
public countdown()
{
switch(CountStage)
{
case 1:
{
GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~]~g~-~g~START~g~-~y~]~g~-",1000,3);
for(new i; i < MAX_PLAYERS; i++)
{
if(Frozen[i] == 1) TogglePlayerControllable(i, 1), Frozen[i] = 0;
GetPlayerPos(i,X,Y,Z);
PlayerPlaySound(i,1057,X,Y,Z);
}
KillTimer(timer);
CountStage = 0;
}
case 2: GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 1 ~g~-",1000,3), CountStage = 1;
case 3: GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 2 ~g~-",1000,3), CountStage = 2;
}
}
stock Distance(Float:a, Float:b, Float:c, Float:d, Float:e, Float:f)
{
dist = floatsqroot(floatpower((a - d),2)+floatpower((b - e),2)+floatpower((c - f),2));
return floatround(dist);
}
//##########################
//## © Thomas_Conroy 2009 ##
//##########################