Capture zone help - 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: Capture zone help (
/showthread.php?tid=601087)
Capture zone help -
AmirAmani - 16.02.2016
when i leave check point text draw dose not remove and after 25 seconds say you captured this zone! anyone help?
Код:
stock ActiveDesertAirport(playerid)
{
if(UnderAttack[DesertAirport] == 0)
{
if(!IsPlayerInAnyVehicle(playerid))
{
UnderAttack[DesertAirport] = 1;
timer[playerid][DesertAirport] = SetTimerEx("DesertAirportTimer", 25000, false,"i",playerid);
Captured[playerid][DesertAirport] = 0;
SendClientMessage(playerid, 0xFFFFFFFF,"*Stay in this checkpoint for "COL_RED"25 "COL_WHITE"seconds to capture it!");
capCooldown[playerid] = gettime();
capturetimer[playerid] = SetTimer("captime", 1000, true);
if(gTeam[playerid] == TEAM_Internationalforces)
{
GangZoneFlashForAll(Zone[DesertAirport], 0x80FFFF96);
}
else if(gTeam[playerid] == TEAM_Daesh)
{
GangZoneFlashForAll(Zone[DesertAirport], 0x00800096);
}
else if(gTeam[playerid] == TEAM_Iraq)
{
GangZoneFlashForAll(Zone[DesertAirport], 0xFF800096);
}
else if(gTeam[playerid] == TEAM_Unitedkingdom)
{
GangZoneFlashForAll(Zone[DesertAirport], 0x0000FF96);
}
else if(gTeam[playerid] == TEAM_Russian)
{
GangZoneFlashForAll(Zone[DesertAirport], 0xFF000096);
}
for(new i = 0; i < MAX_PLAYERS; i ++)
{
IsPlayerCapturing[i][DesertAirport] = 1;
}
}
else return CaptureZoneMessage(playerid, 1);
}
else return CaptureZoneMessage(playerid, 2);
return 1;
}
Код:
stock DesertAirportCaptured(playerid)
{
TextDrawHideForPlayer(playerid, capture[playerid]);
Captured[playerid][DesertAirport] = 1;
UnderAttack[DesertAirport] = 0;
KillTimer(timer[playerid][DesertAirport]);
KillTimer(capturetimer[playerid]);
CountVar[playerid][DesertAirport] = 25;
GivePlayerScore(playerid, 5);
PlayerInfo[playerid][pScore] += 5;
GivePlayerMoney(playerid, 5000);
PlayerInfo[playerid][pMoney] += 5000;
SendClientMessage(playerid, COLOR_GREEN,"Congratulations! You have captured the DesertAirport! You received +5 scores and +$5000 cash!");
for(new i = 0; i < MAX_PLAYERS; i++)
{
IsPlayerCapturing[i][Hideout] = 0;
if(gTeam[i] == gTeam[playerid])
{
SendClientMessage(i, 0xFFFFFFFF,"*Your team has captured the DesertAirport! You received +1 score for it!");
GivePlayerScore(i, 1);
PlayerInfo[i][pScore] += 1;
}
}
tCP[DesertAirport] = gTeam[playerid];
GangZoneStopFlashForAll(Zone[DesertAirport]);
if(gTeam[playerid] == TEAM_Internationalforces)
{
GangZoneShowForAll(Zone[DesertAirport], 0x80FFFF96);
}
else if(gTeam[playerid] == TEAM_Daesh)
{
GangZoneShowForAll(Zone[DesertAirport], 0x00800096);
}
else if(gTeam[playerid] == TEAM_Iraq)
{
GangZoneFlashForAll(Zone[DesertAirport], 0xFF800096);
}
else if(gTeam[playerid] == TEAM_Unitedkingdom)
{
GangZoneFlashForAll(Zone[DesertAirport], 0x0000FF96);
}
else if(gTeam[playerid] == TEAM_Russian)
{
GangZoneFlashForAll(Zone[DesertAirport], 0xFF000096);
}
return 1;
}
Код:
stock LeavingDesertAirport(playerid)
{
TextDrawHideForPlayer(playerid, capture[playerid]);
Captured[playerid][DesertAirport] = 0;
UnderAttack[DesertAirport] = 0;
KillTimer(timer[playerid][DesertAirport]);
KillTimer(capturetimer[playerid]);
CountVar[playerid][DesertAirport] = 25;
GangZoneStopFlashForAll(Zone[DesertAirport]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
IsPlayerCapturing[i][DesertAirport] = 0;
}
SendClientMessage(playerid, COLOR_RED,"You have failed to capture this zone!");
return 1;
}
Код:
public captime(playerid)
{
new str[128], correcttime;
if((capCooldown[playerid]+25) - correcttime == 0)
{
KillTimer(capturetimer[playerid]);
TextDrawHideForPlayer(playerid, capture[playerid]);
return 1;
}
correcttime = gettime();
format(str, sizeof(str), "~w~captured...~r~ %d",(capCooldown[playerid]+25) - correcttime);
TextDrawSetString(capture[playerid], str);
TextDrawShowForPlayer(playerid, capture[playerid]);
return 1;
}
Re: Capture zone help -
Rasyidmf - 21.06.2016
You used createdynamiccp ?