Radio Text
#1

How i do a Radio text?
credit to Ash.

How i do the style for radio text?
GameTextForPlayer(playerid, const string[], time, 3);
public OnPlayerConnect(playerid)
{
return 1;
}
Reply
#2

do you can to explain better exactly what you want to make? I wanna help you but i have no idea what radio text you expect from us.
GameTextForPlayer with name of radio online which players are listening?
Reply
#3

Yes like dis:

https://sampforum.blast.hk/showthread.php?tid=361660
Reply
#4

You'll need to use a textdraw. No gametext looks like that.

pawn Код:
x = CreatePlayerTextDraw(playerid, 320.0, 20, "HELLO WORLD!");
PlayerTextDrawAlignment(playerid, x, 2);
PlayerTextDrawBackgroundColor(playerid, x, 255);
PlayerTextDrawFont(playerid, x, 2);
PlayerTextDrawLetterSize(playerid, x, 0.4, 1.6);
PlayerTextDrawColor(playerid, x, 0x906210FF);
PlayerTextDrawSetOutline(playerid, x, 1);
PlayerTextDrawTextSize(playerid, x, 15.0, 350.0);
That's from my GM. The Y height was different (middle of screen) - I assume 20 is about right; adjust accordingly.
Reply
#5

Where i put it?
But sorry for asking.
Reply
#6

You can use Zamaroht's text draw editor to make your own, it's very easy.

BTW, those are called textdraws
Reply
#7

You can make a textdraw for each radio with his name. For example:

You can have a command for start/stop radio stream like this:

PHP код:
if(strcmp(cmd"/listen"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            new 
x_job[256];
            
x_job strtok(cmdtextidx);
            if(!
strlen(x_job)) {
                if(
RadioOn[playerid] == 1) { StopAudioStreamForPlayer(playerid); RadioOn[playerid] = 0; return 1; }
                
SendClientMessage(playeridCOLOR_WHITE"|__________________ Listen __________________|");
                
SendClientMessage(playeridCOLOR_WHITE"{00FF00}Usage:{FFFFFF} /listen [on/off]");
                
SendClientMessage(playeridCOLOR_WHITE"|____________________________________________|");
                return 
1;
            }
            if(
strcmp(x_job,"on",true)==0)
            {
                if(
IsPlayerInAnyVehicle(playerid)) {} else return SendClientMessage(playeridCOLOR_WHITE"{DC0C0C}Radio:{FFFFFF} You need to be in a car!");
                
RadioOn[playerid] = 1;
                
PlayAudioStreamForPlayer(playerid"http://stream.profm.ro:8012/profm.mp3");
                
format(stringsizeof(string), "{DC0C0C}Radio: {FFFFFF}You listen EXAMPLERADIO now!");
                
SendClientMessage(playeridCOLOR_WHITEstring);
                return 
1;
            }
            if(
strcmp(x_job,"off"true) == 0)
            {
                if(
IsPlayerInAnyVehicle(playerid)) {} else return SendClientMessage(playeridCOLOR_WHITE"{DC0C0C}Radio:{FFFFFF} You need to be in a car!");
                
RadioOn[playerid] = 0;
                
StopAudioStreamForPlayer(playerid);
                return 
1;
            }
        }
    } 
Now,let is begin to create your textdraw !

Define :
Код:
new Text:RadioExample[MAX_PLAYERS];
Next Step:
Код:
for( new i; i < MAX_PLAYERS; ++i )
    {
        RadioExample[i] = TextDrawCreate(60.000000, 426.000000, "Example1");
		TextDrawBackgroundColor(RadioExample[i], 255);
		TextDrawFont(RadioExample[i], 3);
		TextDrawLetterSize(RadioExample[i], 0.369999, 1.300000);
		TextDrawColor(RadioExample[i], -1);
		TextDrawSetOutline(RadioExample[i], 1);
		TextDrawSetProportional(RadioExample[i], 1);
		TextDrawUseBox(RadioExample[i], 1);
		TextDrawBoxColor(RadioExample[i], 255);
		TextDrawTextSize(RadioExample[i], 118.000000, 2.000000);
}
This code , you will put in
Код:
public ongamemodeinit
Next Step:

Put the hide/show textdraw code in your command!
The hide code is :
Код:
TextDrawHideForPlayer(playerid, RadioExample[playerid]);
The show code is:
Код:
TextDrawShowForPlayer(playerid, RadioExample[playerid]);
At finally,your command will be like this one:

PHP код:
if(strcmp(cmd"/listen"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            new 
x_job[256];
            
x_job strtok(cmdtextidx);
            if(!
strlen(x_job)) {
                if(
RadioOn[playerid] == 1) { StopAudioStreamForPlayer(playerid); RadioOn[playerid] = 0; return 1; }
                
SendClientMessage(playeridCOLOR_WHITE"|__________________ Listen __________________|");
                
SendClientMessage(playeridCOLOR_WHITE"{00FF00}Usage:{FFFFFF} /listen [on/off]");
                
SendClientMessage(playeridCOLOR_WHITE"|____________________________________________|");
                return 
1;
            }
            if(
strcmp(x_job,"on",true)==0)
            {
                if(
IsPlayerInAnyVehicle(playerid)) {} else return SendClientMessage(playeridCOLOR_WHITE"{DC0C0C}Radio:{FFFFFF} You need to be in a car!");
                
RadioOn[playerid] = 1;
                
PlayAudioStreamForPlayer(playerid"http://stream.profm.ro:8012/profm.mp3");
                
format(stringsizeof(string), "{DC0C0C}Radio: {FFFFFF}You listen EXAMPLERADIO now!");
                
SendClientMessage(playeridCOLOR_WHITEstring);
                            
TextDrawShowForPlayer(playeridRadioExample[playerid]);
                return 
1;
            }
            if(
strcmp(x_job,"off"true) == 0)
            {
                if(
IsPlayerInAnyVehicle(playerid)) {} else return SendClientMessage(playeridCOLOR_WHITE"{DC0C0C}Radio:{FFFFFF} You need to be in a car!");
                
RadioOn[playerid] = 0;
                
StopAudioStreamForPlayer(playerid);
                            
TextDrawHideForPlayer(playeridRadioExample[playerid]);
                return 
1;
            }
        }
    } 
I hope that i helped you and this was usefully for you !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)