2 timers gettin mixed - different turfs
#1

hey there
when there are 2 or more active turfs Textdraw timers gets mixed up and when the first turf finishes the timer gets back to normal can you please help me out to make for each turf to have their own timer thanks, here are my codes


Код:
forward TakeOverTurf( turfID, playerid, /*player1, player2, player3, player4, player5, player6, player7,*/ factionID );
public TakeOverTurf( turfID, playerid, /*player1, player2, player3, player4, player5, player6, player7,*/ factionID )
{
new file[50];
	if(	!IsPlayerInTurf(playerid, turfID) || PlayersAroundSameFaction(playerid) < 1)
		{
			SendClientMessageToTeam(factionID,"# [Info] Turf Take Over failed. One or more members are too far away.",COLOR_PLAYER_VLIGHTBLUE);
			KillTimer(TurfTakeOver[ turfID ][ TIMER ]);
			format( iStr, sizeof(iStr), "10[TURF] %s has failed the turf-takeover(ID:%d)", PlayerInfo[playerid][PTeamName], turfID);
	iEcho( iStr, IRC_TURFS );
			        format(file, sizeof(file), "Zone-%d.txt", turfID);
		dini_IntSet(file, "Takeable", 4);
		//SetTimer("TakeTimer", 3600000, true);
			GangZoneStopFlashForAll(Gangzones[turfID][gID]), Gangzones[turfID][gBLINK] = 0;
			return 1;
		}
		new str[MAX_STRING];
PlayerLoop(i)
{
if(GetPlayerFaction(playerid) == GetPlayerFaction(i) && GetDistanceBetweenPlayers(i, playerid) <=20)
{
format(str, sizeof(str), "~n~~n~~n~~n~~n~~n~~y~TIME LEFT: ~w~%s Minutes",TimeConvert(300-TurfTakeOver[ turfID ][ TIME ]));
TextDrawSetString(turfTD,str);
TextDrawShowForPlayer(i,turfTD);
}
}


    if(TurfTakeOver[ turfID ][ TIME ] == 0) SendClientMessageToTeam(factionID,"# [Turf Info] Attempting to take over a turf. Do not leave the area for 5 minutes.",COLOR_PLAYER_VLIGHTBLUE);
    TurfTakeOver[ turfID ][ TIME ] += 1;
if(TurfTakeOver[ turfID ][ TIME ] == 60) SendClientMessageToTeam(factionID,"# [Turf Info] 4 minutes left until you have full control over the new turf.",COLOR_PLAYER_VLIGHTBLUE);
    if(TurfTakeOver[ turfID ][ TIME ] == 120) SendClientMessageToTeam(factionID,"# [Turf Info] 3 minutes left until you have full control over the new turf.",COLOR_PLAYER_VLIGHTBLUE);
    if(TurfTakeOver[ turfID ][ TIME ] == 180) SendClientMessageToTeam(factionID,"# [Turf Info] 2 minute left until you have full control over the new turf.",COLOR_PLAYER_VLIGHTBLUE);
    if(TurfTakeOver[ turfID ][ TIME ] == 240) SendClientMessageToTeam(factionID,"# [Turf Info] 1 minute left until you have full control over the new turf.",COLOR_PLAYER_VLIGHTBLUE);
	if(TurfTakeOver[ turfID ][ TIME ] >= 300)
    {
    format(file, sizeof(file), "Zone-%d.txt", turfID);
        SendClientMessageToTeam(factionID,"# [Turf Info] Your faction has acquired control over a new turf !",COLOR_PLAYER_VLIGHTBLUE);
        format( iStr, sizeof(iStr), "10[TURF] %s has managed to take over a turf(ID:%d)", PlayerInfo[playerid][PTeamName], turfID);
	iEcho( iStr, IRC_TURFS );
        dini_IntSet(file, "Takeable", 8);
        // SetTimer("TakeTimer", 3600000, true);
		KillTimer(TurfTakeOver[ turfID ][ TIMER ]);
		TurfTakeOver[ turfID ][ TIME ] = 0;
        PlayerLoop(i)
{
TextDrawHideForPlayer(i,turfTD);
}
		GangZoneStopFlashForAll(Gangzones[turfID][gID]), Gangzones[turfID][gBLINK] = 0;
		dini_IntSet(file, "Faction", factionID);
		DestroyGangZones();
		LoadGangZones();
		PlayerLoop(i) GangZoneShowForPlayer(i, Gangzones[turfID][gID], GetFactionTurfColour(Gangzones[turfID][gFACTION]));
		GiveFPoints(playerid, 100);
        GivePlayerMoneyEx(playerid, 100000);
         SendClientMessageToTeam(factionID,"# [Turf Info] Your faction leader received 100,000$ plus 100 F-Points from taking turf taxs!",COLOR_PLAYER_VLIGHTBLUE);
		//EzeeCubeTest
		for(new q; q < sizeof(Gangzones); q++)
		{
			GangZoneShowForAll(Gangzones[q][gID], GetFactionTurfColour(Gangzones[q][gFACTION]));
			TextDrawHideForAll(Gangzones[q][gDRAW]);
			if(Gangzones[q][gBLINK] == 1) GangZoneFlashForAll(Gangzones[q][gID], COLOR_WHITET);
		}
		return 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)