Salutare !
M-am gandit sa postez un sistem de radio beta , e asemanator cu cel din poza doar ca aveti doua posturi de radio . Daca exista doritori o sa adaug mai multe posturi de radio...
O sa incerc sa postez in fiecare saptamana cate ceva asemanator .
Puteti sa lasati intr-un reply ce sisteme v-ati dori pe viitor .
Seara faina !
* Daca doriti versiunea full pentru RPG o puteti cumpara la pretul de 2 euro !
#if defined Header
Radio system by Gabriel in data 2/4/2019 , ora 21:23!
#endif
//------------------------------------------------------------------------------
#include <a_samp>
#include <zcmd>
//------------------------------------------------------------------------------
#define DIALOG_STYLE_TABLIST_HEADERS 5
#define Radio_D 2009
//------------------------------------------------------------------------------
enum BData
{
RadioONN
};
enum RAData
{
HITFM, PROFM
}
//------------------------------------------------------------------------------
new RRInfo[MAX_PLAYERS][BData], RRInfo2[MAX_PLAYERS][RAData];
//------------------------------------------------------------------------------
public OnPlayerConnect(playerid)
{
RRInfo[playerid][RadioONN] = 0;
//-----------------------------------------------------------------------------
RRInfo2[playerid][HITFM] = 0;
RRInfo2[playerid][PROFM] = 0;
return 1;
}
public OnPlayerDisconnect(playerid)
{
RRInfo[playerid][RadioONN] = 0;
//-----------------------------------------------------------------------------
RRInfo2[playerid][HITFM] = 0;
RRInfo2[playerid][PROFM] = 0;
return 1;
}
CMD:mp32(playerid, params[])
{
//--------------------------------------------------------------------------
new mp3radio[1555];
//--------------------------------------------------------------------------
new radioString[500],stringradio2[500];
//--------------------------------------------------------------------------
if(RRInfo[playerid][RadioONN] == 0) radioString = "{FF0000}You are not listening to anything";
else if(RRInfo[playerid][RadioONN] == 1) radioString = "{00FF00}You are listening to <hit fm>";
else if(RRInfo[playerid][RadioONN] == 2) radioString = "{00FF00}You are listening to <pro fm>";
else if(RRInfo[playerid][RadioONN] > 3) radioString = "{FF0000}WRONG ID";
//--------------------------------------------------------------------------
format(stringradio2, 512, "%s", radioString);
//--------------------------------------------------------------------------
strcat(mp3radio, "{FF0000}Stop Music\n");
strcat(mp3radio, "{6633FF}Radio Romania\n");
return ShowPlayerDialog(playerid, Radio_D +1, DIALOG_STYLE_LIST, stringradio2, mp3radio, "Selecteaza", "Iesi");
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == Radio_D +1)
{
if(response)
{
switch(listitem)
{
case 0: return AllIRadio(playerid);
case 1:
{
//-------------------------------------------------------
new sStr[1500],radioString[500],stringradio2[500],TRadio[1500];
//------------------------------------------------------
if(RRInfo[playerid][RadioONN] == 0) radioString = "{FF0000}You are not listening to anything";
else if(RRInfo[playerid][RadioONN] == 1) radioString = "{00FF00}You are listening to <hit fm>";
else if(RRInfo[playerid][RadioONN] == 2) radioString = "{00FF00}You are listening to <pro fm>";
else if(RRInfo[playerid][RadioONN] > 3) radioString = "{FF0000}WRONG ID";
//------------------------------------------------------
format(stringradio2, 512, "%s", radioString);
//------------------------------------------------------
// Radio by Five
//------------------------------------------------------
format(sStr, sizeof(sStr), "Radio\tAscultatori\n", PlayersInHITFM()),strcat(TRadio, sStr, sizeof(TRadio));
format(sStr, sizeof(sStr), "{FF3300}Radio HIT FM\t{00FF00}%d\n", PlayersInHITFM()),strcat(TRadio, sStr, sizeof(TRadio));
format(sStr, sizeof(sStr), "{FF3333}Radio PRO FM\t{00FF00}%d\n", PlayersInPROFM()),strcat(TRadio, sStr, sizeof(TRadio));
//--------------------------------------------------------------------------
return ShowPlayerDialog(playerid, Radio_D +2, DIALOG_STYLE_TABLIST_HEADERS, stringradio2, TRadio, "Asculta", "Inapoi"), 1;
}
}
}
}
if(dialogid == Radio_D +2)
{
if(response)
{
//----------------------------------------------------------------------
// L I S T E N I N G
//----------------------------------------------------------------------
if(listitem == 0)
{
PlayAudioStreamForPlayer(playerid,"[Hidden Content]"); // Pro FM
RRInfo[playerid][RadioONN] = 1;
RRInfo2[playerid][HITFM] = 1;
RRInfo2[playerid][PROFM] = 0;
}
if(listitem == 1)
{
PlayAudioStreamForPlayer(playerid,"[Hidden Content]");
RRInfo[playerid][RadioONN] = 2;
RRInfo2[playerid][HITFM] = 0;
RRInfo2[playerid][PROFM] = 1;
}
return 1;
//-------------------------------------------------------------------------
}
else CallRemoteFunction("OnPlayerCommandText", "is", playerid, "/mp32");
}
return 1;
}
PlayersInPROFM()
{
new sStr; for(new s = 0; s < MAX_PLAYERS; s++) if(RRInfo2[s][PROFM] == 1) sStr++; return sStr;
}
PlayersInHITFM()
{
new sStr; for(new s = 0; s < MAX_PLAYERS; s++) if(RRInfo2[s][HITFM] == 1) sStr++; return sStr;
}
stock AllIRadio(playerid)
{
StopAudioStreamForPlayer(playerid);
RRInfo2[playerid][HITFM] = 0; RRInfo[playerid][RadioONN] = 0;
RRInfo2[playerid][PROFM] = 0;
return 1;
}