whiplk

[CODE] - TimerEasyWork

Aug 10th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.06 KB | None | 0 0
  1. //Retorna um valor de tempo dependendo do parĂ¢metro assinalado pelo programador 'segundos', 'minutos', 'horas'
  2. stock timeExe(stringExe[])
  3. {
  4.     new string_recortada[ 0x14 ] , string_tratada = 0 ;
  5.     strmid ( string_recortada , stringExe , 0 , ( strfind ( stringExe , " " ) ) ) ;
  6.     string_tratada = strval ( string_recortada ) ;
  7.     if ( string_tratada != '\0' )
  8.     {
  9.         strmid ( string_recortada , stringExe , ( ( strfind ( stringExe , " " ) ) + 1 ) , strlen ( stringExe ) ) ;
  10.     }
  11.  
  12.     if ( !strcmp ( string_recortada , "segundos" ) )
  13.     {
  14.         if ( ( string_tratada *= 1000 ) )
  15.         return string_tratada ;
  16.     }
  17.     else if ( !strcmp ( string_recortada , "minutos" ) )
  18.     {
  19.         if ( ( string_tratada *= 60 * 1000 ) )
  20.         return string_tratada ;
  21.     }
  22.     else if ( !strcmp ( string_recortada , "horas" ) )
  23.     {
  24.         if ( ( string_tratada *= 60 * 60 * 1000 ) )
  25.         return string_tratada ;
  26.     }
  27.     return 0 ;
  28. }
  29.  
  30. exemplo de uso, para os que usam timer ou etc...
  31.  
  32. public OnGameModeInit()
  33. {
  34.     SetTimer("x", timeExe("3 segundos"), false);
  35.     return 0;
  36. }
  37. forward x();
  38. public x()
  39. {
  40.     printf("x");
  41. }
Advertisement
Add Comment
Please, Sign In to add comment