Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 13/07/2013 3:49 p.m.
- Система динамических объявлений
- By [FADE]Parka
- Version: 0.1a
- (forked and translated to Russian from http://forum.sa-mp.com/showthread.php?t=450640)
- Перевод: Daniel_Cortez
- */
- #include <a_samp>
- #include <sscanf2>
- #include <dc_cmd>
- #define fpub:%0(%1) forward %0(%1); public %0(%1)
- new
- Float:TD_Position,
- Text:Announce,
- Text:Background,
- sAnnounce[118],
- Type,
- bool:aProgress = false,
- TimeTextDraw;
- public OnPlayerText(playerid, text[]) return 1;
- public OnFilterScriptInit()
- {
- print("\n\n 13/07/2013 3:49 p.m.");
- print("Система динамических объявлений");
- print(" By [FADE]Parka\n\n");
- Announce = TextDrawCreate(250.000000, 1.000000, "~y~Dynamic ~b~ Announce~r~ System");
- TextDrawBackgroundColor(Announce, 51);
- TextDrawFont(Announce, 1);
- TextDrawLetterSize(Announce, 0.440000, 1.300000);
- TextDrawColor(Announce, -1);
- TextDrawSetOutline(Announce, 1);
- TextDrawSetProportional(Announce, 1);
- return TextDrawSetSelectable(Announce, 0);
- }
- public OnFilterScriptExit()
- {
- return KillTimer(TimeTextDraw);
- }
- CMD:announce(playerid,params[])
- {
- #define TD_Type params[0]
- #define TD_Text params[1]
- if(IsPlayerAdmin(playerid) == 0)
- return SendClientMessage( playerid, 0xFF0000ff, "Ошибка: Вы не администратор!");
- if(sscanf(params, "ds[118]", TD_Type, TD_Text))
- return SendClientMessage( playerid, 0xFF0000ff, "Использование: /Announce <тип(0-низ,1-верх)> <текст>");
- if(aProgress)
- return SendClientMessage( playerid, 0xFF0000ff, "Ошибка: Подождите, пока исчезнет предыдущее объявление.");
- Type = TD_Type;
- AnnounceBox(320.0, (TD_Type) ? 435.0 : 1.0000);
- aProgress = true;
- TD_Position = 641.0000;
- sAnnounce[0] = 0, strcat(sAnnounce, TD_Text);
- AnnounceTextDraw();
- return SendClientMessage( playerid, 0x00FF00FF, "Объявление передано успешно!");
- #undef TD_Text
- #undef TD_Type
- }
- fpub:AnnounceBox(Float: TD_x, Float: TD_y)
- {
- Background = TextDrawCreate( TD_x, TD_y, "~n~_");
- TextDrawAlignment(Background, 2);
- TextDrawBackgroundColor(Background, 255);
- TextDrawFont(Background, 1);
- TextDrawLetterSize(Background, 0.500000, 1.000000);
- TextDrawColor(Background, -1);
- TextDrawSetOutline(Background, 0);
- TextDrawSetProportional(Background, 1);
- TextDrawSetShadow(Background, 1);
- TextDrawUseBox(Background, 1);
- TextDrawBoxColor(Background, 85);
- TextDrawTextSize(Background, 0.000000, 658.000000);
- TextDrawSetSelectable(Background, 0);
- TextDrawShowForAll(Background);
- }
- fpub:RemoveAnnounce()
- {
- aProgress = false;
- TextDrawHideForAll(Announce);
- TextDrawDestroy(Background);
- return KillTimer(TimeTextDraw);
- }
- fpub:AnnounceTextDraw()
- {
- UpDateTextDraw(Announce);
- TD_Position -= 1.0;
- if(floatcmp(TD_Position, -385.0) <= 0)
- {
- RemoveAnnounce();
- TD_Position = 641.0000;
- return 1;
- }
- if(floatcmp(TD_Position, 640.0) >= 0)
- {
- TextDrawSetString(Announce , sAnnounce);
- }
- return SetTimer("AnnounceTextDraw", 50, false);
- }
- fpub:UpDateTextDraw(Text:TextId)
- {
- EditAnnounceType(TextId, (Type) ? 435.0 : 1.0000);
- return TextDrawShowForAll(TextId);
- }
- fpub:EditAnnounceType(Text:TextId, Float:TD_x)
- {
- TextDrawDestroy(TextId);
- TextId = TextDrawCreate( TD_Position, TD_x, sAnnounce);
- TextDrawBackgroundColor(TextId, 51);
- TextDrawFont(TextId, 1);
- TextDrawLetterSize(TextId, 0.440000, 1.300000);
- TextDrawColor(TextId, -1);
- TextDrawSetOutline(TextId, 1);
- TextDrawSetProportional(TextId, 1);
- TextDrawSetSelectable(TextId, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement