Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined _timertd_included
- #endinput
- #endif
- #define _timertd_included
- #include <a_samp>
- #define PosX 0
- #define PosY 0
- enum Data_TD
- {
- Text:TD,
- timer,
- ForWhoShow,
- t_string[128],
- };
- new STD[MAX_PLAYERS+1][Data_TD];
- stock TimerTextDraw(time,ForWho) // to all write in ForWho 500
- {
- if(ForWho <=500)
- {
- format(STD[ForWho][t_string], 128, "%02d:%02d", time > 59 ? ( time / 60 ) : ( 00 ) , time > 59 ? ( time % 60 ) : ( time ) );
- STD[ForWho][TD] = TextDrawCreate(PosX,PosY,STD[ForWho][t_string]);
- STD[ForWho][timer] = time;
- STD[ForWho][ForWhoShow] = ForWho;
- SetTimerEx("UpdateTimer", 1000, false, "d","d", time, ForWho);
- }
- return 1;
- }
- forward UpdateTimer(time, ForWho);
- public UpdateTimer(time, ForWho)
- {
- if(time == 0) return TextDrawDestroy(STD[ForWho][TD]);
- else if( time > 0 )
- {
- switch(ForWho)
- {
- case 0 .. 499 :
- {
- STD[ForWho][timer] --;
- TextDrawHideForPlayer(STD[ForWho][ForWhoShow],STD[ForWho][TD]);
- format(STD[ForWho][t_string], 128, "%02d:%02d", time > 59 ? ( time / 60 ) : ( 00 ) , time > 59 ? ( time % 60 ) : ( time ) );
- TextDrawSetString(STD[ForWho][TD],STD[ForWho][t_string]);
- TextDrawShowForPlayer(STD[ForWho][ForWhoShow], STD[ForWho][TD]);
- }
- case 500 :
- {
- STD[ForWho][timer] --;
- TextDrawHideForAll(STD[ForWho][TD]);
- format(STD[ForWho][t_string], 128, "%02d:%02d", time > 59 ? ( time / 60 ) : ( 00 ) , time > 59 ? ( time % 60 ) : ( time ) );
- TextDrawSetString(STD[ForWho][TD],STD[ForWho][t_string]);
- TextDrawShowForAll(STD[ForWho][TD]);
- }
- }
- return SetTimerEx("UpdateTimer", 1000, false, "d","d", STD[ForWho][timer], STD[ForWho][ForWhoShow]);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment