garfield

[FS]: Pegar tempo em race.

Oct 19th, 2011
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.02 KB | None | 0 0
  1. //   Pegar Tempo em Race... By [iPs]SuYaNw
  2.  
  3.  
  4. #include a_samp
  5.  
  6.  
  7. enum sYaw
  8. {
  9.     Hora,
  10.     Min,
  11.     Sec
  12. };
  13.  
  14. new
  15.     Time[MAX_PLAYERS][sYaw]
  16. ;
  17.  
  18. public OnPlayerCommandText(playerid,cmdtext[])
  19. {
  20.     if(!strcmp(cmdtext,"/race", true))
  21.     {
  22.         Time[playerid][Hora]    =   0;
  23.         Time[playerid][Min]     =   0;
  24.         Time[playerid][Sec]     =   0;
  25.         gettime(Time[playerid][Hora], Time[playerid][Min], Time[playerid][Sec]);
  26.         return 1;
  27.     }
  28.     if(!strcmp(cmdtext,"/term", true))
  29.     {
  30.         TerminarCorrida(playerid);
  31.         return 1;
  32.     }
  33.     return 0;
  34. }
  35.  
  36.  
  37. static stock TerminarCorrida(playerid)
  38. {
  39.     static
  40.         sSegundo,    tSegundo,
  41.         sMinuto,     tMinuto,
  42.         sHora,       tHora
  43.     ;
  44.    
  45.     gettime(sHora, sMinuto, sSegundo);
  46.    
  47.     tSegundo    = sSegundo   -= Time[playerid][Sec];
  48.     tMinuto     = sMinuto    -= Time[playerid][Min];
  49.     tHora       = sHora      -= Time[playerid][Hora];
  50.    
  51.     static string[100];
  52.     format(string, sizeof(string),"VocĂȘ terminou o race, Tempo: %02d:%02d:%02d", tHora, tMinuto, tSegundo);
  53.     SendClientMessage(playerid, -1, string);
  54.     return 1;
  55. }
  56.  
Advertisement
Add Comment
Please, Sign In to add comment