29.01.2007, 01:02
Red Alert!
Type: Admin Command.
Description: Kicks all connected players off the server, due to an emergency etc.
_________________________________________________
Global Variable (Top Of Your Script):
_________________________________________________
Function
_________________________________________________
The Command: (Under The OnPlayerCommandText Callback)
_________________________________________________
Type: Admin Command.
Description: Kicks all connected players off the server, due to an emergency etc.
_________________________________________________
Global Variable (Top Of Your Script):
pawn Code:
new RedAlertTimer;
Function
pawn Code:
public KickAll()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
Kick(i);
}
}
}
The Command: (Under The OnPlayerCommandText Callback)
pawn Code:
if (strcmp(cmdtext, "/redalert", true)==0)
{
if(IsPlayerAdmin(playerid))
{
new string[256];
new aname[256];
GetPlayerName(playerid,aname,sizeof(aname));
GameTextForAll("~r~Red Alert",7000,4);
format(string,sizeof(string), "Admin: %s has called Red Alert",aname);
SendClientMessageToAll(0xAA3333AA,string);
SendClientMessageToAll(0xAA3333AA,"You will all be kicked in ten seconds.");
RedAlertTimer = SetTimer("KickAll",10000,0);
SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Successful. To Abort Type /abort");
printf("%s has initialized the red alert countdown.",aname);
return 1;
}
else
{
return 0;
}
return 1;
}
if (strcmp(cmdtext, "/abort", true)==0)
{
if(IsPlayerAdmin(playerid))
{
new string[256];
new aname[256];
GetPlayerName(playerid,aname,sizeof(aname));
GameTextForAll("~y~Red Alert Aborted",7000,4);
format(string,sizeof(string), "Admin: %s has canceled the Red Alert",aname);
SendClientMessageToAll(0x33AA33AA,string);
KillTimer(RedAlertTimer);
SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Abort Successful.");
printf("%s has cancelled the red alert countdown.",aname);
return 1;
}
else
{
return 0;
}
return 1;
}