Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #define USEREALTIME false //true = Serverzeit wird genutzt (Real Time)||false = Custom Zeit wird genutzt
- #define time 10 //Alle wieviel Sekunden eine Ingame Minute verstreichen soll
- #if USEREALTIME true
- new DoppelpunktShow,Text:Texture1,Text:Box,Text:Texture2,Text:Doppelpunkt,Text:Stunde,Text:Minute,Backgroundcolor,TextColor;
- #else
- new DoppelpunktShow,Text:Texture1,Text:Box,Text:Texture2,Text:Doppelpunkt,Text:Stunde,Text:Minute,HoursEllapsed,MinutesEllapsed,Clockup,Backgroundcolor,TextColor;
- #endif
- stock HexToInt(string[])
- {
- if (string[0]==0) return 0;
- new i;
- new cur=1;
- new res=0;
- for (i=strlen(string);i>0;i--)
- {
- if (string[i-1]<58) res=res+cur*(string[i-1]-48); else res=res+cur*(string[i-1]-65+10);
- cur=cur*16;
- }
- return res;
- }
- forward ClockUpdate(playerid);
- public OnFilterScriptInit()
- {
- print(" ");
- print("\t\t|=============================|");
- print("\t\t| uClock v1.0 R1 |");
- print("\t\t| scriptet by ulbi1990 |");
- print("\t\t|=============================|");
- print(" ");
- Backgroundcolor=0xFFFFFFFF;
- TextColor=0xFF0000FF;
- Texture1 = TextDrawCreate(537.000000, 26.000000, "LD_BEAT:chit");
- TextDrawBackgroundColor(Texture1,Backgroundcolor);
- TextDrawFont(Texture1, 4);
- TextDrawLetterSize(Texture1, 0.500000, 1.000000);
- TextDrawColor(Texture1,Backgroundcolor);
- TextDrawSetOutline(Texture1, 0);
- TextDrawSetProportional(Texture1, 1);
- TextDrawSetShadow(Texture1, 1);
- TextDrawUseBox(Texture1, 1);
- TextDrawBoxColor(Texture1,Backgroundcolor);
- TextDrawTextSize(Texture1, 45.000000, 33.000000);
- Texture2 = TextDrawCreate(566.000000, 26.000000, "LD_BEAT:chit");
- TextDrawBackgroundColor(Texture2, Backgroundcolor);
- TextDrawFont(Texture2, 4);
- TextDrawLetterSize(Texture2, 0.500000, 1.000000);
- TextDrawColor(Texture2,Backgroundcolor);
- TextDrawSetOutline(Texture2, 0);
- TextDrawSetProportional(Texture2, 1);
- TextDrawSetShadow(Texture2, 1);
- TextDrawUseBox(Texture2, 1);
- TextDrawBoxColor(Texture2,Backgroundcolor);
- TextDrawTextSize(Texture2, 45.000000, 33.000000);
- Box = TextDrawCreate(594.000000, 34.000000, "_");
- TextDrawBackgroundColor(Box,Backgroundcolor);
- TextDrawFont(Box, 1);
- TextDrawLetterSize(Box, 0.500000, 1.899999);
- TextDrawColor(Box,Backgroundcolor);
- TextDrawSetOutline(Box, 0);
- TextDrawSetProportional(Box, 1);
- TextDrawSetShadow(Box, 1);
- TextDrawUseBox(Box, 1);
- TextDrawBoxColor(Box,Backgroundcolor);
- TextDrawTextSize(Box, 559.000000, 0.000000);
- Stunde = TextDrawCreate(550.000000, 30.000000, "00");
- TextDrawBackgroundColor(Stunde, 255);
- TextDrawFont(Stunde, 1);
- TextDrawLetterSize(Stunde, 0.430000, 2.399999);
- TextDrawColor(Stunde,TextColor);
- TextDrawSetOutline(Stunde, 0);
- TextDrawSetProportional(Stunde, 1);
- TextDrawSetShadow(Stunde, 1);
- Minute = TextDrawCreate(577.000000, 30.000000, "00");
- TextDrawBackgroundColor(Minute, 255);
- TextDrawFont(Minute, 1);
- TextDrawLetterSize(Minute, 0.430000, 2.399999);
- TextDrawColor(Minute,TextColor);
- TextDrawSetOutline(Minute, 0);
- TextDrawSetProportional(Minute, 1);
- TextDrawSetShadow(Minute, 1);
- Doppelpunkt = TextDrawCreate(570.000000, 27.000000, ":");
- TextDrawBackgroundColor(Doppelpunkt, 255);
- TextDrawFont(Doppelpunkt, 1);
- TextDrawLetterSize(Doppelpunkt, 0.500000, 2.699999);
- TextDrawColor(Doppelpunkt, 16732415);
- TextDrawSetOutline(Doppelpunkt, 0);
- TextDrawSetProportional(Doppelpunkt, 1);
- TextDrawSetShadow(Doppelpunkt, 1);
- SetTimer("ClockUpdate",1000,1);
- #if defined USEREALCLOCK false
- Clockup=0;
- #endif
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- TogglePlayerClock(playerid,0);
- SetPVarInt(playerid,"Spawned",0);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- TextDrawShowForPlayer(playerid,Texture1);
- TextDrawShowForPlayer(playerid,Texture2);
- TextDrawShowForPlayer(playerid,Box);
- TextDrawShowForPlayer(playerid,Stunde);
- TextDrawShowForPlayer(playerid,Minute);
- TextDrawShowForPlayer(playerid,Doppelpunkt);
- SetPVarInt(playerid,"Spawned",1);
- return 1;
- }
- public ClockUpdate(playerid)
- {
- if(GetPVarInt(playerid,"Spawned")==1)
- {
- new str[4],str2[4],worldtime[20];
- #if USEREALTIME true
- new hour,minute,second;
- gettime(hour,minute,second);
- if(minute<10)
- {
- format(str2,sizeof(str2),"%02d",minute);
- }
- else if(minute>9)
- {
- format(str2,sizeof(str2),"%d",minute);
- }
- TextDrawSetString(Minute,str2);
- TextDrawShowForPlayer(playerid,Minute);
- if(hour<10)
- {
- format(str,sizeof(str),"%02d",hour);
- }
- else if(hour>9)
- {
- format(str,sizeof(str),"%d",hour);
- }
- TextDrawSetString(Stunde,str);
- TextDrawShowForPlayer(playerid,Stunde);
- SetWorldTime(hour);
- format(worldtime,sizeof(worldtime),"worldtime %02d:%02d",hour,minute);
- SendRconCommand(worldtime);
- #else
- Clockup++;
- if(Clockup==time)
- {
- Clockup=0;
- if(MinutesEllapsed<60)
- {
- if(MinutesEllapsed<10)
- {
- format(str2,sizeof(str2),"%02d",MinutesEllapsed);
- }
- else if(MinutesEllapsed>9)
- {
- format(str2,sizeof(str2),"%d",MinutesEllapsed);
- }
- MinutesEllapsed++;
- TextDrawSetString(Minute,str2);
- TextDrawShowForPlayer(playerid,Minute);
- }
- else if(MinutesEllapsed==60)
- {
- MinutesEllapsed=0;
- if(HoursEllapsed<10)
- {
- format(str2,sizeof(str2),"00");
- format(str,sizeof(str),"%02d",HoursEllapsed);
- }
- else if(MinutesEllapsed>9)
- {
- format(str2,sizeof(str2),"00");
- format(str,sizeof(str),"%d",HoursEllapsed);
- }
- HoursEllapsed++;
- if(HoursEllapsed==24)
- {
- HoursEllapsed=0;
- {
- format(str,sizeof(str),"00");
- }
- }
- TextDrawSetString(Minute,str2);
- TextDrawShowForPlayer(playerid,Minute);
- TextDrawSetString(Stunde,str);
- TextDrawShowForPlayer(playerid,Minute);
- }
- }
- SetWorldTime(HoursEllapsed);
- format(worldtime,sizeof(worldtime),"worldtime %02d:%02d",HoursEllapsed,MinutesEllapsed);
- SendRconCommand(worldtime);
- #endif
- if(DoppelpunktShow==0)
- {
- TextDrawHideForAll(Doppelpunkt);
- DoppelpunktShow=1;
- }
- else if(DoppelpunktShow==1)
- {
- TextDrawShowForAll(Doppelpunkt);
- DoppelpunktShow=0;
- }
- }
- return 1;
- }
- CMD:backgroundcolor(playerid,params[])
- {
- new color[11];
- if(IsPlayerAdmin(playerid))
- {
- if(sscanf(params,"x",color)) return SendClientMessage(playerid,-1,"[Nutzung]: /background [hex color]");
- {
- if(strlen(params)<10||strlen(params)>10)
- {
- SendClientMessage(playerid,-1,"Bitte nur Hex Colors!");
- }
- else
- {
- for(new i;i<MAX_PLAYERS;i++)
- {
- if(GetPVarInt(i,"Spawned")==1)
- {
- Backgroundcolor=HexToInt(params);
- TextDrawHideForAll(Texture1);
- TextDrawHideForAll(Texture2);
- TextDrawHideForAll(Box);
- TextDrawBackgroundColor(Texture1,Backgroundcolor);
- TextDrawColor(Texture1,Backgroundcolor);
- TextDrawBoxColor(Texture1,Backgroundcolor);
- TextDrawBackgroundColor(Texture2,Backgroundcolor);
- TextDrawColor(Texture2,Backgroundcolor);
- TextDrawBoxColor(Texture2,Backgroundcolor);
- TextDrawBackgroundColor(Box,Backgroundcolor);
- TextDrawColor(Box,Backgroundcolor);
- TextDrawBoxColor(Box,Backgroundcolor);
- TextDrawShowForPlayer(i,Texture1);
- TextDrawShowForPlayer(i,Texture2);
- TextDrawShowForPlayer(i,Box);
- }
- }
- }
- }
- }
- else
- {
- SendClientMessage(playerid,-1,"Nur Rcon Admins k�nnen die Farbe �ndern!");
- }
- return 1;
- }
- CMD:textcolor(playerid,params[])
- {
- new color[11];
- if(IsPlayerAdmin(playerid))
- {
- if(sscanf(params,"x",color)) return SendClientMessage(playerid,-1,"[Nutzung]: /background [hex color]");
- {
- if(strlen(params)<10||strlen(params)>10)
- {
- SendClientMessage(playerid,-1,"Bitte nur Hex Colors!");
- }
- else
- {
- for(new i;i<MAX_PLAYERS;i++)
- {
- if(GetPVarInt(i,"Spawned")==1)
- {
- TextColor=HexToInt(params);
- TextDrawHideForAll(Stunde);
- TextDrawHideForAll(Minute);
- TextDrawColor(Stunde,TextColor);
- TextDrawColor(Minute,TextColor);
- TextDrawShowForPlayer(i,Stunde);
- TextDrawShowForPlayer(i,Minute);
- }
- }
- }
- }
- }
- else
- {
- SendClientMessage(playerid,-1,"Nur Rcon Admins k�nnen die Farbe �ndern!");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment