Radio Help
#1

Код:
include <a_samp>
#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))

#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define vehid
//-------------------------------------------------

public OnFilterScriptInit()
{
    return 1;
}
//-------------------------------------------------

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_ACTION)) {
        if(IsPlayerInAnyVehicle(playerid))
		{
		new vehid = GetPlayerVehicleID(playerid);
         for(new i = 0; i<MAX_PLAYERS; i++) {
		{
		PlayAudioStreamForPlayer(i, "http://www.radiofg.com/streams/fg.pls");
		SendClientMessage(i, 0xFF330000, "Now Playing: Radio FG");
      }
      else if(PRESSED(KEY_ACTION)) {
      {
		PlayAudioStreamForPlayer(i, "http://www.radiofg.com/streams/fgu.pls");
		SendClientMessage(i, 0xFF330000, "Now Playing: Underground FG");
        }
    }
    return 1;
}
//-------------------------------------------------

public OnPlayerUpdate(playerid)
{
    if(!IsPlayerConnected(playerid)) return 0;
    if(IsPlayerNPC(playerid)) return 1;

    // Handle playing SomaFM at the alhambra
    if(GetPlayerInterior(playerid) == 17) {
        if(IsPlayerInRangeOfPoint(playerid,70.0,489.5824,-14.7563,1000.6797)) { // alhambra middle
            if(!GetPVarInt(playerid,"alhambra")) {
                SetPVarInt(playerid,"alhambra",1);
                PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls",480.9575,-3.5402,1002.0781,40.0,true);
            }
        }
    }
    else {
        if(GetPVarInt(playerid,"alhambra")) {
            DeletePVar(playerid,"alhambra");
            StopAudioStreamForPlayer(playerid);
        }
    }

    return 1;
}
Wil someone help me if someone helps me and the radio works he has an +rep from me!
Reply
#2

if someone help i give rep!
Reply
#3

What's the problem?
Reply
#4

error 001: expected token: "-identifier-", but found "="
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "if"
warning 217: loose indentation
warning 217: loose indentation
error 029: invalid expression, assumed zero
error 004: function "OnPlayerUpdate" is not implemented
error 030: compound statement not closed at the end of file (started at line 21)

i want to fix it to work like this i want to press numpad 4&6 to move radio stations left and right i tried but i gave me problems please help me fix the whole problem and i give rep! Please
!
Reply
#5

pawn Код:
#include <a_samp>
#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))

#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
   
//-------------------------------------------------

public OnFilterScriptInit()
{
    return 1;
}
//-------------------------------------------------

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_ANALOG_LEFT)) {
        if(IsPlayerInAnyVehicle(playerid))
        {
            PlayAudioStreamForPlayer(playerid, "http://www.radiofg.com/streams/fg.pls");
            SendClientMessage(playerid, 0xFF330000, "Now Playing: Radio FG");
        }
        else if(PRESSED(KEY_ANALOG_RIGHT)) {

            PlayAudioStreamForPlayer(playerid, "http://www.radiofg.com/streams/fgu.pls");
            SendClientMessage(playerid, 0xFF330000, "Now Playing: Underground FG");
        }
    }
    return 1;
}
//-------------------------------------------------

public OnPlayerUpdate(playerid)
{
    if(!IsPlayerConnected(playerid)) return 0;
    if(IsPlayerNPC(playerid)) return 1;

    // Handle playing SomaFM at the alhambra
    if(GetPlayerInterior(playerid) == 17) {
        if(IsPlayerInRangeOfPoint(playerid,70.0,489.5824,-14.7563,1000.6797)) { // alhambra middle
            if(!GetPVarInt(playerid,"alhambra")) {
                SetPVarInt(playerid,"alhambra",1);
                PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls",480.9575,-3.5402,1002.0781,40.0);
            }
        }
    }
    else {
        if(GetPVarInt(playerid,"alhambra")) {
            DeletePVar(playerid,"alhambra");
            StopAudioStreamForPlayer(playerid);
        }
    }

    return 1;
}
Have fun, I tested it myself
Reply
#6

Thanks soo much!
Reply
#7

i want to pres only Right analog and changing radio stations how i do it?
Reply
#8

please help
Reply
#9

#include <a_samp>
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))

#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

//-------------------------------------------------

public OnFilterScriptInit()
{
return 1;
}
//-------------------------------------------------

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_ANALOG_RIGHT)) {
if(IsPlayerInVehicle (playerid))
{
PlayAudioStreamForPlayer(playerid, "http://stream.profm.ro:8012/profm.mp3");
SendClientMessage(playerid, 0xFF330000, "Ascultati: Radio Pro Fm");
}
else if ((newkeys & KEY_ANALOG_LEFT)) {
PlayAudioStreamForPlayer(playerid, "http://asculta.radiotaraf.com:7100/");
SendClientMessage(playerid, 0xFF330000, "Ascultati: Radio Taraf ");
}
} else if ((newkeys & KEY_ANALOG_DOWN)) {

PlayAudioStreamForPlayer(playerid, "http://live.radiomillenium.ro:9000");
SendClientMessage(playerid, 0xFF330000, "Ascultati: Radio Milenium");
}
if ((newkeys & KEY_ANALOG_UP)) {

PlayAudioStreamForPlayer(playerid, "http://92.114.63.81:9978/");
SendClientMessage(playerid, 0xFF330000, "Ascultati: Radio Party");
}
else if ((newkeys & KEY_RIGHT)) {
PlayAudioStreamForPlayer(playerid, "http://stream.radiozu.ro:8020/");
SendClientMessage(playerid, 0xFF330000, "Ascultati: Radio ZU");
}
return 1;
}
//-------------------------------------------------

public OnPlayerUpdate(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
if(IsPlayerNPC(playerid)) return 1;

// Handle playing SomaFM at the alhambra
if(GetPlayerInterior(playerid) == 17) {
if(IsPlayerInRangeOfPoint(playerid,70.0,489.5824,-14.7563,1000.6797)) { // alhambra middle
if(!GetPVarInt(playerid,"alhambra")) {
SetPVarInt(playerid,"alhambra",1);
PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls",480.9575,-3.5402,1002.0781,40.0);
}
}
}
else {
if(GetPVarInt(playerid,"alhambra")) {
DeletePVar(playerid,"alhambra");
StopAudioStreamForPlayer(playerid);
}
}

return 1;
}

i want to press right analog for all of them ... but i want all of them to change
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)