[FilterScript] Radio Sys. Text.
#1

This is my FS radio system textdraw
FS contains a list of radios from my country

Image:


Код:
#include <a_samp>
new Text:title;
new Text:next;
new Text:back;
new Text:guitar;
new string[69];

new RadioP[MAX_PLAYERS];
new Radio[5][] =
{
       			"http://somafm.com/tags.pls",
       			"http://stream.profm.ro:8012/profm.mp3",
       			 "http://www.radiogmusic.com/rock.m3u",
       			"http://www.radiomafia.ro/listen.m3u",
				"http://s4.radiohost.pl:8154/listen.pls"


};
new Tit[5][] =
{
		"Soma FM",
		"Pro FM",
		"Radio Rock",
		"Radio Mafia",
		"Radio Dubstep"
};
public OnFilterScriptInit()
{
      

        title = TextDrawCreate(298.000000, 49.000000, "title");
        TextDrawAlignment(title, 2);
        TextDrawBackgroundColor(title, 255);
        TextDrawFont(title, 1);
        TextDrawLetterSize(title, 0.500000, 1.799999);
        TextDrawColor(title, -1);
        TextDrawSetOutline(title, 0);
        TextDrawSetProportional(title, 1);
        TextDrawSetShadow(title, 1);
        TextDrawUseBox(title, 1);
        TextDrawBoxColor(title, 101058123);
        TextDrawTextSize(title, 423.000000, -197.000000);

        next = TextDrawCreate(395.000000, 50.000000, ">");
        TextDrawAlignment(next, 2);
        TextDrawBackgroundColor(next, 255);
        TextDrawFont(next, 2);
        TextDrawLetterSize(next, 0.700000, 3.000000);
        TextDrawColor(next, -1);
        TextDrawSetOutline(next, 0);
        TextDrawSetProportional(next, 1);
        TextDrawSetShadow(next, 1);

        back = TextDrawCreate(202.000000, 50.000000, "<");
        TextDrawAlignment(back, 2);
        TextDrawBackgroundColor(back, 255);
        TextDrawFont(back, 2);
        TextDrawLetterSize(back, 0.700000, 3.000000);
        TextDrawColor(back, -1);
        TextDrawSetOutline(back, 0);
        TextDrawSetProportional(back, 1);
        TextDrawSetShadow(back, 1);

        guitar = TextDrawCreate(247.000000, -6.000000, "guitar");
		TextDrawBackgroundColor(guitar, 0);
		TextDrawFont(guitar, 5);
		TextDrawLetterSize(guitar, 0.500000, 9.800000);
		TextDrawColor(guitar, -1);
		TextDrawSetOutline(guitar, 0);
		TextDrawSetProportional(guitar, 1);
		TextDrawSetShadow(guitar, 1);
		TextDrawUseBox(guitar, 1);
		TextDrawBoxColor(guitar, 0);
		TextDrawTextSize(guitar, 132.000000, 60.000000);
		TextDrawSetPreviewModel( guitar, 19317);
		TextDrawSetPreviewRot( guitar, 0.000000, -35.000000, 180.000000, 1.000000);
		TextDrawSetSelectable(guitar, 1);

        TextDrawSetSelectable(title, false);
        TextDrawSetSelectable(next, true);
        TextDrawSetSelectable(back, true);
        TextDrawSetSelectable(guitar, true);
        return 1;
}

public OnFilterScriptExit()
{
        TextDrawDestroy(title);
        TextDrawDestroy(next);
        TextDrawDestroy(back);
        TextDrawDestroy(guitar);
        return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        if (!strcmp("/radio", cmdtext, true))
        {
            TextDrawShowForPlayer(playerid, title);
            TextDrawShowForPlayer(playerid, next);
            TextDrawShowForPlayer(playerid, back);
            TextDrawShowForPlayer(playerid, guitar);
            SelectTextDraw(playerid, 0xA3B4C5FF);
            RadioP[playerid]=0;
		    format(string,sizeof(string),"%s",Tit[RadioP[playerid]]);
		    TextDrawSetString(title,string);
		    TextDrawShowForPlayer(playerid,title);
			return 1;
        }
        return 0;
}

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
        if(_:clickedid != 65535)
        {
         	if(clickedid == back)
                {
					if(RadioP[playerid] == 0) RadioP[playerid]=5;
                         	RadioP[playerid]-=1;
				         	format(string,sizeof(string),"%s",Tit[RadioP[playerid]]);
						 	TextDrawSetString(title,string);
						 	TextDrawShowForPlayer(playerid,title);
						 	PlayAudioStreamForPlayer(playerid,Radio[RadioP[playerid]]);

                }
			if(clickedid == next)
                {
                        
                       	 RadioP[playerid]+=1;
				         format(string,sizeof(string),"%s",Tit[RadioP[playerid]]);
						 TextDrawSetString(title,string);
						 TextDrawShowForPlayer(playerid,title);
						 PlayAudioStreamForPlayer(playerid,Radio[RadioP[playerid]]);
						 
                }
                
                


        }
        return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if (newkeys & KEY_YES)
	{
	    TextDrawHideForPlayer(playerid, title);
        TextDrawHideForPlayer(playerid, next);
        TextDrawHideForPlayer(playerid, back);
        TextDrawHideForPlayer(playerid, guitar);
        CancelSelectTextDraw(playerid);
	}
	return 1;
}
Reply
#2

Pretty good use of TextDrawSetPreviewModel, +rep
Reply
#3

Very good ma frend !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)