SA-MP Forums Archive
i need one little 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: i need one little help.. (/showthread.php?tid=475872)



i need one little help.. - ReD_HunTeR - 15.11.2013

Hello guys, i need one little help in zombie apocalypse the time is running to slowly like 250(after 8 seconds)245(again after 8 seconds) 240...
help me to make this as like this 250(after 1seconds) 249(again after 1 second)248.....

here what i found in gammeode:

Код:
function OnMapUpdate()
{
	time -= 1;

	new str[64];
	format(str,sizeof(str),"%d",time);
	TextDrawSetString(TimeLeft,str);

	if(time <= 0) TextDrawSetString(TimeLeft," ..."),KillTimer(mapvar),KillTimer(balvar),SetTimer("ShowCheckpoint",MAX_SHOW_CP_TIME,false);
	return 1;
}
---------------------------------------------------------------------------------------

Код:
function OnMapBalance()
{
	if(playerOnline >= 2)
	{
		if(GetTeamPlayersAlive(TEAM_HUMAN) == 0)
		{
			KillTimer(balvar);
			KillTimer(mapvar);
			TextDrawSetString(TimeLeft,"~r~Zombies win");
			SetTimer("EndMap",4000,false); // Cannot use MAX_END_TIME Because of MAX_END_TIME is set to 1 minute not 4 seconds *NOTE TO ME*
			foreach(Player,i)
			{
				if(team[i] == TEAM_ZOMBIE)
				{
					pInfo[i][pXP] += 30;
					GivePlayerXP(i,30);
				}
			}
		}
	}
	return 1;
}
---------------------------------------------------------------------------------------

Код:
	TimeLeft = TextDrawCreate(22.000000, 251.000000, "250");
	TextDrawBackgroundColor(TimeLeft, 255);
	TextDrawFont(TimeLeft, 3);
	TextDrawLetterSize(TimeLeft, 1.770000, 3.499999);
	TextDrawColor(TimeLeft, 16777215);
	TextDrawSetOutline(TimeLeft, 0);
	TextDrawSetProportional(TimeLeft, 1);
	TextDrawSetShadow(TimeLeft, 1);
---------------------------------------------------------------------------------------


Re: i need one little help.. - Konstantinos - 15.11.2013

What's the interval of OnMapUpdate?


Re: i need one little help.. - ReD_HunTeR - 15.11.2013

what do you mean?


Re: i need one little help.. - Konstantinos - 15.11.2013

I mean that SetTimer uses as parameter the interval.

pawn Код:
SetTimer(funcname[], interval, repeating);
So if you want it to be called every second instead of 8, you should use 1000 as interval (in milliseconds - it's 1 second).

pawn Код:
SetTimer("OnMapUpdate", 1000, true);



Re: i need one little help.. - ReD_HunTeR - 15.11.2013

can you make code of it?, and give it? in [code] {/code]


Re: i need one little help.. - Konstantinos - 15.11.2013

Quote:
Originally Posted by BlackBomb
Посмотреть сообщение
can you make code of it?, and give it? in [code] {/code]
I already did. Look my above post, it says the correct way of setting the timer to 1 second. Replace it with your own one.


Re: i need one little help.. - ReD_HunTeR - 15.11.2013

i cant find that can you tell me full in or someone else can help me?


Re: i need one little help.. - Konstantinos - 15.11.2013

Quote:
Originally Posted by BlackBomb
Посмотреть сообщение
i cant find that can you tell me full in or someone else can help me?
No, I cannot. I'm able to help you with the information you've given only.

Just press Ctrl + F and type: OnMapUpdate
If it's not in the first result, click on 'Find Next' button until you find a line about SetTimer.


Re: i need one little help.. - ReD_HunTeR - 15.11.2013

i cant find
SetTimer(funcname[], interval, repeating);
or
SetTimer("OnMapUpdate", 1000, true);
on gamemode :/


Re: i need one little help.. - Konstantinos - 15.11.2013

Because they do not exist. I told you to search for "OnMapUpdate" only (without the quotes "" of course).

pawn Код:
SetTimer(funcname[], interval, repeating);
was an example of the parameters of the SetTimer.

pawn Код:
SetTimer("OnMapUpdate", 1000, true);
is the correct one which calls OnMapUpdate every second. You'll need to find where you set the timer about OnMapUpdate in your script and replace it with the above code.