01.03.2011, 22:39
(
Последний раз редактировалось Unknown123; 01.03.2011 в 23:02.
Причина: Code Updated
)
My TextDraw is on 288 Lines...
Can someone fix it for me..? Im learning by looking on others work :]
I made it as FilterScript here, Ripped out of my GameMode
Can someone fix it for me..? Im learning by looking on others work :]
I made it as FilterScript here, Ripped out of my GameMode
pawn Код:
#include <a_samp>
#include <zones>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
forward OnTextDrawUpdate(playerid);
new Text:LocationTextdraw[MAX_PLAYERS];
new Text:GameClock[MAX_PLAYERS];
new Text:TheDate[MAX_PLAYERS];
new Text:FakeStar0[MAX_PLAYERS];
new Text:FakeStar1[MAX_PLAYERS];
new Text:FakeStar2[MAX_PLAYERS];
new Text:FakeStar3[MAX_PLAYERS];
new Text:FakeStar4[MAX_PLAYERS];
new Text:FakeStar5[MAX_PLAYERS];
new GPS[MAX_PLAYERS];
new RealClock[MAX_PLAYERS];
new Date[MAX_PLAYERS];
public OnFilterScriptInit()
{
SetTimer("OnTextDrawUpdate", 1000, true);
for(new i = 0; i < MAX_PLAYERS; i++)
{
//GPS
LocationTextdraw[i] = TextDrawCreate(501.000000, 130.000000, "-------------------------------");
TextDrawBackgroundColor(LocationTextdraw[i], 255);
TextDrawFont(LocationTextdraw[i], 1);
TextDrawLetterSize(LocationTextdraw[i], 0.239999, 0.899999);
TextDrawColor(LocationTextdraw[i], -1);
TextDrawSetOutline(LocationTextdraw[i], 0);
TextDrawSetProportional(LocationTextdraw[i], 1);
TextDrawSetShadow(LocationTextdraw[i], 1);
TextDrawUseBox(LocationTextdraw[i], 1);
TextDrawBoxColor(LocationTextdraw[i], 0x000000AA);
TextDrawTextSize(LocationTextdraw[i], 604.000000, 0.000000);
//RealClock
GameClock[i] = TextDrawCreate(546.000000, 21.000000, "00:00");
TextDrawBackgroundColor(GameClock[i], 255);
TextDrawFont(GameClock[i], 3);
TextDrawLetterSize(GameClock[i], 0.629999, 2.399999);
TextDrawColor(GameClock[i], -1);
TextDrawSetOutline(GameClock[i], 1);
TextDrawSetProportional(GameClock[i], 1);
//The Date
TheDate[i] = TextDrawCreate(499.000000, 7.000000, "1.January.0000");
TextDrawBackgroundColor(TheDate[i], 255);
TextDrawFont(TheDate[i], 3);
TextDrawLetterSize(TheDate[i], 0.390000, 1.300000);
TextDrawColor(TheDate[i], -1);
TextDrawSetOutline(TheDate[i], 1);
TextDrawSetProportional(TheDate[i], 1);
//FakeStars
FakeStar0[i] = TextDrawCreate(499.000000, 102.000000, "]");
FakeStar1[i] = TextDrawCreate(516.000000, 102.000000, "]");
FakeStar2[i] = TextDrawCreate(534.000000, 102.000000, "]");
FakeStar3[i] = TextDrawCreate(552.000000, 102.000000, "]");
FakeStar4[i] = TextDrawCreate(570.000000, 102.000000, "]");
FakeStar5[i] = TextDrawCreate(590.000000, 102.000000, "]");
TextDrawBackgroundColor(FakeStar0[i], 0x000000AA);
TextDrawBackgroundColor(FakeStar1[i], 0x000000AA);
TextDrawBackgroundColor(FakeStar2[i], 0x000000AA);
TextDrawBackgroundColor(FakeStar3[i], 0x000000AA);
TextDrawBackgroundColor(FakeStar4[i], 0x000000AA);
TextDrawBackgroundColor(FakeStar5[i], 0x000000AA);
TextDrawFont(FakeStar0[i], 0);
TextDrawFont(FakeStar1[i], 0);
TextDrawFont(FakeStar2[i], 0);
TextDrawFont(FakeStar3[i], 0);
TextDrawFont(FakeStar4[i], 0);
TextDrawFont(FakeStar5[i], 0);
TextDrawLetterSize(FakeStar0[i], 0.629999, 2.399999);
TextDrawLetterSize(FakeStar1[i], 0.629999, 2.399999);
TextDrawLetterSize(FakeStar2[i], 0.629999, 2.399999);
TextDrawLetterSize(FakeStar3[i], 0.629999, 2.399999);
TextDrawLetterSize(FakeStar4[i], 0.629999, 2.399999);
TextDrawLetterSize(FakeStar5[i], 0.629999, 2.399999);
TextDrawColor(FakeStar0[i], 0x00000066);
TextDrawColor(FakeStar1[i], 0x00000066);
TextDrawColor(FakeStar2[i], 0x00000066);
TextDrawColor(FakeStar3[i], 0x00000066);
TextDrawColor(FakeStar4[i], 0x00000066);
TextDrawColor(FakeStar5[i], 0x00000066);
TextDrawSetOutline(FakeStar0[i], 0);
TextDrawSetOutline(FakeStar1[i], 0);
TextDrawSetOutline(FakeStar2[i], 0);
TextDrawSetOutline(FakeStar3[i], 0);
TextDrawSetOutline(FakeStar4[i], 0);
TextDrawSetOutline(FakeStar5[i], 0);
TextDrawSetProportional(FakeStar0[i], 1);
TextDrawSetProportional(FakeStar1[i], 1);
TextDrawSetProportional(FakeStar2[i], 1);
TextDrawSetProportional(FakeStar3[i], 1);
TextDrawSetProportional(FakeStar4[i], 1);
TextDrawSetProportional(FakeStar5[i], 1);
TextDrawSetShadow(FakeStar0[i], 0);
TextDrawSetShadow(FakeStar1[i], 0);
TextDrawSetShadow(FakeStar2[i], 0);
TextDrawSetShadow(FakeStar3[i], 0);
TextDrawSetShadow(FakeStar4[i], 0);
TextDrawSetShadow(FakeStar5[i], 0);
return 1;
}
return 1;
}
public OnPlayerConnect(playerid)
{
GPS[playerid] = 1;
RealClock[playerid] = 1;
Date[playerid] = 1;
TextDrawShowForPlayer(playerid, LocationTextdraw[playerid]);
TextDrawShowForPlayer(playerid, GameClock[playerid]);
TextDrawShowForPlayer(playerid, TheDate[playerid]);
TextDrawShowForPlayer(playerid, FakeStar0[playerid]);
TextDrawShowForPlayer(playerid, FakeStar1[playerid]);
TextDrawShowForPlayer(playerid, FakeStar2[playerid]);
TextDrawShowForPlayer(playerid, FakeStar3[playerid]);
TextDrawShowForPlayer(playerid, FakeStar4[playerid]);
TextDrawShowForPlayer(playerid, FakeStar5[playerid]);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
GPS[playerid] = 0;
RealClock[playerid] = 0;
Date[playerid] = 0;
TextDrawHideForPlayer(playerid, LocationTextdraw[playerid]);
TextDrawHideForPlayer(playerid, GameClock[playerid]);
TextDrawHideForPlayer(playerid, TheDate[playerid]);
TextDrawHideForPlayer(playerid, FakeStar0[playerid]);
TextDrawHideForPlayer(playerid, FakeStar1[playerid]);
TextDrawHideForPlayer(playerid, FakeStar2[playerid]);
TextDrawHideForPlayer(playerid, FakeStar3[playerid]);
TextDrawHideForPlayer(playerid, FakeStar4[playerid]);
TextDrawHideForPlayer(playerid, FakeStar5[playerid]);
return 1;
}
public OnTextDrawUpdate(playerid)
{
new string[128];
new Hour, Minute;
new Year, Month4, Day;
new Wantedlevel;
gettime(Hour, Minute);
getdate(Year, Month4, Day);
Wantedlevel = GetPlayerWantedLevel(playerid);
//GPS
format(string, sizeof(string), "%s", GetPlayerZone(playerid));
TextDrawSetString(LocationTextdraw[playerid], string);
//RealClock
format(string, sizeof(string), "%02d:%02d", Hour, Minute);
TextDrawSetString(GameClock[playerid], string);
//The Date
format(string, sizeof(string), "%d.%s.%d", Day, GetMonth(), Year);
TextDrawSetString(TheDate[playerid], string);
if(Wantedlevel > 0)
{
TextDrawHideForPlayer(playerid, FakeStar0[playerid]);
TextDrawHideForPlayer(playerid, FakeStar1[playerid]);
TextDrawHideForPlayer(playerid, FakeStar2[playerid]);
TextDrawHideForPlayer(playerid, FakeStar3[playerid]);
TextDrawHideForPlayer(playerid, FakeStar4[playerid]);
TextDrawHideForPlayer(playerid, FakeStar5[playerid]);
}
else
{
TextDrawShowForPlayer(playerid, FakeStar0[playerid]);
TextDrawShowForPlayer(playerid, FakeStar1[playerid]);
TextDrawShowForPlayer(playerid, FakeStar2[playerid]);
TextDrawShowForPlayer(playerid, FakeStar3[playerid]);
TextDrawShowForPlayer(playerid, FakeStar4[playerid]);
TextDrawShowForPlayer(playerid, FakeStar5[playerid]);
}
return 1;
}
//Commands
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(gps, 3, cmdtext);
dcmd(clock, 5, cmdtext);
dcmd(date, 4, cmdtext);
return 1;
}
dcmd_gps(playerid, params[])
{
#pragma unused params
if(GPS[playerid] == 1)
{
TextDrawHideForPlayer(playerid, LocationTextdraw[playerid]);
SendClientMessage(playerid, 0xFFFFFFAA, "You turned the GPS {FF0000}off");
GPS[playerid] = 0;
return 1;
}
else
{
if(GPS[playerid] == 0)
{
TextDrawShowForPlayer(playerid, LocationTextdraw[playerid]);
SendClientMessage(playerid, 0xFFFFFFAA, "You turned the GPS {FF0000}on");
GPS[playerid] = 1;
return 1;
}
}
return 1;
}
dcmd_clock(playerid, params[])
{
#pragma unused params
if(RealClock[playerid] == 1)
{
TextDrawHideForPlayer(playerid, GameClock[playerid]);
SendClientMessage(playerid, 0xFFFFFFAA, "You turned the Clock {FF0000}off");
RealClock[playerid] = 0;
return 1;
}
else
{
if(RealClock[playerid] == 0)
{
TextDrawShowForPlayer(playerid, GameClock[playerid]);
SendClientMessage(playerid, 0xFFFFFFAA, "You turned the Clock {FF0000}on");
RealClock[playerid] = 1;
return 1;
}
}
return 1;
}
dcmd_date(playerid, params[])
{
#pragma unused params
if(Date[playerid] == 1)
{
TextDrawHideForPlayer(playerid, TheDate[playerid]);
SendClientMessage(playerid, 0xFFFFFFAA, "You turned the Date {FF0000}off");
Date[playerid] = 0;
return 1;
}
else
{
if(Date[playerid] == 0)
{
TextDrawShowForPlayer(playerid, TheDate[playerid]);
SendClientMessage(playerid, 0xFFFFFFAA, "You turned the Date {FF0000}on");
Date[playerid] = 1;
return 1;
}
}
return 1;
}
stock GetMonth()
{
new monthname[10], Year, Month1, Day;
getdate(Year, Month1, Day);
switch(Month1)
{
case 1: monthname = "January";
case 2: monthname = "February";
case 3: monthname = "March";
case 4: monthname = "April";
case 5: monthname = "May";
case 6: monthname = "June";
case 7: monthname = "July";
case 8: monthname = "August";
case 9: monthname = "September";
case 10: monthname = "October";
case 11: monthname = "November";
case 12: monthname = "December";
}
return monthname;
}