SA-MP Forums Archive
Radio[rep] - 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[rep] (/showthread.php?tid=320056)



Radio[rep] - Dan_Barocu - 21.02.2012

i made an radio and i want so when i exit car the radio stops.. look..First help gets rep!if it works...

PHP код:
public OnPlayerExitVehicle(playeridvehicleid)
for(new 
ii<MAX_PLAYERSi++)
{
StopAudioStreamForPlayer(i);
}
}
return 
1;

PHP код:
2 errors:
error 054unmatched closing brace ("}")
error 010invalid function or declaration 



Re: Radio[rep] - emokidx - 21.02.2012

try
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        StopAudioStreamForPlayer(i);
    }
    return 1;
}



Re: Radio[rep] - ArmyOps - 21.02.2012

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        StopAudioStreamForPlayer(i);
    }
    return 1;
}
Edit: ok some1 was faster *


Re: Radio[rep] - Toreno - 21.02.2012

I can't see why you're using a loop when playerid is already defined as a parameter on a public;
pawn Код:
public OnPlayerExitVehicle( playerid, vehicleid )
{
    StopAudioStreamForPlayer( playerid );
   
    return 1;
}



Re: Radio[rep] - YoungWildFree - 21.02.2012

Off-Topic: Da hell is up with your signature "Click here to see something cool" That scared my Sister like crazy!


Re: Radio[rep] - Dan_Barocu - 21.02.2012

Quote:
Originally Posted by emokidx111
Посмотреть сообщение
try
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        StopAudioStreamForPlayer(i);
    }
    return 1;
}
ok good il give you another chance soo u dont say im an noob..

if i go in range it spams.. liek you see in picture please help first help gets Rep!

PHP код:
public OnPlayerUpdate(playerid)
{
    if(!
IsPlayerConnected(playerid)) return 0;
    if(
IsPlayerNPC(playerid)) return 1;
    if(
GetPlayerInterior(playerid) == 0) {
        if(
IsPlayerInRangeOfPoint(playerid,70.0,1300.4093,-1868.7646,17.4449)) {
            if(!
GetPVarInt(playerid,"alhambra")) {
                
SetPVarInt(playerid,"alhambra",0);
                
PlayAudioStreamForPlayer(playerid"http://live.radioplayone.ro:9888/",1300.4093,-1868.7646,17.4449,70.0,true);
            }
        }
    }
    else {
        if(
GetPVarInt(playerid,"alhambra")) {
              
DeletePVar(playerid,"alhambra");
               
StopAudioStreamForPlayer(playerid);
        }
    }
    return 
1;

http://imageshack.us/photo/my-images/835/samp001pb.png/ see picture please!


Re: Radio[rep] - Mark™ - 21.02.2012

Like Toreno said, add stopaudiostreamforplayer on OnPlayerExitVehicle callback, no need to complicate it by using unnecessary loops.


Re: Radio[rep] - Dan_Barocu - 21.02.2012

this is something else..i made the range one..and if i go in range it spams the radio...see picture


Re: Radio[rep] - emokidx - 21.02.2012

something like this?
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(!IsPlayerConnected(playerid)) return 0;
    if(IsPlayerNPC(playerid)) return 1;
   
    new isnear;

    if(GetPlayerInterior(playerid) == 0 && isnear == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,70.0,1300.4093,-1868.7646,17.4449))
        {
            if(!GetPVarInt(playerid,"alhambra"))
            {
                SetPVarInt(playerid,"alhambra",0);
                isnear = 1;
                PlayAudioStreamForPlayer(playerid, "http://live.radioplayone.ro:9888/",1300.4093,-1868.7646,17.4449,70.0,true);
            }
        }
    }
    else
    {
        if(GetPVarInt(playerid,"alhambra"))
        {
              DeletePVar(playerid,"alhambra");
              StopAudioStreamForPlayer(playerid);
              isnear = 0;
        }
    }

    return 1;
}



Re: Radio[rep] - Dan_Barocu - 21.02.2012

Quote:
Originally Posted by Toreno
Посмотреть сообщение
I can't see why you're using a loop when playerid is already defined as a parameter on a public;
pawn Код:
public OnPlayerExitVehicle( playerid, vehicleid )
{
    StopAudioStreamForPlayer( playerid );
   
    return 1;
}
ok i did it stops spaming but if i exitcar there i range so u see a bar there with range..i exitcar and i cant listem to that music..understand?