#1

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??
Reply
#2

You create a player timer that will repeat itself every second. In the callback/public, you create Player textdraw that will update itself and show on the screen whenever timer is called. You kill the timer when the time runs out
Reply
#3

well that is good start .
Reply
#4

Its quite simple

PHP Code:

#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;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)