17.12.2014, 19:27
pawn Код:
//This Is An Example Of How You Can Do What You Want It To Do.
//It's not perfect, but it will give you an example.
#include <a_samp>
#include <YSI\y_commands>
#include <foreach>
#define COLOR_WHITE 0xFFFFFFFF
new Text:Timer;
forward CanGangwar(playerid);
new CanFightForGangZone[MAX_PLAYERS];
public OnFilterScriptInit()
{
Timer = TextDrawCreate(605.000000,25.000000,"00:00");
TextDrawAlignment(Timer,3);
TextDrawBackgroundColor(Timer,0x000000FF);
TextDrawFont(Timer,3);
TextDrawLetterSize(Timer,0.535,2.2);
TextDrawColor(Timer,COLOR_WHITE);
TextDrawSetOutline(Timer,2);
TextDrawSetProportional(Timer,1);
TextDrawSetShadow(Timer,1);
return 1;
}
public OnFilterScriptExit()
{
TextDrawDestroy(Timer);
return 1;
}
//Used To Count Down The Timer.
//Set the Amount Of CanFightForGangZone, then count down this timer in intervals of 1 seconds
public CanGangwar(playerid)
{
new str1[10];
CanFightForGangZone[playerid]--;
format(str1,sizeof(str1),"%s",TimeConvert(CanFightForGangZone[playerid]));
TextDrawSetString(Timer,str1);
TextDrawShowForAll(Timer);
return 1;
}
//This Is A Stock Made By Someone On The SA-MP Forums (Thanks to whoever made it), that will convert seconds to actual Minutes and Seconds.
TimeConvert(time) {
new minutes;
new seconds;
new string[128];
if(time > 59){
minutes = floatround(time/60);
seconds = floatround(time - minutes*60);
if(seconds>9)format(string,sizeof(string),"%d:%d",minutes,seconds);
else format(string,sizeof(string),"%d:0%d",minutes,seconds);
}
else{
seconds = floatround(time);
if(seconds>9)format(string,sizeof(string),"0:%d",seconds);
else format(string,sizeof(string),"0:0%d",seconds);
}
return string;
}