#include <a_samp>
#define SSCANF_NO_NICE_FEATURES // comment this line if ur using community pro compiler
#include <zcmd>
#include <sscanf2>

new Text:annoucegreen;
new Text:annoucetext;
new ServerIsAnnoucing;

public OnFilterScriptInit()
{
    print("\n");
    print("  |---------------------------------------------------");
    print("  |--- Mudoo Annoucement Filterscript");
    print("  |--        |-realdiegopoptart-|");
    print("  |---     ''Dizzy can you unban me?''");
    print("  |---------------------------------------------------");

    annoucegreen = TextDrawCreate(320.000000, 429.000000, "~w~");
    TextDrawFont(annoucegreen, 1);
    TextDrawLetterSize(annoucegreen, 0.350000, 2.150000);
    TextDrawTextSize(annoucegreen, 414.500000, 659.500000);
    TextDrawSetOutline(annoucegreen, 0);
    TextDrawSetShadow(annoucegreen, 0);
    TextDrawAlignment(annoucegreen, 2);
    TextDrawColor(annoucegreen, -1);
    TextDrawBackgroundColor(annoucegreen, 255);
    TextDrawBoxColor(annoucegreen, 9109542);
    TextDrawUseBox(annoucegreen, 1);
    TextDrawSetProportional(annoucegreen, 1);
    TextDrawSetSelectable(annoucegreen, 0);

    annoucetext = TextDrawCreate(320.000000, 432.000000, "Governor Canidate ~r~Diego Starm~w~ holds a speech inside LSCH");
    TextDrawFont(annoucetext, 1);
    TextDrawLetterSize(annoucetext, 0.200000, 1.200000);
    TextDrawTextSize(annoucetext, 663.500000, 639.500000);
    TextDrawSetOutline(annoucetext, 1);
    TextDrawSetShadow(annoucetext, 0);
    TextDrawAlignment(annoucetext, 2);
    TextDrawColor(annoucetext, -1);
    TextDrawBackgroundColor(annoucetext, 255);
    TextDrawBoxColor(annoucetext, 50);
    TextDrawUseBox(annoucetext, 0);
    TextDrawSetProportional(annoucetext, 1);
    TextDrawSetSelectable(annoucetext, 0);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	if(ServerIsAnnoucing == 1)
	{
		TextDrawShowForPlayer(playerid, annoucegreen);
		TextDrawShowForPlayer(playerid, annoucetext);
		return 1;
	}
	return 1;
}

CMD:annouce(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
    return SendClientMessage(playerid, -1, "{FF8282}You must be logged in to Rcon");

    if(isnull(params))
    {
        return SendClientMessage(playerid, -1, "{FF8282}/annouce [message]");
    }

    new astring[322];
    format(astring, sizeof(astring), "%s", params);
    TextDrawSetString(annoucetext, astring);

    //
    TextDrawShowForAll(annoucegreen);
	TextDrawShowForAll(annoucetext);
    return 1;
}

CMD:unannouce(playerid, params[])
{
	if(!IsPlayerAdmin(playerid))
	return SendClientMessage(playerid, -1, "{FF8282}You must be logged in to Rcon");

    TextDrawHideForAll(annoucegreen);
    TextDrawHideForAll(annoucetext);
    SendClientMessage(playerid, -1, "{FF8282}You removed the annoucement");
    ServerIsAnnoucing = 0;

    return 1;
}
