cap zone
#1

when i leave check point text draw dose not remove and after 25 sec say you captured this zone.

Код:
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;
}
Reply
#2

pawn Код:
capturetimer[playerid] = SetTimer("captime", 1000, true);
this should be SetTimerEx not settimer...
try:
pawn Код:
capturetimer[playerid] = SetTimerEx("captime", 1000, true,"i",playerid);
Reply
#3

not works.
Reply
#4

when do you call LeavingDesertAirport(playerid)?
Reply
#5

Код:
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
	if(checkpointid == CP[DesertAirport] && Captured[playerid][DesertAirport] == 0 && IsPlayerCapturing[playerid][DesertAirport] == 1 && !IsPlayerInDynamicCP(playerid, CP[DesertAirport]))
	{
		LeavingDesertAirport(playerid);
	}
	return 1;
}
Reply
#6

I am not sure but try this:

pawn Код:
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
    if(checkpointid == CP[DesertAirport] && Captured[playerid][DesertAirport] == 0 && IsPlayerCapturing[playerid][DesertAirport] == 1)
    {
        LeavingDesertAirport(playerid);
    }
    return 1;
}
Reply
#7

https://sampforum.blast.hk/showthread.php?tid=453013
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)