09.08.2016, 16:42
Код:
new ctimer[MAX_PLAYERS];
stock ActiveTown(playerid)
{
if(UnderAttack[Town] == 0)
{
if(!IsPlayerInAnyVehicle(playerid))
{
UnderAttack[Town] = 1;
timer[playerid][Town] = SetTimerEx("TownTimer", 25000, false,"i",playerid);
Captured[playerid][Town] = 0;
SendClientMessage(playerid, -1,"| Stay in this checkpoint for {FFFFFF}25 {FFFFFF}seconds {FFFFFF}to capture it! |");
if(gTeam[playerid] == C1)
{
GangZoneFlashForAll(Zone[Town], COLOR_BLUE);
}
else if(gTeam[playerid] == T1)
{
GangZoneFlashForAll(Zone[Town], RED);
}
else if(gTeam[playerid] == BG)
{
GangZoneFlashForAll(Zone[Town], RED);
}
//------Message-----
if(tCP[Town] == C1)
{
SendClientMessage(playerid, C_COLOR,"This flag is controlled by Cops!");
SendClientMessageToAll(-1,"{FFFFFF}>{FFFFFF}Old observatory is under attack!");
}
else if(tCP[Town] == T1)
{
SendClientMessage(playerid, T_COLOR,"This flag is controlled by Terrorists!");
SendClientMessageToAll(-1,"{FFFFFF}>{FFFFFF}Old observatory is under attack!");
}
else if(tCP[Town] == BG)
{
SendClientMessage(playerid, T_COLOR,"This flag is controlled by Terrorists!");
SendClientMessageToAll(-1,"{FFFFFF}>{FFFFFF}Old observatory is under attack!");
}
else if(tCP[Town] == NONE)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is not controlled by any team!");
}
//---------loop-------//
for(new i = 0; i < MAX_PLAYERS; i ++)
{
IsPlayerCapturing[i][Town] = 1;
}
ctimer[playerid] = SetTimerEx("CountDown1", 1000, true, "i", playerid);
}
else return CaptureZoneMessage(playerid, 1);
}
else {
CaptureZoneMessage(playerid, 2);
TextDrawHideForPlayer(playerid, CountText[playerid]);
}
return 1;
}
Код:
forward CountDown1(playerid);
public CountDown1(playerid)
{
foreach(Player, playerid)
{
if(IsPlayerInDynamicCP(playerid, CP[CAPZONE]) && UnderAttack[CAPZONE] == 1 && IsPlayerCapturing[playerid][CAPZONE] == 1)
{
if(CountVar[playerid][CAPZONE] == 0) return KillTimer(ctimer[playerid]);
CountVar[playerid][CAPZONE]--;
new str1[124];
TextDrawShowForPlayer(playerid, CountText[playerid]);
format(str1, sizeof(str1),"~r~%d seconds ~w~left to ~g~capture", CountVar[playerid][CAPZONE]);
TextDrawSetString(CountText[playerid], str1);
}
}
return 1;
}
