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(cmdtext, idx);
if(!strlen(x_job)) {
if(RadioOn[playerid] == 1) { StopAudioStreamForPlayer(playerid); RadioOn[playerid] = 0; return 1; }
SendClientMessage(playerid, COLOR_WHITE, "|__________________ Listen __________________|");
SendClientMessage(playerid, COLOR_WHITE, "{00FF00}Usage:{FFFFFF} /listen [on/off]");
SendClientMessage(playerid, COLOR_WHITE, "|____________________________________________|");
return 1;
}
if(strcmp(x_job,"on",true)==0)
{
if(IsPlayerInAnyVehicle(playerid)) {} else return SendClientMessage(playerid, COLOR_WHITE, "{DC0C0C}Radio:{FFFFFF} You need to be in a car!");
RadioOn[playerid] = 1;
PlayAudioStreamForPlayer(playerid, "http://stream.profm.ro:8012/profm.mp3");
format(string, sizeof(string), "{DC0C0C}Radio: {FFFFFF}You listen EXAMPLERADIO now!");
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(strcmp(x_job,"off", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid)) {} else return SendClientMessage(playerid, COLOR_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(cmdtext, idx);
if(!strlen(x_job)) {
if(RadioOn[playerid] == 1) { StopAudioStreamForPlayer(playerid); RadioOn[playerid] = 0; return 1; }
SendClientMessage(playerid, COLOR_WHITE, "|__________________ Listen __________________|");
SendClientMessage(playerid, COLOR_WHITE, "{00FF00}Usage:{FFFFFF} /listen [on/off]");
SendClientMessage(playerid, COLOR_WHITE, "|____________________________________________|");
return 1;
}
if(strcmp(x_job,"on",true)==0)
{
if(IsPlayerInAnyVehicle(playerid)) {} else return SendClientMessage(playerid, COLOR_WHITE, "{DC0C0C}Radio:{FFFFFF} You need to be in a car!");
RadioOn[playerid] = 1;
PlayAudioStreamForPlayer(playerid, "http://stream.profm.ro:8012/profm.mp3");
format(string, sizeof(string), "{DC0C0C}Radio: {FFFFFF}You listen EXAMPLERADIO now!");
SendClientMessage(playerid, COLOR_WHITE, string);
TextDrawShowForPlayer(playerid, RadioExample[playerid]);
return 1;
}
if(strcmp(x_job,"off", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid)) {} else return SendClientMessage(playerid, COLOR_WHITE, "{DC0C0C}Radio:{FFFFFF} You need to be in a car!");
RadioOn[playerid] = 0;
StopAudioStreamForPlayer(playerid);
TextDrawHideForPlayer(playerid, RadioExample[playerid]);
return 1;
}
}
}
I hope that i helped you and this was usefully for you !