Gettime
#1

How do i make a timer without making the timer?

Ex:

/command - does something

After 10 secs, it says "You are doing something"

after 20 says same thing

It says samething every 10 secs until the 60 second marker

At 60 secs = "You are done doing something"

Help?

Script:

Код:
if(strcmp(cmd, "/mine", true) == 0) if(Logged[playerid] == 1)
	{
		if(Job[playerid] == MW) // 12 engineer 11 mineworker
		{
		if(MM[playerid] == 0) return scm(playerid,cr,"[ ! ] You are not at the mining area!");
		if(Mine[playerid] == 1) return SendClientMessage(playerid,cr,"[ ! ] Already mining !");
		Mine[playerid] = 1;
		SendClientMessage(playerid,COLOR_YELLOW,"[ ! ] ..:Mining in progress:..");
		minemsg[playerid] = gettime();
		if((gettime()-minemsg[playerid]) == 50)
		{
			SendClientMessage(playerid,COLOR_YELLOW,"[ ! ] ..:Mining in progress:..");
			if(MM[playerid] == 0)
			{
				scm(playerid,cr,"[ ! ] You left the mining area, job canceled !");
				
				return 1;
			}
		}
		if((gettime()-minemsg[playerid]) == 40)
		{
			SendClientMessage(playerid,COLOR_YELLOW,"[ ! ] ..:Mining in progress:..");
			if(MM[playerid] == 0)
			{
				scm(playerid,cr,"[ ! ] You left the mining area, job canceled !");
				
				return 1;
			}
		}
		if((gettime()-minemsg[playerid]) == 30)
		{
			SendClientMessage(playerid,COLOR_YELLOW,"[ ! ] ..:Mining in progress:..");
			if(MM[playerid] == 0)
			{
				scm(playerid,cr,"[ ! ] You left the mining area, job canceled !");
				
				return 1;
			}
		}
		if((gettime()-minemsg[playerid]) == 20)
		{
			SendClientMessage(playerid,COLOR_YELLOW,"[ ! ] ..:Mining in progress:..");
			if(MM[playerid] == 0)
			{
				scm(playerid,cr,"[ ! ] You left the mining area, job canceled !");
				
				return 1;
			}
		}
		if((gettime()-minemsg[playerid]) == 10)
		{
			SendClientMessage(playerid,COLOR_YELLOW,"[ ! ] ..:Mining in progress:..");
			if(MM[playerid] == 0)
			{
				scm(playerid,cr,"[ ! ] You left the mining area, job canceled !");
				
				return 1;
			}
		}
		if((gettime()-minemsg[playerid]) == 60)
		{
   		if(MM[playerid] == 0)
			{
				scm(playerid,cr,"[ ! ] You left the mining area, job canceled !");
				
				return 1;
			}
			moneys = Mlvl[playerid];
			if(Mlvl[playerid] == 0)
			{
			if(Mine[playerid] == 0) return 1;
			Mineral[playerid] = Mineral[playerid] + 1;
			format(string,sizeof(string),"[ ! ] Mining finished ! You get 1 mineral !");
			SendClientMessage(playerid,COLOR_YELLOW,string);
			SendClientMessage(playerid,COLOR_GREEN,"[ ! ] Mining level +1 !");
			Mlvl[playerid] = Mlvl[playerid] + 1;
			
			Mine[playerid] = 0;
			return 1;
			}
			else if(Mlvl[playerid] > 0)
			{
			if(Mine[playerid] == 0) return 1;
			Mineral[playerid] = Mineral[playerid] + moneys;
			format(string,sizeof(string),"[ ! ] Mining finished ! You get %d minerals !",moneys);
			SendClientMessage(playerid,COLOR_YELLOW,string);
			SendClientMessage(playerid,COLOR_GREEN,"[ ! ] Mining level +1 !");
			Mlvl[playerid] = Mlvl[playerid] + 1;
			
			Mine[playerid] = 0;
			return 1;
			}
		}
		return 1;
		}
		else
		{
		SendClientMessage(playerid,COLOR_WHITE,"SERVER: Unknown command.");
		}
		return 1;
	}
For..

Код:
if((gettime()-minemsg[playerid]) == 60)
I've tried replacing with < or > etc but still doesn't even show msgs.
Reply
#2

Firstly replace "scm" with SendClientMessage.
Reply
#3

>.>

#define scm SendClientMessage

<.<
Reply
#4

Can somebody just help? Been trying to figure this out all day..
Reply
#5

I tried to make something like this i FAILED
i did was like make a function where it makes a timer that a value of 1 every 6000 ms(1 second), and in the script i am like:
Код:
{
   RandomShit(playerid,secs);
   if(randtime == 20)
   {
      //do shit here
   }
}
Suddenly i failed 5 times and my friend told me to give up

I think they use GetTickCount for this things
Reply
#6

Still doesn't work.

Doesn't send message every 10 seconds.

Doesn't finish mining after 60 seconds.
Reply
#7

Quote:
Originally Posted by Coole[AG
]
>.>

#define scm SendClientMessage

<.<
lololololololol
Reply
#8

Just make a timer.
Reply
#9

Quote:
Originally Posted by Baked-Banana
Just make a timer.
I've tried that but the message doesn't show up (Mining in progress)

So people just leave thinking wdf why doesn't it mine?

Even when i add a timer for the message...

& i dont want a timer..
Reply
#10

Well I could make it with a timer if you want but other then that, there isn't any other way.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)