SA-MP Forums Archive
Help Timer for +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: Help Timer for +rep (/showthread.php?tid=553592)



Help Timer for +rep - Airblog - 30.12.2014

Hi all i want to make a timer for family wars (or capturing)
that when player typed /capture after 10 sec show a timer that is for end of war but when 10 sec passed it shows the timer for 1 sec after that timer will be remove.
my code
Код:
forward CapturePoint(playerid, idx);
public CapturePoint(playerid, idx)
{
	new Float:Cap[3], string[128];
	GetPlayerPos(playerid, Cap[0], Cap[1], Cap[2]);
	if(Cap[0] == Capture[0] && Cap[1] == Capture[1] && Cap[2] == Capture[2])
	{
	    format(string, sizeof(string), "%s has attempted to capture the %s for %s, it will be theirs in 10 minutes(600 sanie).", RPN(playerid), PointInfo[idx][pName], RPFaN(playerid));
	    SendClientMessageToAll(COLOR_YELLOW, string);
	    Capturing = 0;
	    PointInfo[idx][pOwner] = 0;
	    KillTimer(PointTimer);
	    Capturer = playerid;
	    CapturerFam = idx;
	    PointTimer = SetTimerEx("FinalCapture", 600000, false, "dd", Capturer, CapturerFam);
//	    new playerb = PlayerInfo[playerid][pFam];
//	    foreach(Player, playerb)
//	    {
//	    if(Capturing ==1)
//   	    {
	    WarTimer[playerid] = 600;
	    WarTimer[playerid] --;
        format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Point Time Left: ~w~%d ~r~seconds", WarTimer[playerid]);
        GameTextForPlayer(playerid, string,1500, 3);
//        }
  //      }
	}
	else
	{
		Capturing = 0;
		SendClientMessage(playerid, COLOR_GREY, "You have moved from your position and failed to capture the point.");
	}
	return 1;
}

forward FinalCapture(playerid, idx);
public FinalCapture(playerid, idx)
{
	new string[128];

	format(string, sizeof(string), "%s has successfully captured the %s for %s.", RPN(playerid), PointInfo[idx][pName], RPFaN(playerid));
	SendClientMessageToAll(COLOR_YELLOW, string);
	Capturer = -1;
 	CapturerFam = -1;
	PointInfo[idx][pTime] = 24;
	PointInfo[idx][pOwner] = PlayerInfo[playerid][pFam];
	GiveZaiatMoney(playerid,PointInfo[idx][pProfit]);
	DestroyDynamicPickup(PointInfo[idx][pPickup]);
	DestroyDynamic3DTextLabel(PointInfo[idx][pText]);
	SavePoints();
	return 1;
}
Plz Help For +rep


Re: Help Timer for +rep - Sledgehammer - 30.12.2014

I am not to sure what you want me to do, however timer intervals are not accurate.

The timer intervals can be fixed;
- https://sampforum.blast.hk/showthread.php?tid=289675
- https://sampforum.blast.hk/showthread.php?tid=375925


Re: Help Timer for +rep - Airblog - 30.12.2014

No i dont want this i have fixes


Reply - Ygzeb - 30.12.2014

Do you mean this?

pawn Код:
GameTextForPlayer(playerid, string,1500, 3);
Change it for this:

pawn Код:
GameTextForPlayer(playerid, string, 10000, 3);
Or if it is not what you meant, try changing this:

pawn Код:
PointTimer = SetTimerEx("FinalCapture", 600000, false, "dd", Capturer, CapturerFam);
To this:

pawn Код:
PointTimer = SetTimerEx("FinalCapture", 10000, false, "dd", Capturer, CapturerFam);



Re: Help Timer for +rep - Airblog - 30.12.2014

no i mean cuntdown timer for 600sec


Re: Help Timer for +rep - Airblog - 31.12.2014

Plz Help anyone can't helpme?


Re: Help Timer for +rep - Arxalan - 31.12.2014

Код:
PointTimer = SetTimerEx("FinalCapture", 10000, false, "dd", Capturer, CapturerFam);
Add this and Use TextDraw to show the time for user.