Advertisement
Guest User

Untitled

a guest
Jul 1st, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. /* Info:
  2. PlayerInfo[i][playerTimer][0] = minutes;
  3. PlayerInfo[i][playerTimer][1] = seconds;
  4.  
  5. */
  6.  
  7.  
  8. if(PlayerInfo[i][pTimerSet]==true) // updates every second
  9. {
  10. PlayerInfo[i][playerTimer][1]--;
  11. if(PlayerInfo[i][playerTimer][1]<=1)
  12. {
  13. PlayerInfo[i][playerTimer][0]--;
  14. if(PlayerInfo[i][playerTimer][0] == 0)
  15. {
  16. PlayerInfo[i][playerTimer][0] = 0;
  17. PlayerInfo[i][playerTimer][1] = 0;
  18. SetPlayerTimer(i,PlayerInfo[i][playerTimer][0],PlayerInfo[i][playerTimer][1]);
  19. PlayerInfo[i][pTimerSet] = false;
  20. }
  21. else if(PlayerInfo[i][playerTimer][0] == 1)
  22. {
  23. PlayerInfo[i][playerTimer][0] = 0; // last Minute
  24. PlayerInfo[i][playerTimer][1] = 59;
  25. SetPlayerTimer(i,PlayerInfo[i][playerTimer][0],PlayerInfo[i][playerTimer][1]);
  26. }
  27. }
  28. }
  29.  
  30.  
  31. stock SetPlayerTimer(playerid,minutes,seconds) // add size and font ? optional
  32. {
  33. new string[86];
  34. PlayerInfo[playerid][pTimerSet] = true;
  35. format(string,sizeof(string),"Time_left:_%02d:%02d",minutes,seconds);
  36. PlayerTextDrawSetString(playerid,timerForPlayer[playerid],string);
  37. PlayerTextDrawShow(playerid,timerForPlayer[playerid]);
  38. return 1;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement