if(strcmp("/radio", cmdtext, true) == 0 || strcmp("/radios", cmdtext, true) == 0) { new Radio1, Radio2,Radio3; for(new i; i < GetMaxPlayers(); i++) { if(IsPlayerConnected(i)) { if(OuvindoRadio[i] == true) Radio1++; if(OuvindoRadio2[i] == true) Radio2++; if(OuvindoRadio3[i] == true) Radio3++; } } new String[128], String2[128]; format(String, sizeof(String),"Rбdios\tOuvintes\n"); strcat(String2, String); format(String, sizeof(String),"{FFFFFF}Radio Hunter\t%i\nRadio Funk\t%i\nRadio Rap Brasil\t%i\n{FFFFFF}Nenhuma rбdio {FF0000}(parar sons)","OK","Voltar",Radio1,Radio2,Radio3); strcat(String2, String); ShowPlayerDialog(playerid, 9603, DIALOG_STYLE_TABLIST_HEADERS, "{00FF00}Rбdios:",String2, "Ok", "{FF0000}X"); return 1; } |
#include <foreach>
#include <zcmd>
new Usou1[MAX_PLAYERS], Usou2[MAX_PLAYERS], Usou3[MAX_PLAYERS];
public OnPlayerConnect(playerid){
Usou1[playerid] = 0;
Usou2[playerid] = 0;
Usou3[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid){
Usou1[playerid] = 0;
Usou2[playerid] = 0;
Usou3[playerid] = 0;
return 1;
}
CMD:radio(playerid){
foreach(Player, i){
if(OuvindoRadio[i] == true) Usou1[i] ++;
if(OuvindoRadio2[i] == true) Usou2[i] ++;
if(OuvindoRadio3[i] == true) Usou3[i] ++;
}
return 1;
}
CMD:ouvintes(playerid){
new string[40];
foreach(Player, i){
if(OuvindoRadio[i] == true){
format(string, sizeof(string), "%d Ouvintes Radio 1", Usou1[i]);
SendClientMessageToAll(cores, string);
}
if(OuvindoRadio2[i] == true){
format(string, sizeof(string), "%d Ouvintes Radio 2", Usou2[i]);
SendClientMessageToAll(cores, string);
}
if(OuvindoRadio3[i] == true){
format(string, sizeof(string), "%d Ouvintes Radio 3", Usou3[i]);
SendClientMessageToAll(cores, string);
}
}
return 1;
}
enum r_RADIO_INFO
{
Nome[30],
Url[50],
}
new const Radios[][r_RADIO_INFO] =
{
{"Radio Hunter", "url da rбdio"},
{"Radio Funk", "url da rбdio"},
{"Radio Brasil", "url da rбdio"}
};
new
OuvintesRadio[sizeof(Radios)], pRadio[MAX_PLAYERS] = -1;
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/radio", cmdtext, true) == 0 || strcmp("/radios", cmdtext, true) == 0)
{
new str[512];
format(str, sizeof(str), "Rбdios\tOuvintes\n");
for(new r; r < sizeof(Radios); r++)
{
format(str, sizeof(str), "%s%s\t%i\n", str, Radios[r][Nome], OuvintesRadio[r]);
}
strcat(str, "Desligar");
ShowPlayerDialog(playerid, 9603, DIALOG_STYLE_TABLIST_HEADERS, "{00FF00}Rбdios:", str, "Ok", "X");
return 1;
}
return 0;
}
public OnPlayerDisconnect(playerid, reason)
{
if(pRadio[playerid] != -1)
{
OuvintesRadio[pRadio[playerid]]--;
pRadio[playerid]=-1;
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 9603:
{
if(response)
{
switch(listitem)
{
case 0 .. sizeof(Radios):
{
new str[70];
format(str, sizeof(str), "Vocк estб sinonizado na rбdio {00bbff}%s", Radios[listitem][Nome]);
SendClientMessage(playerid, -1, str);
PlayAudioStreamForPlayer(playerid, Radios[listitem][Url]);
if(pRadio[playerid] != -1){
OuvintesRadio[pRadio[playerid]]++;
}
pRadio[playerid] = listitem;
OuvintesRadio[listitem]++;
}
default:
{
if(pRadio[playerid] != -1)
{
--OuvintesRadio[pRadio[playerid]];
pRadio[playerid] = -1;
StopAudioStreamForPlayer(playerid);
SendClientMessage(playerid, -1, "rбdio desligada");
}
}
}
return true;
}
return true;
}
}
return true;
}