Turf count
#1

This is my turf system, means when a player gets in someone's gang zone i want to add in the corner TextDraw to count down 120 seconds here I tried to do something for the test,but i dont know how
This is count system
Код:
#include <a_samp>

new CountDownVar = 4;
new CountDownTimer;

public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/count", true))
{
CountDownTimer = SetTimer("CountDown", 1000, false);
return 1;
}
}
forward CountDown();
public CountDown()
{
     CountDownVar--; //Thanks for the fix.
     new str[128];
     if(CountDownVar == 0)
     {
            KillTimer(CountDownTimer);
            CountDownVar = 4; //Edit thanks to Hiddos...i was sleepy :S
     }
     else
     {
           format(str, sizeof(str), "Count Down: %d", CountDownTimer);
           GameTextForAll(str, 1000, 1);
     }
     return 1;
}
and this is section of turf system
Код:
public ZoneUpdate()
{
	for(new z=0; z < MAX_ZONES; z++)
	{
	    if(ZoneTakeOverTeam[z] == -1)
	    {
	        for(new t=0; t < MAX_TEAMS; t++)
	        {
	            if(t == ZoneInfo[z][z_team]) continue;
	            if(GetMembersInZone(z, t) >= 1)
	            {
	                ZoneTakeOverTeam[z] = t;
	                GangZoneFlashForAll(ZoneInfo[z][z_id], GetTeamColor(t));
	                ZoneTakeOverTime[z] = 0;
				}
			}
		}
		else
		{
		    if(GetMembersInZone(z, ZoneTakeOverTeam[z]) > 0)
		    {
		        ZoneTakeOverTime[z]++;
		        if(ZoneTakeOverTime[z] >= 120)
		        {
		            GangZoneStopFlashForAll(ZoneInfo[z][z_id]);
	                GangZoneShowForAll(ZoneInfo[z][z_id], GetTeamColor(ZoneTakeOverTeam[z]));
	                ZoneInfo[z][z_team] = ZoneTakeOverTeam[z];
	                for(new i=0; i<MAX_PLAYERS; i++)
	                {
	                    if(IsPlayerConnected(i))
	                    {
	                        if(GetPlayerZone(i) == z && gTeam[i] == ZoneTakeOverTeam[z])
	                        {
	                            SetPlayerScore(i, GetPlayerScore(i) + 2);
	                            pInfo[i][pKills] += 2;
	                            GameTextForPlayer(i, "~g~Turf ~r~taken over~n~~b~~h~+2 score", 6000, 3);
							}
						}
					}
	                ZoneTakeOverTeam[z] = -1;
	                ZoneTakeOverTime[z] = 0;
				}
			}
			else
			{
                ZoneTakeOverTeam[z] = -1;
                GangZoneStopFlashForAll(ZoneInfo[z][z_id]);
                ZoneTakeOverTime[z] = 0;
			}
		}
	}
}
Reply
#2

create a textdraw/ String it
Put a timer on
You can learn some stuff from a normal Time system
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)