Announcements = TextDrawCreate(3.000000, 430.000000, " ");
TextDrawAlignment(Announcements,0);
TextDrawBackgroundColor(Announcements, 255);
TextDrawFont(Announcements, 1);
TextDrawLetterSize(Announcements, 0.300000, 1.000000);
TextDrawColor(Announcements, -1);
TextDrawSetOutline(Announcements, 0);
Originally Posted by cessil
by using
TextDrawSetString |
new Text:Textan;
Textan = TextDrawCreate(3.000000, 430.000000, " "); TextDrawAlignment(Textan,0); TextDrawBackgroundColor(Textan, 255); TextDrawFont(Textan, 1); TextDrawLetterSize(Textan, 0.300000, 1.000000); TextDrawColor(Textan, -1); TextDrawSetOutline(Textan, 0)
if(strcmp(cmd,"/antd",true)==0) { new tmp[30]; tmp = strtok(cmdtext,idx); new antd = strval(tmp); TextDrawSetString(playerid, antd); TextDrawShowForPlayer(playerid, Textan); return 1; }
Originally Posted by www.******.com
THIS MIGHT TURN OUT TO BE A EPIC FAIL.
|
new aMessage[4][128] =
{
{"Announcement 1"},
{"Announcement 2"},
{"Announcement 3"},
{"Announcement 4"}
};
public MinuteTimer() //SetTimer OnGameModeInit
{
TextDrawSetString(Text:text, aMessage[random(sizeof(aMessage))]);
TextDrawShowForAll(Text:text);
}
#define FILTERSCRIPT #include <a_samp> #include <sscanf>// credits to ****** #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 #define MSGCOMM_COLOR 0x55aaff77 new TextClearCounter; new Text:TDTSBackground; new TDTSBackgroundAlpha; new TDTSBackgroundColor; new Text:TDTSMessage; new TDTSBackgroundText[320]="________________________________________________________________________________________________________________________~n~________________________________________________________________________________________________________________________"; new TDTSMessageText[8192]="________________________________________________________________________________________________________________________newsticker textdraw filterscript loaded."; new gScrollTimer; new gCommercialDelay; new CommercialOld; new Commercials[][]= { "blablablabla", "(samp) type /pagesize 20 to maximize the chatwindow.", "(cmd) type /an <text> to announce some text in the newsticker.", "(cmd) type /aq <text> to announce w/o the players' id/name." }; forward ShowTDTS(); //--------------- public ShowTDTS() //--------------- { TextDrawSetString(TDTSBackground,TDTSBackgroundText); TextDrawShowForAll(TDTSBackground); TextDrawSetString(TDTSMessage,TDTSMessageText); TextDrawShowForAll(TDTSMessage); return 1; } //------------------------- public OnFilterScriptInit() //------------------------- { TDTSBackground=TextDrawCreate(0,435,"_"); TextDrawLetterSize(TDTSBackground,0.198,1.28);//120 TextDrawFont(TDTSBackground,2); TextDrawSetProportional(TDTSBackground,0); TextDrawUseBox(TDTSBackground,1); TextDrawBoxColor(TDTSBackground,0x3f3f3f3f); TextDrawSetShadow(TDTSBackground,0); TextDrawSetOutline(TDTSBackground,0); TextDrawBackgroundColor(TDTSBackground,55555555); TDTSMessage=TextDrawCreate(0,435,"_"); TextDrawLetterSize(TDTSMessage,0.198,1.28); TextDrawFont(TDTSMessage,2); TextDrawSetProportional(TDTSMessage,0); TextDrawUseBox(TDTSMessage,0); TextDrawSetShadow(TDTSMessage,-1); TextDrawSetOutline(TDTSMessage,1); gScrollTimer=SetTimer("ScrollTimer",100,1); gCommercialDelay=SetTimer("CommercialDelay",60000,1); return 1; } public OnFilterScriptExit() { TextDrawDestroy(TDTSBackground); TextDrawDestroy(TDTSMessage); KillTimer(gScrollTimer); KillTimer(gCommercialDelay); return 1; } forward ScrollTimer(s,Text[128]); //---------------------------- public ScrollTimer(s,Text[128]) //---------------------------- { strdel(TDTSMessageText,0,1); new Len=strlen(TDTSMessageText); if(Len<120) { TextClearCounter++; format(TDTSMessageText,sizeof(TDTSMessageText),"%s_",TDTSMessageText); if(TextClearCounter>120) { TDTSBackgroundAlpha-=4; if(TDTSBackgroundAlpha<0) { TDTSBackgroundAlpha=0; } } } else { TextClearCounter=0; TDTSBackgroundAlpha+=2; if(TDTSBackgroundAlpha>127) { TDTSBackgroundAlpha=127; } } TextDrawBoxColor(TDTSBackground,256*TDTSBackgroundColor+TDTSBackgroundAlpha); ShowTDTS(); return 1; } forward CommercialDelay(); //---------------------- public CommercialDelay() //---------------------- { new Rnd=(1+CommercialOld+(random(sizeof(Commercials)-1)))%sizeof(Commercials); AddNews(Commercials[Rnd]); CommercialOld=Rnd; return 1; } //--------------------------------------------- public OnPlayerCommandText(playerid, cmdtext[]) //--------------------------------------------- { dcmd(An, 2, cmdtext); dcmd(Aq, 2, cmdtext); return 0; } forward AddNews(Text[]); //-------------------- public AddNews(Text[]) //-------------------- { format(TDTSMessageText,sizeof(TDTSMessageText),"%s%s_",TDTSMessageText,Text); ShowTDTS(); return 1; } //++++++++++++++++++++++++ dcmd_An(playerid,params[]) //++++++++++++++++++++++++ { new Text[128]; if (sscanf(params,"s",Text)) { SendClientMessage(playerid,MSGCOMM_COLOR, "Usage: \"/An <Text>\""); return 1; } new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,MAX_PLAYER_NAME); format(TDTSMessageText,sizeof(TDTSMessageText),"%s ]]] (%d) %s: ",TDTSMessageText,playerid,playername); AddNews(Text); return 1; } //++++++++++++++++++++++++ dcmd_Aq(playerid,params[]) //++++++++++++++++++++++++ { new Text[128]; if (sscanf(params,"s",Text)) { SendClientMessage(playerid,MSGCOMM_COLOR, "Usage: \"/Aq <Text>\""); return 1; } AddNews(Text); return 1; } public OnPlayerConnect(playerid) { new name[MAX_PLAYER_NAME], string[48]; GetPlayerName(playerid, name, sizeof(name)); format(string,sizeof(string),"]]] %s joined the game.",name); CallRemoteFunction("AddNews","s",string); return 1; }