15.06.2016, 20:09
I made /robbank and it works good. But i want to know how can i make command that will show time left for robbery. I have no idea where ot start from. Can i get little help from you??
#define TIME_NEEDED_TO_ROB 60 //change 60 to how many seconds you want of the player to stand inside
new BankRobbing[MAX_PLAYERS],
RobbingTimer[MAX_PLAYERS];
CMD:robbank(playerid,params[]) {
new currenttime = gettime();
if(currenttime < BankRobbing[playerid]) return SendClientMessage(playerid,COLOR_RED,"You are still robbing the bank!");
BankRobbing[playerid] += TIME_NEEDED_TO_ROB;
RobbingTimer[playerid] = SetTimerEx("timer_Robbing",1000,true,"i",playerid);
SendClientMessageToAll(COLOR_GREEN,"Bank is being robbed!");
return true;
}
forward timer_Robbing(playerid);
public timer_Robbing(playerid) {
new calc = BankRobbing[playerid]-gettime(); //this will get you how many seconds they have left
if(calc <= 0) { //if the time passed
KillTimer(RobbingTimer[playerid]);
return true;
}
new string[128];
format(string,sizeof(string),"Time left %i",calc);
SendClientMessage(playerid,COLOR_RED,string);
return true;
}