How to Put Countdown on Capture Zone ?Rep + - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to Put Countdown on Capture Zone ?Rep + (
/showthread.php?tid=559618)
How to Put Countdown on Capture Zone ?Rep + -
MBilal - 24.01.2015
Код:
forward OnPlayerEnterDynamicCP(playerid, checkpointid);
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == CP[CAPZONE])
{
if(UnderAttack[CAPZONE] == 0)
{
if(tCP[CAPZONE] != gTeam[playerid])
{
CountVar[playerid][CAPZONE] = 25;
ActiveCAPZONE(playerid);
} else return SendClientMessage(playerid, COLOR_RED,"*This zone is already captured by your team!");
} else return CaptureZoneMessage(playerid, 2);
}
return 1;
}
forward OnPlayerLeaveDynamicCP(playerid, checkpointid);
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
if(checkpointid == CP[CAPZONE] && Captured[playerid][CAPZONE] == 0 && IsPlayerCapturing[playerid][CAPZONE] == 1 && !IsPlayerInDynamicCP(playerid, CP[CAPZONE]))
{
LeavingCAPZONE(playerid);
}
}
stock ActiveCAPZONE(playerid)
{
if(UnderAttack[CAPZONE] == 0)
{
if(!IsPlayerInAnyVehicle(playerid))
{
UnderAttack[CAPZONE] = 1;
timer[playerid][CAPZONE] = SetTimerEx("CAPZONETimer", 25000, false,"i",playerid);
Captured[playerid][CAPZONE] = 0;
SendClientMessage(playerid, 0xFFFFFFFF,"| Stay in this checkpoint for 25 seconds to capture it! |");
if(gTeam[playerid] ==TEAM1)
{
GangZoneFlashForAll(Zone[CAPZONE], C_GZ_COLOR);
}
else if(gTeam[playerid] == TEAM2)
{
GangZoneFlashForAll(Zone[CAPZONE], T_GZ_COLOR);
}
else if(gTeam[playerid] == TEAM3)
{
GangZoneFlashForAll(Zone[CAPZONE], COLOR_KRED);
}
//------Message-----
if(tCP[CAPZONE] == TEAM1)
{
SendClientMessage(playerid, C_COLOR,"This flag is controlled by TEAM");
SendClientMessageToAll(STEALTH_BLUE,"*Base is under attack!");
}
else if(tCP[CAPZONE] == TEAM2)
{
//msgcapture
}
else if(tCP[CAPZONE] == TEAM3)
{
//msgcapture
}
else if(tCP[CAPZONE] == NONE)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is not controlled by any team!");
}
//---------loop-------//
for(new i = 0; i < MAX_PLAYERS; i ++)
{
IsPlayerCapturing[i][CAPZONE] = 1;
}
}
else return CaptureZoneMessage(playerid, 1);
}
else {
CaptureZoneMessage(playerid, 2);
}
return 1;
}
How to add Countdown in it? like 25 , 24 , 23, 22...
Re: How to Put Countdown on Capture Zone ?Rep + -
ATGOggy - 24.01.2015
PHP код:
new count, Text:TD[MAX_ZONES];
stock ActiveCAPZONE(playerid)
{
if(UnderAttack[CAPZONE] == 0)
{
if(!IsPlayerInAnyVehicle(playerid))
{
UnderAttack[CAPZONE] = 1;
timer[playerid][CAPZONE] = SetTimerEx("CAPZONETimer", 25000, false,"ii",CAPZONE, gTeam[playerid]);
Captured[playerid][CAPZONE] = 0;
SendClientMessage(playerid, 0xFFFFFFFF,"| Stay in this checkpoint for 25 seconds to capture it! |");
SetTimerEx("Countdown", 1000, true, "i", CAPZONE);
count=25;
TD[CAPZONE]=TextDrawCreate(//*
make textdraw
*//
if(gTeam[playerid] ==TEAM1)
{
GangZoneFlashForAll(Zone[CAPZONE], C_GZ_COLOR);
}
else if(gTeam[playerid] == TEAM2)
{
GangZoneFlashForAll(Zone[CAPZONE], T_GZ_COLOR);
}
else if(gTeam[playerid] == TEAM3)
{
GangZoneFlashForAll(Zone[CAPZONE], COLOR_KRED);
}
//------Message-----
if(tCP[CAPZONE] == TEAM1)
{
SendClientMessage(playerid, C_COLOR,"This flag is controlled by TEAM");
SendClientMessageToAll(STEALTH_BLUE,"*Base is under attack!");
}
else if(tCP[CAPZONE] == TEAM2)
{
//msgcapture
}
else if(tCP[CAPZONE] == TEAM3)
{
//msgcapture
}
else if(tCP[CAPZONE] == NONE)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is not controlled by any team!");
}
//---------loop-------//
for(new i = 0; i < MAX_PLAYERS; i ++)
{
IsPlayerCapturing[i][CAPZONE] = 1;
}
}
else return CaptureZoneMessage(playerid, 1);
}
else {
CaptureZoneMessage(playerid, 2);
}
return 1;
}
PHP код:
forward Countdown(CAPZONE, TEAM);
public Countdown(CAPZONE, TEAM)
{
count--;
TextDrawUpdateString(TD[CAPZONE], count);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(gTeam[i]==TEAM)
{
ShowPlayerTextdraw(playerid, TD[CAPZONE]);
}
}
}