SA-MP Forums Archive
Radio Text - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Radio Text (/showthread.php?tid=437076)



Radio Text - DerickClark - 14.05.2013

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;
}


Re: Radio Text - RedForceFT - 14.05.2013

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?


Re: Radio Text - DerickClark - 14.05.2013

Yes like dis:

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


Re: Radio Text - MP2 - 14.05.2013

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.


Re: Radio Text - DerickClark - 14.05.2013

Where i put it?
But sorry for asking.


Re: Radio Text - DeMoX - 14.05.2013

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

BTW, those are called textdraws


Re: Radio Text - RedForceFT - 14.05.2013

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 !